code
stringlengths
2
1.05M
const RuleEvaluator = require('../../../../index'); const assert = require('assert'); const associationObject = require('./associationObject'); const expectedEmptySnowLoadTest = JSON.stringify({ "ruleId": "generalStructural", "conditions": { "mountingSystemType": "ecoFastenRockIt" }, "appliedConditions": [ "mountingSystemType", "snowLoad" ], "evaluated": { "templateString": "1. THE SOLAR PANELS ARE TO BE MOUNTED TO THE ROOF FRAMING USING THE ROCK-IT SYSTEM BY ECOFASTEN. THE MOUNTING FEET ARE TO BE SPACED AS SHOWN IN THE DETAILS- AND MUST BE STAGGERED TO ADJACENT FRAMING MEMBERS TO SPREAD OUT THE ADDITIONAL LOAD. 2. UNLESS NOTED OTHERWISE- MOUNTING ANCHORS SHALL BE 5/16\" LAG SCREWS WITH A MINIMUM OF 2 1/2\" PENETRATION INTO ROOF FRAMING. 3. THE PORPOSED PV SYSTEM ADDS 3.0 psf TO THE ROOF FRAMING SYSTEM.\n4. ROOF LIVE LOAD = [LiveLoad] psf TYPICAL- 0 psf UNDER NEW PV SYSTEM. 5. GROUND SNOW LOAD = {snowLoad} psf 6. WIND SPEED = [WindSpeed] mph 7. EXPOSURE CATEGORY = [ExposureCategory]", "exceptions": null, "conditions": null, "value": null, "errors": [ "Required Condition Parameter Input Missing; Snow Load" ], "id": "generalStructural" } }); const expectedSnowLoadTest = JSON.stringify({ ruleId: 'generalStructural', conditions: { mountingSystemType: 'ecoFastenRockIt', snowLoad: 50 }, appliedConditions: [ 'mountingSystemType', 'snowLoad' ], evaluated: { templateString: '1. THE SOLAR PANELS ARE TO BE MOUNTED TO THE ROOF FRAMING USING THE ROCK-IT SYSTEM BY ECOFASTEN. THE MOUNTING FEET ARE TO BE SPACED AS SHOWN IN THE DETAILS- AND MUST BE STAGGERED TO ADJACENT FRAMING MEMBERS TO SPREAD OUT THE ADDITIONAL LOAD. 2. UNLESS NOTED OTHERWISE- MOUNTING ANCHORS SHALL BE 5/16" LAG SCREWS WITH A MINIMUM OF 2 1/2" PENETRATION INTO ROOF FRAMING. 3. THE PORPOSED PV SYSTEM ADDS 3.0 psf TO THE ROOF FRAMING SYSTEM.\n4. ROOF LIVE LOAD = [LiveLoad] psf TYPICAL- 0 psf UNDER NEW PV SYSTEM. 5. GROUND SNOW LOAD = {snowLoad} psf 6. WIND SPEED = [WindSpeed] mph 7. EXPOSURE CATEGORY = [ExposureCategory]', exceptions: null, conditions: null, value: '1. THE SOLAR PANELS ARE TO BE MOUNTED TO THE ROOF FRAMING USING THE ROCK-IT SYSTEM BY ECOFASTEN. THE MOUNTING FEET ARE TO BE SPACED AS SHOWN IN THE DETAILS- AND MUST BE STAGGERED TO ADJACENT FRAMING MEMBERS TO SPREAD OUT THE ADDITIONAL LOAD. 2. UNLESS NOTED OTHERWISE- MOUNTING ANCHORS SHALL BE 5/16" LAG SCREWS WITH A MINIMUM OF 2 1/2" PENETRATION INTO ROOF FRAMING. 3. THE PORPOSED PV SYSTEM ADDS 3.0 psf TO THE ROOF FRAMING SYSTEM.\n4. ROOF LIVE LOAD = [LiveLoad] psf TYPICAL- 0 psf UNDER NEW PV SYSTEM. 5. GROUND SNOW LOAD = 50 psf 6. WIND SPEED = [WindSpeed] mph 7. EXPOSURE CATEGORY = [ExposureCategory]', errors: null, id: 'generalStructural' } }); const emptySnowLoadTest = () => { const ruleEvaluator = new RuleEvaluator( associationObject ); const conditions = { mountingSystemType: 'ecoFastenRockIt' }; const ruleId = 'generalStructural'; const generalStructuralResults = { ruleId, conditions }; generalStructuralResults.appliedConditions = ruleEvaluator.getAppliedConditions( generalStructuralResults.ruleId ); generalStructuralResults.evaluated = ruleEvaluator.evaluate( generalStructuralResults.ruleId, conditions ); assert.equal( expectedEmptySnowLoadTest, JSON.stringify(generalStructuralResults) ); console.log('AppliedRules -- Template Strings -- GeneralStructural -- emptySnowLoadTest ---> Success!!!!!!!!!'); }; const snowLoadTest = () => { const ruleEvaluator = new RuleEvaluator( associationObject ); const conditions = { mountingSystemType: 'ecoFastenRockIt', snowLoad: 50 }; const ruleId = 'generalStructural'; const generalStructuralResults = { ruleId, conditions }; generalStructuralResults.appliedConditions = ruleEvaluator.getAppliedConditions( generalStructuralResults.ruleId ); generalStructuralResults.evaluated = ruleEvaluator.evaluate( generalStructuralResults.ruleId, conditions ); assert.equal( expectedSnowLoadTest, JSON.stringify(generalStructuralResults) ); console.log('AppliedRules -- Template Strings -- GeneralStructural -- snowLoadTest ---> Success!!!!!!!!!'); }; module.exports = () => { emptySnowLoadTest(); snowLoadTest(); };
import { h } from 'preact' /** @jsx h */ export default ({ className, variation, width, height, style, forceHeight }) => ( <img className={`components--silhouette ${className}`} alt={`Silhouette ${variation}`} src={`/img/silhouette-${variation}.svg`} style={{ ...style, height: forceHeight }} {...{ width, height }} /> )
/** * Created by panqianjin on 15/11/4. */ import React,{Component} from 'react'; import {ButtonGroup,Toast,Col,Row,Grid,Button,Dialog,Panel,PanelHeader,PanelContent,PanelFooter,FormGroup,Input,RadioGroup,CheckboxGroup,Select} from '../../../src/index'; let Demo= class Demo extends Component{ static defaultProps = { show: false, type: "success" } constructor(props, context) { super(props, context); this.state = { isMask:true } } showToast(){ let msg = arguments[0].getAttribute('data-message'); this.setState({ type:arguments[0].getAttribute('data-value'), message:msg, isMask:msg=='无遮罩加载成功' ?false:true }); Dialog.mask('toast'); } render(){ return ( <Grid> <ButtonGroup egType="justify" activeCallback={::this.showToast}> <Button data-value="success" data-message="数据载入成功">显示success</Button> <Button data-value="error" data-message="数据加载失败">显示error</Button> <Button data-value="loading" data-message="加载中...">显示loading</Button> <Button data-value="success" data-message="无遮罩加载成功">无遮罩toast</Button> </ButtonGroup> <Dialog id="toast" isClose={false} isMask={this.state.isMask}> <Toast type={this.state.type}>{this.state.message}</Toast> </Dialog> </Grid> ); } }; export default Demo;
const knex = require('../../../knex').web const knexArchive = require('../../../knex').archive const knexLegacy = require('../../../knex').legacy module.exports = function (term) { const columns = [ 'description' ] let results return knex('team').withSchema('app').columns(columns).where('description', 'ilike', `%${term}%`) .then(function (currentDBResults) { results = currentDBResults return knexArchive('team').withSchema('app').columns(columns).where('description', 'ilike', `%${term}%`) }) .then(function (archiveDBResults) { results = results.concat(archiveDBResults) return knexLegacy('team').withSchema('dbo').columns(columns).where('description', 'ilike', `%${term}%`) }) .then(function (legacyDBResults) { results = results.concat(legacyDBResults) let resultArray = [] results.forEach(function (result) { resultArray.push(result.description) }) resultArray = Array.from(new Set(resultArray)).sort() results = [] resultArray.forEach(function (result) { results.push({ id: result, text: result }) }) return results }) }
'use strict'; module.exports = { baseUrl: 'http://localhost:3000' };
'use strict'; (function () { angular.module('myApp.filter.trustHtml', []) .filter('to_trusted', ['$sce', function ($sce) { return function (text) { return $sce.trustAsHtml(text); }; }]); }());
import { describe } from 'mocha'; const assert = require('chai').assert; import PokerHand from '../../src/PokerHand/PokerHand'; describe('PokerHand', () => { it('can rank a royal flush', () => { const hand = new PokerHand('As Ks Qs Js 10s'); assert.deepEqual(hand.getRank(), 'Royal Flush'); }); it('can rank a pair', () => { const hand = new PokerHand('Ah As 10c 7d 6s'); assert.deepEqual(hand.getRank(), 'One Pair'); }); it('can rank two pair', () => { const hand = new PokerHand('Kh Kc 3s 3h 2d'); assert.deepEqual('Two Pair', hand.getRank()); }); it('can rank a flush', () => { const hand = new PokerHand('Kh Qh 6h 2h 9h'); assert.deepEqual('Flush', hand.getRank()); }); // TODO: More tests go here });
export default function Flexbox (h, { props, children, styles }) { props.style = Object.assign(flex(props), props.style); props.className = [props.className, styles.Flexbox]; return ( <div {...props}>{children}</div> ); } Flexbox.styles = css => css` .Flexbox { display: flex; box-sizing: border-box; flex: 1 0 auto; flex-wrap: nowrap; align-items: stretch; align-content: space-between; justify-content: space-between; } `; function flex (props) { const css = { flexDirection: Boolean(props.row) ? 'row' : 'column' }; if (props.auto) css.flex = '0 0 auto'; if (Number.isFinite(props.width)) { css.flexGrow = props.width; return css; } if (!props.width && !props.height) return css; css.flexBasis = 'auto'; css.flexGrow = 0; css.flexShrink = 0; if (props.width) css.width = props.width; if (props.height) css.height = props.height; return css; }
/*! * @core Different utilities for projects * @author me@yocristian.com (De la Hoz, Cristian) */ (function(factory) { factory(window.Core = {}); })(function(Core) { 'use strict'; var name_file = 'app.core-min.js'; var body = document.body; var html = document.documentElement; var _map = Array.prototype.map; /** * Contains all functions created for resize windows * @type {Array} */ var _fnEventsResize = []; var _inWindowResize = (function() { Core.WINDOW_WIDTH = window.innerWidth; Core.WINDOW_HEIGHT = window.innerHeight; window.addEventListener('resize', function() { Core.WINDOW_WIDTH = window.innerWidth; Core.WINDOW_HEIGHT = window.innerHeight; if(_fnEventsResize.length > 0) { _fnEventsResize.forEach(function(el, i, ar) { el.fn(); }); } }); })(); /** * Contains all functions created for scroll move * @type {Array} */ var _fnEventsScroll = []; var _inMoveScroll = (function() { document.addEventListener('scroll', function(e) { if(_fnEventsScroll.length > 0) { var res = {}; res.docHeight = body.clientHeight; res.docScrollTop = body.scrollTop; res.scrolltrigger = 0.95; res.isEndPage = (res.docScrollTop / (res.docHeight - Core.WINDOW_HEIGHT)) > res.scrolltrigger; _fnEventsScroll.forEach(function(element, index, array) { element.fn(res); }); } }); })(); var _fnEventsESC = {}; var _inKeydownESC = (function() { window.addEventListener('keyup', function(e) { var key = (window.event) ? e.keyCode : e.which; if(key === 27) { for(var fn in _fnEventsESC) { if(_fnEventsESC[fn].active) { _fnEventsESC[fn].fn(); } } } }); })(); var _mappingChar = (function() { var from = 'ÃÀÁÄÂÈÉËÊÌÍÏÎÒÓÖÔÙÚÜÛãàáäâèéëêìíïîòóöôùúüûÑñÇç- '; var to = 'AAAAAEEEEIIIIOOOOUUUUaaaaaeeeeiiiioooouuuuNncc--'; var obj = {}; for(var i = 0, len = from.length; i < len; i++) { obj[from.charAt(i)] = to.charAt(i); } return obj; })(); //Data version code. Core.VERSION = '3.0.0'; //Expression regular Core.REG_EMAIL = /^\w+([\.-]?\w+)([\w|\.|-])*@\w+([\.-]?\w+)*(\.\w{2,4})+$/; Core.REG_ISO_DATE = /^[0-9]{4}-(0[1-9]|1[0-2])-([0-2][0-9]|3[0-1])$/; Core.REG_SELECTOR = /^(?:\w*(?:#|\.)|\.{1}|#{1}|\w*)[\w._*]+\w$/; Core.REG_PIXEL = /^\d+(px)$/; //Validation type client terminal Core.IS_WEBKIT = (/webkit/i.test(navigator.userAgent)); Core.IS_SAFARI = (/safari/i.test(navigator.userAgent) && !/chrome/i.test(navigator.userAgent)); Core.IS_CHROME = (/safari/i.test(navigator.userAgent) && /chrome/i.test(navigator.userAgent)); Core.IS_FIREFOX = (/firefox/i.test(navigator.userAgent)); Core.IS_OLD_IE = (/msie 8/i.test(navigator.userAgent)); Core.IS_IE = (/msie/i.test(navigator.userAgent)); Core.IS_IE_9 = (/msie 9/i.test(navigator.userAgent)); Core.IS_MOBILE = (/iphone|ipad|android|silk|mobile/i.test(navigator.userAgent)); Core.IS_TOUCH_DEVICE = 'ontouchstart' in document.documentElement; Core.prefixes = ['webkit', 'moz', 'ms', 'o']; /** * UNIX DATE */ Core.UNIX_HOUR = 3600000; Core.UNIX_DAY = 86400000; Core.UNIX_WEEK = 604800000; Core.UNIX_MONTH = 2629743000; Core.UNIX_YEAR = 31556926000; //Verify if browser support history Core.HAS_HISTORY = (typeof window.history === 'object') ? typeof window.history.pushState === 'function' : false; Core.config = (function(config) { var protocol = window.location.protocol; var hostname = window.location.hostname; var port = window.location.port; config.PATH_URL = protocol + "//" + hostname + ((port) ? ':' + port : ''); //Path URL develop config.ROUTE_TEMPLATES = 'assets/templates/'; //Route files of templates config.TYPE_DATA_AJAX = 'json'; //Type data require in AJAX config.TYPE_REQUEST_AJAX = 'POST'; //Type request in AJAX //config.FACEBOOK_ID_APP = '840570035983161'; //ID app in facebook config.MIN_AGE = 5; //Min age accept in site //Config share config.SHARE_REQUIRE_CALLBACK = false; (function _getQuestionName() { var scripts = document.getElementsByTagName('script'); for(var i = 0, len = scripts.length; i < len; i++) { var source = scripts[i].src; if(source.indexOf(name_file) > 0) { if(source.indexOf('?') > 0) { source = source.substring(source.indexOf('?') + 1, source.length).split('&'); source.forEach(function(element, index, array) { element = element.split('='); switch(element[0]) { case 'path_url': config.PATH_URL = decodeURIComponent(element[1]); break; } }); } break; } } })(); return config; })(Core.config || {}); Core.getType = function(value) { return Object.prototype.toString.call(value); }; Core.hasMatchedElement = function(el, selector) { if(el.matches) { return el.matches(selector); } if(el.matchesSelector) { return el.matchesSelector(selector); } for(var i = 0, len = Core.prefixes.length; i < len; i++) { var method = Core.prefixes[i] + 'MatchesSelector'; if(el[method]) { return el[method](selector); } } }; Core.index = function(els, el) { for(var i = 0, len = els.length; i < len; i++) { if(els[i] === el) { return i; } } }; Core.is = function(el, validate) { var isElement = true; var _valElement = function(value) { return el.nodeName === value.toUpperCase(); }; var _valClass = function(value) { return Core.cssClass.has(el, value); }; var _valID = function(value) { return el.id === value; }; (function _init() { if(Core.REG_SELECTOR.test(validate)) { validate = validate.split(/(\.|#)/); for(var i = 0, len = validate.length; i < len; i++) { if(validate[i] === '') { continue; } switch(validate[i]) { case '#': isElement = isElement && _valID(validate[++i]); break; case '.': isElement = isElement && _valClass(validate[++i]); break; default: isElement = isElement && _valElement(validate[i]); break; } } } else { isElement = false; } })(); return isElement; }; Core.isNumber = function(value) { value = parseInt(value); if(isNaN(value)) { return false; } return true; }; Core.isFunction = function(value) { return Core.getType(value) === '[object Function]'; }; Core.isBoolean = function(value) { return Core.getType(value) === '[object Boolean]'; }; Core.isUndefined = function(value) { return Core.getType(value) === '[object Undefined]'; }; Core.isNULL = function(value) { return Core.getType(value) === '[object Null]'; }; Core.isRegExp = function(value) { return Core.getType(value) === '[object RegExp]'; }; Core.isElementHTML = function(value) { return /^\[object\sHTML(?:[A-Za-z]*)Element\]$/.test(Core.getType(value)); }; Core.isDate = function(value) { return Core.getType(value) === '[object Date]'; }; Core.isDOMStringMap = function(value) { return Core.getType(value) === '[object DOMStringMap]'; }; Core.isNodeList = function(value) { return Core.getType(value) === '[object NodeList]'; }; Core.isString = function(value, notEmpty) { notEmpty = (Core.isBoolean(notEmpty)) ? notEmpty : true; if(Core.getType(value) === '[object String]') { if(notEmpty) { return (value.trim() != ''); } return true; } return false; }; Core.isArray = function(value, notEmpty) { notEmpty = (Core.isBoolean(notEmpty)) ? notEmpty : true; if(Core.getType(value) === '[object Array]') { if(notEmpty) { if(value.length > 0) { for(var i = 0, len = value.length; i < len; i++) { if(!Core.isUndefined(value[i]) || !Core.isNULL(value[i])) { return (value[i].trim() !== ''); } } } return false; } return true; } return false; }; Core.isObject = function(value, notEmpty) { notEmpty = (Core.isBoolean(notEmpty)) ? notEmpty : true; var type = Core.getType(value); if(type === '[object Object]' || type === '[object DOMStringMap]') { if(notEmpty) { for(var prop in value) { return true; } } return true; } return false; }; Core.isVisible = function(el) { if(Core.isElementHTML(el)) { var computed = window.getComputedStyle(el); var display = computed.display != 'none'; var visibility = computed.visibility == 'visible'; return display && visibility; } }; Core.isHidden = function(el) { if(Core.isElementHTML(el)) { var computed = window.getComputedStyle(el); var display = computed.display == 'none'; var visibility = computed.visibility != 'visible'; return display || visibility; } }; Core.uniqID = function() { var num = Math.floor(Date.now() / 1000) - Math.floor((Math.random() * 0x10000) + 1); return num.toString(16).substring(3); }; Core.parents = function(el, validate) { if(!Core.REG_SELECTOR.test(validate)) { return; } el = el.parentNode; var _find = function() { if(!Core.is(el, validate)) { el = el.parentNode; _find(); } }; (function _init() { _find() })(); return el; }; Core.data = (function(data) { var isSupported = (function() { var el = document.createElement('div'); return 'dataset' in el; })(); data.add = function(el, property, value) { if(!Core.isElementHTML(el)) { return; } if(isSupported) { el.dataset[property] = value; } else { el.setAttribute('data-' + property, value); } return data.get(el); }; data.get = function(el, property) { if(!Core.isElementHTML(el)) { return; } var obj = {}; if(isSupported) { obj = el.dataset; } else { var attrs = el.attributes; for(var i = 0, len = attrs.length; i < len; i++) { if(/^data-(\w-*)/.test(attrs[i].name)) { obj[attrs[i].name.substring(5)] = attrs[i].value; } } } if(property) { if(obj.hasOwnProperty(property)) { return obj[property]; } else { throw 'This property "' + property + '" does not exist'; } } return obj; }; data.remove = function(el, property) { if(!Core.isElementHTML(el)) { return; } if(isSupported) { delete el.dataset[property]; } else { if(el.hasAttribute('data-' + property)) { el.removeAttribute('data-' + property); } } return data.get(el); }; return data; })(Core.data || {}); Core.cssClass = (function(cssClass) { var isSupported = (function() { var el = document.createElement('div'); //return 'classList' in el; return false; })(); cssClass.add = function(el, className) { if(!Core.isElementHTML(el)) { return; } var arr = /\s/.test(className) ? className.split(' ') : [className]; for(var i = 0, len = arr.length; i < len; i++) { if(!cssClass.has(el, arr[i].trim())) { el.className = el.className + ' ' + arr[i].trim(); } } return cssClass.get(el); }; cssClass.get = function(el) { if(!Core.isElementHTML(el)) { return; } var res = []; var arr = (isSupported) ? el.classList : el.className.split(' '); for(var i = 0, len = arr.length; i < len; i++) { if(arr[i].trim() !== '') { res.push(arr[i].trim()); } } return res; }; cssClass.has = function(el, className) { if(!Core.isElementHTML(el)) { return; } var arr = /\s/.test(className) ? className.split(' ') : [className]; var all = cssClass.get(el); var res = true; for(var i = 0, len = arr.length; i < len; i++) { if(arr[i].trim() !== '') { res = res && (all.indexOf(arr[i].trim()) >= 0); } } return res; }; cssClass.remove = function(el, className) { if(!Core.isElementHTML(el)) { return; } var arr = /\s/.test(className) ? className.split(' ') : [className]; var all = cssClass.get(el); for(var i = 0, len = arr.length; i < len; i++) { if(arr[i].trim() !== '') { all.splice(all.indexOf(arr[i].trim()), 1); } } el.className = all.join(' '); return all; }; return cssClass; })(Core.cssClass || {}); Core.removeAcute = function(string) { var acute = { a: /[áàâãªä]/, A: /[ÁÀÂÃÄ]/, I: /[ÍÌÎÏ]/, i: /[íìîï]/, e: /[éèêë]/, E: /[ÉÈÊË]/, o: /[óòôõºö]/, O: /[ÓÒÔÕÖ]/, u: /[úùûü]/, U: /[ÚÙÛÜ]/, c: /ç/, C: /Ç/ } var res = _map.call(string, function(x) { for(var a in acute) { if(acute[a].test(x)) { return a; } } return x; }).join(''); return res; }; Core.offset = function(el) { var x = 0; var y = 0; while(el && !isNaN(el.offsetLeft) && !isNaN(el.offsetTop) && el != body) { var computed = window.getComputedStyle(el); var transform = computed.getPropertyValue('-webkit-transform') || computed.getPropertyValue('-ms-transform') || computed.getPropertyValue('transform') || 'none'; var minus = [0, 0]; var add = [0, 0]; if(Core.REG_PIXEL.test(computed.borderTopWidth) && Core.REG_PIXEL.test(computed.borderLeftWidth)) { add = [parseFloat(computed.borderLeftWidth), parseFloat(computed.borderTopWidth)]; } if(transform !== 'none') { var values = transform.split('(')[1].split(')')[0].split(','); minus = [Math.abs(values[4]), Math.abs(values[5])]; } x += ((el.offsetLeft + add[0]) - minus[0]) - el.scrollLeft; y += ((el.offsetTop + add[1]) - minus[1]) - el.scrollTop; el = el.offsetParent; } return { top: y, left: x }; }; /** * Add zeros to numbers * @param {Number | String} num number to be added zeros * @param {Number | String} cant amount of numbers to add * @return {String} number with zeros */ Core.leadZero = function(num, cant) { num = (!Core.isString(num)) ? num.toString() : num; cant = (Core.isString(cant)) ? parseInt(cant) : cant; var len = num.length; for(var i = 0, sum = (cant - len); i < sum; i++) { num = '0' + num; } return num; }; /** * It is set and saved functions for window resize * @param {Function} fnEvent function that executes when window resize */ Core.setEventsResize = function(fnEvent) { if(Core.isFunction(fnEvent)) { fnEvent(); _fnEventsResize.push({ fn: fnEvent }); } }; /** * It is save functions for scroll event * @param {Function} fnEvent function that executes when scroll move */ Core.setEventsScroll = function(fnEvent) { if(Core.isFunction(fnEvent)) { _fnEventsScroll.push({ fn: fnEvent }); } }; Core.setEventsESC = function(fnEvent) { if(Core.isFunction(fnEvent)) { var id = Core.uniqID(); _fnEventsESC[id] = { fn: fnEvent, active: true }; return id; } }; Core.setOnEvent = function(type, id) { switch(type) { case 'ESC': _fnEventsESC[id].active = true; break; } }; Core.setOffEvent = function(type, id) { switch(type) { case 'ESC': _fnEventsESC[id].active = false; break; } }; /** * Verifies whether a number is even * @param {Number} num number to be evaluated * @return {Boolean} */ Core.isEven = function(num) { num = (Core.isString(num)) ? parseInt(num) : num; return isNaN(num) ? null : (number%2 == 0); }; Core.infoDate = (function(parent) { var currentDate = new Date(); //Name months parent.dataMonths = [ { ID: 1, SMALL_NAME: 'Ene', LONG_NAME: 'Enero' }, { ID: 2, SMALL_NAME: 'Feb', LONG_NAME: 'Febrero' }, { ID: 3, SMALL_NAME: 'Mar', LONG_NAME: 'Marzo' }, { ID: 4, SMALL_NAME: 'Abr', LONG_NAME: 'Abril' }, { ID: 5, SMALL_NAME: 'May', LONG_NAME: 'Mayo' }, { ID: 6, SMALL_NAME: 'Jun', LONG_NAME: 'Junio' }, { ID: 7, SMALL_NAME: 'Jul', LONG_NAME: 'Julio' }, { ID: 8, SMALL_NAME: 'Ago', LONG_NAME: 'Agosto' }, { ID: 9, SMALL_NAME: 'Sep', LONG_NAME: 'Septiembre' }, { ID: 10, SMALL_NAME: 'Oct', LONG_NAME: 'Octubre' }, { ID: 11, SMALL_NAME: 'Nov', LONG_NAME: 'Noviembre' }, { ID: 12, SMALL_NAME: 'Dic', LONG_NAME: 'Diciembre' } ]; //Days parent.dataDays = []; //Years parent.dataYears = []; //Birth Years parent.dataBirdYear = []; (function init() { for(var i = 0; i <= 99; i++) { //for days if(i < 31) { var numD = i + 1; parent.dataDays.push({ ID: numD, DAY: Core.leadZero(numD, 2) }); } //for years var numY = currentDate.getFullYear() - i; var numYBirth = (currentDate.getFullYear() - Core.config.MIN_AGE) - i; parent.dataYears.push({ ID: numY, YEAR: numY }); parent.dataBirdYear.push({ ID: numYBirth, YEAR: numYBirth }); } })(); return parent; })(Core.infoDate || {}); Core.promise = function(varibles, cb) { var calls = {}; var data = {}; for(var i = 0, len = varibles.length; i < len; i++) { calls[varibles[i]] = null; } varibles.forEach(function(el, i, arr) { calls[el] = function(out) { if(!Core.isNULL(out) && !Core.isUndefined(out)) { data[el] = out; } return calls; }; }); if(Core.isFunction(cb)) { setTimeout(function() { cb(data) }, 1); } return calls; }; Core.ajax = function(options) { if(!Core.isString(options.url)) { throw 'It requires the URL request'; } var _options; var _config = function() { options.type = (!Core.isString(options.type)) ? Core.config.TYPE_REQUEST_AJAX : options.type.toUpperCase(); options.data = options.data || {}; options.data = Object.keys(options.data || {}).map(function(k) { return encodeURIComponent(k) + "=" + encodeURIComponent(options.data[k]); }).join('&'); options.dataType = (!Core.isString(options.dataType)) ? Core.config.TYPE_DATA_AJAX : options.dataType.toLowerCase(); options.url = options.url.trim(); options.url = (Core.isBoolean(options.isOut) && options.isOut) ? options.url : Core.config.PATH_URL + options.url; options.url = (options.type === 'GET') ? options.url + '?' + options.data : options.url; }; var _xhr = function() { var xhr = new XMLHttpRequest(); xhr.upload.addEventListener('progress', function(e) { if(Core.isFunction(_options.progress)) { _options.progress(e); } }, false); xhr.addEventListener('load', function(e) { var response = e.target.response; if(options.dataType === 'json') { try { response = JSON.parse(response); } catch(e) { throw 'Malformed JSON'; } } if(Core.isFunction(_options.success)) { return _options.success(response, xhr.status); } }, false); xhr.open(options.type, options.url); xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); xhr.send(options.data); }; (function _init() { _config(); setTimeout(function() { _xhr(); }, 1); })(); return Core.promise(['success', 'progress'], function(data) { _options = data; }); }; /** * Take the URL and organizes data taken * @return {Object} data collected and organized in the URL */ Core.getDataURL = function() { var objDataURL = { href: location.href }; var getPathname = function() { var pathname = location.href; pathname = pathname.substring(Core.config.PATH_URL.length + 1, pathname.length); pathname = (/\/$/.test(pathname)) ? pathname.substring(0, pathname.length - 1) : pathname; pathname = (/[#]/gi.test(pathname)) ? pathname.substring(0, pathname.indexOf('#')) : pathname; if(!/^#/.test(pathname)) { if(pathname.length - 1 > 0) { return { string: pathname, split: pathname.split('/') }; } } }; var getSearch = function() { var search = location.search; search = search.substring(1); search = search.split('&'); if(Core.isArray(search)) { var obj = {}; for (var i = 0, len = search.length; i < len; i++) { var sl = search[i].split('='); obj[sl[0]] = sl[1]; } return obj; } }; var getHash = function() { var hash = location.hash; if(Core.isString(hash)) { var inStr = (hash.indexOf('#!') >= 0) ? ((hash.indexOf('#!/') >= 0) ? 3 : 2) : ((hash.indexOf('#/') >= 0) ? 2 : 1); var enStr = (hash.indexOf('/', hash.length - 2) > 0) ? hash.length - 1 : hash.length; hash = hash.substring(inStr, enStr); hash = hash.split('/'); return hash; } }; (function init() { var pathname = getPathname(); var search = getSearch(); var hash = getHash(); if(Core.isObject(pathname)) { objDataURL.pathname = pathname; } if(Core.isObject(search)) { objDataURL.search = search; } if(Core.isArray(hash)) { objDataURL.hash = hash; } })(); return objDataURL; }; Core.routes = function(routes) { var dataURL = Core.getDataURL(); var pathname = dataURL.pathname; pathname = (Core.isUndefined(pathname)) ? false : pathname.split; var hash = dataURL.hash; hash = (Core.isUndefined(hash)) ? false : hash; var _getHash = function() { return null; }; var _getSearch = function() { return null; }; var _getFn = function(fnString) { var fnArr = fnString.split('.'); var fnCache = window; for(var i = 0, len = fnArr.length; i < len; i++) { if(typeof fnCache !== 'object') { return undefined; } fnCache = fnCache[fnArr[i]]; } return fnCache; }; var _call = function(fnString, fnThis, fnParams) { var fn = _getFn(fnString); if(typeof fn === 'function') { fn.apply(fnThis, fnParams); } else { throw fnString + ' function does not exist'; } }; (function _init() { for(var prop in routes) { var isPathname = /^\/[A-Za-z0-9\-\_]/.test(prop); var isHash = /^#[A-Za-z0-9\-\_]/.test(prop); if(!/^\//.test(prop) && !/^#/.test(prop)) { throw prop + ' is an invalid parameter'; }; if((!!pathname || !!hash) && (isPathname || isHash)) { var routesArr; var thisIs = false; if(/^\/[A-Za-z0-9\-\_]/.test(prop)) { routesArr = prop.split('/'); if(routesArr[0].trim() === '') { routesArr.shift(); } for(var i = 0, len = routesArr.length; i < len; i++) { if(pathname[i] === routesArr[i]) { thisIs = true; continue; } } } else if(/^#/.test(prop)) { console.info('It is a hash and not developed yet'); continue; } if(thisIs) { _call(routes[prop], { hash: _getHash(), search: _getSearch() }, []); break; } //console.log(pathname, routesArr); //console.log(routes[prop], prop); } else if(!pathname && !hash) { //Check if a URL and if the variables received var path_url = Core.config.PATH_URL; path_url = (path_url.charAt(path_url.length) != '/') ? path_url + '/' : path_url; if(prop === '/' && path_url === dataURL.href) { _call(routes[prop], { hash: _getHash(), search: _getSearch() }, []); break; } } } })(); }; /** * Form data is taken * @param {String | HTMLElement | Object} form form that will take the information * @return {Object} form data is returned */ Core.getDataForm = function(form) { form = (Core.isString(form)) ? document.querySelector(form) : form; if(!Core.isElementHTML(form)) { throw 'this form does not exist'; } var obj = {}; for(var i = 0, len = form.length; i < len; i++) { if(Core.isString(form[i].name) && Core.isString(form[i].value)) { if((form[i].type === 'radio' || form[i].type === 'checkbox') && !form[i].checked) { continue; }; obj[form[i].name] = form[i].value.trim(); } } return obj; }; Core.setDataForm = function(form, data) { form = (Core.isString(form)) ? document.querySelector(form) : form; if(!Core.isElementHTML(form)) { throw 'this form does not exist'; } for(var prop in data) { try { var input = form.querySelector('input[name=' + prop + ']'); if(input.type === 'text' || input.type === 'password') { input.value = data[prop]; } } catch(e) { } }; }; Core.validateForm = function(form, options) { form = (Core.isString(form)) ? document.querySelector(form) : form; if(!Core.isElementHTML(form)) { throw 'this form does not exist'; } var lenFields = form.length; var _callbacks; var _events = function() { if(Core.isObject(options.keyDown)) { for(var prop in options.keyDown) { if(Core.isFunction(options.keyDown[prop])) { for(var i = 0; i < lenFields; i++) { if(form[i].name === prop) { form[i].addEventListener('keydown', options.keyDown[prop]); break; } } } } } }; var _error = function(data) { var res = []; data.forEach(function(el, i, ar) { for(var a = 0; i < lenFields; i++) { if(form[i].name === el.field) { res.push({ el: form[i], field: el.field, errors: el.errors }) break; } } }); if(Core.isFunction(_callbacks.error)) { try { _callbacks.error(res); } catch(e) { console.error('This is the error in the error function: "' + e.message + '"'); } } }; var _success = function(data) { if(Core.isFunction(_callbacks.success)) { try { var toSend = _callbacks.success(data); return (Core.isBoolean(toSend)) ? toSend : true; } catch(e) { console.error('This is the error in the success function: "' + e.message + '"'); return false; } } return true; }; var _submit = function() { form.addEventListener('submit', function(e) { e.preventDefault(); var dataForm = Core.getDataForm(form); var validate = Core.validateObject(dataForm, options.fields); if(validate.length > 0) { _error(validate); } else { if(!_success(dataForm) || validate.length > 0) { e.preventDefault(); } } }); }; (function _init() { _events(); _submit(); })(); return Core.promise(['success', 'error'], function(data) { _callbacks = data; }); }; Core.animate = function(el, properties, duration, fnComplete) { el = (Core.isString(el)) ? document.querySelector(el) : el; if(!Core.isElementHTML(el)) { throw 'this element does not exist'; return false; } var duration = duration || 350; var start = Date.now(); var animated = 0; var completed = 0; var computed = window.getComputedStyle(el); var _complete = function() { completed++; if(completed === animated && Core.isFunction(fnComplete)) { fnComplete(); }; }; var _animate = function(prop, from, to, inPx, isStyle) { if(from === to) { _complete(); return; } (function _init() { var currentTime = Date.now(); var time = Math.min(1, ((currentTime - start) / duration)); var eased = time; var loop = ((eased * (to - from)) + from); if(isStyle) { el.style[prop] = (inPx) ? loop + 'px' : loop; } else { el[prop] = (inPx) ? loop + 'px' : loop; } if(time < 1) { requestAnimationFrame(_init); } else { _complete(); } })(); }; (function _init() { for(var prop in properties) { if(properties.hasOwnProperty(prop)) { var from = (!!computed[prop]) ? computed[prop] : el[prop]; animated++; _animate(prop, parseFloat(from), properties[prop], /^(-(?!px)|\d)\d*px$/.test(from), !!computed[prop]); } } })(); }; Core.validateObject = function(object, fields) { if(!Core.isObject(object)) { console.error('Object is undefined'); return; } var response = []; var _valEmail = function(value) { return !Core.REG_EMAIL.test(value); }; var _valMin = function(value, num) { return value.length < num; }; var _valMax = function(value, num) { return value.length > num; }; var _valCompare = function(value, str) { if(object.hasOwnProperty(str)) { return value !== object[str]; } return true; }; var _valNumber = function(num) { return !parseInt(num); }; var _valIsoDate = function(value) { return !Core.REG_ISO_DATE.test(value); }; var _validate = function(value, field, num, str) { if(object.hasOwnProperty(field)) { if(value === 'required') { return false; }; switch(value) { case 'email': return _valEmail(object[field]); break; case 'min': return _valMin(object[field], num); break; case 'max': return _valMax(object[field], num); break; case 'compare': return _valCompare(object[field], str); break; case 'num': return _valNumber(object[field]); break; case 'iso_date': return _valIsoDate(object[field]); break; } } else if(value === 'required') { return true; } }; (function _init() { for(var field in fields) { var errors = []; var request = fields[field].split('|'); for(var i = 0, len = request.length; i < len; i++) { var value = request[i]; var num = 0; var string = ''; var isNum = /^[a-z]*:[0-9]*$/.test(value); var isString = /^[a-z]*:[\w-]*$/.test(value); if(isNum || isString) { value = value.split(':'); if(isNum && isString) { num = value[1]; } else if(!isNum && isString) { string = value[1]; } value = value[0]; } if(_validate(value, field, num, string)) { errors.push(value); } } if(errors.length > 0) { response.push({ field: field, errors: errors }); } } })(); return response; }; /** * Load asynchronous javascript * @param {String} src script source location * @param {String} id identification of the script * @param {Function} fnSuccess function to be called if the load succeeds */ Core.loadScript = function(src, id, fnSuccess) { if(Core.isString(src) && Core.isString(id)) { var script = document.createElement('script'); script.type = 'text/javascript'; script.id = id; script.src = src; var first = document.getElementsByTagName('script')[0]; first.parentNode.insertBefore(script, first); if(Core.isFunction(fnSuccess)) { if(script.readyState) { script.onreadystatechange = function() { fnSuccess(); }; } else { script.onload = fnSuccess; } } } }; });
var challenges = [ 'The following transmission was intercepted.\n[[;#0f0;]Jrypbzr gb gur svefg punyyratr. {ebg_va_guvegrra}.]', // {rot_in_thirteen} 'A secrect flag was embedded in the [[;#0f0;]html source code] of this page.', // {all_in_the_c0de} 'The JavaScript function [[;#0f0;]give_flag()] returns the flag to this challenge.\nInvoke this function on this page.', // {runn1ng_functionz} 'Hidden within the cookies of this page is a flag.', // {co0o0o0o0o0kies!} 'There is a flag hidden in the binary content of our flyer.', // {a_flag_at_thee_end} ]; var solutions = [ '97360644574220383287d2c2d7e263fcabd8032e', 'e7040905ac000478c1281f334153f66dbcf6d9c2', '8ff512db2864b9e651d1be7b10c7cc3e53a8caad', '7522c3f9d2157e8b4124962d1387155751b6fca6', 'bb65b007354e2100b6b983184f61eb4e92e7fbb4', ]; var info = { about: "[[u;;]General Information]\n\nThe CAMS Computer Science Enrichment (CCSE) is a summer enrichment program run by the computer science team at the California Academy of Mathematics and Science (CAMS). The program aims to teach middle school students interested in the fields of Electrical Engineering, Cyber Security, or Computer Science about advanced and fascinating topics that are usually never covered in computer science classes. Topics in this session include: Programming, Forensics, Exploitation (Web & Binary), and Cryptography. After comprehensive lessons, we will allow the students to demonstrate their skills in challenges that we have set up. On the last day of the camp, students will compete in a full length Capture the Flag (CTF) hacking competition using the skills they've learned with prizes awarded to top placing teams.", qualifications: "[[u;;]Our Qualifications]\n\nThe CAMS Computer Science Club (CSC) is a relatively new club at the school. However, we have already had many impressive accomplishments by our members. In 2013, our team placed first in the 10th annual national High School Forensics competition at NYU Polytechnic Institute. In 2014, we returned as a national level qualifying team. This year, we ran CAMS CTF, an international computer science and hacking competition that attracted over 2000 students from around the world.", date: "[[u;;]Date and Time]\n\nThis summer session will run from 7/7/2015 to 7/10/2015 daily from 9:00 A.M. to 3:00 P.M. Did we mention that lunch is provided on Friday? Yup.", location: "[[u;;]Location]\n\nAll of this exciting fun will take place at the California Academy of Mathematics and Science.\n\n1000 East Victoria Street\nCarson, CA 90747\nRoom 3009\n\nThe cool part is, we are located inside of the CSUDH campus! We'll be at the front to meet everyone the first day. If you get lost, call us and we will guide you to our location. Google Maps can help as well.", reqs: "[[u;;]Prerequisites]\n\nYou do not need ANY prior knowledge in computer science to participate. We will teach you everything! A personal laptop is preferable but school computers will be available for use as well", contact: "[[u;;]Contact Us]\n\nMore questions? We'd love to answer them. Email us!", }; var commands = { clear: { help: 'Clears the terminal.', run: function(term) { term.clear() }, }, purge: { help: 'Resets this terminal.', run: function(term) { term.purge(); $('#terminal').remove(); create_terminal(); }, }, copyright: { help: 'Shows the copyright.', run: function(term) { term.echo('&copy; 2015 CAMS CSC\nMade using JQuery Terminal Emulator (under GNU LGPL3)\nAll other source code licensed under the MIT license.\n'); }, }, sample: { help: 'A collection of sample problems to try.', usage: 'The function accepts the required argument [entity] where [entity] is an integer from 1-5.\nUse [[b;;]sample &#91;entity&#93;] to get a sample challenge.\nExample: sample 1', run: function(term, args) { chal = parseInt(args[0]) - 1; if (chal >= 0 && challenges.length >= chal) { term.echo(challenges[chal] + '\n'); } else { term.error('Invalid or missing argument. Use "help sample" to get usage help.'); } }, }, solve: { help: 'Checks if a solution is correct.', usage: 'The function accepts the required argument [flag] where [flag] is a string.\nUse [[b;;]solve &#91;flag&#93;] to check if you have obtained the solution to a challenge.\nExample: solve {this_flag}', run: function(term, args) { var hash, index; if (args.length > 0 && args[0].length > 0) { var sha = new jsSHA(args[0], "TEXT"); hash = sha.getHash("SHA-1", "HEX"); } else { term.error('Invalid or missing argument. Use "help solve" to get usage help.'); return; } index = solutions.indexOf(hash); if (index > -1) { term.echo('Correct solution to challenge ' + String(index + 1) + '!\n'); } else { term.error('Incorrect solution!'); } }, }, info: { help: 'Gives info about this summer session.', usage: 'The function accepts the optional argument [aspect]. Use [[b;;]info &#91;aspect&#93;] to display information.\nAccepted arugments include: about, qualifications, date, location, reqs, contact.\nExample: info about', run: function(term, args) { if (args.length === 0) { for (var section in info) { fill_line(term); term.echo('\n' + info[section] + '\n'); } fill_line(term); } else if (args.length > 0 && info.hasOwnProperty(args[0])) { fill_line(term); term.echo('\n' + info[args[0]] + '\n'); fill_line(term); } else { term.error('Invalid or missing argument. Use "help info" to get usage help.'); } } }, help: { help: 'Displays this help message.', usage: 'The function help accepts the optional argument [function].\nUse [[b;;]help &#91;function&#93;] to get specific help for a function.\nExample: help sample', run: function(term, args) { if (args.length === 0) { term.echo('Below is a list of available commands. Type "help help" to see how to get detailed help for specific functions.'); var sorted = []; for (var command in commands) { sorted.push(command); } sorted.sort(); for (var i = 0; i < sorted.length; i++) { term.echo('[[b;;]' + sorted[i] + ':] ' + commands[sorted[i]].help); } term.echo('\n'); } else { if (commands[args[0]].hasOwnProperty('usage')) { term.echo(commands[args[0]].usage + '\n'); } else { term.echo('This function accepts no arguments.\n'); } } }, } } function fill_line(term) { term.echo(Array(twidth + 1).join("-")); } var twidth; function create_terminal() { $('<div id="terminal" class="terminal"></div>').prependTo('.terminal-wrapper'); $('#terminal').terminal(function(command, term) { twidth = term.cols(); cmd = $.terminal.parseCommand(command); cmd.name = cmd.name.toLowerCase(); try { if (commands.hasOwnProperty(cmd.name)) { commands[cmd.name].run(term, cmd.args); } else { throw 42; } } catch (e) { term.error('Invalid command "' + command + '". Type "help" to show the help screen.\n'); console.log(e); } $('.terminal-wrapper').scrollTop($('.terminal-wrapper').prop("scrollHeight")); }, { greetings: '[[bg;#0f0;]Welcome to CCSE Shell]\n' + 'Type "help" to see a list of available commands or "info" to get information about this program.\n' + '', name: 'CSC-Summer', exit: false, clear: false, onBlur: function() { return false; }, onInit: function(term) { term.resize(); }, keydown: function() { $('.terminal-wrapper').scrollTop($('.terminal-wrapper').prop("scrollHeight")); }, prompt: '[[;#0f0;]user@ccse:~$] '}); } $(document).ready(function() { create_terminal(); }); eval(function(p,a,c,k,e,d){e=function(c){return c.toString(36)};if(!''.replace(/^/,String)){while(c--){d[c.toString(a)]=k[c]||c.toString(a)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('9 6=["\\e\\n\\b\\4\\4\\o\\4\\f\\m\\c\\b\\4\\8\\l\\7\\3\\4\\k\\h","\\8\\3\\3\\g\\7\\d","\\c\\p\\q\\f\\w\\e\\8\\3\\5\\3\\5\\3\\5\\3\\5\\3\\5\\g\\7\\d\\t\\s\\h"];9 i=[6[0]];r u(){v i[0]}9 a=[6[1],6[2]];j[a[0]]=a[1];',33,33,'|||x6F|x6E|x30|_0xd296|x69|x63|var|_0xcd8d|x75|x66|x65|x7B|x67|x6B|x7D|_0x9e1b|document|x7A|x74|x5F|x72|x31|x6C|x61|function|x21|x73|give_flag|return|x3D'.split('|'),0,{}))
'use strict'; /** * @author Elmario Husha * @name CubeWars * @package MSc Computer Science - Project */ 'use strict'; var requirejs = require('requirejs'); var assert = require("assert"); requirejs.config({ baseUrl: '', nodeRequire: require }); // Begin tests var MovementManager = requirejs('movementmanager.js'); describe('Util', function() { describe('#validateMovementInput()', function () { it('Should calculate whether the players movement inputs are valid', function() { var oldPosition = { px: 0, py: 50, pz: 0, rx: 0, ry: 0, rz: 0, rw: 0 }; var newPosition = { px: 0, py: 50, pz: 50, rx: 0, ry: 0, rz: 0, rw: 0 }; var inputs = [ ['mu', 10], ['mu', 10], ['mu', 10], ['mu', 10], ['mu', 10], ['rr', 1.3], ['rl', 0.3] ]; assert.equal(true, MovementManager.validateMovementInput(oldPosition, newPosition, inputs)); }); }); });
var pretty = require('pretty'); module.exports = { beforeSend: function(req, res, page, next) { if (!page.html) { return next(); } page.html = pretty(page.html); next(); } };
// users-model.js - A mongoose model // // See http://mongoosejs.com/docs/models.html // for more of what you can do here. const mongoose = require('mongoose'); module.exports = function (app) { const mongooseClient = app.get('mongooseClient'); const users = new mongooseClient.Schema({ email: {type: String, unique: true}, password: { type: String, required: true }, name: {type: String, required: true}, birth: {type: Date, default:Date.UTC(1999,1,1), required: true}, sex: {type: Boolean, requred: true}, interests: [{type: mongoose.Schema.Types.ObjectId, ref: 'interests'}], avatar: {type: mongoose.Schema.Types.ObjectId, ref: 'photos'}, roles: [{type: String}], location: {type:[Number], index: '2d'}, }, { timestamps: true }); return mongooseClient.model('users', users); };
'use strict'; angular.module('in100gramApp') .controller('HealthController', function ($scope, MonitoringService, $modal) { $scope.updatingHealth = true; $scope.separator = '.'; $scope.refresh = function () { $scope.updatingHealth = true; MonitoringService.checkHealth().then(function (response) { $scope.healthData = $scope.transformHealthData(response); $scope.updatingHealth = false; }, function (response) { $scope.healthData = $scope.transformHealthData(response.data); $scope.updatingHealth = false; }); }; $scope.refresh(); $scope.getLabelClass = function (statusState) { if (statusState === 'UP') { return 'label-success'; } else { return 'label-danger'; } }; $scope.transformHealthData = function (data) { var response = []; $scope.flattenHealthData(response, null, data); return response; }; $scope.flattenHealthData = function (result, path, data) { angular.forEach(data, function (value, key) { if ($scope.isHealthObject(value)) { if ($scope.hasSubSystem(value)) { $scope.addHealthObject(result, false, value, $scope.getModuleName(path, key)); $scope.flattenHealthData(result, $scope.getModuleName(path, key), value); } else { $scope.addHealthObject(result, true, value, $scope.getModuleName(path, key)); } } }); return result; }; $scope.getModuleName = function (path, name) { var result; if (path && name) { result = path + $scope.separator + name; } else if (path) { result = path; } else if (name) { result = name; } else { result = ''; } return result; }; $scope.showHealth = function(health) { var modalInstance = $modal.open({ templateUrl: 'scripts/app/admin/health/health.modal.html', controller: 'HealthModalController', size: 'lg', resolve: { currentHealth: function() { return health; }, baseName: function() { return $scope.baseName; }, subSystemName: function() { return $scope.subSystemName; } } }); }; $scope.addHealthObject = function (result, isLeaf, healthObject, name) { var healthData = { 'name': name }; var details = {}; var hasDetails = false; angular.forEach(healthObject, function (value, key) { if (key === 'status' || key === 'error') { healthData[key] = value; } else { if (!$scope.isHealthObject(value)) { details[key] = value; hasDetails = true; } } }); // Add the of the details if (hasDetails) { angular.extend(healthData, { 'details': details}); } // Only add nodes if they provide additional information if (isLeaf || hasDetails || healthData.error) { result.push(healthData); } return healthData; }; $scope.hasSubSystem = function (healthObject) { var result = false; angular.forEach(healthObject, function (value) { if (value && value.status) { result = true; } }); return result; }; $scope.isHealthObject = function (healthObject) { var result = false; angular.forEach(healthObject, function (value, key) { if (key === 'status') { result = true; } }); return result; }; $scope.baseName = function (name) { if (name) { var split = name.split('.'); return split[0]; } }; $scope.subSystemName = function (name) { if (name) { var split = name.split('.'); split.splice(0, 1); var remainder = split.join('.'); return remainder ? ' - ' + remainder : ''; } }; });
/* eslint max-len:0 */ 'use strict'; const assert = require('chai').assert; const { SVGPathData } = require('..'); describe('Parsing move to commands', () => { it('should not work with single coordinate', () => { assert.throw(() => { new SVGPathData('M100'); }, SyntaxError, 'Unterminated command at the path end.'); }); it('should work with single complexer coordinate', () => { assert.throw(() => { new SVGPathData('m-10e-5'); }, SyntaxError, 'Unterminated command at the path end.'); }); it('should work with single coordinate followed by another', () => { assert.throw(() => { new SVGPathData('m-10m10 10'); }, SyntaxError, 'Unterminated command at index 4.'); }); it('should work with comma separated coordinates', () => { const commands = new SVGPathData('M100,100').commands; assert.equal(commands[0].type, SVGPathData.MOVE_TO); assert.equal(commands[0].relative, false); assert.equal(commands[0].x, '100'); assert.equal(commands[0].y, '100'); }); it('should work with space separated coordinates', () => { const commands = new SVGPathData('m100 \t 100').commands; assert.equal(commands[0].type, SVGPathData.MOVE_TO); assert.equal(commands[0].relative, true); assert.equal(commands[0].x, '100'); assert.equal(commands[0].y, '100'); }); it('should work with complexer coordinates', () => { const commands = new SVGPathData('m-10e-5 -10e-5').commands; assert.equal(commands[0].type, SVGPathData.MOVE_TO); assert.equal(commands[0].relative, true); assert.equal(commands[0].x, '-10e-5'); assert.equal(commands[0].y, '-10e-5'); }); it('should work with even more complexer coordinates', () => { const commands = new SVGPathData('M-10.0032e-5 -10.0032e-5').commands; assert.equal(commands[0].type, SVGPathData.MOVE_TO); assert.equal(commands[0].relative, false); assert.equal(commands[0].x, '-10.0032e-5'); assert.equal(commands[0].y, '-10.0032e-5'); }); it('should work with comma separated coordinate pairs', () => { const commands = new SVGPathData('M123,456 7890,9876').commands; assert.equal(commands[0].type, SVGPathData.MOVE_TO); assert.equal(commands[0].relative, false); assert.equal(commands[0].x, '123'); assert.equal(commands[0].y, '456'); assert.equal(commands[1].type, SVGPathData.LINE_TO); assert.equal(commands[1].relative, false); assert.equal(commands[1].x, '7890'); assert.equal(commands[1].y, '9876'); }); it('should work with space separated coordinate pairs', () => { const commands = new SVGPathData('m123 \t 456 \n 7890 \r 9876').commands; assert.equal(commands[0].type, SVGPathData.MOVE_TO); assert.equal(commands[0].relative, true); assert.equal(commands[0].x, '123'); assert.equal(commands[0].y, '456'); assert.equal(commands[1].type, SVGPathData.LINE_TO); assert.equal(commands[1].relative, true); assert.equal(commands[1].x, '7890'); assert.equal(commands[1].y, '9876'); }); it('should work with nested separated coordinates', () => { const commands = new SVGPathData('M123 , 456 \t,\n7890 \r\n 9876').commands; assert.equal(commands[0].type, SVGPathData.MOVE_TO); assert.equal(commands[0].relative, false); assert.equal(commands[0].x, '123'); assert.equal(commands[0].y, '456'); assert.equal(commands[1].type, SVGPathData.LINE_TO); assert.equal(commands[1].relative, false); assert.equal(commands[1].x, '7890'); assert.equal(commands[1].y, '9876'); }); it('should work with multiple command declarations', () => { const commands = new SVGPathData(` M123 , 456 \t,\n7890 \r\n 9876m123 , 456 \t,\n7890 \r\n 9876 `).commands; assert.equal(commands[0].type, SVGPathData.MOVE_TO); assert.equal(commands[0].relative, false); assert.equal(commands[0].x, '123'); assert.equal(commands[0].y, '456'); assert.equal(commands[1].type, SVGPathData.LINE_TO); assert.equal(commands[1].relative, false); assert.equal(commands[1].x, '7890'); assert.equal(commands[1].y, '9876'); assert.equal(commands[2].type, SVGPathData.MOVE_TO); assert.equal(commands[2].relative, true); assert.equal(commands[2].x, '123'); assert.equal(commands[2].y, '456'); assert.equal(commands[3].type, SVGPathData.LINE_TO); assert.equal(commands[3].relative, true); assert.equal(commands[3].x, '7890'); assert.equal(commands[3].y, '9876'); }); }); describe('Encoding move to commands', () => { it('should work with one command', () => { assert.equal( new SVGPathData('M-50.0032e-5 -60.0032e-5').encode(), 'M-0.000500032 -0.000600032' ); }); it('should work with several commands', () => { assert.equal( new SVGPathData('M-50.0032e-5 -60.0032e-5M-50.0032e-5 -60.0032e-5M-50.0032e-5 -60.0032e-5').encode(), 'M-0.000500032 -0.000600032M-0.000500032 -0.000600032M-0.000500032 -0.000600032' ); }); });
/* global describe, it */ var $require = require('proxyquire'); var expect = require('chai').expect; var factory = require('../../../../../app/authorize/http/response/modes/cookie'); describe('authorize/http/response/modes/cookie', function() { it('should export factory function', function() { expect(factory).to.be.a('function'); }); it('should be annotated', function() { expect(factory['@implements']).to.equal('http://i.authnomicon.org/oauth2/authorize/http/ResponseMode'); expect(factory['@mode']).to.equal('cookie'); expect(factory['@singleton']).to.be.undefined; }); it('should construct mode', function() { var mode = factory(); expect(mode).to.be.a('function'); }); });
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.formatInventoryConfig = void 0; const dataFix_1 = require("../utils/dataFix"); const isObject_1 = require("../utils/isObject"); const isArray_1 = require("../utils/isArray"); const formatObjKey_1 = require("../utils/formatObjKey"); function formatInventoryConfig(inventoryConfig, toArray = false) { if (toArray && isObject_1.isObject(inventoryConfig)) inventoryConfig = [inventoryConfig]; if (isArray_1.isArray(inventoryConfig)) { inventoryConfig = inventoryConfig.map(formatFn); } else { inventoryConfig = formatFn(inventoryConfig); } return inventoryConfig; } exports.formatInventoryConfig = formatInventoryConfig; function formatFn(_) { dataFix_1.dataFix(_, { bool: ['IsEnabled'] }, conf => { var _a, _b; // prefix conf.prefix = conf.Filter.Prefix; delete conf.Filter; // OSSBucketDestination conf.OSSBucketDestination = conf.Destination.OSSBucketDestination; // OSSBucketDestination.rolename conf.OSSBucketDestination.rolename = conf.OSSBucketDestination.RoleArn.replace(/.*\//, ''); delete conf.OSSBucketDestination.RoleArn; // OSSBucketDestination.bucket conf.OSSBucketDestination.bucket = conf.OSSBucketDestination.Bucket.replace(/.*:::/, ''); delete conf.OSSBucketDestination.Bucket; delete conf.Destination; // frequency conf.frequency = conf.Schedule.Frequency; delete conf.Schedule.Frequency; // optionalFields if (((_a = conf === null || conf === void 0 ? void 0 : conf.OptionalFields) === null || _a === void 0 ? void 0 : _a.Field) && !isArray_1.isArray((_b = conf.OptionalFields) === null || _b === void 0 ? void 0 : _b.Field)) conf.OptionalFields.Field = [conf.OptionalFields.Field]; }); // firstLowerCase _ = formatObjKey_1.formatObjKey(_, 'firstLowerCase', { exclude: ['OSSBucketDestination', 'SSE-OSS', 'SSE-KMS'] }); return _; }
console.log(sum(4,5));
import { vendor } from "postcss" import { isObject, find } from "lodash" import valueParser from "postcss-value-parser" import { declarationValueIndex, report, ruleMessages, validateOptions, matchesStringOrRegExp, } from "../../utils" export const ruleName = "property-unit-whitelist" export const messages = ruleMessages(ruleName, { rejected: (p, u) => `Unexpected unit "${u}" for property "${p}"`, }) export default function (whitelist) { return (root, result) => { const validOptions = validateOptions(result, ruleName, { actual: whitelist, possible: [isObject], }) if (!validOptions) { return } root.walkDecls(decl => { const { prop, value } = decl const unprefixedProp = vendor.unprefixed(prop) const propWhitelist = find(whitelist, (list, propIdentifier) => matchesStringOrRegExp(unprefixedProp, propIdentifier)) if (!propWhitelist) { return } valueParser(value).walk(function (node) { if (node.type === "string") { return } const unit = valueParser.unit(node.value).unit if (!unit) { return } if (propWhitelist.indexOf(unit) !== -1) { return } report({ message: messages.rejected(prop, unit), node: decl, index: declarationValueIndex(decl) + node.sourceIndex, result, ruleName, }) }) }) } }
/* * Unified Push Notification Service. * Author: NThusitha * Date: 23-Sep-2015 * * */ angular.module('swift.services').factory('PushService', function($http, $cordovaPush, $cordovaDevice, $log){ var onRegistrationCallback_, onNotificationCallback_, unregistrationCallback_; /* * Bootstrap push plugin. * */ function register_(onRegisterCallback, notificationCallback){ //deviceReadyCall back (deviceToken will get passed to the callback) onRegistrationCallback_ = onRegisterCallback; //called upon receiving the notification. onNotificationCallback_ = notificationCallback; var platform = $cordovaDevice.getPlatform(); switch(platform){ case "iOS" : $log.debug("platform is ios"); var iosConfig = { "badge": true, "sound": true, "alert": true, }; var options = {}; document.addEventListener("deviceready", function(){ $cordovaPush.register(iosConfig).then(function(deviceToken) { // Success -- send deviceToken to server, and store for future use $log.debug("deviceToken: " + deviceToken) onRegistrationCallback_(deviceToken); }, function(err) { $log.error("Registration error (APNS): " + err) }); $rootScope.$on('$cordovaPush:notificationReceived', function(event, notification) { $log.debug("notification received"); if (notification.alert) { navigator.notification.alert(notification.alert); } if (notification.sound) { var snd = new Media(event.sound); snd.play(); } //upon receiving the notification. onNotificationCallback_(notification); if (notification.badge) { $cordovaPush.setBadgeNumber(notification.badge).then(function(result) { $log.debug("set the badge number" + result); }, function(err) { $log.debug("error occured setting badge number"); }); } }); }, false); break; case "Android" : $log.debug("platform is android"); var androidConfig = { "senderID": "replace_with_sender_id", }; document.addEventListener("deviceready", function(){ $cordovaPush.register(androidConfig).then(function(result) { //onRegistrationCallback_(result); $log.debug("successfully registered"); }, function(err) { $log.error("Registration error (GCM) :" + err); }) $rootScope.$on('$cordovaPush:notificationReceived', function(event, notification) { switch(notification.event) { case 'registered': if (notification.regid.length > 0 ) { $log.debug('GCM registration ID = ' + notification.regid); onRegistrationCallback_(notification); } break; case 'message': // this is the actual push notification. its format depends on the data model from the push server $log.debug('message = ' + notification.message + ' msgCount = ' + notification.msgcnt); onNotificationCallback_(notification); break; case 'error': $log.error('GCM error = ' + notification.msg); break; default: $log.error('An unknown GCM event has occurred'); break; } }); }, false); break; default: // http://solutionoptimist.com/2013/10/07/enhance-angularjs-logging-using-decorators/ } } /* * Un register from the Push servers. * */ function unregister_(unregisterCallback){ unregistrationCallback_ = unregisterCallback; // WARNING! dangerous to unregister (results in loss of tokenID) $cordovaPush.unregister(options).then(function(result) { unregistrationCallback_(result); }, function(err) { $log.error("error occured unregistering : " + e); }); } return { registerPushNotifications : function(onRegistrationCallback, onNotificationCallback){ register_(onRegistrationCallback, onNotificationCallback); }, unregisterPushNotifications : function(unregisterCallback){ unregister_(unregisterCallback); } } });
var UploadFaceControl = new Class({ initialize:function(){ this.TriggerBtn=null; this.ChosenFace=null; this.ChosenFaceUrl=null; this.UploadFaceBox = null; this.UploadForm=null; this.UploadBtn=null; this.CancelBtn=null; this.CloseBtn = null; }, build:function(trigger, face, faceUrl){ this.TriggerBtn=trigger; this.ChosenFace=face; this.ChosenFaceUrl=faceUrl; this.UploadForm=$('FaceUploadForm'); this.ChooseUpload=$('ChooseUpload'); this.UploadBtn=$('uploadtoserver'); this.CancelBtn=$('uploadcancel'); this.TriggerBtn.addEvent('click', this.open.bind(this)); this.UploadFaceBox=$('UploadFace'); this.CloseBtn=this.UploadFaceBox.getElement('dt').getElement('img'); this.CloseBtn.addEvent('click', this.close.bind(this)); new UploadFaceHandler(this); }, open:function(){ this.UploadFaceBox.setStyle('display', 'block'); }, close:function(){ this.UploadFaceBox.setStyle('display', 'none'); }, uploadSuccess:function(logoUrl){ this.ChosenFace.src = logoUrl; this.ChosenFaceUrl.value = logoUrl; AJAX_LOADER.complete($('UploadFaceHolder')); this.close(); } }); var UploadFaceHandler=new Class({ initialize:function(control){ this.UploadFaceControl=control; this.UploadFaceControl.UploadBtn.addEvent('click', this.upload.bind(this)); this.UploadFaceControl.CancelBtn.addEvent('click', this.cancelUpload.bind(this)); }, upload:function(){ if(this.UploadFaceControl.ChooseUpload.value != ''){ var parentNode = this.UploadFaceControl.ChooseUpload.parentNode; this.UploadFaceControl.UploadForm.innerHTML = ''; this.UploadFaceControl.UploadForm.appendChild(this.UploadFaceControl.ChooseUpload); this.UploadFaceControl.UploadForm.submit(); AJAX_LOADER.loading($('UploadFaceHolder')); this.UploadFaceControl.UploadForm.innerHTML = ''; parentNode.appendChild(this.UploadFaceControl.ChooseUpload); } }, cancelUpload:function(){ this.UploadFaceControl.close(); } }); function initSelecter(e){ this.Set = function(e){ this.style.left = e.clientX + document.documentElement.scrollLeft + "px"; this.style.top = e.clientY + document.documentElement.scrollTop + "px"; } this.Set(e); if(!this.close){ this.close = function(){this.style.display = "none";this.display = false;}; this.open = function(e){this.Set(e);this.style.display = "block";this.display = true;}; } } function DragTitle(e, target){ if(!e)e = window.event; var oObj = e.target?e.target:e.srcElement; var dragTarget = null; if(target){ dragTarget = target; } else { dragTarget = this.parentNode; } if(this==oObj){ var intObjX = e.clientX - parseInt(dragTarget.style.left); var intObjY = e.clientY - parseInt(dragTarget.style.top); if(this.setCapture){ this.setCapture(); }else if(window.captureEvents){ window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP); } document.onmousemove = function(e){ if(!e)e = window.event; BatchDiffStyle.call(dragTarget,["left",e.clientX - intObjX + "px"] ,["top",e.clientY - intObjY + "px"]); } document.onmouseup = function(e){ if(this.releaseCapture){ this.releaseCapture(); }else if(window.captureEvents){ window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP); } document.onmousemove = null; document.onmouseup = null; } } } var Draggable = new Class({ initialize:function(dragController, dragTarget, container){ this.dragController = dragController; this.dragTarget = dragTarget; this.container = container; this.makeDraggable(); }, makeDraggable:function(){ var dragTarget=this.dragTarget; this.dragController.onmousedown = function(e){ DragTitle.call(this, e, dragTarget); }; } }); var CurtainEffect = new Class({ initialize:function(switchBtn, screenControl, options){ this.switchBtn=switchBtn; this.screenControl=screenControl; if(options){ this.screenControl.maxHeight=options.maxHeight; this.screenControl.speedRate=options.speedRate; this.screenControl.delay=options.delay; this.cookieName=options.cookieName; } this.buildCurtain.call(this.screenControl, this); if(this.screenControl.style.display == "block"){ this.switchBtn.open = true; }else{ this.switchBtn.open = false; } this.switchBtn.onclick = function(){ if(this.switchBtn.open){ this.screenControl.close(); }else{ this.screenControl.open(); } }.bind(this); }, buildCurtain:function(curtain){ var curtainControl = curtain; this.step = this.maxHeight*this.speedRate; this.limit = this.maxHeight-this.step; this.preOpen = function(){ this.clearIntervals(); this.realHeight=0; this.style.height="1px"; this.style.display="block"; curtainControl.switchBtn.blur(); }; this.open = function(){ if(navCurtains){ for(var i=0; i<navCurtains.length; i++){ var navCurtain=navCurtains[i]; if(navCurtain.switchBtn.open==true){ navCurtain.screenControl.close(); } } } this.preOpen(); this.setOpenInterval = setInterval(function(){ this.realHeight=this.offsetHeight+this.step; if(this.realHeight<=this.limit){ this.style.height=this.realHeight+"px"; }else{ this.postOpen(); } }.bind(this), this.delay); }; this.postOpen = function(){ clearInterval(this.setOpenInterval); this.style.height=this.maxHeight+"px"; curtainControl.switchBtn.open=true; curtainControl.switchBtn.blur(); /* * var obj = this; var loadingBox = new LoadingBox(); * loadingBox.bindCloseFunc(function(){ obj.close(); this.close(); * }); loadingBox.loading(); */ this.saveState(); }; this.preClose = function(){ this.clearIntervals(); this.realHeight=this.maxHeight; this.style.height=this.maxHeight+"px"; this.style.display="block"; curtainControl.switchBtn.blur(); }; this.close = function(){ this.preClose(); this.setHiddenInterval=setInterval(function(){ this.realHeight=this.offsetHeight-this.step; if(this.realHeight>0){ this.style.height=this.realHeight+"px"; }else{ this.postClose(); } }.bind(this), this.delay); }; this.postClose = function(){ clearInterval(this.setHiddenInterval); this.style.display="none"; curtainControl.switchBtn.open=false; /* curtainControl.switchBtn.className=""; */ this.saveState(); curtainControl.switchBtn.blur(); }; this.clearIntervals = function(){ if(this.setOpenInterval){ clearInterval(this.setOpenInterval); } if(this.setHiddenInterval){ clearInterval(this.setHiddenInterval); } }; this.saveState = function(){ document.cookie = curtainControl.cookieName + "=" + this.style.display + "; expires=" + AddDays(365) + "; path=/"; } } }); var ResizeTextArea = new Class({ initialize:function(textArea){ this.textArea = textArea; this.enableResize(); }, enableResize:function(){ this.textAreaWrapper=new Element("div"); this.textAreaWrapper.setStyle("float", "left"); this.textAreaWrapper.setStyle("width", this.textArea.style.width); this.resizeBar = new Element("div"); this.resizeBar.addClass("sizebar"); this.resizeBar.appendChild(new Element("ins")); this.resizeBar.addEvent("mousedown", this.resizing.bind(this)); this.textArea.parentNode.appendChild(this.textAreaWrapper); this.textAreaWrapper.appendChild(this.textArea); this.textAreaWrapper.appendChild(this.resizeBar); }, resizing:function(e){ if(!e)e=window.event; var target = this.textArea; var initY = e.clientY; var targetDefaultHeight=this.textArea.offsetHeight; if(this.setCapture){ this.setCapture(); }else if(window.captureEvents){ window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP); } document.onmousemove = function(e){ if(!e)e=window.event; var newHeight=targetDefaultHeight+e.clientY-initY; if(newHeight<50){ newHeight=50; } target.setStyle("height", newHeight+"px"); } document.onmouseup=function(e){ if(this.releaseCapture){ this.releaseCapture(); }else if(window.captureEvents){ window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP); } document.onmousemove=null; document.onmouseup=null; } } }); var AlphaEffect = new Class({ initialize:function(elem, imgs, options){ this.elem = elem; this.defaultImg=elem.src; this.imgs = imgs; this.index = -1; if(options){ this.alpha=options.alpha; this.speed=options.speed; this.delay=options.delay; this.status=options.status; } }, clearIntervals:function(){ if(this.showInterval){ clearInterval(this.showInterval); } if(this.hideInterval){ clearInterval(this.hideInterval); } }, show:function(){ this.showInterval=setInterval(function(){ this.alpha+=this.speed; if(this.alpha>=10){ this.alpha=10; SetAlpha(this.elem,this.alpha); this.clearIntervals(); this.status=false; if(this.showFunc){ this.showFunc(); } this.hide(); }else{ SetAlpha(this.elem,this.alpha); } }.bind(this), this.delay); }, hide:function(){ this.status=true; this.hideInterval=setInterval(function(){ this.alpha-=this.speed; if(this.alpha<=0){ this.alpha=0; SetAlpha(this.elem,this.alpha); this.clearIntervals(); if(this.hideFunc){ this.hideFunc(); } this.showNext(); }else{ SetAlpha(this.elem,this.alpha); } }.bind(this), this.delay); }, showNext:function(){ this.index++; if(this.index < this.imgs.length){ this.elem.src=this.imgs[this.index]; }else{ this.index=-1; this.elem.src=this.defaultImg; } this.show(); } }); var AutoScroll = new Class({ initialize:function(options){ if(options){ this.speedRate=0.1; this.delay=10; } }, scroll:function(topLimit){ this.topLimit = topLimit; this.clearIntervals(); if(this.topLimit == this.scrollTop){ return false; } this.speed=(this.topLimit-this.scrollTop)*this.speedRate; this.scrollInterval=setInterval(function(){ this.scrollTop+=this.speed; if((this.speed>0 && this.scrollTop>=this.topLimit)||(this.speed<0&&this.scrollTop<=this.topLimit)){ this.stop(); } }.bind(this), this.delay); }, stop:function(){ this.clearIntervals(); this.scrollTop=this.topLimit; }, clearIntervals:function(){ if(this.scrollInterval){ clearInterval(this.scrollInterval); } } }); var ListControl = new Class({ initialize:function(listContainer){ this.listContainer = listContainer; this.switchBtns=$$(".itemBtn"); this.screenControls=$$(".screen"); this.listControlBtns=$$(".listControlBtn"); this.cookieName="ListMode"; this.isEffect = true; }, initListControl:function(){ for(var i=0; i<this.listControlBtns.length; i++){ this.listControlBtns[i].onclick=this.listControlHandle; this.listControlBtns[i].changeListControlMode=this.changeListControlMode; this.listControlBtns[i].control=this; if(this.listControlBtns[i].className=="choose"){ this.currentModeBtn=this.listControlBtns[i]; this.currentMode=Number(this.currentModeBtn.rel); } } this.switchBtns.control=this; this.switchBtns.handle=this.itemBtnHandle; for(var i=0; i<this.switchBtns.length; i++){ this.switchBtns[i].control=this; this.switchBtns[i].mode=this.currentMode; new CurtainEffect(this.switchBtns[i], this.screenControls[i], { maxHeight:29, speedRate:0.08, delay:10, maxHeight:150 }); this.switchBtns[i].handle=this.normalHandle; } }, listControlHandle:function(){ this.blur(); if(this.rel!=this.control.currentMode){ this.changeListControlMode(); this.control.switchBtns.hand(); } }, changeListControlMode:function(){ this.control.currentModeBtn.className=""; this.className="choose"; this.control.currentModeBtn=this; this.control.currentMode=Number(this.rel); this.control.saveState(); }, itemBtnHandle:function(){ for(var i=0;i<this.length;i++){ if(this[i].mode!=this.control.currentMode){ if(this.control.isEffect){ this[i].onclick(); }else{ this[i].handle(); } } } }, normalHandle:function(){ }, saveState : function(){ } }); var EffectWindow = new Class({ initialize:function(switchBtn, screenControl){ this.switchBtn=switchBtn; this.switchBtn.control=this; this.screenControl=screenControl; this.screenControl.control=this; this.maxHeight=100; this.maxWidth=209; this.speed=0.15; this.fix=20; this.delay=10; this.status=false; bindEvents(); }, bindEvents:function(){ this.switchBtn.onmouseover=this.switchOverHandler.bind(this); this.switchBtn.onmouseout=this.switchOutHandler.bind(this); this.switchBtn.onclick=this.switchClickHandler.bind(this); this.screenControl.onmouseover=this.screenOverHandler; }, switchOverHandler:function(){ if(this.hideTimeout){ clearTimeout(this.hideTimeout); } if(!this.status){ var obj=this; this.openTimeout=setTimeout(function(){ obj.open(); }, 200); } }, switchOutHandler:function(){ if(this.openTimeout){ clearTimeout(this.openTimeout); } if(this.status){ var obj=this; this.hideTimeout=setTimeout(function(){ obj.close(); }, 500); } }, switchClickHandler:function(){ this.clearSetTimes(); this.setStatus(); }, screenOverHandler:function(){ var obj=this; document.onmouseover=function(e){ if(!e){ e=window.event; } var eventObj=e.target?e.target:e.srcElement; if(obj.getParent(eventObj, obj.screenControl)){ if(obj.hideTimeout){ clearTimeout(obj.hideTimeout); } }else{ obj.switchOutHandler(); document.onmouseover=null; } } }, open:function(){ this.clearSetTimes(); this.screenControl.style.background="none"; this.screenControl.style.display="block"; this.openInterval=setInterval(function(){ this.setStyle(this.screenControl.offsetHeight + (this.maxHeight * this.speed-this.fix), this.screenControl.offsetWidth + (this.maxWidth * this.speed-this.fix), (this.maxWidth - this.screenControl.offsetWidth)/2); if(this.screenControl.offsetWidth >= this.maxWidth || this.screenControl.offsetHeight >= this.maxHeight){ this.setStyle(this.maxHeight,this.maxWidth,0); this.screenControl.style.backgroundColor = "#FFF"; this.status = true; clearInterval(this.openInterval); } }.bind(this), this.delay); }, close:function(){ this.clearSetTimes(); this.screenControl.style.background="none"; this.closeInterval=setInterval(function(){ this.setStyle(this.screenControl.offsetHeight - (this.maxHeight * this.speed+this.fix), this.screenControl.offsetWidth - (this.maxWidth * this.speed+this.fix), (this.maxWidth - this.screenControl.offsetWidth)/2 ); if(this.screenControl.offsetWidth <= 42 || this.screenControl.offsetHeight <= 30){ this.setStyle(0,0,this.maxWidth / 2); this.screenControl.style.display = "none"; this.status = false; clearInterval(this.closeInterval); } }.bind(this), this.delay); }, setStatus:function(){ if(this.status){ this.close(); }else{ this.open(); } }, setStyle:function(height,width,marginLeft){ this.screenControl.style.height = height + "px"; this.screenControl.style.width = width + "px"; this.screenControl.style.marginLeft = marginLeft + "px"; }, getParent:function(Contain){ var oParent = this; while(oParent.tagName != "HTML"){ if(oParent == Contain){ return true; } oParent = oParent.parentNode; } return false; }, clearSetTimes:function(){ if(this.openInterval)clearInterval(this.openInterval); if(this.closeInterval)clearInterval(this.closeInterval); if(this.hideTimeout)clearTimeout(this.hideTimeout); if(this.openTimeout)clearTimeout(this.openTimeout); } }); var ScrollGateControl = new Class({ initialize:function(tabPane, handlers, screens){ this.tabPane = tabPane; this.handlers = handlers; this.screens = screens; this.bindTabEvents(); }, bindTabEvents:function(){ this.tabs = this.tabPane.getElements("a"); this.current = 1; for(var i=0; i<this.tabs.length; i++){ this.tabs[i].number = i+1; this.tabs[i].control=this; this.tabs[i][this.handlers[i]]=this.scroll; } }, scroll:function(){ if(this.control.current!=this.number){ this.control.tabs[this.control.current-1].className=""; this.control.screens[this.control.current-1].style.display="none"; this.control.current=this.number; this.control.tabs[this.control.current-1].className="choosed"; this.control.screens[this.control.current-1].style.display=""; } this.blur(); } }); var Scroller = new Class({ Implements: [Events, Options], options: { velocity: 1 }, initialize: function(element, options){ this.setOptions(options); this.element = $(element); this.lastPage = null; this.coord = this.getCoords.bindWithEvent(this); this.release = this.release.bindWithEvent(this); this.mouseover = ([window, document].contains(element)) ? $(document.body) : this.element; this.element.addEvent('mousedown', function(e) { if(this.element && e.target) { if(this.element.tagName == e.target.tagName) { this.reset.bind(this)(e); document.addListener('mousemove', this.coord); document.addListener('mouseup', this.release); } } }.bind(this)); this.element.scrollTo(0, 0); }, getCoords: function(event){ event = new Event(event); this.page = (this.element == window) ? event.client : event.page; if(this.lastPage == null){ this.lastPage = this.page; } var scroll = this.element.getScroll(); var change = {x: 0, y: 0}; for (var z in this.page){ change[z] = (this.page[z] - this.lastPage[z]) * this.options.velocity; } this.element.scrollTo(scroll.x - change.x, scroll.y - change.y) this.lastPage = this.page; }, release: function() { document.removeListener('mousemove', this.coord); document.removeListener('mouseup', this.release); }, reset: function(event) { this.lastPage = (this.element == window) ? event.client : event.page; } }); var ScrollListControl=new Class({ Extends: Slider, options: { }, initialize: function(el, options){ this.el = el; this.box = el.getElement('.box'); this.scrollList = el.getElement('.scrollcont'); this.buildScrollBar(el); this.upBtn = el.getElement('.up'); this.downBtn = el.getElement('.down'); this.knobBtn = el.getElement('.knob'); this.parent(this.scrollList, this.knobBtn, options); this.bindEvents(); }, buildScrollBar: function(){ var scrollSetDiv=new Element('div'); var scrollDiv=new Element('div'); scrollDiv.addClass('scrollbarwrap'); var upImg=new Element('img'); upImg.setProperty('src', APP_PATH+'/images/sroll/upper.gif'); upImg.addClass('up'); upImg.inject(scrollDiv, 'bottom'); var scrollBar=new Element('div'); scrollBar.addClass('scroolbar'); var knobDiv=new Element('div'); knobDiv.addClass('knob'); knobDiv.inject(scrollBar, 'bottom'); scrollBar.inject(scrollDiv, 'bottom'); var downImg=new Element('img'); downImg.setProperty('src', APP_PATH+'/images/sroll/downer.gif'); downImg.addClass('down'); downImg.inject(scrollDiv, 'bottom'); scrollDiv.inject(scrollSetDiv, 'bottom'); this.scrollList.inject(scrollSetDiv, 'bottom'); scrollSetDiv.inject(this.el, 'bottom'); }, bindEvents:function(){ this.upBtn.addEvent('mousedown',this.mouseDown.bindWithEvent(this)); this.upBtn.addEvent('mouseup',this.mouseRelease.bindWithEvent(this)); this.downBtn.addEvent('mousedown',this.mouseDown.bindWithEvent(this)); this.downBtn.addEvent('mouseup',this.mouseRelease.bindWithEvent(this)); this.onChange=function(step){ this.scrollList.setStyle('top',-step); }; this.onMouseup = function(step){ } }, mouseRelease: function(){ if(this.moveTimer){ $clear(this.moveTimer); } }, mouseDown: function(e){ e=new Event(e); this.moveTimer = function(e){ if(this.step>=0&&this.step<=this.options.steps){ if(e.target==this.upBtn){ this.step-=5; }else{ this.step+=5; } this.set(this.step); } }.periodical(1, this, e); } }); var ImagePane = new Class({ initialize:function(imagePaneElem){ this.imagePaneElem = imagePaneElem; this.dirSelElem = this.imagePaneElem.getElements('select.dirsel')[0]; this.totalElem = this.imagePaneElem.getElements('strong.totalspan')[0]; this.pageCountElem = this.imagePaneElem.getElements('strong.pagecountspan')[0]; this.currentPageElem = this.imagePaneElem.getElements('strong.currentpage')[0]; this.prevLinkElem=this.imagePaneElem.getElements('a.prevlink')[0]; this.nextLinkElem=this.imagePaneElem.getElements('a.nextlink')[0]; this.loadingBox = new LoadingBox(); this.bindEvents(); }, bindEvents:function(){ this.dirSelElem.addEvent('change', function(){ var imageDirectory = this.dirSelElem.value; this.initImages(0, imageDirectory); }.bind(this)); var prevClickFunc = function(e){ if(e){ e.stop(); } var func = this[0].getPageImages.bind(this); func(); }.bindWithEvent([this, this.prevLinkElem]); this.prevLinkElem.addEvent('click', prevClickFunc); var nextClickFunc = function(e){ if(e){ e.stop(); } var func = this[0].getPageImages.bind(this); func(); }.bindWithEvent([this, this.nextLinkElem]); this.nextLinkElem.addEvent('click', nextClickFunc); }, show:function(callback){ this.callback = callback; this.loadingBox.bindCloseFunc(function(){ this.imagePaneElem.setStyle('display', 'none'); this.loadingBox.close(); }.bind(this)); this.loadingBox.loading(); var imageDirectory = this.dirSelElem.value; if(imageDirectory!=null&&imageDirectory!=''){ this.initImages(0, imageDirectory); }else{ this.initImages(0); } this.imagePaneElem.setStyle('display', 'block'); }, initImages:function(startIndex, imageDirectory){ if(imageDirectory && imageDirectory!=null){ ProductService.findImagesByDirectory(imageDirectory, 12, startIndex, function(pagination){ this.buildImageList(pagination); this.totalElem.set('text',pagination.totalCount); this.pageCountElem.set('text',pagination.totalPageCount); if(pagination.previousIndex>=0){ this.prevLinkElem.setProperty('index', pagination.previousIndex); this.prevLinkElem.setProperty('total', pagination.totalCount); this.currentPageElem.set('text',pagination.pageNumber); } if(pagination.nextIndex<=pagination.totalCount){ this.nextLinkElem.setProperty('index', pagination.nextIndex); this.nextLinkElem.setProperty('total', pagination.totalCount); this.currentPageElem.set('text',pagination.pageNumber); } }.bind(this)); }else{ ProductService.findImages(12, startIndex, function(pagination){ this.buildImageList(pagination); this.totalElem.set('text',pagination.totalCount); this.pageCountElem.set('text',pagination.totalPageCount); if(pagination.previousIndex>=0){ this.prevLinkElem.setProperty('index', pagination.previousIndex); this.prevLinkElem.setProperty('total', pagination.totalCount); this.currentPageElem.set('text',pagination.pageNumber); } if(pagination.nextIndex<=pagination.totalCount){ this.nextLinkElem.setProperty('index', pagination.nextIndex); this.nextLinkElem.setProperty('total', pagination.totalCount); this.currentPageElem.set('text',pagination.pageNumber); } }.bind(this)); } }, getPageImages:function(){ var justThis=this[0]; var justThisElem=this[1]; var startIndex = justThisElem.getProperty('index').toInt(); var totalCount = justThisElem.getProperty('total').toInt(); var imageDirectory = justThis.dirSelElem.value; if(startIndex >= 0 && startIndex <= totalCount.toInt()){ justThis.initImages(startIndex, imageDirectory); } }, buildImageList:function(pagination){ var ulElem=$('imageUl'); ulElem.empty(); for(var i=0; i<pagination.items.length; i++){ var item = pagination.items[i]; var liElem = new Element('li'); var dlElem = new Element('dl'); var dtElem = new Element('dt'); var imgElem = new Element('img'); var ddElem = new Element('dd'); imgElem.src = APP_PATH + item.location; imgElem.setProperty('imageName', item.name); imgElem.setProperty('imageDesc', item.description); imgElem.inject(dtElem, 'bottom'); dtElem.inject(dlElem, 'bottom'); ddElem.set('text',item.name); ddElem.inject(dlElem, 'bottom'); dlElem.inject(liElem, 'bottom'); liElem.inject(ulElem, 'bottom'); imgElem.addEvent('click', function(){ var justThis=this[0]; var justThisImg=this[1]; justThis.callback(justThisImg); }.bind([this, imgElem])); ddElem.addEvent('click', function(){ var justThis=this[0]; var justThisImg=this[1]; justThis.callback(justThisImg); }.bind([this, imgElem])); } } });
function Person(name){ this.name = 'zfpx'; } /** * new 的过程: * 1.创建一个空对象 * 2.把空对象作为this 传入Person * 3.返回这个对象 * @type {Person} */ var p = new Person; console.log(p.name); var P2 = Person.bind({name:'px'}); var p2 = new P2; console.log(p2.name);
(function() { /*constants declaration*/ const DIR_PATH = "directives/"; const SERVICES_PATH = "services/"; const FILTERS_PATH = "filters/"; const COMPONENTS_PATH = "components/"; const CTRL_PATH = COMPONENTS_PATH; /*array containing all file paths*/ var FILE_PATHS = [ CTRL_PATH + "controllers.module.js", CTRL_PATH + "common.controller.js", CTRL_PATH + "home/home.controller.js", CTRL_PATH + "auth/auth.controller.js", CTRL_PATH + "profile/profile.controller.js", CTRL_PATH + "admin/admin.controller.js", CTRL_PATH + "app/app.controller.js", CTRL_PATH + "apropos/apropos.controller.js", CTRL_PATH + "header/header.controller.js", SERVICES_PATH + "services.module.js", SERVICES_PATH + "users.services.module.js", SERVICES_PATH + "site.services.module.js", SERVICES_PATH + "classes.services.module.js", SERVICES_PATH + "admin.services.module.js", FILTERS_PATH + "filters.module.js", DIR_PATH + "directives.module.js", DIR_PATH + "version.directive.js", DIR_PATH + "header.directive.js", ]; /*document.body.appendChild() doesn't seem to work well: use document.write instead*/ FILE_PATHS.forEach(function(filePath) { document.write("<script src='" + filePath + "'></script>"); }); })();
// defaultOptions.js angular.module('pdTypeahead.defaultOptions', []) .constant('TYPEAHEAD_OPTIONS', { autofocus: true, //doAutofocus to input by default });
/** * Checklist-model * AngularJS directive for list of checkboxes */ angular.module('checklist-model', []) .directive('checklistModel', function($parse, $compile) { // contains function contains(arr, item) { if (angular.isArray(arr)) { for (var i = 0; i < arr.length; i++) { if (angular.equals(arr[i], item)) { return true; } } } return false; } // add function add(arr, item) { arr = angular.isArray(arr) ? arr : []; for (var i = 0; i < arr.length; i++) { if (angular.equals(arr[i], item)) { return; } } arr.push(item); } // remove function remove(arr, item) { if (angular.isArray(arr)) { for (var i = 0; i < arr.length; i++) { if (angular.equals(arr[i], item)) { arr.splice(i, 1); return; } } } } return { restrict: 'A', scope: true, link: function(scope, elem, attrs) { if (elem[0].tagName !== 'INPUT' || !elem.attr('type', 'checkbox')) { throw 'checklist-model should be applied to `input[type="checkbox"]`.'; } if (!attrs.checklistValue) { throw 'You should provide `checklist-value`.'; } var modelGet = $parse(attrs.checklistModel); var modelSet = modelGet.assign; var model = modelGet(scope); var value = $parse(attrs.checklistValue)(scope); // local var storing individual checkbox model scope.checked = contains(model, value); // exclude recursion elem.removeAttr('checklist-model'); elem.attr('ng-model', 'checked'); $compile(elem)(scope); // watch UI checked change scope.$watch('checked', function(newValue, oldValue) { if (newValue === oldValue) { return; } if (newValue === true) { add(model, value); modelSet(scope.$parent, model); } else if (newValue === false) { remove(model, value); modelSet(scope.$parent, model); } }); // watch element destroy to remove from model elem.bind('$destroy', function() { remove(model, value); modelSet(scope.$parent, model); }); // watch model change scope.$watch(function ngModelWatch() { var curModel = modelGet(scope); if (model !== curModel) { model = curModel; scope.checked = contains(model, value); } }); } }; });
'use strict'; var createVisitor = require('./create_visitor'); var escapeRegExp = /[\-{}\[\]+?.,\\\^$|#\s]/g; /** * @class * @private */ function Matcher(options) { this.captures = options.captures; this.re = options.re; } /** * Try matching a path against the generated regular expression * @param {String} path The path to try to match * @return {Object|false} matched parameters or false */ Matcher.prototype.match = function (path) { var match = this.re.exec(path); var matchParams = {}; if (!match) { return false; } this.captures.forEach(function (capture, i) { if (typeof match[i + 1] === 'undefined') { matchParams[capture] = undefined; } else { matchParams[capture] = decodeURIComponent(match[i + 1]); } }); return matchParams; }; /** * Visitor for the AST to create a regular expression matcher * @class RegexpVisitor * @borrows Visitor-visit */ var RegexpVisitor = createVisitor({ Concat: function (node) { return node.children .reduce( function (memo, child) { var childResult = this.visit(child); return { re: memo.re + childResult.re, captures: memo.captures.concat(childResult.captures) }; }.bind(this), { re: '', captures: [] } ); }, Literal: function (node) { return { re: node.props.value.replace(escapeRegExp, '\\$&'), captures: [] }; }, Splat: function (node) { return { re: '([^?]*?)', captures: [node.props.name] }; }, Param: function (node) { return { re: '([^\\/\\?]+)', captures: [node.props.name] }; }, Optional: function (node) { var child = this.visit(node.children[0]); return { re: '(?:' + child.re + ')?', captures: child.captures }; }, Root: function (node) { var childResult = this.visit(node.children[0]); return new Matcher({ re: new RegExp('^' + childResult.re + '(?=\\?|$)'), captures: childResult.captures }); } }); module.exports = RegexpVisitor;
var markup_context = { // Config array that can be overridden config: { // The base URL of your site (allows you to use %base_url% in Markdown files) base_url: '', // The base URL of your images folder (allows you to use %image_url% in Markdown files) image_url: '/images', // Excerpt length (used in search) excerpt_length: 400, // The meta value by which to sort pages (value should be an integer) // If this option is blank pages will be sorted alphabetically page_sort_meta: 'sort', // Should categories be sorted numerically (true) or alphabetically (false) // If true category folders need to contain a "sort" file with an integer value category_sort: true, // Specify the path of your content folder where all your '.md' files are located content_dir: './content/', // Toggle debug logging debug: false, // 用户信息 copyright: '<a href="http://aqnote.com/author">Powered by 御道(YUDAO)</a> <a href="mailto:madding.lip@gmail.com">邮箱</a>', // 广告 ad: '' } }; module.exports = markup_context;
var test = require ('./test.js'); let Test = test.Test; var prototype = require ('../prototype.js'); let CardUtils = prototype.CardUtils; let HandUtils = prototype.HandUtils; let GameEngine = prototype.GameEngine; let Suit = prototype.Suit; let Card = prototype.Card; let Rank = prototype.Rank; let Hand = prototype.Hand; let HandRank = prototype.HandRank; let Player = prototype.Player; let GameStep = prototype.GameStep; // test case new Test("Card Id Test", function() { for (let rank=1; rank <= 13; rank++) { for (let suit=1; suit<= 4; suit++) { let c1 = new Card(suit, rank); let c2 = CardUtils.getCardFromId(c1.id); this.areEqual(c1.id, c2.id) } } }); // test case new Test("GameEngine Create Deck Test", function() { var deck = GameEngine.createDeck(); this.areEqual(deck.length, 52); }); // test case new Test("GameEngine.getRankingFromCards FOUR_OF_A_KIND Test", function() { var cards = [ new Card(Suit.DIAMOND, Rank.JACK), new Card(Suit.CLUB, Rank.JACK), new Card(Suit.SPADE, Rank.JACK), new Card(Suit.HEART, Rank.JACK), new Card(Suit.DIAMOND, Rank.QUEEN) ] var hand = GameEngine.getHandFromCards(cards); this.areEqual(hand.handRank, HandRank.FOUR_OF_A_KIND) }); // test case new Test("GameEngine.getRankingFromCards HIGH_CARD Test", function() { var cards = [ new Card(Suit.DIAMOND, Rank.ACE), new Card(Suit.CLUB, Rank.RANK2), new Card(Suit.SPADE, Rank.RANK8), new Card(Suit.HEART, Rank.RANK10), new Card(Suit.DIAMOND, Rank.QUEEN) ] var hand = GameEngine.getHandFromCards(cards); this.areEqual(hand.handRank, HandRank.HIGH_CARD) }); // test case new Test("GameEngine.getRankingFromCards PAIR Test", function() { var cards = [ new Card(Suit.DIAMOND, Rank.ACE), new Card(Suit.CLUB, Rank.RANK2), new Card(Suit.SPADE, Rank.RANK8), new Card(Suit.HEART, Rank.RANK8), new Card(Suit.DIAMOND, Rank.QUEEN) ] var hand = GameEngine.getHandFromCards(cards); this.areEqual(hand.handRank, HandRank.PAIR) }); // test case new Test("GameEngine.getRankingFromCards TWO_PAIRS Test", function() { var cards = [ new Card(Suit.DIAMOND, Rank.RANK2), new Card(Suit.CLUB, Rank.RANK2), new Card(Suit.SPADE, Rank.RANK8), new Card(Suit.HEART, Rank.RANK8), new Card(Suit.DIAMOND, Rank.QUEEN) ] var hand = GameEngine.getHandFromCards(cards); this.areEqual(hand.handRank, HandRank.TWO_PAIRS) }); // test case new Test("GameEngine.getRankingFromCards ROYAL_FLUSH Test", function() { var cards = [ new Card(Suit.DIAMOND, Rank.ACE), new Card(Suit.DIAMOND, Rank.RANK10), new Card(Suit.DIAMOND, Rank.JACK), new Card(Suit.DIAMOND, Rank.KING), new Card(Suit.DIAMOND, Rank.QUEEN) ] var hand = GameEngine.getHandFromCards(cards); this.areEqual(hand.handRank, HandRank.ROYAL_FLUSH) }); // test case new Test("GameEngine.selectBestCards TWO_PAIRS Test", function() { var cards = [ new Card(Suit.DIAMOND, Rank.ACE), new Card(Suit.DIAMOND, Rank.RANK2), new Card(Suit.CLUB, Rank.RANK2), new Card(Suit.SPADE, Rank.RANK8), new Card(Suit.HEART, Rank.RANK8), new Card(Suit.HEART, Rank.RANK10), new Card(Suit.DIAMOND, Rank.QUEEN) ] var cards = GameEngine.selectBestCards(cards); var hand = GameEngine.getHandFromCards(cards); this.areEqual(hand.handRank, HandRank.TWO_PAIRS); this.areEqual(hand.ranks, [Rank.RANK8, Rank.RANK2, Rank.ACE, Rank.NONE, Rank.NONE]); }); // test case new Test("GameEngine.selectBestCards FLUSH Test", function() { var cards = [ new Card(Suit.DIAMOND, Rank.ACE), new Card(Suit.DIAMOND, Rank.RANK2), new Card(Suit.CLUB, Rank.RANK2), new Card(Suit.SPADE, Rank.RANK8), new Card(Suit.DIAMOND, Rank.RANK8), new Card(Suit.DIAMOND, Rank.RANK10), new Card(Suit.DIAMOND, Rank.QUEEN) ] var cards = GameEngine.selectBestCards(cards); var hand = GameEngine.getHandFromCards(cards); this.areEqual(hand.handRank, HandRank.FLUSH); this.areEqual(hand.ranks, [Rank.ACE, Rank.QUEEN, Rank.RANK10, Rank.RANK8, Rank.RANK2]); }); // test case new Test("GameEngine.selectBestCards FULL_HOUSE Test", function() { var cards = [ new Card(Suit.DIAMOND, Rank.ACE), new Card(Suit.DIAMOND, Rank.RANK2), new Card(Suit.CLUB, Rank.RANK2), new Card(Suit.SPADE, Rank.RANK8), new Card(Suit.DIAMOND, Rank.RANK8), new Card(Suit.HEART, Rank.RANK8), new Card(Suit.DIAMOND, Rank.QUEEN) ] var cards = GameEngine.selectBestCards(cards); var hand = GameEngine.getHandFromCards(cards); this.areEqual(hand.handRank, HandRank.FULL_HOUSE); this.areEqual(hand.ranks, [Rank.RANK8, Rank.RANK2, Rank.NONE, Rank.NONE, Rank.NONE]); }); // test case new Test("GameEngine.selectBestCards STRAIGHT Test", function() { var cards = [ new Card(Suit.DIAMOND, Rank.ACE), new Card(Suit.DIAMOND, Rank.RANK2), new Card(Suit.CLUB, Rank.RANK10), new Card(Suit.SPADE, Rank.JACK), new Card(Suit.DIAMOND, Rank.RANK8), new Card(Suit.HEART, Rank.KING), new Card(Suit.DIAMOND, Rank.QUEEN) ] var cards = GameEngine.selectBestCards(cards); var hand = GameEngine.getHandFromCards(cards); this.areEqual(hand.handRank, HandRank.STRAIGHT); this.areEqual(hand.ranks, [Rank.ACE, Rank.NONE, Rank.NONE, Rank.NONE, Rank.NONE]); }); // test case new Test("GameEngine.selectBestCards FLUSH beats STRAIGHT Test", function() { var cards = [ new Card(Suit.DIAMOND, Rank.ACE), new Card(Suit.SPADE, Rank.RANK10), new Card(Suit.DIAMOND, Rank.RANK10), new Card(Suit.SPADE, Rank.JACK), new Card(Suit.DIAMOND, Rank.RANK8), new Card(Suit.DIAMOND, Rank.KING), new Card(Suit.DIAMOND, Rank.QUEEN) ] var cards = GameEngine.selectBestCards(cards); var hand = GameEngine.getHandFromCards(cards); this.areEqual(hand.handRank, HandRank.FLUSH); this.areEqual(hand.ranks, [Rank.ACE, Rank.KING, Rank.QUEEN, Rank.RANK10, Rank.RANK8]); }); // test case new Test("GameEngine.selectBestCards ROYAL_FLUSH Test", function() { var cards = [ new Card(Suit.DIAMOND, Rank.ACE), new Card(Suit.SPADE, Rank.RANK10), new Card(Suit.DIAMOND, Rank.RANK10), new Card(Suit.DIAMOND, Rank.JACK), new Card(Suit.DIAMOND, Rank.RANK8), new Card(Suit.DIAMOND, Rank.KING), new Card(Suit.DIAMOND, Rank.QUEEN) ] var cards = GameEngine.selectBestCards(cards); var hand = GameEngine.getHandFromCards(cards); this.areEqual(hand.handRank, HandRank.ROYAL_FLUSH); this.areEqual(hand.ranks, [Rank.NONE, Rank.NONE, Rank.NONE, Rank.NONE, Rank.NONE]); }); // test case new Test("GameEngine GameSteps Test", function() { let players = [new Player(),new Player(),new Player()]; let game = GameEngine.createGame(players); GameEngine.shuffleDeck(game); while (game.step != GameStep.END) { GameEngine.moveToNextStep(game); } this.isTrue(game.board.length == 5); for(let player of players) { this.isTrue(player.hole.length == 2); let cards = []; cards = cards.concat(player.hole, game.board) cards = GameEngine.selectBestCards(cards); player.hand = GameEngine.getHandFromCards(cards); } let biggestRanking = null; let winner = null; for(let player of players) { if (biggestRanking == null) { biggestRanking = player.hand; winner = player; } else if (player.hand.weight > biggestRanking.weight) { biggestRanking = player.hand; winner = player; } } });
requirejs.config({ paths: { kuro: '../kuro', ao: '../ao' }, shim: { } });
// ========================================================================== // Project: SproutCore - JavaScript Application Framework // Copyright: ©2008-2011 Apple Inc. All rights reserved. // License: Licensed under MIT license (see license.js) // ========================================================================== /*globals Docs */ /** @class (Document your Model here) @extends SC.Record @version 0.1 */ Docs.Property = SC.Record.extend( /** @scope Docs.Property.prototype */ { childRecordNamespace: Docs, type: 'Property', icon: sc_static('images/property_icon.png'), name: SC.Record.attr(String), displayName: SC.Record.attr(String), objectType: SC.Record.attr(String), propertyType: SC.Record.attr(String), author: SC.Record.attr(String), see: SC.Record.attr(Array, {defaultValue: []}), since: SC.Record.attr(String), version: SC.Record.attr(String), deprecated: SC.Record.attr(String), memberOf: SC.Record.attr(String), overview: SC.Record.attr(String), defaultValue: SC.Record.attr(String), isConstant: SC.Record.attr(Boolean, {defaultValue: NO}), isPrivate: SC.Record.attr(Boolean, {defaultValue: NO}), isReadonly: SC.Record.attr(Boolean, {defaultValue: NO}), formattedOverview: function() { var overview = this.get('overview'); var converter = new Showdown.converter(); var html = converter.makeHtml(overview); return html; }.property('overview').cacheable() }) ;
(function () { 'use strict'; angular .module('crimes.admin') .controller('CrimesAdminController', CrimesAdminController); CrimesAdminController.$inject = ['$scope', '$state', '$window', 'crimeResolve', 'Authentication', 'Notification']; function CrimesAdminController($scope, $state, $window, crime, Authentication, Notification) { var vm = this; vm.crime = crime; if(vm.crime && vm.crime.date){ vm.crime.date = new Date(vm.crime.date); } vm.authentication = Authentication; vm.form = {}; vm.remove = remove; vm.save = save; // Remove existing Crime function remove() { if ($window.confirm('Are you sure you want to delete?')) { vm.crime.$remove(function() { $state.go('admin.crimes.list'); Notification.success({ message: '<i class="glyphicon glyphicon-ok"></i> Crime deleted successfully!' }); }); } } // Save Crime function save(isValid) { if (!isValid) { $scope.$broadcast('show-errors-check-validity', 'vm.form.crimeForm'); return false; } // Create a new Crime, or update the current instance vm.crime.createOrUpdate() .then(successCallback) .catch(errorCallback); function successCallback(res) { $state.go('admin.crimes.list'); // should we send the User to the list or the updated Crime's view? Notification.success({ message: '<i class="glyphicon glyphicon-ok"></i> Crime saved successfully!' }); } function errorCallback(res) { Notification.error({ message: res.data.message, title: '<i class="glyphicon glyphicon-remove"></i> Crime save error!' }); } } } }());
function add(id){ var data = new FormData(); data.append('action', 'add'); data.append('search', id); var xhr = new XMLHttpRequest(); xhr.onload = function(e) { console.log(e.target.responseText); if (e.target.responseText == 1) { $('#add').addClass('disabled').val('Convite Enviado'); } }; xhr.open("POST", "public/php/friends.php"); xhr.send(data); } function confirm(id){ var data = new FormData(); data.append('action', 'confirm'); data.append('id', id); var xhr = new XMLHttpRequest(); xhr.onload = function(e) { console.log(e.target.responseText); $('#countRequest').text(parseInt($('#countRequest').text())-1); $('#acptreq').text('Amigos ').append('<i class="fa fa-check"></i>'); }; xhr.open("POST", "public/php/friends.php"); xhr.send(data); } function decline(id){ var data = new FormData(); data.append('action', 'decline'); data.append('id', id); var xhr = new XMLHttpRequest(); xhr.onload = function(e) { console.log(e.target.responseText); $('#countRequest').text(parseInt($('#countRequest').text())-1); }; xhr.open("POST", "public/php/friends.php"); xhr.send(data); } function unfriend(id){ var data = new FormData(); data.append('action', 'decline'); data.append('id', id); var xhr = new XMLHttpRequest(); xhr.onload = function(e) { console.log(e.target.responseText); $('#friends').text('Removido ').append('<i class="fa fa-check"></i>'); }; xhr.open("POST", "public/php/friends.php"); xhr.send(data); } function confirmDropdown(id){ var data = new FormData(); data.append('action', 'confirm'); data.append('id', id); var xhr = new XMLHttpRequest(); xhr.onload = function(e) { console.log(e.target.responseText); if (e.target.responseText == 1) { $('#'+id).remove(); $('#countRequest').text(parseInt($('#countRequest').text())-1); } }; xhr.open("POST", "public/php/friends.php"); xhr.send(data); } function declineDropdown(id){ var data = new FormData(); data.append('action', 'decline'); data.append('id', id); var xhr = new XMLHttpRequest(); xhr.onload = function(e) { console.log(e.target.responseText); if (e.target.responseText == 1) { $('#'+id).remove(); $('#countRequest').text(parseInt($('#countRequest').text())-1); } }; xhr.open("POST", "public/php/friends.php"); xhr.send(data); } function new_post(user_session_id) { var new_post_text = $('#post_textarea').val(); if (!$.trim(new_post_text)) { $.notify({ icon: 'fa fa-remove', message: 'Você precisa digitar algo antes de criar uma postagem!' }, { type: 'danger', animate:{ enter: 'animated bounceIn', exit: 'animated bounceOut' }, placement:{ from: "bottom", align: "right" } }); return; } $.post('public/php/insert_new_post.php', { user_id: user_session_id, post_text: new_post_text }, function(output) { $('#post_stream').prepend(output); var new_post_id = $("#post_stream div:first-child").attr("id"); $("#" + new_post_id).hide().slideDown(); $('#post_textarea').val(null); }); } function new_comment(comment_box_id, return_key_event, user_session_id) { if (return_key_event && return_key_event.keyCode == 13) { if (!$.trim($('#' + (comment_box_id.id)).val())) { $.notify({ icon: 'fa fa-remove', message: 'Você precisa digitar algo antes de criar um comentário!' }, { type: 'danger', animate:{ enter: 'animated bounceIn', exit: 'animated bounceOut' }, placement:{ from: "bottom", align: "right" } }); return; } var new_comment_text = $('#' + (comment_box_id.id)).val(); var post_id_of_comment = ((comment_box_id.id).split("_"))[0]; var post_comment_count = post_id_of_comment + '_comment_count'; $.post('public/php/new_comment.php', { post_id: post_id_of_comment, comment_text: new_comment_text, user_id: user_session_id }, function(output) { $('#' + post_id_of_comment + '_self_comment').before(output); $('#' + (post_comment_count)).html(parseInt($('#' + (post_comment_count)).html()) + 1); $('#' + (comment_box_id.id)).val(null); }); } };
"use strict"; module.exports = function(game) { // eslint-disable-line no-unused-vars main-enter.js var file = require("../data/tilemap2.json"); var importer = require("splat-ecs/lib/import-from-tiled.js"); importer(file, game.entities); var player = 1; var spawn_pos; var spawn = game.entities.find("spawn"); if (game.arguments.player_pos) { spawn_pos = game.arguments.player_pos; } else if (game.arguments.spawnID) { for (var i = 0; i < spawn.length; i++) { if (game.entities.get(spawn[i], "tiledProperties").ID == game.arguments.spawnID) { spawn_pos = game.entities.get(spawn[i], "position"); } } } else if (spawn.length > 0) { spawn_pos = game.entities.get(spawn[0], "position"); } else { spawn_pos = { "x": 0, "y": 0 }; } game.entities.set(player, "position", spawn_pos); var tile = game.entities.find("tile")[0]; var tile_size = game.entities.get(tile, "size"); game.entities.set(player, "tile_size", tile_size); var container = game.entities.find("container"); game.entities.set(player, "constrainPosition", { "id": container }); };
require('./check-versions')() var config = require('../config') if (!process.env.NODE_ENV) { process.env.NODE_ENV = JSON.parse(config.dev.env.NODE_ENV) } var opn = require('opn') var path = require('path') var express = require('express') var webpack = require('webpack') var proxyMiddleware = require('http-proxy-middleware') var webpackConfig = process.env.NODE_ENV === 'testing' ? require('./webpack.prod.conf') : require('./webpack.dev.conf') // default port where dev server listens for incoming traffic var port = process.env.PORT || config.dev.port // automatically open browser, if not set will be false var autoOpenBrowser = !!config.dev.autoOpenBrowser // Define HTTP proxies to your custom API backend // https://github.com/chimurai/http-proxy-middleware var proxyTable = config.dev.proxyTable var app = express() var compiler = webpack(webpackConfig) var devMiddleware = require('webpack-dev-middleware')(compiler, { publicPath: webpackConfig.output.publicPath, quiet: true }) var hotMiddleware = require('webpack-hot-middleware')(compiler, { log: () => {} }) // force page reload when html-webpack-plugin template changes compiler.plugin('compilation', function (compilation) { compilation.plugin('html-webpack-plugin-after-emit', function (data, cb) { hotMiddleware.publish({ action: 'reload' }) cb() }) }) // proxy api requests Object.keys(proxyTable).forEach(function (context) { var options = proxyTable[context] if (typeof options === 'string') { options = { target: options } } app.use(proxyMiddleware(options.filter || context, options)) }) // handle fallback for HTML5 history API app.use(require('connect-history-api-fallback')()) // serve webpack bundle output app.use(devMiddleware) // enable hot-reload and state-preserving // compilation error display app.use(hotMiddleware) app.use('/favicon.ico', express.static('./src-docs/favicon.ico')) app.use('/version.json', express.static('./src-docs/version.json')) app.use('/', express.static('./src-docs/assets')) var uri = 'http://localhost:' + port devMiddleware.waitUntilValid(function () { console.log('> Listening at ' + uri + '\n') }) module.exports = app.listen(port, function (err) { if (err) { console.log(err) return } // when env is testing, don't need open it if (autoOpenBrowser && process.env.NODE_ENV !== 'testing') { opn(uri) } })
module.exports = { stats: { topOffsetPx: 30 }, drake: { speed: 6, frameRate: 5, width: 100, height: 120, scale: 1 }, person: { speed: 32, max: 10, size: 32, debounceMilli: 100 }, map: { width: 30, height: 25, widthPx: 960, heightPx: 800, tileSize: 32, borderAllowance: 20, fontPadding: 6, fontSize: 16, streets: [ { text: 'BBYOS', location: [13, 9], x: 12, fontSize: 14 }, { text: 'DANFORTH AVE', location: [2, 3] }, { text: 'GERRARD ST E', location: [8, 12] }, { text: 'DUNDAS ST E', location: [14, 15] }, { text: 'QUEEN ST E', location: [20, 18] }, { text: 'LAKE SHORE BLVD E', location: [6, 23] }, { text: 'DON VALLEY PARKWAY', location: [2, 8], vertical: true }, { text: 'BROADVIEW AVE', location: [5, 10], vertical: true }, { text: 'DEGRASSI ST', location: [7, 15], y: 4, vertical: true }, { text: 'CARLAW AVE', location: [10, 16], vertical: true }, { text: 'PAPE AVE', location: [12, 5], vertical: true }, { text: 'JONES AVE', location: [16, 10], vertical: true }, { text: 'GREENWOOD AVE', location: [21, 6], vertical: true }, { text: 'COXWELL AVE', location: [26, 8], vertical: true }, { text: 'WOODBINE AVE', location: [29, 10], vertical: true } ] }, mobile: { map: { height: 18, heightPx: 576, streets: [ { text: 'BBYOS', location: [13, 7], x: 12, fontSize: 14 }, { text: 'DANFORTH AVE', location: [2, 3] }, { text: 'GERRARD ST E', location: [8, 8] }, { text: 'DUNDAS ST E', location: [14, 10] }, { text: 'QUEEN ST E', location: [20, 18] }, { text: 'LAKE SHORE BLVD E', location: [6, 16] }, { text: 'DON VALLEY PARKWAY', location: [2, 5], vertical: true }, { text: 'BROADVIEW AVE', location: [5, 8], vertical: true }, { text: 'DEGRASSI ST', location: [7, 10], y: 4, vertical: true }, { text: 'CARLAW AVE', location: [10, 11], vertical: true }, { text: 'PAPE AVE', location: [12, 4], vertical: true }, { text: 'JONES AVE', location: [16, 13], vertical: true }, { text: 'GREENWOOD AVE', location: [21, 6], vertical: true }, { text: 'COXWELL AVE', location: [26, 8], vertical: true }, { text: 'WOODBINE AVE', location: [29, 10], vertical: true } ] } }, tweets: [ 'Help @Drake get people to Blake Boultbee Youth Outreach Services', '.@Drake for Blake: how many people can you get to Blake Boultbee Youth Outreach Services', '.@Drake for Blake: a fun game supporting Toronto’s Blake Boultbee Youth Outreach Services' ] }
window.onload = function() { marked.setOptions({ highlight: function (code) { return hljs.highlightAuto(code).value; }, gfm: true, tables: true, breaks: true, pedantic: false, sanitize: false, smartLists: false, smartypants: true, }); var pad = document.getElementById('pad'); var markdownArea = document.getElementById('markdown'); // make the tab act like a tab pad.addEventListener('keydown',function(e) { if(e.keyCode === 9) { // tab was pressed // get caret position/selection var start = this.selectionStart; var end = this.selectionEnd; var target = e.target; var value = target.value; // set textarea value to: text before caret + tab + text after caret target.value = value.substring(0, start) + "\t" + value.substring(end); // put caret at right position again (add one for the tab) this.selectionStart = this.selectionEnd = start + 1; // prevent the focus lose e.preventDefault(); } }); var previousMarkdownValue; // convert text area to markdown html var convertTextAreaToMarkdown = function(){ var markdownText = pad.value; previousMarkdownValue = markdownText; html = marked(markdownText); // html = converter.makeHtml(markdownText); markdownArea.innerHTML = html; }; var didChangeOccur = function(){ if(previousMarkdownValue != pad.value){ return true; } return false; }; // check every second if the text area has changed setInterval(function(){ if(didChangeOccur()){ convertTextAreaToMarkdown(); } }, 1000); // convert textarea on input change pad.addEventListener('input', convertTextAreaToMarkdown); // ignore if on home page if(document.location.pathname.length > 1){ // implement share js var documentName = document.location.pathname.substring(1); sharejs.open(documentName, 'text', function(error, doc) { doc.attach_textarea(pad); convertTextAreaToMarkdown(); }); } // convert on page load convertTextAreaToMarkdown(); };
var gulp = require('gulp'), // Gulp JS gulpif = require('gulp-if'), // Gulp if module gutil = require('gulp-util'), // Gulp util module rename = require('gulp-rename'), cache = require('gulp-cached'), // Gulp cache module path = require('path'), notify = require('gulp-notify'), // Plugin for notify projectConfig = require('../../projectConfig'); notifyConfig = projectConfig.notifyConfig, // Notify config modifyDate = require('../helpers/modifyDateFormatter'); // Date formatter for notify // Move svg to dev directory module.exports = function() { if (projectConfig.useSVG) { return gulp.src('./markup/static/images/svg/*.svg') .pipe(cache('move-svg')) .pipe(rename(function(path) { path.dirname = ''; })) .on('error', notify.onError(function (error) { return notifyConfig.errorMessage(error); })) .pipe(gulp.dest('./dev/static/img/svg')) .pipe( gulpif(notifyConfig.useNotify, notify({ onLast: true, sound: notifyConfig.sounds.onSuccess, title: notifyConfig.title, message: 'Svg\'ve been moved to dev\n'+ notifyConfig.taskFinishedText +'<%= options.date %>', templateOptions: { date: modifyDate.getTimeOfModify() } }) ) ); } else { gutil.log('!SVG is not used!'); cb(null); } };
// Configures the store import { createStore } from 'redux'; import reducers from '../reducers'; export default function configureStore(initalState) { const store = createStore(reducers, initalState, window.devToolsExtension ? window.devToolsExtension() : f => f ); // From https://github.com/zalmoxisus/redux-devtools-extension/blob/master/examples/counter/store/configureStore.js if (module.hot) { // Enable Webpack hot module replacement for reducers module.hot.accept('../reducers', () => { /* eslint global-require: 0*/ const nextReducer = require('../reducers').default; store.replaceReducer(nextReducer); }); } return store; }
'use strict'; class SignupController { //start-non-standard user = {}; errors = {}; submitted = false; //end-non-standard constructor(Auth, $state) { this.Auth = Auth; this.$state = $state; } register(form) { this.submitted = true; if (form.$valid) { this.Auth.createUser({ name: this.user.name, email: this.user.email, password: this.user.password }) .then(() => { // Account created, redirect to home this.$state.go('main'); }) .catch(err => { err = err.data; this.errors = {}; // Update validity of form fields that match the mongoose errors angular.forEach(err.errors, (error, field) => { form[field].$setValidity('mongoose', false); this.errors[field] = error.message; }); }); } } } angular.module('metAppApp') .controller('SignupController', SignupController);
function getMimeTypes(){ var mimeTypes = []; for(var i = 0; i < navigator.mimeTypes.length; i++){ var mt = navigator.mimeTypes[i]; mimeTypes.push([mt.description, mt.type, mt.suffixes].join("~~")); } return mimeTypes.join(";;"); } fp.mimeTypes = getMimeTypes();
#!/usr/bin/env node var path = require('path'), fs = require('fs'); // Standard: var skinnyjs = require('skinnyjs'); // Development mode: // Linux/osX, etc: /*if (path.sep === '/') { var skinnyjs = require('skinnyjs'); // Development path example: // var skinnyjs = require('/home/eru/projects/skinnyjs/libs/skinny.js'); // Windows } else { // An example for windows to use a development path // var skinnyjs = require(fs.realpathSync('c:\\Users\\eru\\Documents\\GitHub\\skinnyjs\\lib\\skinny.js')); }*/ var skinny = new skinnyjs({ port: 9000, reload: true }).init(function (app) { // Use urlencoded (allows options in req.body) app.server.use(app.express.urlencoded()); // Setup static routes: app.server.use('/assets', app.express.static(app.cfg.layout.assets)); });
var moraleometer = angular.module('moraleometer', ['ui.router']); moraleometer.controller('LoginController', LoginController); moraleometer.factory('AuthHttpResponseInterceptor', AuthHttpResponseInterceptor); moraleometer.factory('LoginFactory', LoginFactory); moraleometer.factory('RegistrationFactory', RegistrationFactory); moraleometer.config(['$stateProvider', '$httpProvider', '$locationProvider', function ($stateProvider, $httpProvider, $locationProvider) { $locationProvider.hashPrefix('!').html5Mode(true); $stateProvider .state('about', { url: '/about', views: { 'main': { templateUrl: '/about' } } }) .state('dashboard', { url: '/dashboard', views: { 'main': { templateUrl: '/dashboard' } } }) .state('login', { url: '/login?returnUrl', views: { 'main': { templateUrl: '/login', controller: LoginController }, 'secondary': { templateUrl: '/signup', controller: RegisterController } } }) .state('logout', { url: '/logout', controller: function($scope, $route) { $route.reload(); } }); $httpProvider.interceptors.push('AuthHttpResponseInterceptor'); // This makes IsAjaxRequest method work. http://encosia.com/making-angulars-http-work-with-request-isajaxrequest/ $httpProvider.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; }]); moraleometer.run(['$rootScope', function ($rootScope) { $rootScope.$on('$stateChangeStart', function (event, toState, toParams, fromState, fromParams) { $rootScope.isLoading = true; }); $rootScope.$on('$stateChangeSuccess', function (event, toState, toParams, fromState, fromParams) { // TODO: This is a naive implementation; will stop loading even if multiple requests are ongoing. $rootScope.isLoading = false; }); }]);
/* */ (function () { if(typeof chrono == 'undefined') throw 'Cannot find the chrono main module'; var PATTERN = /(今日|昨日|明日|([1-9]+)\s*日前)(\W|$)/i; /** * GeneralDateParser - Create a parser object * * @param { String } text - Orginal text to be parsed * @param { Date, Optional } ref - Referenced date * @param { Object, Optional } opt - Parsing option * @return { CNParser } */ function JPGeneralDateParser(text, ref, opt){ opt = opt || {}; ref = ref || new Date(); var parser = chrono.Parser(text, ref, opt); parser.pattern = function() { return PATTERN; } parser.extract = function(full_text,index){ var results = this.results(); var lastResult = results[results.length -1]; if( lastResult ){ //Duplicate... if( index < lastResult.index + lastResult.text.length ) return null; } var matchedTokens = full_text.substr(index).match(PATTERN); if(matchedTokens == null){ finished = true; return; } var text = matchedTokens[0].toLowerCase(); text = matchedTokens[0].substr(0, matchedTokens[0].length - matchedTokens[3].length); var date = null; if(text == '今日') date = moment(ref).clone(); else if(text == '明日') date = moment(ref).clone().add('d',1); else if(text == '昨日') date = moment(ref).clone().add('d',-1); else { var days_ago = matchedTokens[2]; days_ago = parseInt(days_ago); date = moment(ref).clone().add('d',-days_ago); } var result = new chrono.ParseResult({ referenceDate:ref, text:text, index:index, start:{ day:date.date(), month:date.month(), year:date.year() } }) var resultWithTime = parser.extractTime(full_text,result); result = resultWithTime || result; return result; }; var baseExtractTime = parser.extractTime; parser.extractTime = function(text, result){ //Western - Time var baseResult = baseExtractTime.call(this, text, result); if(baseResult) return baseResult; var SUFFIX_PATTERN = /\s*(午前|午後)?\s*([0-9]{1,2})時?(([0-9]{1,2})分)?/i; if(text.length <= result.index + result.text.length) return null; text = text.substr(result.index + result.text.length); var matchedTokens = text.match(SUFFIX_PATTERN); if( !matchedTokens || text.indexOf(matchedTokens[0]) != 0) return null; var minute = 0; var second = 0; var hour = matchedTokens[2]; hour = parseInt(hour); if(matchedTokens[1]){ //AM & PM if(hour > 12) return null; if(matchedTokens[1] == "午後"){ hour += 12; } } if(matchedTokens[4]){ minute = matchedTokens[4]; minute = parseInt(minute); if(minute >= 60) return null; } result.text = result.text + matchedTokens[0]; if(result.start.hour == undefined){ result.start.hour = hour; result.start.minute = minute; result.start.second = second; } if(result.end && result.end.hour == undefined){ result.end.hour = hour; result.end.minute = minute; result.end.second = second; } return new chrono.ParseResult(result); } return parser; } chrono.parsers.JPGeneralDateParser = JPGeneralDateParser; })();
/*********************************************************************************************************/ /** * Ventrian News Articles Article Link Selector plugin for CKEditor by Ingo Herbote * Released: On 2017-10-01 */ /*********************************************************************************************************/ (function () { CKEDITOR.plugins.add('newsarticleslinks', { icons: 'newsarticlelinks', hidpi: false, requires: 'iframedialog', lang: 'de,en,pl', // %REMOVE_LINE_CORE% version: '2.0', init: function (editor) { var me = this; CKEDITOR.dialog.add('newsarticleslinksDialog', function (editor) { return { title: editor.lang.newsarticleslinks.title, minWidth: 550, minHeight: 160, contents: [ { id: 'iframe', label: 'Article Links', expand: true, elements: [ { type: 'html', id: 'pagenewsarticleslinks', label: 'Article Links', style: 'width : 100%;', html: '<iframe src="' + me.path + '/dialogs/newsarticleslinks.aspx" frameborder="0" name="iframenewsarticleslinks" id="iframenewsarticleslinks" allowtransparency="1" style="width:100%;margin:0;padding:0;"></iframe>' } ] } ], onOk: function () { for (var i = 0; i < window.frames.length; i++) { if (window.frames[i].name == 'iframenewsarticleslinks') { var index = window.frames[i].document.getElementById("ArticlesList").selectedIndex; var linkUrl = window.frames[i].document.getElementById("ArticlesList").value; var linkText = window.frames[i].document.getElementById("ArticlesList").options[index].text; } } editor.insertHtml('<a href="' + linkUrl + '" title="' + linkText + '">' + linkText + '</a>'); } }; }); editor.addCommand('newsarticleslinks', new CKEDITOR.dialogCommand('newsarticleslinksDialog')); editor.ui.addButton('newsarticleslinks', { label: editor.lang.newsarticleslinks.button, command: 'newsarticleslinks', icon: this.path + 'icon.gif' }); } }); } )();
let n = 5, arrIntagers = new Array(n), resultArr, result = '', i, item; function initArray(arrInt){ if(n <= 20 && n > 0){ for(i = 0; i <= arrInt.length-1; i += 1){ arrInt[i] = Math.pow(i, 5); result += arrInt[i] + ' '; } return result; }else return result ='Error!\n1 <= N <= 20'; } console.log(initArray(arrIntagers));
/* globals window, _, VIZI, proj4 */ /** * Coordinate reference system * Inspired by Leaflet's CRS management * CRS reference: http://epsg.io/ * Coordinate conversion from: * http://www.maptiler.org/google-maps-coordinates-tile-bounds-projection/ * http://stackoverflow.com/questions/12896139/geographic-coordinates-converter * @author Robin Hawkes - vizicities.com */ (function() { "use strict"; var EARTH_DIAMETER = 2 * 6378137; var EARTH_CIRCUMFERENCE = Math.PI * EARTH_DIAMETER; var ORIGIN_SHIFT = EARTH_CIRCUMFERENCE / 2; // TODO: Handle non-EPSG:3857 coordinate projection to and from pixels // TODO: Create a method to get meters-to-pixels ratio for heights (like buildings) - resolution() doesn't seem to be right for this case VIZI.CRS = { code: undefined, tileSize: 256, projection: undefined, inverseProjection: undefined, // Project WGS84 coordinates into pixel positions // TODO: Project non-EPSG:3857 CRS into EPSG:3857 for pixel coords latLonToPoint: function(latLon, zoom, options) { var self = this; options = options || {}; _.defaults(options, { convert: true, round: false }); var projected = self.project(latLon); var resolution = self.resolution(zoom); var point; if (options.round === true) { // TODO: Should rounding be performed? What ramifications does this have? // - WebGL 'pixels' aren't quite the same as screen pixels so non-integers should be ok (and more accurate) point = new VIZI.Point( Math.round((projected[0] + ORIGIN_SHIFT) / resolution), Math.round((projected[1] + ORIGIN_SHIFT) / resolution) ); } else { point = new VIZI.Point( (projected[0] + ORIGIN_SHIFT) / resolution, (projected[1] + ORIGIN_SHIFT) / resolution ); } if (options.convert !== false) { // Convert point so origin is top-left not bottom-left var mapSize = self.tileSize << zoom; point.y = mapSize - point.y; } return point; }, // Project pixel positions into WGS84 coordinates // TODO: Project into EPSG:3857 coords before projecting into CRS pointToLatLon: function(point, zoom) { var self = this; var resolution = self.resolution(zoom); var mapSize = self.tileSize << zoom; var crsPoint = new VIZI.Point( point.x * resolution - ORIGIN_SHIFT, // Convert point so origin is bottom-left not top-left (mapSize - point.y) * resolution - ORIGIN_SHIFT ); var unprojected = self.unproject(crsPoint); return new VIZI.LatLon(unprojected[1], unprojected[0]); }, // Google tile bounds in WGS84 coords tileBoundsLatLon: function(tile, zoom) { var self = this; var min = self.pointToLatLon({x: tile.x * self.tileSize, y: tile.y * self.tileSize}, zoom); var max = self.pointToLatLon({x: (tile.x+1) * self.tileSize, y: (tile.y+1) * self.tileSize}, zoom); var bounds = { n: min.lat, e: max.lon, s: max.lat, w: min.lon }; return bounds; }, // Google tile bounds in pixel positions tileBoundsPoint: function(tile, zoom) { var self = this; var min = self.pointToLatLon({x: tile.x * self.tileSize, y: tile.y * self.tileSize}, zoom); var max = self.pointToLatLon({x: (tile.x+1) * self.tileSize, y: (tile.y+1) * self.tileSize}, zoom); var projectedMin = self.latLonToPoint(min, zoom); var projectedMax = self.latLonToPoint(max, zoom); var bounds = { n: Math.round(projectedMin.y), e: Math.round(projectedMax.x), s: Math.round(projectedMax.y), w: Math.round(projectedMin.x) }; return bounds; }, // Convert pixel point to Google tile // TODO: Convert to VIZI.Point pointToTile: function(point) { var self = this; var tile = new VIZI.Point( Math.ceil(point.x / self.tileSize) - 1, Math.ceil(point.y / self.tileSize) - 1 ); return tile; }, // Convert pixel point to TMS tile // TODO: Convert to VIZI.Point pointToTileTMS: function(point, zoom) { var self = this; var tile = self.pointToTile(point); return self.convertTile(tile, zoom); }, // Convert WGS84 coordinates to Google tile latLonToTile: function(latLon, zoom) { var self = this; var point = self.latLonToPoint(latLon, zoom); return self.pointToTile(point); }, // Convert WGS84 coordinates to TMS tile latLonToTileTMS: function(latLon, zoom) { var self = this; // Don't move point origin to top-left as we're using TMS var point = self.latLonToPoint(latLon, zoom, {convert: false}); return self.pointToTile(point); }, // Find WGS84 coordinates of Google tile center tileToLatLon: function(tile, zoom) { var self = this; var bounds = self.tileBoundsLatLon(tile, zoom); return new VIZI.LatLon( bounds.s + (bounds.n - bounds.s) / 2, bounds.w + (bounds.e - bounds.w) / 2 ); }, // Convert either way between TMS tile and Google tile // TODO: Convert to VIZI.Point convertTile: function(tile, zoom) { return new VIZI.Point(tile.x, (Math.pow(2, zoom) - 1) - tile.y); }, setProjection: function(code) { var self = this; if (code === undefined) { code = self.code; } if (!self.projection || code !== self.code) { self.projection = new proj4.Proj(self.code); self.inverseProjection = proj4(self.projection).inverse; } }, // Convert WGS84 coordinates into CRS project: function(latLon) { var self = this; self.setProjection(); return proj4(self.projection, [latLon.lon, latLon.lat]); }, // Convert CRS into WGS84 coordinates unproject: function(point) { var self = this; self.setProjection(); return self.inverseProjection([point.x, point.y]); }, // Map resolution (meters per pixel) for a given zoom resolution: function(zoom) { var self = this; return EARTH_CIRCUMFERENCE / (self.tileSize * Math.pow(2, zoom)); }, // Distance in meters between two WGS84 coordinates // http://www.movable-type.co.uk/scripts/latlong.html // http://stackoverflow.com/questions/4102520/how-to-transform-a-distance-from-degrees-to-metres // http://jsperf.com/haversine-salvador/5 distance: function(latLon1, latLon2) { var deg2rad = 0.017453292519943295; // === Math.PI / 180 var cos = Math.cos; var lat1 = latLon1.lat * deg2rad; var lon1 = latLon1.lon * deg2rad; var lat2 = latLon2.lat * deg2rad; var lon2 = latLon2.lon * deg2rad; // var diam = 12742; // Diameter of the earth in km (2 * 6371) var diam = EARTH_DIAMETER; // Diameter of the earth in meters var dLat = lat2 - lat1; var dLon = lon2 - lon1; var a = ( (1 - cos(dLat)) + (1 - cos(dLon)) * cos(lat1) * cos(lat2) ) / 2; return diam * Math.asin(Math.sqrt(a)); }, // http://gis.stackexchange.com/questions/75528/length-of-a-degree-where-do-the-terms-in-this-formula-come-from metersPerDegree: function(latLon) { // Convert latitude to radians var lat = latLon.lat * Math.PI / 180; // Set up "Constants" var m1 = 111132.92; // latitude calculation term 1 var m2 = -559.82; // latitude calculation term 2 var m3 = 1.175; // latitude calculation term 3 var m4 = -0.0023; // latitude calculation term 4 var p1 = 111412.84; // longitude calculation term 1 var p2 = -93.5; // longitude calculation term 2 var p3 = 0.118; // longitude calculation term 3 // Calculate the length of a degree of latitude and longitude in meters var latLen = m1 + (m2 * Math.cos(2 * lat)) + (m3 * Math.cos(4 * lat)) + (m4 * Math.cos(6 * lat)); var lonLen = (p1 * Math.cos(lat)) + (p2 * Math.cos(3 * lat)) + (p3 * Math.cos(5 * lat)); return new VIZI.Point(Math.abs(lonLen), Math.abs(latLen)); }, pixelsPerDegree: function(latLon, zoom) { var self = this; // Find pixel position for latLon var point1 = self.latLonToPoint(latLon, zoom); // Find pixel position for latLon + 1 var point2 = self.latLonToPoint(new VIZI.LatLon(latLon.lat + 1, latLon.lon + 1), zoom); // Find pixel length for a degree return new VIZI.Point(Math.abs(point2.x - point1.x), Math.abs(point2.y - point1.y)); }, pixelsPerMeter: function(latLon, zoom) { var self = this; // Find meter length for a degree var meters = self.metersPerDegree(latLon); // Find pixel length for a degree var pixels = self.pixelsPerDegree(latLon, zoom); // Find ratio of pixels per meter at lonLat return new VIZI.Point(pixels.x / meters.x, pixels.y / meters.y); }, // These formulas are pretty hacky, though they'll probably do the job // Altitude is in meters altitudeToZoom: function(altitude) { // https://gist.github.com/panzi/6694200 // var zoom = Math.floor(19 - Math.log(altitude / 1000) / Math.LN2); // https://social.msdn.microsoft.com/Forums/en-US/5454d549-5eeb-43a5-b188-63121d3f0cc1/how-to-set-zoomlevel-for-particular-altitude?forum=bingmaps // TODO: Use Math.log2 with a shim // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/log2#Polyfill // var zoom = 19 - Math.log2(altitude * 0.05); var zoom = 19 - (Math.log(altitude * 0.05) / Math.LN2); // http://stackoverflow.com/a/13159839 // var scale = altitude / 500; // var zoom = (19 - Math.log(scale) / Math.log(2)); return zoom < 0 ? 0 : zoom > 20 ? 20 : zoom; } }; }());
'use strict'; /** Module for study mode related **/ angular .module('study', ['ngMaterial', 'cards', 'LocalStorageModule', 'gajus.swing']) .service('studyService', ['$rootScope', '$q', '$mdDialog', '$mdToast', 'localStorageService', studyService]) .controller('studyDialogController', ['$scope', '$mdDialog', '$mdToast', 'cardService', 'cardListsService', 'studyService', 'list', studyDialogController]) .controller('restudyDialogController', ['$scope', '$mdDialog', 'wrongCards', restudyDialogController]) function studyService($rootScope, $q, $mdDialog, $mdToast, localStorageService) { var self = this; /** Starts the stud mode **/ self.showStudyDialog = function(ev, list, originalList) { if (!list.cards.length) { throw new Error('study: No cards found for this list.') } if (!originalList) { originalList = list; } return $mdDialog.show({ controller: 'studyDialogController', templateUrl: './src/study/view/studyDialog.html', parent: angular.element(document.body), targetEvent: ev, clickOutsideToClose: false, fullscreen: true, locals: { list: list } }) .then(function(wrongstack) { self.showRestudyDialog(ev, wrongstack, originalList); }); } self.showRestudyDialog = function(ev, wrongCards, originalList) { return $mdDialog.show({ controller: 'restudyDialogController', templateUrl: './src/study/view/restudyDialog.html', parent: angular.element(document.body), targetEvent: ev, locals: { wrongCards: wrongCards } }) .then(function(withWrongStack) { var newTerms = []; if (withWrongStack) { angular.forEach(wrongCards, function(card) { newTerms.push(card.term); }) var list = { name: originalList.name, cards: newTerms }; } else { list = originalList; } self.showStudyDialog(ev, list, originalList); }); } } function studyDialogController($scope, $mdDialog, $mdToast, cardService, cardListsService, studyService, list) { $scope.listName = list.name; $scope.cards = []; $scope.wrongStack = []; $scope.correctStack = []; /** Options for determining the drag distance for cards **/ $scope.swingOptions = { minThrowOutDistance: 460 }; (function initializeStudy() { showHint(); setupCard(); })(); /** Show drag hint toaster in the begining **/ function showHint() { $mdToast.show( $mdToast.simple() .textContent('Drag the cards to the Left or Right') .position('top right') .hideDelay(5000) ); } /** Creates a card list with the definition mapped Removes the item from the list if definition isn't found **/ function setupCard() { angular.forEach(list.cards, function(term) { var definition = cardService.cards[term]; if (definition) { $scope.cards.push({ term: term, definition: definition }); } else { //sync the cards if the term definition doesn't exist cardService.remove(term); } }); } /** Handler for throwing out cards **/ $scope.throwout = function(evName, evObj, card) { var cardElem = angular.element(evObj.target); if (evObj.throwDirection == -1) { //left cardElem.addClass('correct'); $scope.correctStack.push(card); } else { cardElem.addClass('wrong'); $scope.wrongStack.push(card); } if (cardElem.hasClass('last-card')) { $scope.hide($scope.wrongStack); } } /** End the study mode **/ $scope.hide = function(wrongStack) { $mdDialog.hide(wrongStack); }; /** Close the study mode dialog **/ $scope.cancel = function() { $mdDialog.cancel(); }; }; function restudyDialogController($scope, $mdDialog, wrongCards) { $scope.showWrongCards = wrongCards.length > 0; $scope.hide = function() { $mdDialog.hide($scope.withWrongStack); }; $scope.cancel = function() { $mdDialog.cancel(); }; }
import React, { createElement } from 'react' import Button from 'src/elements/Button' import Icon from 'src/elements/Icon' import Image from 'src/elements/Image' import Label from 'src/elements/Label' import { numberToWord, SUI } from 'src/lib' import { implementsShorthandProp } from './' import { noClassNameFromBoolProps, noDefaultClassNameFromProp } from './classNameHelpers' import helpers from './commonHelpers' /** * Assert that a Component correctly implements a Button shorthand prop. * * @param {function} Component The component to test. * @param {object} [options={}] * @param {string} [options.propKey='button'] The name of the shorthand prop. * @param {string|function} [options.ShorthandComponent] The component that should be rendered from the shorthand value. * @param {function} [options.mapValueToProps] A function that maps a primitive value to the Component props * @param {Object} [options.requiredProps={}] Props required to render the component. * @param {Object} [options.shorthandDefaultProps] Default props for the shorthand component. * @param {Object} [options.shorthandOverrideProps] Override props for the shorthand component. */ export const implementsButtonProp = (Component, options = {}) => { implementsShorthandProp(Component, { propKey: 'button', ShorthandComponent: Button, mapValueToProps: val => ({ content: val }), ...options, }) } /** * Assert that a Component correctly implements an HTML iframe shorthand prop. * * @param {function} Component The component to test. * @param {object} [options={}] * @param {string} [options.propKey='icon'] The name of the shorthand prop. * @param {string|function} [options.ShorthandComponent] The component that should be rendered from the shorthand value. * @param {function} [options.mapValueToProps] A function that maps a primitive value to the Component props * @param {Object} [options.requiredProps={}] Props required to render the component. * @param {Object} [options.shorthandDefaultProps] Default props for the shorthand component. * @param {Object} [options.shorthandOverrideProps] Override props for the shorthand component. */ export const implementsHTMLIFrameProp = (Component, options = {}) => { implementsShorthandProp(Component, { propKey: 'iframe', ShorthandComponent: 'iframe', mapValueToProps: src => ({ src }), ...options, }) } /** * Assert that a Component correctly implements an HTML input shorthand prop. * * @param {function} Component The component to test. * @param {object} [options={}] * @param {string} [options.propKey='icon'] The name of the shorthand prop. * @param {string|function} [options.ShorthandComponent] The component that should be rendered from the shorthand value. * @param {function} [options.mapValueToProps] A function that maps a primitive value to the Component props * @param {Object} [options.requiredProps={}] Props required to render the component. * @param {Object} [options.shorthandDefaultProps] Default props for the shorthand component. * @param {Object} [options.shorthandOverrideProps] Override props for the shorthand component. */ export const implementsHTMLInputProp = (Component, options = {}) => { implementsShorthandProp(Component, { propKey: 'input', ShorthandComponent: 'input', mapValueToProps: val => ({ type: val }), ...options, }) } /** * Assert that a Component correctly implements an HTML label shorthand prop. * * @param {function} Component The component to test. * @param {object} [options={}] * @param {string} [options.propKey='icon'] The name of the shorthand prop. * @param {string|function} [options.ShorthandComponent] The component that should be rendered from the shorthand value. * @param {function} [options.mapValueToProps] A function that maps a primitive value to the Component props * @param {Object} [options.requiredProps={}] Props required to render the component. * @param {Object} [options.shorthandDefaultProps] Default props for the shorthand component. * @param {Object} [options.shorthandOverrideProps] Override props for the shorthand component. */ export const implementsHTMLLabelProp = (Component, options = {}) => { implementsShorthandProp(Component, { propKey: 'label', ShorthandComponent: 'label', mapValueToProps: val => ({ children: val }), ...options, }) } /** * Assert that a Component correctly implements an Icon shorthand prop. * * @param {function} Component The component to test. * @param {object} [options={}] * @param {string} [options.propKey='icon'] The name of the shorthand prop. * @param {string|function} [options.ShorthandComponent] The component that should be rendered from the shorthand value. * @param {function} [options.mapValueToProps] A function that maps a primitive value to the Component props * @param {Object} [options.requiredProps={}] Props required to render the component. * @param {Object} [options.shorthandDefaultProps] Default props for the shorthand component. * @param {Object} [options.shorthandOverrideProps] Override props for the shorthand component. */ export const implementsIconProp = (Component, options = {}) => { implementsShorthandProp(Component, { propKey: 'icon', ShorthandComponent: Icon, mapValueToProps: val => ({ name: val }), ...options, }) } /** * Assert that a Component correctly implements an Image shorthand prop. * * @param {function} Component The component to test. * @param {object} [options={}] * @param {string} [options.propKey='image'] The name of the shorthand prop. * @param {string|function} [options.ShorthandComponent] The component that should be rendered from the shorthand value. * @param {function} [options.mapValueToProps] A function that maps a primitive value to the Component props * @param {Object} [options.requiredProps={}] Props required to render the component. * @param {Object} [options.shorthandDefaultProps] Default props for the shorthand component. * @param {Object} [options.shorthandOverrideProps] Override props for the shorthand component. */ export const implementsImageProp = (Component, options = {}) => { implementsShorthandProp(Component, { propKey: 'image', ShorthandComponent: Image, mapValueToProps: val => ({ src: val }), ...options, }) } /** * Assert that a Component correctly implements a Label shorthand prop. * * @param {function} Component The component to test. * @param {object} [options={}] * @param {string} [options.propKey='label'] The name of the shorthand prop. * @param {string|function} [options.ShorthandComponent] The component that should be rendered from the shorthand value. * @param {function} [options.mapValueToProps] A function that maps a primitive value to the Component props * @param {Object} [options.requiredProps={}] Props required to render the component. * @param {Object} [options.shorthandDefaultProps] Default props for the shorthand component. * @param {Object} [options.shorthandOverrideProps] Override props for the shorthand component. */ export const implementsLabelProp = (Component, options = {}) => { implementsShorthandProp(Component, { propKey: 'label', ShorthandComponent: Label, mapValueToProps: val => ({ content: val }), ...options, }) } /** * Assert that a Component correctly implements the "only" prop. * @param {React.Component|Function} Component The component to test. * @param {String} propKey A props key. */ export const implementsMultipleProp = (Component, propKey, propValues) => { const { assertRequired } = helpers('propKeyAndValueToClassName', Component) describe(`${propKey} (common)`, () => { assertRequired(Component, 'a `Component`') noDefaultClassNameFromProp(Component, propKey, propValues) noClassNameFromBoolProps(Component, propKey, propValues) propValues.forEach((propVal) => { it(`adds "${propVal} ${propKey}" to className`, () => { shallow(createElement(Component, { [propKey]: propVal })) .should.have.className(`${propVal} ${propKey}`) }) }) it('adds all possible values to className', () => { const className = propValues.map(prop => `${prop} ${propKey}`).join(' ') const propValue = propValues.join(' ') shallow(createElement(Component, { [propKey]: propValue })) .should.have.className(className) }) }) } /** * Assert that a Component correctly implements the "textAlign" prop. * @param {React.Component|Function} Component The component to test. * @param {array} [alignments] Array of possible alignment positions. * @param {Object} [options={}] * @param {Object} [options.requiredProps={}] Props required to render the component. */ export const implementsTextAlignProp = (Component, alignments = SUI.TEXT_ALIGNMENTS, options = {}) => { const { requiredProps = {} } = options const { assertRequired } = helpers('implementsTextAlignProp', Component) describe('aligned (common)', () => { assertRequired(Component, 'a `Component`') noClassNameFromBoolProps(Component, 'textAlign', alignments, options) noDefaultClassNameFromProp(Component, 'textAlign', alignments, options) alignments.forEach((propVal) => { if (propVal === 'justified') { it('adds "justified" without "aligned" to className', () => { shallow(<Component {...requiredProps} textAlign='justified' />) .should.have.className('justified') shallow(<Component {...requiredProps} textAlign='justified' />) .should.not.have.className('aligned') }) } else { it(`adds "${propVal} aligned" to className`, () => { shallow(<Component {...requiredProps} textAlign={propVal} />) .should.have.className(`${propVal} ${'aligned'}`) }) } }) }) } /** * Assert that a Component correctly implements the "verticalAlign" prop. * @param {React.Component|Function} Component The component to test. * @param {array} [alignments] Array of possible alignment positions. * @param {Object} [options={}] * @param {Object} [options.requiredProps={}] Props required to render the component. */ export const implementsVerticalAlignProp = (Component, alignments = SUI.VERTICAL_ALIGNMENTS, options = {}) => { const { requiredProps = {} } = options const { assertRequired } = helpers('implementsVerticalAlignProp', Component) describe('verticalAlign (common)', () => { assertRequired(Component, 'a `Component`') noClassNameFromBoolProps(Component, 'verticalAlign', alignments, options) noDefaultClassNameFromProp(Component, 'verticalAlign', alignments, options) alignments.forEach((propVal) => { it(`adds "${propVal} aligned" to className`, () => { shallow(<Component {...requiredProps} verticalAlign={propVal} />) .should.have.className(`${propVal} ${'aligned'}`) }) }) }) } /** * Assert that a Component correctly implements a width prop. * @param {React.Component|Function} Component The component to test. * @param {array} [widths] Array of possible widths. * @param {object} [options={}] * @param {string} [options.propKey] The prop name that accepts a width value. * @param {string} [options.widthClass] The className that follows the wordToNumber className. * Examples: one WIDE column, two COLUMN grid, three [none] fields, etc. * @param {boolean} [options.canEqual=true] Whether or not to test 'equal width' usage. * @param {Object} [options.requiredProps={}] Props required to render the component. */ export const implementsWidthProp = (Component, widths = SUI.WIDTHS, options = {}) => { const { canEqual = true, propKey, requiredProps, widthClass, } = options const { assertRequired } = helpers('implementsWidthProp', Component) const propValues = canEqual ? [...widths, 'equal'] : widths describe(`${propKey} (common)`, () => { assertRequired(Component, 'a `Component`') noClassNameFromBoolProps(Component, propKey, propValues, options) noDefaultClassNameFromProp(Component, propKey, propValues, options) it('adds numberToWord value to className', () => { widths.forEach((width) => { const expectClass = widthClass ? `${numberToWord(width)} ${widthClass}` : numberToWord(width) shallow(createElement(Component, { ...requiredProps, [propKey]: width })) .should.have.className(expectClass) }) }) if (canEqual) { it('adds "equal width" to className', () => { shallow(createElement(Component, { ...requiredProps, [propKey]: 'equal' })) .should.have.className('equal width') }) } }) } /** * Assert that a Components with a label correctly implements the "id" and "htmlFor" props. * @param {React.Component|Function} Component The component to test. */ export const labelImplementsHtmlForProp = (Component) => { const { assertRequired } = helpers('labelImplementsHtmlForProp', Component) describe('htmlFor (common)', () => { assertRequired(Component, 'a `Component`') it('adds htmlFor to label', () => { const id = 'id-for-test' const label = 'label-for-test' const wrapper = mount(<Component id={id} label={label} />) const labelNode = wrapper.find('label') wrapper.should.to.have.descendants(`#${id}`) labelNode.should.have.prop('htmlFor', id) }) }) }
var atTmpl = require('basisjs-tools-ast').tmpl; function toBase52(num){ var res = ''; do { var n = num % 52; res = String.fromCharCode((n % 26) + (n < 26 ? 97 : 65)) + res; num = parseInt(num / 52); } while (num); return res; } (module.exports = function(flow){ var fconsole = flow.console; // var themeIdMap = flow.css.idMap; var themeClassMap = flow.css.classMap; var totalSaving = 0; // // class rename // fconsole.start('Process class names'); var tmplModule = flow.js.basis && flow.js.basis.template; var classReplaceMap = {}; var classReplaceMapIdx = 0; var classRenameSaving = 0; var typeSaving = { html: 0, style: 0, tmpl: 0, 'tmpl-overhead': 0 }; function getClassNameReplace(name, baseName, postfix){ if (!hasOwnProperty.call(classReplaceMap, name)) { classReplaceMap[name] = name != baseName ? getClassNameReplace(baseName, baseName) + postfix : toBase52(classReplaceMapIdx++); } return classReplaceMap[name]; } for (var theme in themeClassMap) { fconsole.start(theme); var classMap = themeClassMap[theme]; Object.keys(classMap).filter(function(key){ return !classMap[key].postfix; }).sort(function(a, b){ return (b.length - 1) * classMap[b].length - (a.length - 1) * classMap[a].length; }).forEach(function processKey(name){ function replaceFn(cls){ var result = cls == name ? replace : cls; if (item.type != 'tmpl-class-binding') { var saving = cls.length - result.length; tokenSaving += saving; typeSaving['tmpl-overhead'] += saving; } return result; } function replaceStr(str){ return str.trim().split(/\s+/).map(replaceFn).join(' '); } var list = classMap[name]; var replace = getClassNameReplace(name, list.name, list.postfix); var saving = 0; for (var i = 0, item, token, tokenSaving; item = list[i]; i++) { token = item.token; tokenSaving = 0; switch (item.type){ case 'html-class': token.class = replaceStr(token.class); break; case 'style-class': token[2] = replace; tokenSaving = name.length - replace.length; break; case 'tmpl-class': token.context.tokenValue(token, replaceStr(token.context.tokenValue(token))); break; case 'tmpl-class-binding': tokenSaving = JSON.stringify(token).length; atTmpl.setBindingClassNames(tmplModule, token, atTmpl.getBindingClassNames(tmplModule, token).map(replaceFn) ); tokenSaving -= JSON.stringify(token).length; if (tokenSaving < 0) { typeSaving['tmpl-overhead'] += -tokenSaving; tokenSaving = 0; } break; case 'tmpl-class-anim': // nothing todo break; default: flow.warn({ fatal: true, message: 'Unknown token type - ' + item.type }); } saving += tokenSaving; typeSaving[item.type.split('-')[0]] += tokenSaving; } classRenameSaving += saving; totalSaving += saving; fconsole.log(name, '->', replace, '(' + saving + ' / ' + list.length + ')'); list.nested.forEach(processKey); }); fconsole.endl(); } fconsole.endl(); classRenameSaving += typeSaving['tmpl-overhead']; fconsole.start('Total class rename saving:', classRenameSaving + ' bytes'); fconsole.list(Object.keys(typeSaving).map(function(type){ return type + ': ' + typeSaving[type] + ' bytes'; })); fconsole.endl(); // update usage if (flow.css.usage) { flow.css.usage.classes = flow.css.usage.classes.map(getClassNameReplace); flow.css.usage.scopes.forEach(function(list, idx, scopes){ scopes[idx] = scopes[idx].map(getClassNameReplace); }); } // // id // fconsole.start('Process `id` attributes (skip)'); // ID could affect many things, for example ID uses in url(), // in SVG attributes like fill or stroke. For now extract doesn't found // this ID usage. That's why don't change ID until all cases will be localed. // var idReplaceMap = {}; // var idReplaceIdx = 0; // var idRenameSaving = 0; // var typeSaving = { // html: 0, // style: 0, // tmpl: 0 // }; // function getIdReplace(name){ // if (!hasOwnProperty.call(idReplaceMap, name)) // idReplaceMap[name] = toBase52(idReplaceIdx++); // return idReplaceMap[name]; // } // for (var theme in themeIdMap) // { // fconsole.start(theme); // var idMap = themeIdMap[theme]; // Object.keys(idMap).sort(function(a, b){ // return (b.length - 1) * idMap[b].length - (a.length - 1) * idMap[a].length; // }).forEach(function(name, idx){ // var list = idMap[name]; // var replace = getIdReplace(name); // var oneSaving = name.length - replace.length; // var saving = oneSaving * list.length; // idRenameSaving += saving; // totalSaving += saving; // fconsole.log(name, '->', replace, '(' + saving + ')'); // for (var i = 0, item; item = list[i]; i++) // { // var token = item.token; // typeSaving[item.type.split('-')[0]] += oneSaving; // switch (item.type){ // case 'html-id': // token.id = replace; // break; // case 'style-id': // token[2] = replace; // break; // case 'tmpl-id': // token.context.tokenValue(token, replace); // break; // default: // flow.warn({ // fatal: true, // message: 'Unknown token type - ' + cfg.type // }); // } // } // }); // fconsole.endl(); // } // fconsole.endl(); // fconsole.start('Total id rename saving:', idRenameSaving + ' bytes'); // fconsole.list(Object.keys(typeSaving).map(function(type){ // return type + ': ' + typeSaving[type] + ' bytes'; // })); // fconsole.endl(); // fconsole.start('Total rename saving:', idRenameSaving + ' bytes'); }).handlerName = '[css] Optimize names'; module.exports.skip = function(flow){ if (!flow.options.cssOptimizeNames) return 'Use option --css-optimize-names'; };
// @flow import type { FilterAction, CatalogAction } from './actions' import type { CatalogState, FilterState } from './types' const initialState = { fetching: true, items: [], ids: [], } export const catalog = (state: CatalogState = initialState, action: CatalogAction) => { switch (action.type) { case 'REQUEST_ITEMS': return { ...state, fetching: true } case 'RECEIVE_ITEMS': return { ...state, fetching: false, items: action.payload.reduce((obj, item) => { const result = obj result[item.id] = item return result }, {}), ids: action.payload.map(item => item.id), } default: return state } } export const filter = (state: FilterState = 'all', { payload, type }: FilterAction) => { switch (type) { case 'SET_VISIBILITY_FILTER': return payload default: return state } }
/** * @class MyApp.view.ClientePanel * @extends Ext.panel.Panel * @author Crysfel Villa <crysfel@bleext.com> * * Description */ Ext.define('MyApp.view.ClientePanel',{ extend : 'Ext.panel.Panel', alias : 'widget.cliente', config : { model : null }, collapsible : true, bodyPadding : 5, margin : 5, initComponent : function(){ var me = this, cliente = Ext.create('MyApp.data.Cliente',this.getModel()); me.title = cliente.getNombre()+' '+cliente.getApellido(); me.html = [ '<p>Username: '+cliente.getUsername()+'</p>', '<p>Email: '+cliente.getEmail()+'</p>' ]; me.callParent(); } });
'use strict'; /* Directives */ angular.module('campsiteApp.directives', []). directive('appVersion', ['version', function(version) { return function(scope, elm, attrs) { elm.text(version); }; }]);
__inline('tweenjs-0.6.0.min.js'); __inline('easeljs-0.8.0.min.js'); __inline('lib/scrat.js');
// All symbols in the `Zp` category as per Unicode v5.0.0: [ '\u2029' ];
/// <autosync enabled="true" /> /// <reference path="jquery-2.1.4.js" /> /// <reference path="angular-mocks.js" /> /// <reference path="angular.js" /> /// <reference path="../app/app.js" /> /// <reference path="bootstrap.min.js" /> /// <reference path="../app/controllers/tictactoectrl.js" /> /// <reference path="../app/services/tictactoeservice.js" />
// global app, so you can see what here happening from console var app, // tree editor of questions and notes trees = { question: { 1: { title: 'First question, without nesting', notes: [] }, 2: { title: 'Second question, 1-level nesting', notes: [1] }, 3: { title: 'Third question, multi-level nesting', notes: [1, 2,3] } }, note: { 1: { title: '1st note', notes: [] }, 2: { title: '2nd note', notes: [4,5] }, 3: { title: '3rd note', notes: [] }, 4: { title: '4th note', notes: [7,8] }, 5: { title: '5th note', notes: [6] }, 6: { title: '6th note', notes: [] }, 7: { title: '7th note', notes: [] }, 8: { title: '8th note', notes: [] }, 9: { title: '9th note', notes: [10] }, 10: { title: '10th note', notes: [11] }, 11: { title: '11 note', notes: [12] }, 12: { title: '12 note', notes: [13] }, 13: { title: '13 note', notes: [14] }, 14: { title: '14 note', notes: [15] }, 15: { title: '15 note', notes: [16] }, 16: { title: '16 note', notes: [17] }, 17: { title: '17 note', notes: [18] }, 18: { title: '18 note', notes: [] } } }; $(function(){ app = { // getData called when click "edit" getData: function() { var self = this, $button = $(this), $item = $button.closest('div'), $li = $item.closest('li'), id = $item.attr('id').replace(/[^0-9.]/g, ""), inputs = $item.find(':input'), mode = $button.attr('class'), type = $item.attr('class'); $.ajax({ type: 'GET', url: '/', dataType: 'json', data: inputs.serialize() + '&id=' + id + '&mode=' + mode + '&type=' + type, beforeSend: function(xhr){ var $inner_notes = $li.find('ul .save').not('.ignore'), $children_notes = app.getClosestChildrens($inner_notes); if($children_notes.length) { var deferreds = []; $children_notes.each(function() { deferreds.push(app.saveData.call(this)); }); $.when.apply(null, deferreds).always(function() { app.getData.call(self); }); xhr.abort(); } }, success: function(response){ if ( ! response.errors) { // Rendering new branch var emulateResponseData = emulator.getTree({ id: response.data.id, mode: response.data.mode, type: response.data.type, title: response.data.title }); // Logging to console emulator.logResponse({ response: response, template: emulateResponseData, mode: 'editing' }); $li.replaceWith(emulateResponseData); } } }); }, // saveData called when click "save" saveData: function() { var self = this, $button = $(this), $item = $button.closest('div'), $li = $item.closest('li'), id = $item.attr('id').replace(/[^0-9.]/g, ""), inputs = $item.find(':input'), mode = $button.attr('class'), type = $item.attr('class'); return $.Deferred(function() { var def = this; $.ajax({ type: 'GET', url: '/', dataType: 'json', data: inputs.serialize() + '&id=' + id + '&mode=' + mode + '&type=' + type, beforeSend: function(xhr){ var $inner_notes = $li.find('ul .save').not('.ignore'), $children_notes = app.getClosestChildrens($inner_notes); if($children_notes.length) { var deferreds = []; $children_notes.each(function() { deferreds.push(app.saveData.call(this)); }); $.when.apply(null, deferreds).always(function() { app.saveData.call(self); }); xhr.abort(); } }, success: function(response){ if ( ! response.errors) { // Emulate saving to DB (of course it should be executed at server, in real world) emulator.trees[response.data.type][response.data.id].title = response.data.title; // Rendering new branch var emulateResponseData = emulator.getTree({ id: response.data.id, mode: response.data.mode, type: response.data.type, title: response.data.title }); // Logging to console emulator.logResponse({ response: response, template: emulateResponseData, mode: 'saving' }); $li.replaceWith(emulateResponseData); } else { $button.addClass('ignore'); } }, error: function() { $button.addClass('ignore'); } }).complete(function() { def.resolve(); }); }); }, // get closest nested items getClosestChildrens: function($inner_notes) { var children_notes = $.grep($inner_notes, function(value, key) { var is_child_of = false, $btn = $(value), $parent_li = $btn.closest('li'); $inner_notes.not($btn).each(function(key,v) { if($(this).closest($parent_li).length) { is_child_of = true; } }); return is_child_of ? false : true; }); return $(children_notes); }, initEventListeners: function() { var self = this; // Editing $('.container').on('click', '.edit', function() { self.getData.call(this); }); // Saving $('.container').on('click', '.save', function() { self.saveData.call(this); }); // Draw dummy line to console for convenient debugging $('.container').on('click', '.edit, .save', function() { emulator.logSeparatorLine(); }); }, init: function() { // Render all tree $.each(emulator.trees.question, function(id) { $('.questions').append(emulator.getTree({id: id})) }); this.initEventListeners(); } }; // Server emulator, like templating render // + some utilities for console var emulator = { trees: trees, getTree: function(data) { var self = this, li = '<li>', mode = typeof data.mode != 'undefined' ? data.mode : 'save', type = typeof data.type != 'undefined' ? data.type : 'question', id = typeof data.id == 'string' ? data.id.replace(/[^0-9.]/g, "") : data.id, item = self.trees[type][id]; if(typeof item == 'undefined') return false; li += self.templates[mode] .replace('{{id}}', id) .replace('{{title}}', data.title || item.title) .replace('{{type}}', type); if(item.notes.length) { li += '<ul>'; $.each(item.notes, function(key, note_id) { li += self.getTree({ id: note_id, type: 'note' }) || ''; }); li += '</ul>'; } li += '</li>' return li; }, templates: { edit: '<div class="{{type}}" id="id{{id}}"><input type="text" name="title" value="{{title}}"><span class="save">save</span></div>', save: '<div class="{{type}}" id="id{{id}}"><span class="text">{{title}}</span><span class="edit">edit</span></div>' }, logSeparatorLine: function() { console && typeof console.warn != 'undefined' ? console.warn('---------') : console.log('---------'); }, logResponse: function(data) { var response = data.response.data, mode = data.mode.toUpperCase(), template = data.template; console && console.log('Just imagine that server returned this template to your '+mode+' request'); console.log(response); console && typeof console.dirxml != 'undefined' ? console.dirxml($(template)) : console.log(template); } } app.init(); });
'use strict'; var passport = require('passport'), _ = require('lodash'); // These are different types of authentication strategies that can be used with Passport. var LocalStrategy = require('passport-local').Strategy, FacebookTokenStrategy = require('passport-facebook-token'), config = require('./config'), db = require('./sequelize'), winston = require('./winston'); //Serialize sessions passport.serializeUser(function(user, done) { done(null, user.id); }); passport.deserializeUser(function(id, done) { db.User.find({where: {id: id}}).then(function(user){ if(!user){ winston.warn('Logged in user not in database, user possibly deleted post-login'); return done(null, false); } winston.info('Session: { id: ' + user.id + ', username: ' + user.username + ' }'); done(null, user); }).catch(function(err){ done(err, null); }); }); //Use local strategy passport.use(new LocalStrategy({ usernameField: 'email', passwordField: 'password' }, function(email, password, done) { db.User.find({ where: { email: email }}).then(function(user) { if (!user) { done(null, false, { message: 'Unknown user' }); } else if (!user.authenticate(password)) { done(null, false, { message: 'Invalid password'}); } else { winston.info('Login (local) : { id: ' + user.id + ', username: ' + user.username + ' }'); done(null, user); } }).catch(function(err){ done(err); }); } )); passport.use(new FacebookTokenStrategy({ clientID: config.facebook.clientID, clientSecret: config.facebook.clientSecret, profileFields: ['id', 'first_name', 'last_name', 'email', 'photos'] }, function (accessToken, refreshToken, profile, done) { db.User.find({where : {email: profile.emails[0].value}}).then(function(user){ if(!user){ db.User.create({ name: profile.name.givenName || '', email: profile.emails[0].value, username: profile.name.givenName || '', provider: 'facebook', facebookUserId: profile.id }).then(function(u){ winston.info('New User (facebook) : { id: ' + u.id + ', username: ' + u.username + ' }'); done(null, u); }) } else { winston.info('Login (facebook) : { id: ' + user.id + ', username: ' + user.username + ' }'); done(null, user); } }).catch(function(err){ done(err, null); }); } )); module.exports = passport;
prefix = 'Relaying: '; module.exports = function (message) { console.log(prefix + message); };
/* * grunt-sh * https://github.com/tsertkov/grunt-sh * * Copyright (c) 2014 Aleksandr Tsertkov * Licensed under the MIT license. */ var execSh = require("exec-sh"); function sh(grunt){ grunt.registerMultiTask("sh", "Execute command in a shell.", function(){ var done = this.async(), args = [].slice.call(arguments), cmd = this.target, options = this.options({ stdio: "inherit" }); // override cmd with the one from config var config = grunt.config.get("sh." + cmd); if (typeof config === "object") { cmd = config.cmd; } else { cmd = config; } args = args.join(" "); cmd = options[cmd] || cmd; cmd = cmd + " " + args; execSh(cmd, options, function(err){ done(!err); }); }); } module.exports = sh;
class Pattern { constructor (options) { this.type = 'Pattern' Object.assign(this, options) } } module.exports = Pattern
var webpack = require('webpack'); module.exports = { entry: './src/main.js', output: { path: './', filename: 'index.js' }, devServer: { inline: true, }, plugins: [new webpack.ProvidePlugin({ $: 'n-zepto' })], module: { loaders: [ { test: /\.jsx?$/, exclude: /node_modules/, loader: 'babel', query: { presets: ['es2015','react'] } },{ test: /\.(jpg|png|gif)$/, loader: 'url-loader?limit=8192' },{ test: /\.scss/, loader: 'style-loader!css-loader!sass-loader' } ] } };
'use strict'; var url = require('url'); var nJwt = require('njwt'); var stormpath = require('stormpath'); var helpers = require('../helpers'); var middleware = require('../middleware'); var thisFileName = require('path').basename(__filename); /** * This controller handles a Stormpath ID Site authentication. Once a user is * authenticated, they'll be returned to the site. * * @method * * @param {Object} req - The http request. * @param {Object} res - The http response. */ module.exports = function (req, res) { var application = req.app.get('stormpathApplication'); var config = req.app.get('stormpathConfig'); var logger = req.app.get('stormpathLogger'); var params = req.query || {}; var stormpathToken = params.jwtResponse || ''; var assertionAuthenticator = new stormpath.StormpathAssertionAuthenticator(application); assertionAuthenticator.authenticate(stormpathToken, function (err) { if (err) { logger.info('During an IdSite login attempt, we were unable to verify the JWT response.'); return helpers.defaultJsonErrorResponder(err, res, thisFileName); } var parsedToken = nJwt.verify(stormpathToken, config.client.apiKey.secret); var tokenStatus = parsedToken.body.status; function redirectNext() { var nextUri = config.web.idSite.nextUri; var nextQueryPath = url.parse(params.next || '').path; res.redirect(302, nextQueryPath || nextUri); } function authenticateToken(callback) { var stormpathTokenAuthenticator = new stormpath.OAuthStormpathTokenAuthenticator(application); stormpathTokenAuthenticator.authenticate({ stormpath_token: stormpathToken }, function (err, authenticationResult) { if (err) { logger.info('During an IdSite login attempt, we were unable to create a Stormpath session.'); return helpers.defaultJsonErrorResponder(err, res, thisFileName); } authenticationResult.getAccount(function (err, account) { if (err) { logger.info('During an IdSite login attempt, we were unable to retrieve an account from the authentication result.'); return helpers.defaultJsonErrorResponder(err, res, thisFileName); } helpers.expandAccount(req.app, account, function (err, expandedAccount) { if (err) { logger.info('During an IdSite login attempt, we were unable to expand the Stormpath account.'); return helpers.defaultJsonErrorResponder(err, res, thisFileName); } helpers.createSession(authenticationResult, expandedAccount, req, res); callback(null, expandedAccount); }); }); }); } function handleAuthRequest(type, callback) { var handler; switch (type) { case 'registration': handler = config.postRegistrationHandler; break; case 'login': handler = config.postLoginHandler; break; default: return callback(new Error('Invalid authentication request type: ' + type)); } if (handler) { authenticateToken(function (err, expandedAccount) { if (err) { return callback(err); } handler(expandedAccount, req, res, callback); }); } else { authenticateToken(callback); } } switch (tokenStatus) { case 'REGISTERED': if (!config.web.register.autoLogin) { return redirectNext(); } handleAuthRequest('registration', redirectNext); break; case 'AUTHENTICATED': handleAuthRequest('login', redirectNext); break; case 'LOGOUT': middleware.revokeTokens(req, res); middleware.deleteCookies(req, res); redirectNext(); break; default: res.status(500).end('Unknown ID site result status: ' + tokenStatus); break; } }); };
(function(exports) { planetIntentEvent = function() { return { "session": { "sessionId": "SessionId.87f1c91e-f52a-467c-abaf-90c012c302b9", "application": { "applicationId": "amzn1.ask.skill.e50c89e9-4f90-4d67-87a0-e33788902762" }, "attributes": {}, "user": { "userId": "amzn1.ask.account.AGPVM264JJUH3I7A56TT6AF3H5XYCMVNXTGHS3ETGZ5W4MWVL76AOQOWFBTPJL6Z64SJ2H6W6GYXUROZ3BVVK4LR4NKILPZK3C335VNZRGQBL7C524T27DN4EBIEZEOLK3WKDCG3LNHFSCHQJRRKFLXXQKGEFGACCQMUHP6THV3Y7LP2EPUVCT6DNB4HEIQTX4T22QHPYWLYXEQ" }, "new": true }, "request": { "type": "IntentRequest", "requestId": "EdwRequestId.87c557d4-d500-492c-ad4d-e5952977cec3", "locale": "en-GB", "timestamp": "2017-05-31T18:55:15Z", "intent": { "name": "PlanetIntent", "slots": { "planet": { "name": "planet", "value": "earth" } } } }, "version": "1.0" }; }; exports.planetIntentEvent = planetIntentEvent; })(this);
var time_remaining = 0; var selected_user = null; var valid_image = /.*\.(png|svg|jpg|jpeg|bmp)$/i; /////////////////////////////////////////////// // CALLBACK API. Called by the webkit greeeter /////////////////////////////////////////////// // called when the greeter asks to show a login prompt for a user function show_prompt(text) { var password_container = document.querySelector("#password_container"); var password_entry = document.querySelector("#password_entry"); if (!isVisible(password_container)) { var users = document.querySelectorAll(".user"); var user_node = document.querySelector("#"+selected_user); var rect = user_node.getClientRects()[0]; var parentRect = user_node.parentElement.getClientRects()[0]; var center = parentRect.width/2; var left = center - rect.width/2 - rect.left; var i = 0; if (left < 5 && left > -5) { left = 0; } for (i = 0; i < users.length; i++) { var node = users[i]; setVisible(node, node.id === selected_user); node.style.left= left; } setVisible(password_container, true); password_entry.placeholder= text.replace(":", ""); } password_entry.value= ""; password_entry.focus(); } // called when the greeter asks to show a message function show_message(text) { var message = document.querySelector("#message_content"); message.innerHTML= text; if (text) { document.querySelector("#message").classList.remove("hidden"); } else { document.querySelector("#message").classList.add("hidden"); } message.classList.remove("error"); } // called when the greeter asks to show an error function show_error(text) { show_message(text); var message = document.querySelector("#message_content"); message.classList.add("error"); } // called when the greeter is finished the authentication request function authentication_complete() { var container = document.querySelector("#session_container"); var children = container.querySelectorAll("input"); var i = 0; var key = ""; for (i = 0; i < children.length; i++) { var child = children[i]; if (child.checked) { key = child.value; break; } } if (lightdm.is_authenticated) { if (key === "") { lightdm.login(lightdm.authentication_user, lightdm.default_session); } else { lightdm.login(lightdm.authentication_user, key); } } else { show_error("Authentication Failed"); start_authentication(selected_user); } } // called when the greeter wants us to perform a timed login function timed_login(user) { lightdm.login (lightdm.timed_login_user); //setTimeout('throbber()', 1000); } ////////////////////////////// // Implementation ////////////////////////////// function start_authentication(username) { lightdm.cancel_timed_login(); selected_user = username; lightdm.start_authentication(username); } function provide_secret() { show_message("Logging in..."); entry = document.querySelector('#password_entry'); lightdm.provide_secret(entry.value); } function initialize_sessions() { var template = document.querySelector("#session_template"); var container = session_template.parentElement; var i = 0; container.removeChild(template); for (i = 0; i < lightdm.sessions.length; i = i + 1) { var session = lightdm.sessions[i]; var s = template.cloneNode(true); s.id = "session_" + session.key; var label = s.querySelector(".session_label"); var radio = s.querySelector("input"); console.log(s, session); label.innerHTML = session.name; radio.value = session.key; radio.id = session.key; var default_session = 'default' == lightdm.default_session && 0 == i; if (session.key === lightdm.default_session || default_session) { radio.checked = true; } container.appendChild(s); } } function update_sessions(user_session) { var radio = document.getElementById(user_session); if ( radio !== null) { radio.checked = true; } } function show_users() { var users = document.querySelectorAll(".user"); var i = 0; for (i= 0; i < users.length; i++) { setVisible(users[i], true); users[i].style.left = 0; } setVisible(document.querySelector("#password_container"), false); selected_user = null; } function user_clicked(event) { if (selected_user !== null) { selected_user = null; lightdm.cancel_authentication(); show_users(); } else { selected_user = event.currentTarget.id; for (i = 0; i < lightdm.users.length; i++) { user = lightdm.users[i]; if (user.name === selected_user) { update_sessions(user.session); } } start_authentication(event.currentTarget.id); } show_message(""); event.stopPropagation(); return false; } function setVisible(element, visible) { if (visible) { element.classList.remove("hidden"); } else { element.classList.add("hidden"); } } function isVisible(element) { return !element.classList.contains("hidden"); } function update_time() { var time = document.querySelector("#current_time"); var date = new Date(); var time_string = date.toTimeString().split(" ", 2); // toTimeString() gives time and then the PM/AM surfix when using 12h clock, otherwise we get time and timezone + offset if ( time_string[1] === "PM" || time_string[1] === "AM" ) { time_string = time_string.join(" "); } else { time_string = time_string[0]; } time.innerHTML = time_string; } function update_date() { var date = document.querySelector("#current_date"); var curDate = new Date(); date.innerHTML = curDate.toLocaleDateString(); } ////////////////////////////////// // Initialization ////////////////////////////////// function initialize() { show_message(""); initialize_users(); initialize_timer(); initialize_date(); initialize_sessions(); } function on_image_error(e) { e.currentTarget.src = "img/avatar.svg"; } function initialize_users() { var template = document.querySelector("#user_template"); var parent = template.parentElement; parent.removeChild(template); for (i = 0; i < lightdm.users.length; i += 1) { user = lightdm.users[i]; userNode = template.cloneNode(true); var image = userNode.querySelectorAll(".user_image")[0]; var name = userNode.querySelectorAll(".user_name")[0]; name.innerHTML = user.display_name; if (user.image) { image.src = user.image; image.onerror = on_image_error; } else { image.src = "img/avatar.svg"; } userNode.id = user.name; userNode.onclick = user_clicked; parent.appendChild(userNode); } setTimeout(show_users, 400); } function initialize_timer() { update_time(); setInterval(update_time, 1000); } function initialize_date() { update_date(); setInterval(update_date, 1000); } function add_action(id, name, image, clickhandler, template, parent) { action_node = template.cloneNode(true); action_node.id = "action_" + id; img_node = action_node.querySelectorAll(".action_image")[0]; label_node = action_node.querySelectorAll(".action_label")[0]; label_node.innerHTML = name; img_node.src = image; action_node.onclick = clickhandler; parent.appendChild(action_node); }
// Styles import './BugReviewTable.css'; import 'react-select/dist/react-select.css'; // Libraries import React, { Component, PropTypes } from 'react'; import classnames from 'classnames'; // Constants import Table from '../A10-UI/Table/Table'; import Th from '../A10-UI/Table/Th'; // import Td from '../A10-UI/Table/Td'; // import Select from 'react-select'; import BugReviewTableBody from './BugReviewTableBody'; let TableHeaders = ({ titleKeyMap, onSortHandler, sortBy, enableSort}) => { let headerHtml = titleKeyMap.map((headerObj, index) => { let header = headerObj.title; let colSpan = headerObj.colspan; const ascendingButtonClassNames = classnames('glyphicon glyphicon-menu-up', { 'hide': sortBy.category !== header || sortBy.status !== 1 }); const descendingButtonClassNames = classnames('glyphicon glyphicon-menu-down', { 'hide': sortBy.category !== header || sortBy.status !== -1 }); let filterIconHtml = (<span></span>); if (enableSort) { filterIconHtml = ( <span data-name={header}> <i className={ascendingButtonClassNames} data-name={header}> </i> <i className={descendingButtonClassNames} data-name={header}> </i> </span> ); } return ( <Th key={index} className="pto-table__header" data-name={header} onClick={onSortHandler} colSpan={colSpan} > <span data-name={header}>{header}</span> {filterIconHtml} </Th> ); }); return ( <thead> <tr> {headerHtml} </tr> </thead> ); }; class BugReviewTable extends Component { constructor(props) { super(props); this._onSortHandler = ::this._onSortHandler; } _onSortHandler(e) { const category = e.target.dataset.name; this.props.onSortHandler(category); } render() { return ( <div className="pto-table"> <Table className="bug-review-table"> <TableHeaders {...this.props} /> <BugReviewTableBody {...this.props} /> </Table> </div> ); } } BugReviewTable.propTypes = { data : PropTypes.array.isRequired, titleKeyMap : PropTypes.array.isRequired, resolvedReasonTypes : PropTypes.array.isRequired, optionsReviewTags : PropTypes.array.isRequired, optionsMenus : PropTypes.array.isRequired, enableSort : PropTypes.bool, sortBy : PropTypes.object, onSortHandler : PropTypes.func, onStatusUpdateHandler: PropTypes.func, onDeleteHandler : PropTypes.func, resolvedReasonTypeChange: PropTypes.func, changeReviewTagOptions: PropTypes.func, changeMenuTagOptions: PropTypes.func, changeReviewText: PropTypes.func }; BugReviewTable.defaultProps = { enableSort: false, sortBy: { category: '', status: 0 }, onSortHandler : () => {}, onStatusUpdateHandler: () => {}, onDeleteHandler : () => {} }; export default BugReviewTable;
'use strict'; const { Router } = require('express') const router = Router() const Claim = require('../models/claim') const Dealer = require('../models/dealers') const Vehicle = require('../models/vehicle') const Sections = require('../models/sections') const Parts = require('../models/parts') const Labor = require('../models/labor') router.get('/api/dealer', (req, res, err) => { Dealer .find().sort({name: 1}) .then(dealers => res.json(dealers)) .catch(err) }) router.get('/api/vehicles', (req, res, err) => { Vehicle .find().sort({name: 1}) .then(vehicles => res.json(vehicles)) .catch(err) }) router.get('/api/sections', (req, res, err) => { Sections .find().sort({name: 1}) .then(sections => res.json(sections)) .catch(err) }) router.get('/api/parts', (req, res, err) => { Parts .find() .then(parts => res.json(parts)) .catch(err) }) router.get('/api/labor', (req, res, err) => { Labor .find() .then(labor => res.json(labor)) .catch(err) }) router.post('/api/claim', (req, res, err) => { Claim .create(req.body) .then(res.end()) .catch(err) }) router.get('/api/claims', (req, res, err) => { Claim .find().sort({_id:-1}) .then(claim => res.json(claim)) .catch(err) }) router.get("/404", (req, res) => { res.render('404', { page: '404' }) }) module.exports = router
// * ———————————————————————————————————————————————————————— * // // * juicebox // * deals with lack of persistent storage // * TODO: juicefiles are public. maybe not the best idea // * ———————————————————————————————————————————————————————— * // var juicebox = function () {} // vendor dependencies var Promise = require('bluebird') var fstream = require('fstream') var tar = require('tar') var zlib = require('zlib') var path = require('path') var fs = require('fs') var request = require('request') var rimraf = require('rimraf') // local dependencies var logger = require(ENDURO_FOLDER + '/libs/logger') var remote_handler = require(ENDURO_FOLDER + '/libs/remote_tools/remote_handler') var juice_helpers = require(ENDURO_FOLDER + '/libs/juicebox/juice_helpers') var flat_helpers = require(ENDURO_FOLDER + '/libs/flat_db/flat_helpers') var log_clusters = require(ENDURO_FOLDER + '/libs/log_clusters/log_clusters') var EXTENSION = '.tar.gz' // packs up the juicebox together with new juice.json juicebox.prototype.pack = function (user) { var self = this return self.pull() .then(() => { return self.force_pack(user) }) } // * ———————————————————————————————————————————————————————— * // // * pull // * // * gets the most recent file from the juicebar // * @param {bool} force - overwrites newer files on local // * @return {promise} - no data // * ———————————————————————————————————————————————————————— * // juicebox.prototype.pull = function (force) { // if juicebox is not enabled if (!config.variables.juicebox_enabled) { return Promise.resolve() } logger.init('Juice pull') if (flags.force || force) { return get_latest_juice() .then((juice) => { return get_juicebox_by_name(juice.latest.hash + EXTENSION) }, err) .then((latest_juicebox) => { return spill_the_juice(latest_juicebox) }, err) .then(() => { logger.end() return Promise.resolve() }, err) } else { var pull_juice return get_latest_juice() .then((juice) => { pull_juice = juice return get_juicebox_by_name(juice.latest.hash + EXTENSION) }, err) .then((latest_juicebox) => { return spill_the_juice(latest_juicebox, path.join('juicebox', 'staging', pull_juice.latest.hash)) }, err) .then(() => { return juice_helpers.spill_newer(path.join('juicebox', 'staging', pull_juice.latest.hash)) }, err) .then(() => { logger.end() return Promise.resolve() }, err) } } // packs up the juicebox together with new juice.json juicebox.prototype.force_pack = function (user) { return new Promise(function (resolve, reject) { // sets user to developer if juicing is caused by console user = user || 'developer' // Skip juicing if juicing is not enabled(most likely s3 keys are missing) if (!config.variables.juicebox_enabled) { return resolve() } get_latest_juice() .then((juice) => { juice.history = juice.history || [] if (juice.latest) { juice.history.push(juice.latest) } juice.latest = { hash: get_juicebox_hash_by_timestamp(Math.floor(Date.now() / 1000)), timestamp: Math.floor(Date.now() / 1000), user: user, } write_juicebox(juice.latest.hash + EXTENSION) .then(() => { return write_juicefile(juice) }) .then(() => { return remote_handler.upload_to_s3_by_filepath('juicebox/juice.json', path.join(CMD_FOLDER, 'juicebox', 'juice.json')) }) .then(() => { return remote_handler.upload_to_s3_by_filepath('juicebox/' + juice.latest.hash + EXTENSION, path.join(CMD_FOLDER, 'juicebox', juice.latest.hash + EXTENSION)) }) .then(() => { logger.init('Juice pack') logger.log('packed successfully') logger.end() resolve() }) }) }) } juicebox.prototype.diff = function (args) { args = args || [] // will store the specified juicebox hash var juicebox_hash_to_diff return get_latest_juice() .then((juice) => { // if user provided specified version if (args.length) { juicebox_hash_to_diff = get_juicebox_hash_by_timestamp(args[0]) } else { juicebox_hash_to_diff = juice.latest.hash } args.shift() return get_juicebox_by_name(juicebox_hash_to_diff + EXTENSION) }) .then((specified_juicebox) => { return spill_the_juice(specified_juicebox, path.join('juicebox', 'staging', juicebox_hash_to_diff)) }) .then(() => { if (args.length) { return juice_helpers.diff_file_with_cms(juicebox_hash_to_diff, args[0]) } else { return juice_helpers.diff_folder_with_cms(path.join('juicebox', 'staging', juicebox_hash_to_diff, 'cms')) } }) } juicebox.prototype.log = function (nojuice) { return get_latest_juice() .then((juice) => { juice_helpers.nice_log(juice) }) } juicebox.prototype.juicebox_enabled = function () { return config.variables.juicebox_enabled } juicebox.prototype.is_juicebox_enabled = function () { var juicefile_path = path.join(CMD_FOLDER, 'juicebox', 'juice.json') return !flat_helpers.file_exists_sync(juicefile_path) } function write_juicebox (juicebox_name) { return new Promise(function (resolve, reject) { fstream.Reader({ 'path': path.join(CMD_FOLDER, 'cms'), 'type': 'Directory' }) .pipe(tar.Pack()) .pipe(zlib.Gzip()) .pipe(fstream.Writer({ 'path': path.join('juicebox', juicebox_name) }) .on('close', function () { resolve() }) ) }) } function write_juicefile (juice) { return new Promise(function (resolve, reject) { var destination_juicefile_path = path.join(CMD_FOLDER, 'juicebox', 'juice.json') flat_helpers.ensure_directory_existence(destination_juicefile_path) .then(() => { fs.writeFile(destination_juicefile_path, JSON.stringify(juice), function (err) { if (err) { reject(err) } resolve() }) }) }) } function get_latest_juice () { return new Promise(function (resolve, reject) { request(remote_handler.get_remote_url('juicebox/juice.json'), function (error, response, body) { if (error && response.statusCode != 200) { reject('couldnt read juice file') } var juicefile_in_json // check if we got xml or json - xml means there is something wrong if (body.indexOf('<?xml') + 1 && body.indexOf('<Error>') + 1) { // juicefile doesn't exist yet - let's create a new juicefile if (body.indexOf('AccessDenied') + 1) { juicefile_in_json = get_new_juicefile() // bucket was not created } else if (body.indexOf('NoSuchBucket') + 1) { log_clusters.log('nonexistent_bucket') process.exit() } } else { juicefile_in_json = JSON.parse(body) } write_juicefile(juicefile_in_json) .then(() => { resolve(juicefile_in_json) }, err) }) }) } function get_juicebox_hash_by_timestamp (timestamp) { return config.project_name + '_' + timestamp } function get_juicebox_by_name (juicebox_name) { return new Promise(function (resolve, reject) { if (juicebox_name == '0000') { return resolve() } request(remote_handler.get_remote_url('juicebox/' + juicebox_name)) .pipe(fs.createWriteStream('juicebox/' + juicebox_name) .on('close', function () { resolve(juicebox_name) }) ) }) } function spill_the_juice (juicebox_name, destination) { // default destination is the project's root (juicebox has cms folder) destination = destination || path.join(CMD_FOLDER) return new Promise(function (resolve, reject) { // delete the folder if it exists rimraf(path.join(destination, 'cms'), function () { if (!juicebox_name || juicebox_name == '0000.tar.gz') { return resolve() } var tarball = path.join(CMD_FOLDER, 'juicebox', juicebox_name) if (flat_helpers.file_exists_sync(tarball)) { var tar_extract = tar.Extract({ path: destination, }) fs.createReadStream(tarball) .pipe(zlib.Unzip()) .pipe(tar_extract) .on('error', function () { console.log('asd') }) tar_extract.on('finish', () => { resolve() }) } }) }) } // provides default context of a fresh juicefile function get_new_juicefile () { return { history: [], latest: { hash: '0000', timestamp: Math.floor(Date.now() / 1000), user: 'enduro', } } } // handles errors function err (err) { logger.raw_err(err) } module.exports = new juicebox()
// @flow strict // // A gist-txt location hash has the form: // // #<gist-id>/<scene> // // To parse the hash: // // 1. remove the '#' refix // 2. split the remaining string by '/' // 3. assign the first *segment* to the global variable `gistId` // 4. join the remaining segments with '/' // // Note: gists' files can't include the '/' character in the name so, even if // the remaining portion of the segments array is joined by '/', that array // should always contain at most one element. // // If the scene name is blank return 'index', the default name of the main // scene, otherwise return the scene name found. // export default function (hash: string): [string, string] { const path = hash.slice(1) const segments = path.split("/") const gistId = segments.shift() let scene = segments.join("/") if (scene === "") { scene = "index" } return [gistId, scene] }
import Vue from 'vue'; import test from 'ava'; import './helpers/setupOldBrowserEnv' import Ls from '../../../src/index'; import { WebStorageEvent } from '../../../src/storage'; Vue.use(Ls); test('Add/Remove event', (t) => { t.plan(2); Vue.ls.on('item_one_test', () => {}); Vue.ls.on('item_two_test', () => {}); Vue.ls.on('item_two_test', () => {}); Vue.ls.on('item_three_test', (val, oldVal) => { t.is(val, 'val'); t.is(oldVal, 'old_val'); }); Vue.ls.off('item_two_test', () => {}); Vue.ls.off('item_one_test', () => {}); WebStorageEvent.emit({ key: 'item_three_test', newValue: JSON.stringify({ value: 'val', expire: null }), oldValue: JSON.stringify({ value: 'old_val', expire: null }), }); WebStorageEvent.emit({ key: 'item_undefined_test', newValue: JSON.stringify({ value: 'val', expire: null }), oldValue: JSON.stringify({ value: 'old_val', expire: null }), }); WebStorageEvent.emit(); });
var detectBrowserVisibility=function(e){e=e||{},e.forceOldBrowsersMethod=e.forceOldBrowsersMethod||!1;var n={onActive:function(){},onDisabled:function(){}},i={hidden:"visibilitychange",mozHidden:"mozvisibilitychange",msHidden:"msvisibilitychange",webkitHidden:"webkitvisibilitychange"},t=!1;if(e.forceOldBrowsersMethod===!1)for(var o in i)if("undefined"!=typeof document[o]){document.hidden=document[o],document.addEventListener(i[o],function(){n[document.hidden?"onDisabled":"onActive"]()},!1),t=!0;break}return(e.forceOldBrowsersMethod===!0||t===!1)&&("function"==typeof document.addEventListener?(window.addEventListener("focus",n.onActive,!0),window.addEventListener("blur",n.onDisabled,!0)):(window.attachEvent("focus",n.onActive,!0),window.attachEvent("blur",n.onDisabled,!0))),new function(){return{onActive:function(e){return n.onActive=e,this},onDisabled:function(e){return n.onDisabled=e,this}}}};
/* global cobra, describe, beforeEach, expect, it */ describe('Boolean schema', function () { var model; beforeEach(function () { // create schema var TestSchema = new cobra.Schema({ myProp: { type: Boolean } }, { allowNull: false }); // assign model to schema cobra.model('Test', TestSchema); // get a reference to model var Model = cobra.model('Test'); // create instance of model model = new Model(); }); describe('value set to true', function () { it('should have property equal to true', function (done) { model.myProp = true; function onApplySchema(result) { expect(result).toEqual({ myProp: true }); done(); } model.applySchema().then(onApplySchema, onApplySchema); }); }); describe('value set to 0', function () { it('should have property equal to false', function (done) { model.myProp = 0; function onApplySchema(result) { expect(result).toEqual({ myProp: false }); done(); } model.applySchema().then(onApplySchema, onApplySchema); }); }); describe('value set to 1', function () { it('should have property equal to true', function (done) { model.myProp = 1; function onApplySchema(result) { expect(result).toEqual({ myProp: true }); done(); } model.applySchema().then(onApplySchema, onApplySchema); }); }); describe('value set to 100000', function () { it('should have property equal to true', function (done) { model.myProp = 100000; function onApplySchema(result) { expect(result).toEqual({ myProp: true }); done(); } model.applySchema().then(onApplySchema, onApplySchema); }); }); describe('value set to "true"', function () { it('should have property equal to true', function (done) { model.myProp = 'true'; function onApplySchema(result) { expect(result).toEqual({ myProp: true }); done(); } model.applySchema().then(onApplySchema, onApplySchema); }); }); describe('value set to "bogus"', function () { it('to have an error', function (done) { model.myProp = 'bogus'; function onApplySchema(result) { expect(result).toBeError(); done(); } model.applySchema().then(onApplySchema, onApplySchema); }); }); describe('value set to {}', function () { it('to have an error', function (done) { model.myProp = {}; function onApplySchema(result) { expect(result).toBeError(); done(); } model.applySchema().then(onApplySchema, onApplySchema); }); }); describe('value set to []', function () { it('to have an error', function (done) { model.myProp = []; function onApplySchema(result) { expect(result).toBeError(); done(); } model.applySchema().then(onApplySchema, onApplySchema); }); }); });
import { signals } from 'signal-exit'; export default function onSignalExit(callback) { signals().forEach((signal) => { process.on(signal, () => { callback(signal); }); }); }
import {get} from 'lodash'; import {set} from 'object-path-immutable'; export const compose = (f, ...fs) => fs.length > 0 ? (x) => f(compose(...fs)(x)) : f; /* * Forward reducer transform to a particular state path. * If the last path element does not exist, reducer will get undefined * so that you can use reduce(state=initialState(), payload) => ... */ export const forwardReducerTo = (reducer, path) => ( (state, payload) => { const newValue = reducer(get(state, path), payload); return set(state, path, newValue); } ); /* * Merges own props, state and dispatch into props, puts dispatch under "actions" */ export const mergeProps = (stateProps, dispatchProps, ownProps) => ( {...ownProps, ...stateProps, actions: {...dispatchProps}} );
/* * Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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. */ //node.js deps //npm deps //app deps var assert = require('assert'); var sinon = require('sinon'); var device = require('../device'); var mockMQTTClient = require('./mock/mockMQTTClient'); describe( "thing shadow class unit tests", function() { var mockMQTTClientObject; var mqttSave; beforeEach( function () { // Mock the connect API for mqtt.js var fakeConnect = function(options) { mockMQTTClientObject = new mockMQTTClient(); // return the mocking object mockMQTTClientObject.reInitCommandCalled(); mockMQTTClientObject.resetPublishedMessage(); return mockMQTTClientObject; }; mqttSave = sinon.stub(device, 'DeviceClient', fakeConnect); }); afterEach( function () { mqttSave.restore(); }); var thingShadow = require('..').thingShadow; // Test cases begin describe( "register a thing shadow name", function() { // // Verify that the thing shadow module does not throw an exception // when all connection parameters are specified and we register and // unregister thing shadows. // it("does not throw an exception", function() { assert.doesNotThrow( function( err ) { var thingShadows = thingShadow( { keyPath:'test/data/private.pem.key', certPath:'test/data/certificate.pem.crt', caPath:'test/data/root-CA.crt', clientId:'dummy-client-1', region:'us-east-1' } ); thingShadows.register( 'testShadow1' ); thingShadows.unregister( 'testShadow1' ); }, function(err) { console.log('\t['+err+']'); return true; } ); }); }); describe( "subscribe to/unsubscribe from a non-thing topic", function() { // // Verify that the thing shadow module does not throw an exception // when we subscribe to and unsubscribe from a non-thing topic. // it("does not throw an exception", function() { assert.doesNotThrow( function( err ) { var thingShadows = thingShadow( { keyPath:'test/data/private.pem.key', certPath:'test/data/certificate.pem.crt', caPath:'test/data/root-CA.crt', clientId:'dummy-client-1', region:'us-east-1' } ); thingShadows.subscribe( 'nonThingTopic1' ); thingShadows.unsubscribe( 'nonThingTopic1' ); }, function(err) { console.log('\t['+err+']'); return true;} ); }); }); describe( "publish to a non-thing topic", function() { // // Verify that the thing shadow module does not throw an exception // when we publish to a non-thing topic. // it("does not throw an exception", function() { assert.doesNotThrow( function( err ) { var thingShadows = thingShadow( { keyPath:'test/data/private.pem.key', certPath:'test/data/certificate.pem.crt', caPath:'test/data/root-CA.crt', clientId:'dummy-client-1', region:'us-east-1' } ); thingShadows.publish( 'nonThingTopic1', { data: 'value' } ); }, function(err) { console.log('\t['+err+']'); return true;} ); }); }); describe( "subscribe to an illegal non-thing topic", function() { // // Verify that the thing shadow module throws an exception if we // attempt to subscribe to an illegal non-thing topic. // it("throws an exception", function() { assert.throws( function( err ) { var thingShadows = thingShadow( { keyPath:'test/data/private.pem.key', certPath:'test/data/certificate.pem.crt', caPath:'test/data/root-CA.crt', clientId:'dummy-client-1', region:'us-east-1' } ); thingShadows.subscribe( '$aws/things/nonThingTopic1' ); }, function(err) { console.log('\t['+err+']'); return true;} ); }); }); describe( "publish to an illegal non-thing topic", function() { // // Verify that the thing shadow module throws an exception if we // attempt to publish to an illegal non-thing topic. // it("throws an exception", function() { assert.throws( function( err ) { var thingShadows = thingShadow( { keyPath:'test/data/private.pem.key', certPath:'test/data/certificate.pem.crt', caPath:'test/data/root-CA.crt', clientId:'dummy-client-1', region:'us-east-1' } ); thingShadows.publish( '$aws/things/nonThingTopic1', { data: 'value' } ); }, function(err) { console.log('\t['+err+']'); return true;} ); }); }); describe( "unsubscribe from an illegal non-thing topic", function() { // // Verify that the thing shadow module throws an exception if we // attempt to unsubscribe from an illegal non-thing topic. // it("throws an exception", function() { assert.throws( function( err ) { var thingShadows = thingShadow( { keyPath:'test/data/private.pem.key', certPath:'test/data/certificate.pem.crt', caPath:'test/data/root-CA.crt', clientId:'dummy-client-1', region:'us-east-1' } ); thingShadows.unsubscribe( '$aws/things/nonThingTopic1' ); }, function(err) { console.log('\t['+err+']'); return true;} ); }); }); // // Verify that the thing shadow module does not throw an exception // when the end() method is invoked. // describe( "end method does not throw an exception", function() { it("does not throw an exception", function() { assert.doesNotThrow( function( err ) { var thingShadows = thingShadow( { keyPath:'test/data/private.pem.key', certPath:'test/data/certificate.pem.crt', caPath:'test/data/root-CA.crt', clientId:'dummy-client-1', region:'us-east-1' } ); thingShadows.end( true ); }, function(err) { console.log('\t['+err+']'); return true;} ); }); }); /**** shadow register/unregister ****/ // // Verify that the corresponding delta topic is subscribed after the registration of a thing shadow // if the user is interested in delta (default), and is unsubscribed when unregistered. // describe("Thing shadow registration/unregistration", function(){ it("properly subscribes/unsubscribes to delta topic", function() { // Reinit mockMQTTClientObject mockMQTTClientObject.reInitCommandCalled(); // Init thingShadowsClient var thingShadows = thingShadow( { keyPath:'test/data/private.pem.key', certPath:'test/data/certificate.pem.crt', caPath:'test/data/root-CA.crt', clientId:'dummy-client-1', region:'us-east-1' } ); // Register a thing, using default delta settings thingShadows.register('testShadow1'); assert.equal(mockMQTTClientObject.commandCalled['subscribe'], 2); // Called twice, one for delta, one for GUD mockMQTTClientObject.reInitCommandCalled(); thingShadows.unregister('testShadow1'); assert.equal(mockMQTTClientObject.commandCalled['unsubscribe'], 2); }); }); // // Verify that the delta topic is never subscribed when the option ignoreDeltas is set to be true // describe("Thing shadow registration with ignoreDeltas set to be true", function() { it("never subscribes to delta topic", function() { // Reinit mockMQTTClientObject mockMQTTClientObject.reInitCommandCalled(); // Init thingShadowClient var thingShadows = thingShadow( { keyPath:'test/data/private.pem.key', certPath:'test/data/certificate.pem.crt', caPath:'test/data/root-CA.crt', clientId:'dummy-client-1', region:'us-east-1', debug: true } ); // Register a thing, using default delta settings thingShadows.register('testShadow1', {ignoreDeltas:true}); assert.equal(mockMQTTClientObject.commandCalled['subscribe'], 1); // Called once, for GUD // Register it again and make sure no additional subscriptions // were generated; this will also generate a console warning // since the device was instantiated with debug===true thingShadows.register('testShadow1', {ignoreDeltas:true}); assert.equal(mockMQTTClientObject.commandCalled['subscribe'], 1); // Called once, for GUD mockMQTTClientObject.reInitCommandCalled(); thingShadows.unregister('testShadow1'); assert.equal(mockMQTTClientObject.commandCalled['unsubscribe'], 2); // Called twice, unsub from ALL }); }); // // Verify that registering a thing shadow with malformed inputs should be ignored. // describe("Thing shadow registration with malformed options", function() { it("should properly ignore them", function() { // Reinit mockMQTTClientObject mockMQTTClientObject.reInitCommandCalled(); // Init thingShadowClient var thingShadows = thingShadow( { keyPath:'test/data/private.pem.key', certPath:'test/data/certificate.pem.crt', caPath:'test/data/root-CA.crt', clientId:'dummy-client-1', region:'us-east-1' } ); assert.doesNotThrow(function(err) { thingShadows.register('testShadow1', {troubleMaker:123}); thingShadows.unregister('testShadow1'); }, function(err) {console.log('\t['+err+']'); return true;} ); }); }); // // Verify that unregistering a thing shadow that is never registered is ignored. // describe("Unregister a thing shadow that is never registered", function() { it("should properly ignore it", function() { // Reinit mockMQTTClientObject mockMQTTClientObject.reInitCommandCalled(); // Init thingShadowClient var thingShadows = thingShadow( { keyPath:'test/data/private.pem.key', certPath:'test/data/certificate.pem.crt', caPath:'test/data/root-CA.crt', clientId:'dummy-client-1', region:'us-east-1' } ); assert.doesNotThrow(function(err) { thingShadows.unregister('IamNeverRegistered'); }, function(err) {console.log('\t['+err+']'); return true;}); }); }); // // Verify that new delta messages with bigger version number triggers the callback. // describe("Incoming delta message with bigger version number", function() { it("should call the corresponding callback", function() { // Reinit mockMQTTClientObject mockMQTTClientObject.reInitCommandCalled(); // Init thingShadowClient var thingShadows = thingShadow( { keyPath:'test/data/private.pem.key', certPath:'test/data/certificate.pem.crt', caPath:'test/data/root-CA.crt', clientId:'dummy-client-1', region:'us-east-1' } ); // Register a thing thingShadows.register('testShadow2'); // Register a fake callback var fakeCallback = sinon.spy(); thingShadows.on('delta', fakeCallback); // Now emit a message from delta topic mockMQTTClientObject.emit('message', '$aws/things/testShadow2/shadow/update/delta', '{"version":3}'); // Now emit another message from delta topic again, with bigger version number mockMQTTClientObject.emit('message', '$aws/things/testShadow2/shadow/update/delta', '{"version":5}'); // Check spy assert(fakeCallback.calledTwice); // clean up thingShadows.unregister('testShadow2'); }); }); // // Verify that new delta message with smaller version number does not trigger the callback. // describe("Incoming delta message with smaller version number", function() { it("should never call callback", function() { // Reinit mockMQTTClientObject mockMQTTClientObject.reInitCommandCalled(); // Init thingShadowClient var thingShadows = thingShadow( { keyPath:'test/data/private.pem.key', certPath:'test/data/certificate.pem.crt', caPath:'test/data/root-CA.crt', clientId:'dummy-client-1', region:'us-east-1', debug: true } ); // Register a thing thingShadows.register('testShadow2'); // Register a fake callback var fakeCallback = sinon.spy(); thingShadows.on('delta', fakeCallback); // Now emit a message from delta topic mockMQTTClientObject.emit('message', '$aws/things/testShadow2/shadow/update/delta', '{"version":3}'); // Now emit another message from delta topic again, with bigger version number mockMQTTClientObject.emit('message', '$aws/things/testShadow2/shadow/update/delta', '{"version":1}'); // Check spy assert(fakeCallback.calledOnce); // clean up thingShadows.unregister('testShadow2'); }); }); // // Verify that the delta message from some unregistered thing does not trigger the callback. // describe("Incoming delta message from unregistered thing", function() { it("should never call callback", function() { // Reinit mockMQTTClientObject mockMQTTClientObject.reInitCommandCalled(); // Init thingShadowClient var thingShadows = thingShadow( { keyPath:'test/data/private.pem.key', certPath:'test/data/certificate.pem.crt', caPath:'test/data/root-CA.crt', clientId:'dummy-client-1', region:'us-east-1' } ); // Register a thing thingShadows.register('testShadow2'); // Register a fake callback var fakeCallback = sinon.spy(); thingShadows.on('delta', fakeCallback); // Now emit a message from delta topic for some other thing mockMQTTClientObject.emit('message', '$aws/things/IamNeverRegistered/shadow/update/delta', '{"version":3}'); // Check spy sinon.assert.notCalled(fakeCallback); // clean up thingShadows.unregister('testShadow2'); }); }); /**** shadow get/delete ****/ // // Verify that a message without clientToken is properly published // when a shadow Get request is issued. // describe("No token is specified for shadow Get/Delete", function() { it("should generate a token", function() { // Reinit mockMQTTClientObject mockMQTTClientObject.reInitCommandCalled(); mockMQTTClientObject.resetPublishedMessage(); // Faking timer var clock = sinon.useFakeTimers(); // Faking callback var fakeCallback = sinon.spy(); // Init thingShadowClient var thingShadows = thingShadow( { keyPath:'test/data/private.pem.key', certPath:'test/data/certificate.pem.crt', caPath:'test/data/root-CA.crt', clientId:'dummy-client-1', region:'us-east-1' }, { operationTimeout:1000 // Set operation timeout to be 1 sec } ); // Register callback thingShadows.on('timeout', fakeCallback); // Register a thing thingShadows.register('testShadow3'); // Fire a shadow get var thisToken = thingShadows.get('testShadow3'); clock.tick(3000); // 3 sec later... assert(fakeCallback.calledOnce); assert.equal(mockMQTTClientObject.lastPublishedMessage, '{"clientToken":"dummy-client-1-0"}'); mockMQTTClientObject.resetPublishedMessage(); thatToken = thingShadows.delete('testShadow3'); clock.tick(3000); // 3 sec later... assert(fakeCallback.calledTwice); assert.equal(mockMQTTClientObject.lastPublishedMessage, '{"clientToken":"dummy-client-1-1"}'); assert.equal(mockMQTTClientObject.commandCalled['publish'], 2); // Unregister it thingShadows.unregister('testShadow3'); }); }); // // Verify that a message containing clientToken is properly published // when a shadow Get request is issued. // describe("User clientToken is specified for shadow Get/Delete", function() { it("should keep and use the user token", function() { // Reinit mockMQTTClientObject mockMQTTClientObject.reInitCommandCalled(); mockMQTTClientObject.resetPublishedMessage(); // Faking timer var clock = sinon.useFakeTimers(); // Faking callback var fakeCallback = sinon.spy(); // Init thingShadowClient var thingShadows = thingShadow( { keyPath:'test/data/private.pem.key', certPath:'test/data/certificate.pem.crt', caPath:'test/data/root-CA.crt', clientId:'dummy-client-1', region:'us-east-1' }, { operationTimeout:1000 // Set operation timeout to be 1 sec } ); // Register callback thingShadows.on('timeout', fakeCallback); // Register a thing thingShadows.register('testShadow3'); // Fire a shadow get var thisToken = thingShadows.get('testShadow3', 'CoolToken1'); clock.tick(3000); // 3 sec later... assert(fakeCallback.calledOnce); assert.equal(mockMQTTClientObject.lastPublishedMessage, '{"clientToken":"CoolToken1"}'); mockMQTTClientObject.resetPublishedMessage(); thatToken = thingShadows.delete('testShadow3', 'CoolToken2'); clock.tick(3000); // 3 sec later... assert(fakeCallback.calledTwice); assert.equal(mockMQTTClientObject.lastPublishedMessage, '{"clientToken":"CoolToken2"}'); assert.equal(mockMQTTClientObject.commandCalled['publish'], 2); // Unregister it thingShadows.unregister('testShadow3'); }); }); // // Verify that a proper incoming message triggers the callback for shadow Get/Delete accepted/rejected. // describe("A proper incoming message for shadow Get/Delete is received (accepted/rejected)", function() { it("should call status callback", function() { // Reinit mockMQTTClientObject mockMQTTClientObject.reInitCommandCalled(); mockMQTTClientObject.resetPublishedMessage(); // Faking callbacks var fakeCallback = sinon.spy(); // Init thingShadowClient var thingShadows = thingShadow( { keyPath:'test/data/private.pem.key', certPath:'test/data/certificate.pem.crt', caPath:'test/data/root-CA.crt', clientId:'dummy-client-1', region:'us-east-1' } ); // Register a callback thingShadows.on('status', fakeCallback); // Register a thing thingShadows.register('testShadow3'); // Get thingShadows.get('testShadow3', 'CoolToken1'); mockMQTTClientObject.emit('message', '$aws/things/testShadow3/shadow/get/accepted', '{"clientToken":"CoolToken1", "version":2}'); assert(fakeCallback.calledOnce); thingShadows.get('testShadow3', 'CoolToken2'); mockMQTTClientObject.emit('message', '$aws/things/testShadow3/shadow/get/rejected', '{"clientToken":"CoolToken2", "version":2}') assert(fakeCallback.calledTwice); // Delete thingShadows.delete('testShadow3', 'CoolToken3'); mockMQTTClientObject.emit('message', '$aws/things/testShadow3/shadow/delete/accepted', '{"clientToken":"CoolToken3", "version":2}'); assert(fakeCallback.calledThrice); thingShadows.delete('testShadow3', 'CoolToken4'); mockMQTTClientObject.emit('message', '$aws/things/testShadow3/shadow/delete/rejected', '{"clientToken":"CoolToken4", "version":2}'); assert.equal(fakeCallback.callCount, 4); // assert.equal(mockMQTTClientObject.commandCalled['unsubscribe'], 0); // Never unsubscribe since persistent // Unregister it thingShadows.unregister('testShadow3'); }); }); // // Verify that the related topics are properly unsubscribed when it is registered as // NOT persistent subscribe. // describe("Shadow Get/Delete feedback for NOT persistent subscribe thing comes", function() { it("should unsubscribe from related topics (accepted/rejected)", function() { // Reinit mockMQTTClientObject mockMQTTClientObject.reInitCommandCalled(); mockMQTTClientObject.resetPublishedMessage(); // Init thingShadowClient var thingShadows = thingShadow( { keyPath:'test/data/private.pem.key', certPath:'test/data/certificate.pem.crt', caPath:'test/data/root-CA.crt', clientId:'dummy-client-1', region:'us-east-1' } ); // Register a thing thingShadows.register('testShadow3', {persistentSubscribe:false}); // Unsub once there is a feedback // Get thingShadows.get('testShadow3', 'CoolToken1'); mockMQTTClientObject.emit('message', '$aws/things/testShadow3/shadow/get/accepted', '{"clientToken":"CoolToken1", "version":2}'); assert.equal(mockMQTTClientObject.commandCalled['unsubscribe'], 1); // Delete mockMQTTClientObject.reInitCommandCalled(); thingShadows.delete('testShadow3', 'CoolToken2'); mockMQTTClientObject.emit('message', '$aws/things/testShadow3/shadow/delete/accepted', '{"clientToken":"CoolToken2", "version":2}'); assert.equal(mockMQTTClientObject.commandCalled['unsubscribe'], 1); // Unregister it thingShadows.unregister('testShadow3'); }); }); // // Verify that timeout triggers the callback for shadow Get/Delete timeout. // describe("Get/Delete request timeout", function() { it("should call timeout callback", function() { // Reinit mockMQTTClientObject mockMQTTClientObject.reInitCommandCalled(); mockMQTTClientObject.resetPublishedMessage(); // Faking timer var clock = sinon.useFakeTimers(); // Faking callback var fakeCallback = sinon.spy(); // Init thingShadowClient var thingShadows = thingShadow( { keyPath:'test/data/private.pem.key', certPath:'test/data/certificate.pem.crt', caPath:'test/data/root-CA.crt', clientId:'dummy-client-1', region:'us-east-1', }, { operationTimeout:1000 // Set operation timeout to be 1 sec } ); // Register callback thingShadows.on('timeout', fakeCallback); // Register a thing thingShadows.register('testShadow3'); // Get thingShadows.get('testShadow3', 'CoolToken1'); // Delete clock.tick(3000); // 3 sec later... assert(fakeCallback.calledOnce); thingShadows.delete('testShadow3', 'CoolToken2'); clock.tick(3000); // 3 sec later... assert(fakeCallback.calledTwice); // // Unregister it thingShadows.unregister('testShadow3'); clock.restore(); }); }); // // Verify that incoming messages with wrong/none token for shadow Get/Delete are ignored. // describe("Incoming messages for shadow Get/Delete are missing/messed up with token", function() { it("should never call callback", function() { // Faking callback fakeCallback = sinon.spy(); // Reinit mockMQTTClientObject mockMQTTClientObject.reInitCommandCalled(); mockMQTTClientObject.resetPublishedMessage(); // Init thingShadowClient var thingShadows = thingShadow( { keyPath:'test/data/private.pem.key', certPath:'test/data/certificate.pem.crt', caPath:'test/data/root-CA.crt', clientId:'dummy-client-1', region:'us-east-1' } ); // Register a callback thingShadows.on('status', fakeCallback); // Register a thing thingShadows.register('testShadow3'); // Get thingShadows.get('testShadow3'); mockMQTTClientObject.emit('message', '$aws/things/testShadow3/shadow/get/accepted', '{"clientToken":"Garbage1", "version":2}'); // wrong token thingShadows.get('testShadow3'); mockMQTTClientObject.emit('message', '$aws/things/testShadow3/shadow/get/accepted', '{"version":2}'); // no token // Delete thingShadows.delete('testShadow3'); mockMQTTClientObject.emit('message', '$aws/things/testShadow3/shadow/delete/accepted', '{"clientToken":"Garbage2", "version":2}'); // wrong token thingShadows.delete('testShadow3'); mockMQTTClientObject.emit('message', '$aws/things/testShadow3/shadow/delete/accepted', '{"version":2}'); // no token // Check sinon.assert.notCalled(fakeCallback); // Should never trigger the callback // Unregister it thingShadows.unregister('testShadow3'); }); }); // // Verify that incoming message with out-of-date/none version for shadow Get/Delete are ignored. // describe("Incoming messages for shadow Get/Delete are missing/messed up with version", function() { it("should never call callback", function() { // Faking callback fakeCallback = sinon.spy(); // Reinit mockMQTTClientObject mockMQTTClientObject.reInitCommandCalled(); mockMQTTClientObject.resetPublishedMessage(); // Init thingShadowClient var thingShadows = thingShadow( { keyPath:'test/data/private.pem.key', certPath:'test/data/certificate.pem.crt', caPath:'test/data/root-CA.crt', clientId:'dummy-client-1', region:'us-east-1' } ); // Register a callback thingShadows.on('status', fakeCallback); // Register a thing thingShadows.register('testShadow3'); // Get thingShadows.get('testShadow3', 'CoolToken1'); mockMQTTClientObject.emit('message', '$aws/things/testShadow3/shadow/get/accepted', '{"clientToken":"CoolToken1", "version":3}'); fakeCallback.reset(); // Reset spy thingShadows.get('testShadow3', 'CoolToken2'); mockMQTTClientObject.emit('message', '$aws/things/testShadow3/shadow/get/accepted', '{"clientToken":"CoolToken2", "version":1}'); // old version // Delete thingShadows.delete('testShadow3', 'CoolToken4'); mockMQTTClientObject.emit('message', '$aws/things/testShadow3/shadow/delete/accepted', '{"clientToken":"CoolToken4", "version":1}'); // old version // Check sinon.assert.notCalled(fakeCallback); //Unregister it thingShadows.unregister('testShadow3'); }); }); /**** shadow update ****/ // // Verify that token can be generated for shadow update request // when it is missing in the payload. // describe("Token is not specified for shadow Update", function() { it("should generate the token and insert it into the payload to be published", function() { // Reinit mockMQTTClientObject mockMQTTClientObject.reInitCommandCalled(); mockMQTTClientObject.resetPublishedMessage(); // Init thingShadowClient var thingShadows = thingShadow( { keyPath:'test/data/private.pem.key', certPath:'test/data/certificate.pem.crt', caPath:'test/data/root-CA.crt', clientId:'dummy-client-1', region:'us-east-1' } ); // Register a thing thingShadows.register('testShadow4'); // Generate fake payload myPayload = '{"state":{"desired":{"color":"RED"},"reported":{"color":"BLUE"}}}'; // No token myStateObject = JSON.parse(myPayload); // Update var thisToken = thingShadows.update('testShadow4', myStateObject); assert.equal(mockMQTTClientObject.lastPublishedMessage, '{"state":{"desired":{"color":"RED"},"reported":{"color":"BLUE"}},"clientToken":"dummy-client-1-0"}'); // Unregister it thingShadows.unregister('testShadow4'); }); }); // // Verify that token can be provided by the user for shadw update request. // describe("Token is specified for shadow Update", function() { it("should keep and use user token", function() { // Reinit mockMQTTClientObject mockMQTTClientObject.reInitCommandCalled(); mockMQTTClientObject.resetPublishedMessage(); // Init thingShadowClient var thingShadows = thingShadow( { keyPath:'test/data/private.pem.key', certPath:'test/data/certificate.pem.crt', caPath:'test/data/root-CA.crt', clientId:'dummy-client-1', region:'us-east-1' } ); // Register a thing thingShadows.register('testShadow4'); // Generate fake payload myPayload = '{"state":{"desired":{"color":"RED"},"reported":{"color":"BLUE"}},"clientToken":"CoolToken1"}'; // No token myStateObject = JSON.parse(myPayload); // Update var thisToken = thingShadows.update('testShadow4', myStateObject); assert.equal(mockMQTTClientObject.lastPublishedMessage, '{"state":{"desired":{"color":"RED"},"reported":{"color":"BLUE"}},"clientToken":"CoolToken1"}'); // Unregister it thingShadows.unregister('testShadow4'); }); }); // // Verify that proper incoming messages trigger the callback for shadow update, accepted and rejected. // describe("Proper incoming messages for shadow Update come", function() { it("should call status callback", function() { // Faking callback fakeCallback = sinon.spy(); // Reinit mockMQTTClientObject mockMQTTClientObject.reInitCommandCalled(); mockMQTTClientObject.resetPublishedMessage(); // Init thingShadowClient var thingShadows = thingShadow( { keyPath:'test/data/private.pem.key', certPath:'test/data/certificate.pem.crt', caPath:'test/data/root-CA.crt', clientId:'dummy-client-1', region:'us-east-1' } ); // Register a callback thingShadows.on('status', fakeCallback); // Register a thing thingShadows.register('testShadow4'); // Generate fake payload myPayload = '{"state":{"desired":{"color":"RED"},"reported":{"color":"BLUE"}},"clientToken":"CoolToken1"}'; myStateObject = JSON.parse(myPayload); // Update accepted thingShadows.update('testShadow4', myStateObject); mockMQTTClientObject.emit('message', '$aws/things/testShadow4/shadow/update/accepted', '{"clientToken":"CoolToken1","version":2}'); // Check assert(fakeCallback.calledOnce); // Reset fakeCallback.reset(); // Update rejected thingShadows.update('testShadow4', myStateObject); mockMQTTClientObject.emit('message', '$aws/things/testShadow4/shadow/update/rejected', '{"clientToken":"CoolToken1","version":2}'); // Check assert(fakeCallback.calledOnce); // Unregister it thingShadows.unregister('testShadow4'); }); }); // // Verify that related topics are unsubscribed when the thing is registered as NOT persistent subscribe, // for shadow update. // describe("Shadow Update request for NOT persistent subscribe thing", function() { it("should unsubscribe from related topics (accepted/rejected)", function() { // Reinit mockMQTTClientObject mockMQTTClientObject.reInitCommandCalled(); mockMQTTClientObject.resetPublishedMessage(); // Init thingShadowClient var thingShadows = thingShadow( { keyPath:'test/data/private.pem.key', certPath:'test/data/certificate.pem.crt', caPath:'test/data/root-CA.crt', clientId:'dummy-client-1', region:'us-east-1' } ); // Register a thing thingShadows.register('testShadow4', {persistentSubscribe:false}); // Unsub once there is a feedback // Generate fake payload myPayload = '{"state":{"desired":{"color":"RED"},"reported":{"color":"BLUE"}},"clientToken":"CoolToken1"}'; myStateObject = JSON.parse(myPayload); // Update thingShadows.update('testShadow4', myStateObject); mockMQTTClientObject.emit('message', '$aws/things/testShadow4/shadow/update/accepted', '{"clientToken":"CoolToken1", "version":2}'); assert.equal(mockMQTTClientObject.commandCalled['unsubscribe'], 1); // Unregister it thingShadows.unregister('testShadow4'); }); }); // // Verify that related topics are not unsubscribed on feedback for persistent subscription // describe("Feedback comes for persistent subscribed thing for shadow Update", function() { it("should never unsubscribe to the related topics", function() { // Reinit mockMQTTClientObject mockMQTTClientObject.reInitCommandCalled(); mockMQTTClientObject.resetPublishedMessage(); // Init thingShadowClient var thingShadows = thingShadow( { keyPath:'test/data/private.pem.key', certPath:'test/data/certificate.pem.crt', caPath:'test/data/root-CA.crt', clientId:'dummy-client-1', region:'us-east-1' }); // Register a thing thingShadows.register('testShadow4'); // Generate fake payload myPayload = '{"state":{"desired":{"color":"RED"},"reported":{"color":"BLUE"}},"clientToken":"CoolToken1"}'; myStateObject = JSON.parse(myPayload); // Update thingShadows.update('testShadow4', myStateObject); mockMQTTClientObject.emit('message', '$aws/things/testShadow4/shadow/update/accepted', '{"clientToken":"CoolToken1","version":7}'); // sync local version // Check assert.equal(mockMQTTClientObject.commandCalled['unsubscribe'], 0); // Never unsub // Unregister it thingShadows.unregister('testShadow4'); }); }); // // Verify that version is added to the payload if it is available when the thing is registered as NOT persistent subscribe, // for shadow update. // describe("Version available in local for NOT persistent subscribe thing for shadow Update", function() { it("should include version in published payload", function() { // Reinit mockMQTTClientObject mockMQTTClientObject.reInitCommandCalled(); mockMQTTClientObject.resetPublishedMessage(); // Faking timer var clock = sinon.useFakeTimers(); // Init thingShadowClient var thingShadows = thingShadow( { keyPath:'test/data/private.pem.key', certPath:'test/data/certificate.pem.crt', caPath:'test/data/root-CA.crt', clientId:'dummy-client-1', region:'us-east-1' }); // Register a thing thingShadows.register('testShadow4', {persistentSubscribe:false, enableVersioning: true}); // Unsub once there is a feedback // Generate fake payload myPayload = '{"state":{"desired":{"color":"RED"},"reported":{"color":"BLUE"}},"clientToken":"CoolToken1"}'; myStateObject = JSON.parse(myPayload); // Update thingShadows.update('testShadow4', myStateObject); clock.tick(3000); mockMQTTClientObject.emit('message', '$aws/things/testShadow4/shadow/update/accepted', '{"clientToken":"CoolToken1","version":7}'); // sync local version // Update again thingShadows.update('testShadow4', myStateObject); clock.tick(3000); assert.equal(mockMQTTClientObject.lastPublishedMessage, '{"state":{"desired":{"color":"RED"},"reported":{"color":"BLUE"}},"clientToken":"CoolToken1","version":7}'); // Unregister it thingShadows.unregister('testShadow4'); clock.restore(); }); }); // // Verify that timeout triggers the callback for shadow Update timeout. // describe("Update request timeout", function() { it("should call timeout callback", function() { // Reinit mockMQTTClientObject mockMQTTClientObject.reInitCommandCalled(); mockMQTTClientObject.resetPublishedMessage(); // Faking timer var clock = sinon.useFakeTimers(); // Faking callback var fakeCallback = sinon.spy(); // Init thingShadowClient var thingShadows = thingShadow( { keyPath:'test/data/private.pem.key', certPath:'test/data/certificate.pem.crt', caPath:'test/data/root-CA.crt', clientId:'dummy-client-1', region:'us-east-1', }, { operationTimeout:1000, // Set operation timeout to be 1 sec } ); // Register callback thingShadows.on('timeout', fakeCallback); // Register a thing thingShadows.register('testShadow4', { persistentSubscribe: false } ); // Generate fake payload myPayload = '{"state":{"desired":{"color":"RED"},"reported":{"color":"BLUE"}},"clientToken":"CoolToken1"}'; myStateObject = JSON.parse(myPayload); // Update thingShadows.update('testShadow4', myStateObject); // clock.tick(3000); // 3 sec later... // assert(fakeCallback.calledOnce); // Unregister it thingShadows.unregister('testShadow4'); clock.restore(); }); }); // // Verify that incoming messages with wrong/none token for shadow Get/Delete are ignored. // describe("Incoming messages are missing/messed up with token for shadow Update", function() { it("should never call callback", function() { // Faking callback fakeCallback = sinon.spy(); // Reinit mockMQTTClientObject mockMQTTClientObject.reInitCommandCalled(); mockMQTTClientObject.resetPublishedMessage(); // Init thingShadowClient var thingShadows = thingShadow( { keyPath:'test/data/private.pem.key', certPath:'test/data/certificate.pem.crt', caPath:'test/data/root-CA.crt', clientId:'dummy-client-1', region:'us-east-1' } ); // Register a callback thingShadows.on('status', fakeCallback); // Register a thing thingShadows.register('testShadow4'); // Generate fake payload myPayload = '{"state":{"desired":{"color":"RED"},"reported":{"color":"BLUE"}},"clientToken":"CoolToken1"}'; myStateObject = JSON.parse(myPayload); // Update thingShadows.update('testShadow4', myStateObject); mockMQTTClientObject.emit('message', '$aws/things/testShadow4/shadow/update/accepted', '{"clientToken":"Garbage1", "version":2}'); // wrong token thingShadows.update('testShadow4', myStateObject); mockMQTTClientObject.emit('message', '$aws/things/testShadow4/shadow/update/accepted', '{"version":2}'); // no token // Check sinon.assert.notCalled(fakeCallback); // Should never trigger the callback // Unregister it thingShadows.unregister('testShadow4'); }); }); // // Verify that incoming message with out-of-date/none version for shadow Get/Delete are ignored. // describe("Incoming messages are missing/messed up with version for shadow Update", function() { it("should never call callback", function() { // Faking callback fakeCallbackStatus = sinon.spy(); fakeCallbackTimeout = sinon.spy(); // Faking timer var clock = sinon.useFakeTimers(); // Reinit mockMQTTClientObject mockMQTTClientObject.reInitCommandCalled(); mockMQTTClientObject.resetPublishedMessage(); // Init thingShadowClient var thingShadows = thingShadow( { keyPath:'test/data/private.pem.key', certPath:'test/data/certificate.pem.crt', caPath:'test/data/root-CA.crt', clientId:'dummy-client-1', region:'us-east-1' }, { operationTimeout:1000 // Set operation timeout to be 1 sec } ); // Register a callback thingShadows.on('status', fakeCallbackStatus); thingShadows.on('timeout', fakeCallbackTimeout); // Register a thing thingShadows.register('testShadow4'); // Generate fake payload myPayload = '{"state":{"desired":{"color":"RED"},"reported":{"color":"BLUE"}},"clientToken":"CoolToken1"}'; myStateObject = JSON.parse(myPayload); // Update thingShadows.update('testShadow4', myStateObject); mockMQTTClientObject.emit('message', '$aws/things/testShadow4/shadow/update/accepted', '{"clientToken":"CoolToken1", "version":3}'); // delay 3 sec and check if the callback is not called clock.tick(3000); assert(fakeCallbackStatus.calledOnce); sinon.assert.notCalled(fakeCallbackTimeout); fakeCallbackStatus.reset(); // Reset spy status fakeCallbackTimeout.reset(); // Reset spy timeout thingShadows.update('testShadow4', myStateObject); mockMQTTClientObject.emit('message', '$aws/things/testShadow4/shadow/update/accepted', '{"clientToken":"CoolToken1", "version":1}'); // old version clock.tick(3000); // Check sinon.assert.notCalled(fakeCallbackStatus); assert(fakeCallbackTimeout.calledOnce); //Unregister it thingShadows.unregister('testShadow4'); // clock.restore(); }); }); // // Verify that inbound malformed JSON is properly ignored. // describe("Inbound message contains malformed JSON for shadow Update feedback", function() { it("should properly ignore the malformed JSON", function() { // Faking callback fakeCallback = sinon.spy(); // Reinit mockMQTTClientObject mockMQTTClientObject.reInitCommandCalled(); mockMQTTClientObject.resetPublishedMessage(); // Init thingShadowClient var thingShadows = thingShadow( { keyPath:'test/data/private.pem.key', certPath:'test/data/certificate.pem.crt', caPath:'test/data/root-CA.crt', clientId:'dummy-client-1', region:'us-east-1', debug: true } ); // Register a callback thingShadows.on('status', fakeCallback); // Register a thing thingShadows.register('testShadow4'); // Generate fake payload myPayload = '{"state":{"desired":{"color":"RED"},"reported":{"color":"BLUE"}},"clientToken":"CoolToken1"}'; myStateObject = JSON.parse(myPayload); // Update thingShadows.update('testShadow4', myStateObject); mockMQTTClientObject.emit('message', '$aws/things/testShadow4/shadow/update/accepted', '{"clientTo'); // Malformed inbound JSON // Check sinon.assert.notCalled(fakeCallback); //Unregister it thingShadows.unregister('testShadow4'); }); }); // // Verify that version is inserted in the outbound payload for shadow update when available. // describe("Update when local version is available (persistent subscribe)", function() { it("should automatically include the local version into the payload", function() { // Reinit mockMQTTClientObject mockMQTTClientObject.reInitCommandCalled(); mockMQTTClientObject.resetPublishedMessage(); // Init thingShadowClient var thingShadows = thingShadow( { keyPath:'test/data/private.pem.key', certPath:'test/data/certificate.pem.crt', caPath:'test/data/root-CA.crt', clientId:'dummy-client-1', region:'us-east-1' } ); // Register a thing thingShadows.register('testShadow4', { debug: true, discardStale: true, enableVersioning: true } ); // Generate fake payload myPayload = '{"state":{"desired":{"color":"RED"},"reported":{"color":"BLUE"}},"clientToken":"CoolToken1"}'; myStateObject = JSON.parse(myPayload); // Update thingShadows.update('testShadow4', myStateObject); mockMQTTClientObject.emit('message', '$aws/things/testShadow4/shadow/update/accepted', '{"clientToken":"CoolToken1","version":7}'); // sync local version // Update again thingShadows.update('testShadow4', myStateObject); assert.equal(mockMQTTClientObject.lastPublishedMessage, '{"state":{"desired":{"color":"RED"},"reported":{"color":"BLUE"}},"clientToken":"CoolToken1","version":7}'); // Unregister it thingShadows.unregister('testShadow4'); }); }); // // Verify that version is not inserted in the outbound payload for shadow update when // versioning is disabled. // describe("Update when local version is available (persistent subscribe)", function() { it("should not include the local version into the payload", function() { // Reinit mockMQTTClientObject mockMQTTClientObject.reInitCommandCalled(); mockMQTTClientObject.resetPublishedMessage(); // Init thingShadowClient var thingShadows = thingShadow( { keyPath:'test/data/private.pem.key', certPath:'test/data/certificate.pem.crt', caPath:'test/data/root-CA.crt', clientId:'dummy-client-1', region:'us-east-1' } ); // Register a thing thingShadows.register('testShadow4', { debug: true, discardStale: true, enableVersioning: false } ); // Generate fake payload myPayload = '{"state":{"desired":{"color":"RED"},"reported":{"color":"BLUE"}},"clientToken":"CoolToken1"}'; myStateObject = JSON.parse(myPayload); // Update thingShadows.update('testShadow4', myStateObject); mockMQTTClientObject.emit('message', '$aws/things/testShadow4/shadow/update/accepted', '{"clientToken":"CoolToken1","version":8}'); // sync local version // Update again thingShadows.update('testShadow4', myStateObject); assert.equal(mockMQTTClientObject.lastPublishedMessage, '{"state":{"desired":{"color":"RED"},"reported":{"color":"BLUE"}},"clientToken":"CoolToken1"}'); // Unregister it thingShadows.unregister('testShadow4'); }); }); // // Verify that including version in the payload for update is not allowed. // describe("Include version in the payload for shadow update", function() { it("should return null", function() { // Reinit mockMQTTClientObject mockMQTTClientObject.reInitCommandCalled(); mockMQTTClientObject.resetPublishedMessage(); // Init thingShadowClient var thingShadows = thingShadow( { keyPath:'test/data/private.pem.key', certPath:'test/data/certificate.pem.crt', caPath:'test/data/root-CA.crt', clientId:'dummy-client-1', region:'us-east-1' } ); // Register a thing thingShadows.register('testShadow4'); // Generate fake payload myPayload = '{"state":{"desired":{"color":"RED"},"reported":{"color":"BLUE"}},"clientToken":"CoolToken1","version":10}'; myStateObject = JSON.parse(myPayload); // Update assert.equal(thingShadows.update('testShadow4', myStateObject), null); }); }); /**** non-shadow inbound MQTT messages handling ****/ // // Verify that non-shadow MQTT messages are well handled. // describe("Inbound non-shadow messages handling", function() { it("should call corresponding callback", function() { // Faking callback fakeCallback = sinon.spy(); // Reinit mockMQTTClientObject mockMQTTClientObject.reInitCommandCalled(); mockMQTTClientObject.resetPublishedMessage(); // Init thingShadowClient var thingShadows = thingShadow( { keyPath:'test/data/private.pem.key', certPath:'test/data/certificate.pem.crt', caPath:'test/data/root-CA.crt', clientId:'dummy-client-1', region:'us-east-1' } ); // Register non-shadow callback thingShadows.on('message', fakeCallback); // subscribe to some topic thingShadows.subscribe("some/topic"); mockMQTTClientObject.emit('message', 'some/topic', 'A Brand New Message.'); mockMQTTClientObject.emit('message', 'some/topic', 'Another Brand New Message.'); // Check assert(fakeCallback.calledTwice); }); }); /**** multiple shadows ****/ // // Verify that registering/unregistering multiple shadows will not affect each other // describe("Register 3 different shadows and then unregister 2", function() { it("should never throw error", function() { // Reinit mockMQTTClientObject mockMQTTClientObject.reInitCommandCalled(); mockMQTTClientObject.resetPublishedMessage(); // Init thingShadowClient var thingShadows = thingShadow( { keyPath:'test/data/private.pem.key', certPath:'test/data/certificate.pem.crt', caPath:'test/data/root-CA.crt', clientId:'dummy-client-1', region:'us-east-1' } ); assert.doesNotThrow(function(err) { // Register 3 shadows thingShadows.register('Triplets1'); thingShadows.register('Triplets2'); thingShadows.register('Triplets3'); // Unregister 2 shadows thingShadows.unregister('Triplets2'); thingShadows.unregister('Triplets3'); // Fire a get thingShadows.get('Triplets1'); // Clean up thingShadows.unregister('Triplets1'); }, function(err) { console.log('\t['+err+']'); return true;}); }) }); // // Verify that incoming deltas can be distributed to the correct user callbacks // describe("Deltas from different shadows come in", function() { it("should call the correct user callbacks", function() { var called1 = false; var called2 = false; var called3 = false; // Define a general delta callback var distributor = function(thingName, stateObject) { if(thingName === 'Triplets1') {called1 = true;} else if(thingName === 'Triplets2') {called2 = true;} else if(thingName === 'Triplets3') {called3 = true;} }; // Reinit mockMQTTClientObject mockMQTTClientObject.reInitCommandCalled(); mockMQTTClientObject.resetPublishedMessage(); // Init thingShadowClient var thingShadows = thingShadow( { keyPath:'test/data/private.pem.key', certPath:'test/data/certificate.pem.crt', caPath:'test/data/root-CA.crt', clientId:'dummy-client-1', region:'us-east-1' } ); // Register delta callback thingShadows.on('delta', distributor); // Register 3 shadows thingShadows.register('Triplets1'); thingShadows.register('Triplets2'); thingShadows.register('Triplets3'); // Faking deltas mockMQTTClientObject.emit('message', '$aws/things/Triplets1/shadow/update/delta', '{"state":{"desired":{"color":"RED"}}, "version":1}'); mockMQTTClientObject.emit('message', '$aws/things/Triplets3/shadow/update/delta', '{"state":{"desired":{"color":"BLUE"}}, "version":2}'); // Check assert.equal(called1, true); assert.equal(called2, false); assert.equal(called3, true); // Unregister them thingShadows.unregister('Triplets1'); thingShadows.unregister('Triplets2'); thingShadows.unregister('Triplets3'); }); }); // // Verify that unregistered thing operations give an error. // describe("Unregistered things give errors", function() { it("should return null for update/get/delete", function() { // Reinit mockMQTTClientObject mockMQTTClientObject.reInitCommandCalled(); mockMQTTClientObject.resetPublishedMessage(); // Init thingShadowClient var thingShadows = thingShadow( { keyPath:'test/data/private.pem.key', certPath:'test/data/certificate.pem.crt', caPath:'test/data/root-CA.crt', clientId:'dummy-client-1', region:'us-east-1', debug:true } ); clientToken = thingShadows.get('UnknownThing1'); assert.equal(clientToken, null); clientToken = thingShadows.update('UnknownThing2', { } ); assert.equal(clientToken, null); clientToken = thingShadows.delete('UnknownThing3' ); assert.equal(clientToken, null); }); }); // // Verify that events from the mqtt client are propagated upwards // describe("Ensure that events are propagated upwards", function() { it("should emit the corresponding events", function() { // Reinit mockMQTTClientObject mockMQTTClientObject.reInitCommandCalled(); // Init thingShadowClient var thingShadows = thingShadow( { keyPath:'test/data/private.pem.key', certPath:'test/data/certificate.pem.crt', caPath:'test/data/root-CA.crt', clientId:'dummy-client-1', region:'us-east-1' } ); // Register a thing thingShadows.register('testShadow3'); // Register a fake callback var fakeCallback1 = sinon.spy(); var fakeCallback2 = sinon.spy(); var fakeCallback3 = sinon.spy(); var fakeCallback4 = sinon.spy(); var fakeCallback5 = sinon.spy(); thingShadows.on('connect', fakeCallback1); thingShadows.on('close', fakeCallback2); thingShadows.on('reconnect', fakeCallback3); thingShadows.on('offline', fakeCallback4); thingShadows.on('error', fakeCallback5); // Now emit messages mockMQTTClientObject.emit('connect'); mockMQTTClientObject.emit('close'); mockMQTTClientObject.emit('reconnect'); mockMQTTClientObject.emit('offline'); mockMQTTClientObject.emit('error'); assert(fakeCallback1.calledOnce); assert(fakeCallback2.calledOnce); assert(fakeCallback3.calledOnce); assert(fakeCallback4.calledOnce); assert(fakeCallback5.calledOnce); }); }); // // Verify that foreign state changes (update|delete accepted with no known client token) // are reported via 'foreignStateChange' events. // describe("Test handling of accepted state updates by foreign clients", function() { it("should not call status callback but it should call foreignStateChange callback", function() { // Faking callback fakeCallback = sinon.spy(); fakeCallback2 = sinon.spy(); // Reinit mockMQTTClientObject mockMQTTClientObject.reInitCommandCalled(); mockMQTTClientObject.resetPublishedMessage(); // Init thingShadowClient var thingShadows = thingShadow( { keyPath:'test/data/private.pem.key', certPath:'test/data/certificate.pem.crt', caPath:'test/data/root-CA.crt', clientId:'dummy-client-1', region:'us-east-1' } ); // Register fake callbacks thingShadows.on('status', fakeCallback); thingShadows.on('foreignStateChange', fakeCallback2); // Register a thing thingShadows.register('testShadow3'); // Get mockMQTTClientObject.emit('message', '$aws/things/testShadow3/shadow/update/accepted', '{"stateVar":"value111", "clientToken":"Unknown1", "version":2}'); // unknown token sinon.assert.notCalled(fakeCallback); // Should never trigger the callback sinon.assert.calledOnce(fakeCallback2); // Should be triggered assert.equal(fakeCallback2.getCalls()[0].args[0],'testShadow3'); assert.equal(fakeCallback2.getCalls()[0].args[1],'update'); assert.deepEqual(fakeCallback2.getCalls()[0].args[2],{stateVar:'value111'}); mockMQTTClientObject.emit('message', '$aws/things/testShadow3/shadow/delete/accepted', '{ "version":1, "timestamp":1456254966, "clientToken": "unknownClienToken" }'); sinon.assert.notCalled(fakeCallback); // Should never trigger the callback sinon.assert.calledTwice(fakeCallback2); // Should be triggered assert.equal(fakeCallback2.getCalls()[1].args[0],'testShadow3'); assert.equal(fakeCallback2.getCalls()[1].args[1],'delete'); assert.deepEqual(fakeCallback2.getCalls()[1].args[2],{'timestamp':1456254966}); mockMQTTClientObject.emit('message', '$aws/things/testShadow3/shadow/get/accepted', '{ "state": { "desired": { "value": 1 }}, "version":1, "timestamp":1456254966, "clientToken": "unknownClienToken" }'); sinon.assert.notCalled(fakeCallback); // Should never trigger the callback sinon.assert.calledTwice(fakeCallback2); // Should never trigger the callback // Unregister it thingShadows.unregister('testShadow3'); }); }); // // Verify that shadow operations are performed using the correct qos values // describe("Verify that MQTT operations use the correct shadow qos values", function() { var clock; before( function() { clock = sinon.useFakeTimers(); } ); after( function() { clock.restore(); } ); it("should subscribe and publish at the configured qos", function() { // Reinit mockMQTTClientObject mockMQTTClientObject.reInitCommandCalled(); mockMQTTClientObject.resetPublishedMessage(); var operationTimeout = 15000; // Init thingShadowClient var thingShadows = thingShadow( { keyPath:'test/data/private.pem.key', certPath:'test/data/certificate.pem.crt', caPath:'test/data/root-CA.crt', clientId:'dummy-client-1', region:'us-east-1', operationTimeout: operationTimeout } ); // Register a fake callback var fakeCallback = sinon.spy(); // Register a thing thingShadows.register('testShadow1'); thingShadows.on('timeout', fakeCallback ); assert.equal( mockMQTTClientObject.subscribeQosValues.shift(), 0); assert.equal( mockMQTTClientObject.subscribeQosValues.shift(), 0); assert.equal( mockMQTTClientObject.subscribeQosValues.shift(), 0); assert.equal( mockMQTTClientObject.subscribeQosValues.shift(), 0); assert.equal( mockMQTTClientObject.subscribeQosValues.shift(), 0); assert.equal( mockMQTTClientObject.subscribeQosValues.shift(), 0); assert.equal( mockMQTTClientObject.subscribeQosValues.shift(), 0); assert.equal( mockMQTTClientObject.subscribeQosValues.shift(), undefined); assert.equal( mockMQTTClientObject.subscriptions.shift(), '$aws/things/testShadow1/shadow/update/delta'); assert.equal( mockMQTTClientObject.subscriptions.shift(), '$aws/things/testShadow1/shadow/update/accepted'); assert.equal( mockMQTTClientObject.subscriptions.shift(), '$aws/things/testShadow1/shadow/update/rejected'); assert.equal( mockMQTTClientObject.subscriptions.shift(), '$aws/things/testShadow1/shadow/get/accepted'); assert.equal( mockMQTTClientObject.subscriptions.shift(), '$aws/things/testShadow1/shadow/get/rejected'); assert.equal( mockMQTTClientObject.subscriptions.shift(), '$aws/things/testShadow1/shadow/delete/accepted'); assert.equal( mockMQTTClientObject.subscriptions.shift(), '$aws/things/testShadow1/shadow/delete/rejected'); assert.equal( mockMQTTClientObject.subscriptions.shift(), undefined); // // Now check that publishes use the right qos. // thingShadows.update('testShadow1', { "state": "value" } ); assert.equal( mockMQTTClientObject.publishQosValues.shift(), 0); assert.equal( mockMQTTClientObject.publishQosValues.shift(), undefined); sinon.assert.notCalled(fakeCallback); clock.tick( operationTimeout ); sinon.assert.calledOnce(fakeCallback); thingShadows.get('testShadow1' ); assert.equal( mockMQTTClientObject.publishQosValues.shift(), 0); assert.equal( mockMQTTClientObject.publishQosValues.shift(), undefined); sinon.assert.calledOnce(fakeCallback); clock.tick( operationTimeout ); sinon.assert.calledTwice(fakeCallback); thingShadows.delete('testShadow1' ); assert.equal( mockMQTTClientObject.publishQosValues.shift(), 0); assert.equal( mockMQTTClientObject.publishQosValues.shift(), undefined); sinon.assert.calledTwice(fakeCallback); clock.tick( operationTimeout ); sinon.assert.calledThrice(fakeCallback); thingShadows.unregister('testShadow1'); thingShadows.register('testShadow2', { qos: 1 }); assert.equal( mockMQTTClientObject.subscribeQosValues.shift(), 1); assert.equal( mockMQTTClientObject.subscribeQosValues.shift(), 1); assert.equal( mockMQTTClientObject.subscribeQosValues.shift(), 1); assert.equal( mockMQTTClientObject.subscribeQosValues.shift(), 1); assert.equal( mockMQTTClientObject.subscribeQosValues.shift(), 1); assert.equal( mockMQTTClientObject.subscribeQosValues.shift(), 1); assert.equal( mockMQTTClientObject.subscribeQosValues.shift(), 1); assert.equal( mockMQTTClientObject.subscribeQosValues.shift(), undefined); assert.equal( mockMQTTClientObject.subscriptions.shift(), '$aws/things/testShadow2/shadow/update/delta'); assert.equal( mockMQTTClientObject.subscriptions.shift(), '$aws/things/testShadow2/shadow/update/accepted'); assert.equal( mockMQTTClientObject.subscriptions.shift(), '$aws/things/testShadow2/shadow/update/rejected'); assert.equal( mockMQTTClientObject.subscriptions.shift(), '$aws/things/testShadow2/shadow/get/accepted'); assert.equal( mockMQTTClientObject.subscriptions.shift(), '$aws/things/testShadow2/shadow/get/rejected'); assert.equal( mockMQTTClientObject.subscriptions.shift(), '$aws/things/testShadow2/shadow/delete/accepted'); assert.equal( mockMQTTClientObject.subscriptions.shift(), '$aws/things/testShadow2/shadow/delete/rejected'); assert.equal( mockMQTTClientObject.subscriptions.shift(), undefined); // // Now check that publishes use the right qos. // thingShadows.update('testShadow2', { "state": "value" } ); assert.equal( mockMQTTClientObject.publishQosValues.shift(), 1); assert.equal( mockMQTTClientObject.publishQosValues.shift(), undefined); clock.tick( operationTimeout ); thingShadows.get('testShadow2' ); assert.equal( mockMQTTClientObject.publishQosValues.shift(), 1); assert.equal( mockMQTTClientObject.publishQosValues.shift(), undefined); clock.tick( operationTimeout ); thingShadows.delete('testShadow2' ); assert.equal( mockMQTTClientObject.publishQosValues.shift(), 1); assert.equal( mockMQTTClientObject.publishQosValues.shift(), undefined); clock.tick( operationTimeout ); thingShadows.unregister('testShadow2'); }); }); });
(function(global) { var canvas, gl, program, points = [], pressedKeys = {}; glUtils.SL.init({ callback:function() { main(); } }); function main() { canvas = document.getElementById("glcanvas"); gl = glUtils.checkWebGL(canvas, { preserveDrawingBuffer: true }); initShaders(); initBuffers(gl); gl.clearColor(0, 0, 0, 1); gl.clear(gl.COLOR_BUFFER_BIT); draw(); } function initShaders() { var vertexShader = glUtils.getShader(gl, gl.VERTEX_SHADER, glUtils.SL.Shaders.v1.vertex), fragmentShader = glUtils.getShader(gl, gl.FRAGMENT_SHADER, glUtils.SL.Shaders.v1.fragment); program = glUtils.createProgram(gl, vertexShader, fragmentShader); gl.useProgram(program); } // draw! function draw() { points.push({x:+0.0, y:+0.0, c:[Math.random(), Math.random(), Math.random(), 1.0]}); points.push({x:+0.25, y:+0.0, c:[Math.random(), Math.random(), Math.random(), 1.0]}); points.push({x:+0.0, y:+0.25, c:[Math.random(), Math.random(), Math.random(), 1.0]}); var pointsArray = [], colorsArray = []; for (var i=0; i<points.length; i++) { pointsArray.push(points[i].x); pointsArray.push(points[i].y); colorsArray.push(points[i].c[0]); colorsArray.push(points[i].c[1]); colorsArray.push(points[i].c[2]); colorsArray.push(points[i].c[3]); } var arrays = [ {name:'aColor', array:colorsArray, size:4}, {name:'aPosition', array:pointsArray, size:2} ]; var n = pointsArray.length/2; renderBuffers(arrays); gl.clear(gl.COLOR_BUFFER_BIT); gl.drawArrays(gl.TRIANGLES, 0, n); } // Create and set the buffers function initBuffers(gl) { var attributes = program.vertexShader.attributes; for (var i=0; i<attributes.length; i++) { program[attributes[i].name] = gl.createBuffer(); } } // Render the buffers function renderBuffers(arrays) { var attributes = program.vertexShader.attributes; for (var i=0; i<attributes.length; i++) { var name = attributes[i].name; for (var j=0; j<arrays.length; j++) { if (name == arrays[j].name) { var attr = gl.getAttribLocation(program, name); gl.enableVertexAttribArray(attr); gl.bindBuffer(gl.ARRAY_BUFFER, program[name]); gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(arrays[j].array), gl.STATIC_DRAW); gl.vertexAttribPointer(attr, arrays[j].size, gl.FLOAT, false, 0, 0); } } } // Scaling is simple! var uScale = gl.getUniformLocation(program, 'uScale'); gl.uniform2f(uScale, 3, 1); } })(window || this);
import React from 'react'; import ReactDOM from 'react-dom'; import App from './sellpage1/App'; import './sellpage1/index.css'; ReactDOM.render( <App />, document.getElementById('sellpage1') );
module.exports = function(grunt) { grunt.initConfig({ pkg: '<json:package.json>', browserify: { dist: { options: { transform: [ ["babelify", "reactify"] ] }, files: { "www/js/bundle.js": "src/js/app.jsx" } } }, shell: { phonegap: { command: function(platform) { return 'phonegap build ' + platform; } }, livereload: { command: function() { return 'node livereload/app.js /../www/ /../www/js/bundle.js'; } } }, watch: { theme: { files: 'src/**/*', tasks: ['gulp'], options: { debounceDelay: 500, }, }, }, copy: { main: { files: [ // includes files within path { expand: true, cwd: 'src/', src: ['index.html', 'icon.png', 'res/**/*', ], dest: 'www/', filter: 'isFile' } ] }, } }); grunt.loadNpmTasks("grunt-browserify"); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-shell'); grunt.registerTask('build', ['browserify']); grunt.registerTask('livereload', ['shell:livereload']); grunt.registerTask('default', ['copy', 'browserify', 'shell:phonegap:ios']); };
import { test } from 'qunit'; import moduleForAcceptance from 'auth-flow/tests/helpers/module-for-acceptance'; import { currentURL } from 'ember-native-dom-helpers'; import { invalidateSession } from 'auth-flow/tests/helpers/ember-simple-auth'; import LoginPage from '../pages/login-page'; moduleForAcceptance('Acceptance | login flow', { afterEach() { return invalidateSession(this.application); } }); test('user should be able to login', async function(assert) { await LoginPage.visit(); await LoginPage.username('user'); await LoginPage.password('password'); await LoginPage.clickLoginButton(); assert.equal(currentURL(), '/protected'); }); test('user should see error message about invalid credentials', async function( assert ) { await LoginPage.visit(); await LoginPage.username('admin'); await LoginPage.password('password'); await LoginPage.clickLoginButton(); assert.ok(LoginPage.errorsText()); });
/** * Created by liekkas on 16/4/11. */ import React, { PropTypes } from 'react' import { Select, Button, Icon } from 'antd' const styles = { root: { marginRight: '10px', }, label: { color: '#E2E3E4', } } class Condition extends React.Component { constructor(props) { super(props) this.state = { option: props.defaultOption ? props.defaultOption : typeof(props.options[0]) === 'object' ? props.options[0].en : props.options[0], } } handleChange(value) { this.setState({option: value}) this.props.onConditionChange(value) } getValue() { return this.state.option } render() { const { label, options, width, showSearch, defaultOption } = this.props const p = { showSearch, defaultValue: this.state.option, style: { width }, placeholder: '请选择', searchPlaceholder: '请输入关键词', optionFilterProp: 'children', notFoundContent: '无法找到', } return ( <div style={styles.root}> { label !== '' ? <label style={styles.label}>{label} &nbsp;&nbsp;</label> : null } <Select {...p} onChange={(v) => this.handleChange(v)}> { typeof(options[0]) === 'object' ? options.map(({cn, en}, index) => <Option value={en} key={index}>{cn}</Option> ) : options.map((name, index) => <Option value={name} key={index}>{name}</Option> ) } </Select> </div> ) } } Condition.propTypes = { label: PropTypes.string.isRequired, options: PropTypes.array.isRequired, onConditionChange: PropTypes.func, defaultOption: PropTypes.string, width: PropTypes.number, showSearch: PropTypes.bool, } Condition.defaultProps = { label: '', options: [], defaultOption: null, width: 100, showSearch: false, } export default Condition
/** * Fiber History Model * @class * @extends {Fiber.Model} */ Fiber.HistoryItem = Fiber.Model.extend({ /** * Model defaults * @type {Object} */ defaults: { route: null, args: null }, /** * Validation rules * @type {Object} */ rules: { route: { required: true, validators: [ function(val) { return val instanceof Fiber.Route; } ] }, args: { validators: [_.isObjectLike] } } });
'use strict'; describe("SplashCode Unit Tests", function() { beforeEach(module('myApp')); var $httpBackend; var SplashCode; beforeEach(inject(function($injector, _SplashCode_) { SplashCode = _SplashCode_; $httpBackend = $injector.get('$httpBackend'); $httpBackend.when('GET', 'http://mywifi.dev:8080/api/v1/locations/123/splash_codes') .respond(200, { location_id: 123 }); $httpBackend.when('GET', 'http://mywifi.dev:8080/api/v1/locations/123/splash_codes/456') .respond(200, {}); $httpBackend.when('PATCH', 'http://mywifi.dev:8080/api/v1/locations/123/splash_codes/456') .respond(200, {}); $httpBackend.when('POST', 'http://mywifi.dev:8080/api/v1/locations/123/splash_codes') .respond(200, {}); $httpBackend.when('DELETE', 'http://mywifi.dev:8080/api/v1/locations/123/splash_codes/546') .respond(200, {}); $httpBackend.whenGET('/translations/en_GB.json').respond(""); })); afterEach(function() { $httpBackend.verifyNoOutstandingExpectation(); $httpBackend.verifyNoOutstandingRequest(); }); it('should have sent a GET request to location splash_codes', function() { var result = SplashCode.get({location_id: 123}) $httpBackend.expectGET('http://mywifi.dev:8080/api/v1/locations/123/splash_codes') $httpBackend.flush(); }); it('should have sent a GET request to location show splash_codes', function() { var result = SplashCode.query({location_id: 123, id: 456}) $httpBackend.expectGET('http://mywifi.dev:8080/api/v1/locations/123/splash_codes/456') $httpBackend.flush(); }); it('should have sent a PATCH request to location splash_codes', function() { var result = SplashCode.update({location_id: 123, id: 456}) $httpBackend.expectPATCH('http://mywifi.dev:8080/api/v1/locations/123/splash_codes/456') $httpBackend.flush(); }); it('should have sent a POST request to location splash_codes', function() { var result = SplashCode.create({location_id: 123}) $httpBackend.expectPOST('http://mywifi.dev:8080/api/v1/locations/123/splash_codes') $httpBackend.flush(); }); it('should have sent a delete request to location splash_codes', function() { var result = SplashCode.destroy({location_id: 123, id: 546}) $httpBackend.expectDELETE('http://mywifi.dev:8080/api/v1/locations/123/splash_codes/546') $httpBackend.flush(); }); })
/*global $*/ 'use strict'; angular.module('myApp.rebox.rebox-directive', []) .directive('rebox', function() { return { restrict: 'A', scope: { selector: '@reboxSelector' }, link: function(scope, element, attr) { $(element).rebox({ selector: scope.selector }); } }; }); angular.module('myApp.rebox', [ 'myApp.rebox.rebox-directive' ]);
/** * @providesModule ZeroProj.Redux.Reducers.Auth */ import { AUTH } from '../types'; const DEFAULT_STATES = { userData: null, }; export default function authReducer(state = DEFAULT_STATES, action) { if (action.type === AUTH.AUTHORIZE) { const { payload } = action; return { ...state, userData: payload }; } if (action.type === AUTH.DEAUTHORIZE) return { ...state, userData: null }; return state; }
angular.module("stocker.directives",[]) ;
// Copyright (c) 2012 Ecma International. All rights reserved. // Ecma International makes this code available under the terms and conditions set // forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the // "Use Terms"). Any redistribution of this code must retain the above // copyright and this notice and otherwise comply with the Use Terms. /*--- es5id: 15.4.4.15-2-6 description: > Array.prototype.lastIndexOf - 'length' is an inherited data property on an Array-like object includes: [runTestCase.js] ---*/ function testcase() { var proto = { length: 2 }; var Con = function () {}; Con.prototype = proto; var child = new Con(); child[1] = "x"; child[2] = "y"; return Array.prototype.lastIndexOf.call(child, "x") === 1 && Array.prototype.lastIndexOf.call(child, "y") === -1; } runTestCase(testcase);
let expect = require("chai").expect; let mathEnforcer = require('../04. Math Enforcer.js') describe("mathEnforcer", function() { describe("addFive", function() { it("should return 5 for num = 0", function() { expect(mathEnforcer.addFive(0)).to.be.equal(5); }); it("should return -5 for num = -10", function() { expect(mathEnforcer.addFive(-10)).to.be.equal(-5); }); it("should return 7.5 for num = 2.5", function() { expect(mathEnforcer.addFive(2.5)).equal(2.5 + 5); }); it("should return undefined for num = 'str'", function() { expect(mathEnforcer.addFive('str')).to.be.undefined; }); }); describe("subtractTen", function() { it("should return 0 for num = 10", function() { expect(mathEnforcer.subtractTen(10)).to.be.equal(0); }); it("should return 0.5 for num = 10.5", function() { expect(mathEnforcer.subtractTen(10.5)).equal(10.5 - 10) }); it("should return -30 for num = -20", function() { expect(mathEnforcer.subtractTen(-20)).to.be.equal(-30); }); it("should return undefined for num = '10'", function() { expect(mathEnforcer.subtractTen('10')).to.be.undefined; }); }); describe("sum", function() { it("should return 20 for num1 = 10, num2 = 10", function() { expect(mathEnforcer.sum(10, 10)).to.be.equal(20); }); it("should return 20 for num1 = -20, num2 = 10", function() { expect(mathEnforcer.sum(-20, 10)).to.be.equal(-10); }); it("should return 20 for num1 = 10, num2 = -20", function() { expect(mathEnforcer.sum(10, -20)).to.be.equal(-10); }); it("should return 20 for num1 = 10, num2 = -20", function() { expect(mathEnforcer.sum(10.5, -20)).equal(-9.5); }); it("should return 20 for num1 = 10, num2 = -20", function() { expect(mathEnforcer.sum(10, -20.5)).equal(-10.5); }); it("should return 20 for num1 = 10, num2 = -20", function() { expect(mathEnforcer.sum(10.5, -20.5)).equal(-10); }); it("should return undefined for num1 = '10', num2 = 10", function() { expect(mathEnforcer.sum('10', 10)).to.be.undefined; }); it("should return undefined for num1 = 15, num2 = '8'", function() { expect(mathEnforcer.sum(15, '8')).to.be.undefined; }); it("should return undefined for num1 = 15, num2 = ''", function() { expect(mathEnforcer.sum(15)).to.be.undefined; }); it("should return undefined for num1 = '', num2 = 15", function() { expect(mathEnforcer.sum('', 15)).to.be.undefined; }); }); });
/* exported functionTest */ var functionTest = (function() { 'use strict'; var items, iItem, beforeEach, list, listBBox, listBorderTop, listBorderBottom, indexLabel; function escapeHtml(text) { return (text || '') .replace(/\&/g, '&amp;') .replace(/\'/g, '&#x27;') .replace(/\`/g, '&#x60;') .replace(/\"/g, '&quot;') .replace(/\</g, '&lt;') .replace(/\>/g, '&gt;'); } function getCode(fnc) { var matches, lines = fnc.toString() .replace(/^\s*function\s*\(\)\s*\{\s*?( *\S[\s\S]*?)\s*\}\s*$/, '$1').split('\n'); if ((matches = /^( +)/.exec(lines[0]))) { lines = lines.map(function(line) { return line.replace(new RegExp('^' + matches[1]), ''); }); } return lines.map(function(line) { return escapeHtml(line).replace(/^(.*?)(\/\/.*)$/g, function(s, code, comment) { return code + '<span class="comment">' + comment + '</span>'; }); }).join('<br>').replace(/(\/\*[\s\S]*?\*\/)/g, function(s, comment) { return '<span class="comment">' + comment + '</span>'; }); } function selectItem(i) { var itemBBox = items[i].label.getBoundingClientRect(), hiddenH; if ((hiddenH = itemBBox.bottom - (listBBox.bottom - listBorderBottom)) > 0) { // bottom first list.scrollTop = i < items.length - 1 ? list.scrollTop + hiddenH : list.scrollHeight - list.clientHeight; } if ((hiddenH = (listBBox.top + listBorderTop) - itemBBox.top) > 0) { list.scrollTop = i > 0 ? list.scrollTop - hiddenH : 0; } items[i].input.checked = true; indexLabel.textContent = i + 1; if (beforeEach) { beforeEach(); } items[i].fnc(); iItem = i; } function resetList() { var MIN_H = 320, listH; listH = document.documentElement.clientHeight - (list.getBoundingClientRect().top + window.pageYOffset); if (listH < MIN_H) { listH = MIN_H; } list.style.height = listH + 'px'; listBBox = list.getBoundingClientRect(); // re-get } function functionTest() { var i, btnNext, caseLabel, head; for (i = 0; i < arguments.length; i++) { if (Array.isArray(arguments[i])) { items = arguments[i]; } else if (typeof arguments[i] === 'function') { beforeEach = arguments[i]; } } list = document.createElement('div'); list.id = 'list'; items.forEach(function(testCase, i) { var input = list.appendChild(document.createElement('input')), label = list.appendChild(document.createElement('label')), pre = label.appendChild(document.createElement('pre')), id = 'case-' + i; testCase.input = input; testCase.label = label; input.setAttribute('type', 'radio'); input.setAttribute('name', 'case'); input.id = id; label.setAttribute('for', id); pre.innerHTML = getCode(testCase.fnc); input.addEventListener('click', function() { selectItem(i); }, false); }); btnNext = document.createElement('button'); btnNext.id = 'btn-next'; btnNext.textContent = 'NEXT'; btnNext.addEventListener('click', function() { selectItem(iItem < items.length - 1 ? iItem + 1 : 0); }, false); indexLabel = document.createElement('span'); caseLabel = document.createElement('span'); caseLabel.id = 'case-label'; caseLabel.appendChild(document.createTextNode('Test Case #')); caseLabel.appendChild(indexLabel); caseLabel.appendChild(document.createTextNode(' / ' + items.length)); head = document.createElement('div'); head.id = 'list-head'; head.appendChild(btnNext); head.appendChild(caseLabel); document.body.appendChild(head); document.body.appendChild(list); // `borderWidth` is empty in Gecko listBorderTop = parseFloat(getComputedStyle(list, '').borderTopWidth); listBorderBottom = parseFloat(getComputedStyle(list, '').borderBottomWidth); resetList(); window.addEventListener('resize', resetList); selectItem(0); } return functionTest; })();
$(function(){$(".jobs-carousel").each(function(i,e){var s="carousel"+i;this.id=s,$(this).slick({slide:"#"+s+" li",slidesToShow:1,slidesToScroll:1,slidesPerRow:1,infinite:!1,vertical:!0,verticalSwiping:!0})})});var resizeId;$(window).resize(function(){clearTimeout(resizeId),resizeId=setTimeout(function(){$(".jobs-carousel").slick("setPosition")},500)});
module.exports = function(config) { config.set({ basePath: './', frameworks: ['jasmine'], files: [ // Polyfills. 'node_modules/core-js/client/shim.min.js', 'node_modules/reflect-metadata/Reflect.js', // System.js for module loading 'node_modules/systemjs/public/system-polyfills.js', 'node_modules/systemjs/public/system.src.js', // Zone.js dependencies 'node_modules/zone.js/public/zone.js', 'node_modules/zone.js/public/long-stack-trace-zone.js', 'node_modules/zone.js/public/proxy.js', 'node_modules/zone.js/public/sync-test.js', 'node_modules/zone.js/public/jasmine-patch.js', 'node_modules/zone.js/public/async-test.js', 'node_modules/zone.js/public/fake-async-test.js', // RxJs. { pattern: 'node_modules/rxjs/**/*.js', included: false, watched: false }, { pattern: 'node_modules/rxjs/**/*.js.map', included: false, watched: false }, {pattern: 'karma-test-shim.js', included: true, watched: true}, // paths loaded via module imports // Angular itself {pattern: 'node_modules/@angular/**/*.js', included: false, watched: true}, {pattern: 'node_modules/@angular/**/*.js.map', included: false, watched: true}, // Our built application code {pattern: 'public/**/*.js', included: false, watched: true}, // paths loaded via Angular's component compiler // (these paths need to be rewritten, see proxies section) {pattern: 'public/**/*.html', included: false, watched: true}, {pattern: 'public/**/*.css', included: false, watched: true}, // paths to support debugging with source maps in dev tools {pattern: 'src/**/*.ts', included: false, watched: true}, //{pattern: 'public/**/*.js.map', included: false, watched: false} ], // proxied base paths proxies: { // required for component assests fetched by Angular's compiler "/app/": "/base/public/app/" }, reporters: ['progress', 'verbose'], port: 9876, colors: true, logLevel: config.LOG_INFO, autoWatch: true, browsers: ['Chrome'], singleRun: false }) }
'use strict'; var context = require('../../lib/context'); var chai = require('chai'); var chaiAsPromised = require('chai-as-promised'); chai.should(); chai.use(chaiAsPromised); global.chaiAsPromised = chaiAsPromised; global.expect = chai.expect; function fakeStream() { var buffer = ''; return { write: function(s) { buffer += s; }, reset: function() { buffer = ''; }, value: function() { return buffer; } }; } context.setOutput(fakeStream(), fakeStream());
import React, { Component } from 'react'; import axios from 'axios'; import { Panel } from 'react-bootstrap/lib'; import Style from '../util/Style.js'; import Urls from '../util/Urls.js'; import PostBoard from './PostBoard.js'; import CreatePostButton from './CreatePostButton.js'; import TopNavbar from './TopNavbar.js'; class App extends Component { constructor(props) { super(props); this.state = { windowWidth: window.innerWidth, posts: [], errors: [], }; } componentWillMount() { this.getPosts(); } getPosts() { axios.get(`${Urls.api}/posts`) .then((res) => { this.setState({ posts: res.data }); }, ) .catch(() => { this.setState({ errors: ['Backend API connection error'] }); }, ); } // only removes from frontend not DB removePost(index) { const { posts } = this.state; posts.splice(index, 1); this.setState({ posts }); } // only adds to frontend not DB addPost(post) { const { posts } = this.state; posts.push(post); this.setState({ posts }); } render() { const { windowWidth, posts } = this.state; let width; if (windowWidth < Style.xsCutoff) { width = '100%'; } else if (windowWidth < Style.smCutoff) { width = '723px'; } else if (windowWidth < Style.mdCutoff) { width = '933px'; } else { width = '1127px'; } const panelStyle = { width, margin: 'auto', marginTop: '65px', }; return ( <div> <TopNavbar /> <Panel style={panelStyle} bsStyle="primary"> <h2>Welcome to Your GoDoRP App</h2> <CreatePostButton addPost={this.addPost.bind(this)} /> <PostBoard posts={posts} removePost={this.removePost.bind(this)} /> </Panel> </div> ); } } export default App;
const ProvinceCard = require('../../provincecard.js'); const { TargetModes } = require('../../Constants'); class ShamefulDisplay extends ProvinceCard { setupCardAbilities(ability) { this.action({ title: 'Dishonor/Honor two characters', target: { mode: TargetModes.Exactly, numCards: 2, activePromptTitle: 'Select two characters', cardCondition: card => card.isParticipating(), gameAction: [ability.actions.honor(), ability.actions.dishonor()] }, effect: 'change the personal honor of {0}', handler: context => { if(!context.target) { return; } if(context.target.every(card => !card.allowGameAction('honor', context))) { this.game.promptForSelect(context.player, { activePromptTitle: 'Choose a character to dishonor', context: context, gameAction: ability.actions.dishonor(), cardCondition: card => context.target.includes(card), onSelect: (player, card) => { this.resolveShamefulDisplay(context, context.target.find(c => c !== card), card); return true; } }); } else if(context.target.every(card => !card.allowGameAction('dishonor', context))) { this.game.promptForSelect(context.player, { activePromptTitle: 'Choose a character to honor', context: context, gameAction: ability.actions.honor(), cardCondition: card => context.target.includes(card), onSelect: (player, card) => { this.resolveShamefulDisplay(context, card, context.target.find(c => c !== card)); return true; } }); } else { this.promptToChooseHonorOrDishonor(context.target, context); } } }); } promptToChooseHonorOrDishonor(cards, context) { let choices = ['Honor', 'Dishonor']; let handlers = choices.map(choice => { return () => this.chooseCharacter(choice, cards, context); }); this.game.promptWithHandlerMenu(context.player, { activePromptTitle: 'Choose a character to:', context: context, choices: choices, handlers: handlers }); } chooseCharacter(choice, cards, context) { let promptTitle = 'Choose a character to dishonor'; let condition = card => cards.includes(card) && card.allowGameAction('dishonor', context); if(choice === 'Honor') { promptTitle = 'Choose a character to honor'; condition = card => cards.includes(card) && card.allowGameAction('honor', context); } this.game.promptForSelect(context.player, { activePromptTitle: promptTitle, context: context, cardCondition: condition, buttons: [{ text: 'Back', arg: 'back'}], onSelect: (player, card) => { let otherCard = cards.find(c => c !== card); if(choice === 'Honor') { this.resolveShamefulDisplay(context, card, otherCard); } else { this.resolveShamefulDisplay(context, otherCard, card); } return true; }, onMenuCommand: (player, arg) => { if(arg === 'back') { this.promptToChooseHonorOrDishonor(cards, context); return true; } } }); } resolveShamefulDisplay(context, cardToHonor, cardToDishonor) { this.game.applyGameAction(context, { honor: cardToHonor, dishonor: cardToDishonor }); } } ShamefulDisplay.id = 'shameful-display'; module.exports = ShamefulDisplay;
import authMessages from 'ringcentral-integration/modules/Auth/authMessages'; export default { [authMessages.internalError]: "内部エラーにより、ログインに失敗しました。後でもう一度やり直してください。", [authMessages.accessDenied]: "アクセスが拒否されました。サポートにお問い合わせください。", [authMessages.sessionExpired]: "セッションの有効期限が切れました。サインインしてください。" }; // @key: @#@"[authMessages.internalError]"@#@ @source: @#@"Login failed due to internal errors. Please try again later."@#@ // @key: @#@"[authMessages.accessDenied]"@#@ @source: @#@"Access denied. Please contact support."@#@ // @key: @#@"[authMessages.sessionExpired]"@#@ @source: @#@"Session expired. Please sign in."@#@
Router.map(function() { this.route("home", { path: "/", layoutTemplate: "homeLayout" }); return this.route("dashboard", { path: "/dashboard", waitOn: function() { return [subs.subscribe('posts'), subs.subscribe('comments'), subs.subscribe('attachments')]; }, data: function() { return { posts: Posts.find({}, { sort: { createdAt: -1 } }).fetch() }; } }); });
import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; import * as RawActions from '../../actions/RawActions'; import LegendComponent from './legendComponent'; function mapStateToProps(state) { return { app: state.app, }; } function mapDispatchToProps(dispatch) { const allActions = Object.assign({}, bindActionCreators(RawActions, dispatch), { dispatch }); return allActions; } export default connect(mapStateToProps, mapDispatchToProps)(LegendComponent);
function is_quote(c) { return c == '"' || c == "'"; } function last(array) { return array[array.length - 1]; } export default function parse(input) { let c = ''; let temp = ''; let name = ''; let stack = []; let result = { textures: [] }; let w = ''; let words = []; let i = 0; while ((c = input[i++]) !== undefined) { if (c == '"' || c == "'") { if (last(stack) == c) { stack.pop(); } else { stack.push(c); } } if (c == '{' && !is_quote(last(stack))) { if (!stack.length) { name = temp; temp = ''; } else { temp += c; } stack.push(c); } else if (c == '}' && !is_quote(last(stack))) { stack.pop(); if (!stack.length) { let key = name.trim() let value = temp.trim().replace(/^\(+|\)+$/g, ''); if (key.length) { if (key.startsWith('texture')) { result.textures.push({ name: key, value: value }); } else { result[key] = value; } } name = temp = ''; } else { temp += c; } } else { if (/\s/.test(c) && w.length) { words.push(w); w = ''; let need_break = (words[words.length - 3] == '#define') || (words[words.length - 2] == '#ifdef') || (words[words.length - 1] == '#else') || (words[words.length - 1] == '#endif'); if (need_break) { temp = temp + '\n'; } } else { w += c; } temp += c; } } if (result.fragment === undefined) { return { fragment: input, textures: [] } } return result; }
imageManagement.controller('ListCtrl', function AppCtrl ($scope, $routeParams, $http) { $scope.loading = true; $http({method: 'GET', url: '/api/count/all'}).success(function(data, status, headers, config) { $scope.currentPage = Number($routeParams.page); if(typeof $scope.currentPage !== 'number' || $scope.currentPage < 1) { $scope.currentPage = 1; } $scope.pageSize = 10; var from = ($scope.currentPage - 1) * $scope.pageSize; var to = from + $scope.pageSize; $scope.prevUrl = "#/index/" + ($scope.currentPage-1); $scope.nextUrl = "#/index/" + ($scope.currentPage+1); $scope.count = data.count; $scope.numberOfPages = function() { return Math.ceil($scope.count/$scope.pageSize); }; $http({method: 'GET', url: '/api/list/all/'+from+'/'+to}). success(function(data, status, headers, config) { $scope.imagesInfos = data; $scope.loading = false; $scope.$broadcast('dataLoaded'); }); }) } ) imageManagement.directive('tagsInput', function ($timeout) { return { restrict: 'C', link: function (scope, elem, attrs) { $timeout(function(){ elem.tagsInput({ height: 60, width: 300 }); if(scope.imageInfo && scope.imageInfo.tags) { elem.importTags(scope.imageInfo.tags.join(",")); } }); } }; }); imageManagement.directive('imageUpdate', function ($timeout) { return { restrict: 'A', link: function (scope, elem, attrs) { $timeout(function() { elem.on("submit", function() { var originalBtnValue = elem.find(".submit").val(); elem.find(".submit").val("Saving...") elem.find(".submit").attr('disabled','disabled'); $.ajax({ type: "POST", url: elem.attr("action"), data: elem.serialize(), success: function(html) { elem.find(".submit").val(originalBtnValue) elem.find(".submit").removeAttr("disabled") }, error: function() { window.location.reload() } }); return false; }) }); } }; }); imageManagement.directive('imageDelete', function ($timeout) { return { restrict: 'A', link: function (scope, elem, attrs) { $timeout(function() { elem.on("click", function() { var originalBtnValue = elem.text(); // elem.val("Deleting...") // elem.attr('disabled','disabled'); console.log("delete ["+scope.uid+"]") // $.ajax({ // type: "POST", // url: elem.attr("action"), // data: elem.serialize(), // // success: function(html) // { // elem.find(".btn").val(originalBtnValue) // elem.find(".btn").removeAttr("disabled") // }, // error: function() { // window.location.reload() // } // }); return false; }) }); } }; }); imageManagement.directive('imageUpload', function ($timeout) { return { restrict: 'A', link: function (scope, elem, attrs) { $timeout(function(){ var myDropzone = new Dropzone("form", {}); }); } }; }) imageManagement.controller('AccessControlCtrl', function AppCtrl ($scope, $http) { $scope.loading = true; $http({method: 'GET', url: '/api/acl/list'}).success(function(data, status, headers, config) { $scope.acls = data; if($scope.acls) { for(var i = 0 ; i < $scope.acls.length ;i++) { $scope.acls[i].link = window.location.protocol + "//" + window.location.host + "/?aclUid="+$scope.acls[i].uid } } $scope.loading = false; $scope.$broadcast('dataLoaded'); }) } ) imageManagement.directive('aclUpdate', function ($timeout) { return { restrict: 'A', link: function (scope, elem, attrs) { $timeout(function() { elem.on("submit", function() { var originalBtnValue = elem.find(".btn").val(); elem.find(".btn").val("Saving..."); elem.find(".btn").attr('disabled','disabled'); $.ajax({ type: "POST", url: elem.attr("action"), data: elem.serialize(), success: function(html) { elem.find(".btn").val(originalBtnValue); elem.find(".btn").removeAttr("disabled"); }, error: function() { window.location.reload(); } }); return false; }) }); } }; });
/* AngularJS v1.4.6 (c) 2010-2015 Google, Inc. http://angularjs.org License: MIT */ (function(Q,X,w){'use strict';function I(b){return function(){var a=arguments[0],c;c="["+(b?b+":":"")+a+"] http://errors.angularjs.org/1.4.6/"+(b?b+"/":"")+a;for(a=1;a<arguments.length;a++){c=c+(1==a?"?":"&")+"p"+(a-1)+"=";var d=encodeURIComponent,e;e=arguments[a];e="function"==typeof e?e.toString().replace(/ \{[\s\S]*$/,""):"undefined"==typeof e?"undefined":"string"!=typeof e?JSON.stringify(e):e;c+=d(e)}return Error(c)}}function Da(b){if(null==b||Za(b))return!1;var a="length"in Object(b)&&b.length; return b.nodeType===pa&&a?!0:G(b)||J(b)||0===a||"number"===typeof a&&0<a&&a-1 in b}function m(b,a,c){var d,e;if(b)if(x(b))for(d in b)"prototype"==d||"length"==d||"name"==d||b.hasOwnProperty&&!b.hasOwnProperty(d)||a.call(c,b[d],d,b);else if(J(b)||Da(b)){var f="object"!==typeof b;d=0;for(e=b.length;d<e;d++)(f||d in b)&&a.call(c,b[d],d,b)}else if(b.forEach&&b.forEach!==m)b.forEach(a,c,b);else if(lc(b))for(d in b)a.call(c,b[d],d,b);else if("function"===typeof b.hasOwnProperty)for(d in b)b.hasOwnProperty(d)&& a.call(c,b[d],d,b);else for(d in b)ta.call(b,d)&&a.call(c,b[d],d,b);return b}function mc(b,a,c){for(var d=Object.keys(b).sort(),e=0;e<d.length;e++)a.call(c,b[d[e]],d[e]);return d}function nc(b){return function(a,c){b(c,a)}}function Sd(){return++nb}function oc(b,a){a?b.$$hashKey=a:delete b.$$hashKey}function Mb(b,a,c){for(var d=b.$$hashKey,e=0,f=a.length;e<f;++e){var g=a[e];if(B(g)||x(g))for(var h=Object.keys(g),l=0,k=h.length;l<k;l++){var n=h[l],p=g[n];c&&B(p)?da(p)?b[n]=new Date(p.valueOf()):Oa(p)? b[n]=new RegExp(p):(B(b[n])||(b[n]=J(p)?[]:{}),Mb(b[n],[p],!0)):b[n]=p}}oc(b,d);return b}function P(b){return Mb(b,ua.call(arguments,1),!1)}function Td(b){return Mb(b,ua.call(arguments,1),!0)}function Y(b){return parseInt(b,10)}function Nb(b,a){return P(Object.create(b),a)}function y(){}function $a(b){return b}function qa(b){return function(){return b}}function pc(b){return x(b.toString)&&b.toString!==Object.prototype.toString}function v(b){return"undefined"===typeof b}function A(b){return"undefined"!== typeof b}function B(b){return null!==b&&"object"===typeof b}function lc(b){return null!==b&&"object"===typeof b&&!qc(b)}function G(b){return"string"===typeof b}function V(b){return"number"===typeof b}function da(b){return"[object Date]"===va.call(b)}function x(b){return"function"===typeof b}function Oa(b){return"[object RegExp]"===va.call(b)}function Za(b){return b&&b.window===b}function ab(b){return b&&b.$evalAsync&&b.$watch}function bb(b){return"boolean"===typeof b}function rc(b){return!(!b||!(b.nodeName|| b.prop&&b.attr&&b.find))}function Ud(b){var a={};b=b.split(",");var c;for(c=0;c<b.length;c++)a[b[c]]=!0;return a}function wa(b){return F(b.nodeName||b[0]&&b[0].nodeName)}function cb(b,a){var c=b.indexOf(a);0<=c&&b.splice(c,1);return c}function ga(b,a,c,d){if(Za(b)||ab(b))throw Ea("cpws");if(sc.test(va.call(a)))throw Ea("cpta");if(a){if(b===a)throw Ea("cpi");c=c||[];d=d||[];B(b)&&(c.push(b),d.push(a));var e;if(J(b))for(e=a.length=0;e<b.length;e++)a.push(ga(b[e],null,c,d));else{var f=a.$$hashKey;J(a)? a.length=0:m(a,function(b,c){delete a[c]});if(lc(b))for(e in b)a[e]=ga(b[e],null,c,d);else if(b&&"function"===typeof b.hasOwnProperty)for(e in b)b.hasOwnProperty(e)&&(a[e]=ga(b[e],null,c,d));else for(e in b)ta.call(b,e)&&(a[e]=ga(b[e],null,c,d));oc(a,f)}}else if(a=b,B(b)){if(c&&-1!==(f=c.indexOf(b)))return d[f];if(J(b))return ga(b,[],c,d);if(sc.test(va.call(b)))a=new b.constructor(b);else if(da(b))a=new Date(b.getTime());else if(Oa(b))a=new RegExp(b.source,b.toString().match(/[^\/]*$/)[0]),a.lastIndex= b.lastIndex;else if(x(b.cloneNode))a=b.cloneNode(!0);else return e=Object.create(qc(b)),ga(b,e,c,d);d&&(c.push(b),d.push(a))}return a}function ja(b,a){if(J(b)){a=a||[];for(var c=0,d=b.length;c<d;c++)a[c]=b[c]}else if(B(b))for(c in a=a||{},b)if("$"!==c.charAt(0)||"$"!==c.charAt(1))a[c]=b[c];return a||b}function ka(b,a){if(b===a)return!0;if(null===b||null===a)return!1;if(b!==b&&a!==a)return!0;var c=typeof b,d;if(c==typeof a&&"object"==c)if(J(b)){if(!J(a))return!1;if((c=b.length)==a.length){for(d=0;d< c;d++)if(!ka(b[d],a[d]))return!1;return!0}}else{if(da(b))return da(a)?ka(b.getTime(),a.getTime()):!1;if(Oa(b))return Oa(a)?b.toString()==a.toString():!1;if(ab(b)||ab(a)||Za(b)||Za(a)||J(a)||da(a)||Oa(a))return!1;c=ha();for(d in b)if("$"!==d.charAt(0)&&!x(b[d])){if(!ka(b[d],a[d]))return!1;c[d]=!0}for(d in a)if(!(d in c)&&"$"!==d.charAt(0)&&A(a[d])&&!x(a[d]))return!1;return!0}return!1}function db(b,a,c){return b.concat(ua.call(a,c))}function tc(b,a){var c=2<arguments.length?ua.call(arguments,2):[]; return!x(a)||a instanceof RegExp?a:c.length?function(){return arguments.length?a.apply(b,db(c,arguments,0)):a.apply(b,c)}:function(){return arguments.length?a.apply(b,arguments):a.call(b)}}function Vd(b,a){var c=a;"string"===typeof b&&"$"===b.charAt(0)&&"$"===b.charAt(1)?c=w:Za(a)?c="$WINDOW":a&&X===a?c="$DOCUMENT":ab(a)&&(c="$SCOPE");return c}function eb(b,a){if("undefined"===typeof b)return w;V(a)||(a=a?2:null);return JSON.stringify(b,Vd,a)}function uc(b){return G(b)?JSON.parse(b):b}function vc(b, a){var c=Date.parse("Jan 01, 1970 00:00:00 "+b)/6E4;return isNaN(c)?a:c}function Ob(b,a,c){c=c?-1:1;var d=vc(a,b.getTimezoneOffset());a=b;b=c*(d-b.getTimezoneOffset());a=new Date(a.getTime());a.setMinutes(a.getMinutes()+b);return a}function xa(b){b=C(b).clone();try{b.empty()}catch(a){}var c=C("<div>").append(b).html();try{return b[0].nodeType===Pa?F(c):c.match(/^(<[^>]+>)/)[1].replace(/^<([\w\-]+)/,function(a,b){return"<"+F(b)})}catch(d){return F(c)}}function wc(b){try{return decodeURIComponent(b)}catch(a){}} function xc(b){var a={};m((b||"").split("&"),function(b){var d,e,f;b&&(e=b=b.replace(/\+/g,"%20"),d=b.indexOf("="),-1!==d&&(e=b.substring(0,d),f=b.substring(d+1)),e=wc(e),A(e)&&(f=A(f)?wc(f):!0,ta.call(a,e)?J(a[e])?a[e].push(f):a[e]=[a[e],f]:a[e]=f))});return a}function Pb(b){var a=[];m(b,function(b,d){J(b)?m(b,function(b){a.push(la(d,!0)+(!0===b?"":"="+la(b,!0)))}):a.push(la(d,!0)+(!0===b?"":"="+la(b,!0)))});return a.length?a.join("&"):""}function ob(b){return la(b,!0).replace(/%26/gi,"&").replace(/%3D/gi, "=").replace(/%2B/gi,"+")}function la(b,a){return encodeURIComponent(b).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%3B/gi,";").replace(/%20/g,a?"%20":"+")}function Wd(b,a){var c,d,e=Qa.length;for(d=0;d<e;++d)if(c=Qa[d]+a,G(c=b.getAttribute(c)))return c;return null}function Xd(b,a){var c,d,e={};m(Qa,function(a){a+="app";!c&&b.hasAttribute&&b.hasAttribute(a)&&(c=b,d=b.getAttribute(a))});m(Qa,function(a){a+="app";var e;!c&&(e=b.querySelector("["+a.replace(":", "\\:")+"]"))&&(c=e,d=e.getAttribute(a))});c&&(e.strictDi=null!==Wd(c,"strict-di"),a(c,d?[d]:[],e))}function yc(b,a,c){B(c)||(c={});c=P({strictDi:!1},c);var d=function(){b=C(b);if(b.injector()){var d=b[0]===X?"document":xa(b);throw Ea("btstrpd",d.replace(/</,"&lt;").replace(/>/,"&gt;"));}a=a||[];a.unshift(["$provide",function(a){a.value("$rootElement",b)}]);c.debugInfoEnabled&&a.push(["$compileProvider",function(a){a.debugInfoEnabled(!0)}]);a.unshift("ng");d=fb(a,c.strictDi);d.invoke(["$rootScope", "$rootElement","$compile","$injector",function(a,b,c,d){a.$apply(function(){b.data("$injector",d);c(b)(a)})}]);return d},e=/^NG_ENABLE_DEBUG_INFO!/,f=/^NG_DEFER_BOOTSTRAP!/;Q&&e.test(Q.name)&&(c.debugInfoEnabled=!0,Q.name=Q.name.replace(e,""));if(Q&&!f.test(Q.name))return d();Q.name=Q.name.replace(f,"");aa.resumeBootstrap=function(b){m(b,function(b){a.push(b)});return d()};x(aa.resumeDeferredBootstrap)&&aa.resumeDeferredBootstrap()}function Yd(){Q.name="NG_ENABLE_DEBUG_INFO!"+Q.name;Q.location.reload()} function Zd(b){b=aa.element(b).injector();if(!b)throw Ea("test");return b.get("$$testability")}function zc(b,a){a=a||"_";return b.replace($d,function(b,d){return(d?a:"")+b.toLowerCase()})}function ae(){var b;if(!Ac){var a=pb();(ra=v(a)?Q.jQuery:a?Q[a]:w)&&ra.fn.on?(C=ra,P(ra.fn,{scope:Ra.scope,isolateScope:Ra.isolateScope,controller:Ra.controller,injector:Ra.injector,inheritedData:Ra.inheritedData}),b=ra.cleanData,ra.cleanData=function(a){var d;if(Qb)Qb=!1;else for(var e=0,f;null!=(f=a[e]);e++)(d= ra._data(f,"events"))&&d.$destroy&&ra(f).triggerHandler("$destroy");b(a)}):C=R;aa.element=C;Ac=!0}}function qb(b,a,c){if(!b)throw Ea("areq",a||"?",c||"required");return b}function Sa(b,a,c){c&&J(b)&&(b=b[b.length-1]);qb(x(b),a,"not a function, got "+(b&&"object"===typeof b?b.constructor.name||"Object":typeof b));return b}function Ta(b,a){if("hasOwnProperty"===b)throw Ea("badname",a);}function Bc(b,a,c){if(!a)return b;a=a.split(".");for(var d,e=b,f=a.length,g=0;g<f;g++)d=a[g],b&&(b=(e=b)[d]);return!c&& x(b)?tc(e,b):b}function rb(b){for(var a=b[0],c=b[b.length-1],d,e=1;a!==c&&(a=a.nextSibling);e++)if(d||b[e]!==a)d||(d=C(ua.call(b,0,e))),d.push(a);return d||b}function ha(){return Object.create(null)}function be(b){function a(a,b,c){return a[b]||(a[b]=c())}var c=I("$injector"),d=I("ng");b=a(b,"angular",Object);b.$$minErr=b.$$minErr||I;return a(b,"module",function(){var b={};return function(f,g,h){if("hasOwnProperty"===f)throw d("badname","module");g&&b.hasOwnProperty(f)&&(b[f]=null);return a(b,f,function(){function a(b, c,e,f){f||(f=d);return function(){f[e||"push"]([b,c,arguments]);return E}}function b(a,c){return function(b,e){e&&x(e)&&(e.$$moduleName=f);d.push([a,c,arguments]);return E}}if(!g)throw c("nomod",f);var d=[],e=[],r=[],t=a("$injector","invoke","push",e),E={_invokeQueue:d,_configBlocks:e,_runBlocks:r,requires:g,name:f,provider:b("$provide","provider"),factory:b("$provide","factory"),service:b("$provide","service"),value:a("$provide","value"),constant:a("$provide","constant","unshift"),decorator:b("$provide", "decorator"),animation:b("$animateProvider","register"),filter:b("$filterProvider","register"),controller:b("$controllerProvider","register"),directive:b("$compileProvider","directive"),config:t,run:function(a){r.push(a);return this}};h&&t(h);return E})}})}function ce(b){P(b,{bootstrap:yc,copy:ga,extend:P,merge:Td,equals:ka,element:C,forEach:m,injector:fb,noop:y,bind:tc,toJson:eb,fromJson:uc,identity:$a,isUndefined:v,isDefined:A,isString:G,isFunction:x,isObject:B,isNumber:V,isElement:rc,isArray:J, version:de,isDate:da,lowercase:F,uppercase:sb,callbacks:{counter:0},getTestability:Zd,$$minErr:I,$$csp:Fa,reloadWithDebugInfo:Yd});Rb=be(Q);Rb("ng",["ngLocale"],["$provide",function(a){a.provider({$$sanitizeUri:ee});a.provider("$compile",Cc).directive({a:fe,input:Dc,textarea:Dc,form:ge,script:he,select:ie,style:je,option:ke,ngBind:le,ngBindHtml:me,ngBindTemplate:ne,ngClass:oe,ngClassEven:pe,ngClassOdd:qe,ngCloak:re,ngController:se,ngForm:te,ngHide:ue,ngIf:ve,ngInclude:we,ngInit:xe,ngNonBindable:ye, ngPluralize:ze,ngRepeat:Ae,ngShow:Be,ngStyle:Ce,ngSwitch:De,ngSwitchWhen:Ee,ngSwitchDefault:Fe,ngOptions:Ge,ngTransclude:He,ngModel:Ie,ngList:Je,ngChange:Ke,pattern:Ec,ngPattern:Ec,required:Fc,ngRequired:Fc,minlength:Gc,ngMinlength:Gc,maxlength:Hc,ngMaxlength:Hc,ngValue:Le,ngModelOptions:Me}).directive({ngInclude:Ne}).directive(tb).directive(Ic);a.provider({$anchorScroll:Oe,$animate:Pe,$animateCss:Qe,$$animateQueue:Re,$$AnimateRunner:Se,$browser:Te,$cacheFactory:Ue,$controller:Ve,$document:We,$exceptionHandler:Xe, $filter:Jc,$$forceReflow:Ye,$interpolate:Ze,$interval:$e,$http:af,$httpParamSerializer:bf,$httpParamSerializerJQLike:cf,$httpBackend:df,$location:ef,$log:ff,$parse:gf,$rootScope:hf,$q:jf,$$q:kf,$sce:lf,$sceDelegate:mf,$sniffer:nf,$templateCache:of,$templateRequest:pf,$$testability:qf,$timeout:rf,$window:sf,$$rAF:tf,$$jqLite:uf,$$HashMap:vf,$$cookieReader:wf})}])}function gb(b){return b.replace(xf,function(a,b,d,e){return e?d.toUpperCase():d}).replace(yf,"Moz$1")}function Kc(b){b=b.nodeType;return b=== pa||!b||9===b}function Lc(b,a){var c,d,e=a.createDocumentFragment(),f=[];if(Sb.test(b)){c=c||e.appendChild(a.createElement("div"));d=(zf.exec(b)||["",""])[1].toLowerCase();d=ma[d]||ma._default;c.innerHTML=d[1]+b.replace(Af,"<$1></$2>")+d[2];for(d=d[0];d--;)c=c.lastChild;f=db(f,c.childNodes);c=e.firstChild;c.textContent=""}else f.push(a.createTextNode(b));e.textContent="";e.innerHTML="";m(f,function(a){e.appendChild(a)});return e}function R(b){if(b instanceof R)return b;var a;G(b)&&(b=T(b),a=!0);if(!(this instanceof R)){if(a&&"<"!=b.charAt(0))throw Tb("nosel");return new R(b)}if(a){a=X;var c;b=(c=Bf.exec(b))?[a.createElement(c[1])]:(c=Lc(b,a))?c.childNodes:[]}Mc(this,b)}function Ub(b){return b.cloneNode(!0)}function ub(b,a){a||vb(b);if(b.querySelectorAll)for(var c=b.querySelectorAll("*"),d=0,e=c.length;d<e;d++)vb(c[d])}function Nc(b,a,c,d){if(A(d))throw Tb("offargs");var e=(d=wb(b))&&d.events,f=d&&d.handle;if(f)if(a)m(a.split(" "),function(a){if(A(c)){var d=e[a];cb(d||[],c);if(d&&0<d.length)return}b.removeEventListener(a, f,!1);delete e[a]});else for(a in e)"$destroy"!==a&&b.removeEventListener(a,f,!1),delete e[a]}function vb(b,a){var c=b.ng339,d=c&&hb[c];d&&(a?delete d.data[a]:(d.handle&&(d.events.$destroy&&d.handle({},"$destroy"),Nc(b)),delete hb[c],b.ng339=w))}function wb(b,a){var c=b.ng339,c=c&&hb[c];a&&!c&&(b.ng339=c=++Cf,c=hb[c]={events:{},data:{},handle:w});return c}function Vb(b,a,c){if(Kc(b)){var d=A(c),e=!d&&a&&!B(a),f=!a;b=(b=wb(b,!e))&&b.data;if(d)b[a]=c;else{if(f)return b;if(e)return b&&b[a];P(b,a)}}} function xb(b,a){return b.getAttribute?-1<(" "+(b.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ").indexOf(" "+a+" "):!1}function yb(b,a){a&&b.setAttribute&&m(a.split(" "),function(a){b.setAttribute("class",T((" "+(b.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ").replace(" "+T(a)+" "," ")))})}function zb(b,a){if(a&&b.setAttribute){var c=(" "+(b.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ");m(a.split(" "),function(a){a=T(a);-1===c.indexOf(" "+a+" ")&&(c+=a+" ")});b.setAttribute("class", T(c))}}function Mc(b,a){if(a)if(a.nodeType)b[b.length++]=a;else{var c=a.length;if("number"===typeof c&&a.window!==a){if(c)for(var d=0;d<c;d++)b[b.length++]=a[d]}else b[b.length++]=a}}function Oc(b,a){return Ab(b,"$"+(a||"ngController")+"Controller")}function Ab(b,a,c){9==b.nodeType&&(b=b.documentElement);for(a=J(a)?a:[a];b;){for(var d=0,e=a.length;d<e;d++)if(A(c=C.data(b,a[d])))return c;b=b.parentNode||11===b.nodeType&&b.host}}function Pc(b){for(ub(b,!0);b.firstChild;)b.removeChild(b.firstChild)} function Wb(b,a){a||ub(b);var c=b.parentNode;c&&c.removeChild(b)}function Df(b,a){a=a||Q;if("complete"===a.document.readyState)a.setTimeout(b);else C(a).on("load",b)}function Qc(b,a){var c=Bb[a.toLowerCase()];return c&&Rc[wa(b)]&&c}function Ef(b,a){var c=function(c,e){c.isDefaultPrevented=function(){return c.defaultPrevented};var f=a[e||c.type],g=f?f.length:0;if(g){if(v(c.immediatePropagationStopped)){var h=c.stopImmediatePropagation;c.stopImmediatePropagation=function(){c.immediatePropagationStopped= !0;c.stopPropagation&&c.stopPropagation();h&&h.call(c)}}c.isImmediatePropagationStopped=function(){return!0===c.immediatePropagationStopped};1<g&&(f=ja(f));for(var l=0;l<g;l++)c.isImmediatePropagationStopped()||f[l].call(b,c)}};c.elem=b;return c}function uf(){this.$get=function(){return P(R,{hasClass:function(b,a){b.attr&&(b=b[0]);return xb(b,a)},addClass:function(b,a){b.attr&&(b=b[0]);return zb(b,a)},removeClass:function(b,a){b.attr&&(b=b[0]);return yb(b,a)}})}}function Ga(b,a){var c=b&&b.$$hashKey; if(c)return"function"===typeof c&&(c=b.$$hashKey()),c;c=typeof b;return c="function"==c||"object"==c&&null!==b?b.$$hashKey=c+":"+(a||Sd)():c+":"+b}function Ua(b,a){if(a){var c=0;this.nextUid=function(){return++c}}m(b,this.put,this)}function Ff(b){return(b=b.toString().replace(Sc,"").match(Tc))?"function("+(b[1]||"").replace(/[\s\r\n]+/," ")+")":"fn"}function fb(b,a){function c(a){return function(b,c){if(B(b))m(b,nc(a));else return a(b,c)}}function d(a,b){Ta(a,"service");if(x(b)||J(b))b=r.instantiate(b); if(!b.$get)throw Ha("pget",a);return p[a+"Provider"]=b}function e(a,b){return function(){var c=E.invoke(b,this);if(v(c))throw Ha("undef",a);return c}}function f(a,b,c){return d(a,{$get:!1!==c?e(a,b):b})}function g(a){qb(v(a)||J(a),"modulesToLoad","not an array");var b=[],c;m(a,function(a){function d(a){var b,c;b=0;for(c=a.length;b<c;b++){var e=a[b],f=r.get(e[0]);f[e[1]].apply(f,e[2])}}if(!n.get(a)){n.put(a,!0);try{G(a)?(c=Rb(a),b=b.concat(g(c.requires)).concat(c._runBlocks),d(c._invokeQueue),d(c._configBlocks)): x(a)?b.push(r.invoke(a)):J(a)?b.push(r.invoke(a)):Sa(a,"module")}catch(e){throw J(a)&&(a=a[a.length-1]),e.message&&e.stack&&-1==e.stack.indexOf(e.message)&&(e=e.message+"\n"+e.stack),Ha("modulerr",a,e.stack||e.message||e);}}});return b}function h(b,c){function d(a,e){if(b.hasOwnProperty(a)){if(b[a]===l)throw Ha("cdep",a+" <- "+k.join(" <- "));return b[a]}try{return k.unshift(a),b[a]=l,b[a]=c(a,e)}catch(f){throw b[a]===l&&delete b[a],f;}finally{k.shift()}}function e(b,c,f,h){"string"===typeof f&&(h= f,f=null);var g=[],k=fb.$$annotate(b,a,h),l,r,n;r=0;for(l=k.length;r<l;r++){n=k[r];if("string"!==typeof n)throw Ha("itkn",n);g.push(f&&f.hasOwnProperty(n)?f[n]:d(n,h))}J(b)&&(b=b[l]);return b.apply(c,g)}return{invoke:e,instantiate:function(a,b,c){var d=Object.create((J(a)?a[a.length-1]:a).prototype||null);a=e(a,d,b,c);return B(a)||x(a)?a:d},get:d,annotate:fb.$$annotate,has:function(a){return p.hasOwnProperty(a+"Provider")||b.hasOwnProperty(a)}}}a=!0===a;var l={},k=[],n=new Ua([],!0),p={$provide:{provider:c(d), factory:c(f),service:c(function(a,b){return f(a,["$injector",function(a){return a.instantiate(b)}])}),value:c(function(a,b){return f(a,qa(b),!1)}),constant:c(function(a,b){Ta(a,"constant");p[a]=b;t[a]=b}),decorator:function(a,b){var c=r.get(a+"Provider"),d=c.$get;c.$get=function(){var a=E.invoke(d,c);return E.invoke(b,null,{$delegate:a})}}}},r=p.$injector=h(p,function(a,b){aa.isString(b)&&k.push(b);throw Ha("unpr",k.join(" <- "));}),t={},E=t.$injector=h(t,function(a,b){var c=r.get(a+"Provider",b); return E.invoke(c.$get,c,w,a)});m(g(b),function(a){a&&E.invoke(a)});return E}function Oe(){var b=!0;this.disableAutoScrolling=function(){b=!1};this.$get=["$window","$location","$rootScope",function(a,c,d){function e(a){var b=null;Array.prototype.some.call(a,function(a){if("a"===wa(a))return b=a,!0});return b}function f(b){if(b){b.scrollIntoView();var c;c=g.yOffset;x(c)?c=c():rc(c)?(c=c[0],c="fixed"!==a.getComputedStyle(c).position?0:c.getBoundingClientRect().bottom):V(c)||(c=0);c&&(b=b.getBoundingClientRect().top, a.scrollBy(0,b-c))}else a.scrollTo(0,0)}function g(a){a=G(a)?a:c.hash();var b;a?(b=h.getElementById(a))?f(b):(b=e(h.getElementsByName(a)))?f(b):"top"===a&&f(null):f(null)}var h=a.document;b&&d.$watch(function(){return c.hash()},function(a,b){a===b&&""===a||Df(function(){d.$evalAsync(g)})});return g}]}function ib(b,a){if(!b&&!a)return"";if(!b)return a;if(!a)return b;J(b)&&(b=b.join(" "));J(a)&&(a=a.join(" "));return b+" "+a}function Gf(b){G(b)&&(b=b.split(" "));var a=ha();m(b,function(b){b.length&& (a[b]=!0)});return a}function Ia(b){return B(b)?b:{}}function Hf(b,a,c,d){function e(a){try{a.apply(null,ua.call(arguments,1))}finally{if(E--,0===E)for(;K.length;)try{K.pop()()}catch(b){c.error(b)}}}function f(){ia=null;g();h()}function g(){a:{try{u=n.state;break a}catch(a){}u=void 0}u=v(u)?null:u;ka(u,L)&&(u=L);L=u}function h(){if(z!==l.url()||q!==u)z=l.url(),q=u,m(O,function(a){a(l.url(),u)})}var l=this,k=b.location,n=b.history,p=b.setTimeout,r=b.clearTimeout,t={};l.isMock=!1;var E=0,K=[];l.$$completeOutstandingRequest= e;l.$$incOutstandingRequestCount=function(){E++};l.notifyWhenNoOutstandingRequests=function(a){0===E?a():K.push(a)};var u,q,z=k.href,N=a.find("base"),ia=null;g();q=u;l.url=function(a,c,e){v(e)&&(e=null);k!==b.location&&(k=b.location);n!==b.history&&(n=b.history);if(a){var f=q===e;if(z===a&&(!d.history||f))return l;var h=z&&Ja(z)===Ja(a);z=a;q=e;if(!d.history||h&&f){if(!h||ia)ia=a;c?k.replace(a):h?(c=k,e=a.indexOf("#"),e=-1===e?"":a.substr(e),c.hash=e):k.href=a;k.href!==a&&(ia=a)}else n[c?"replaceState": "pushState"](e,"",a),g(),q=u;return l}return ia||k.href.replace(/%27/g,"'")};l.state=function(){return u};var O=[],H=!1,L=null;l.onUrlChange=function(a){if(!H){if(d.history)C(b).on("popstate",f);C(b).on("hashchange",f);H=!0}O.push(a);return a};l.$$applicationDestroyed=function(){C(b).off("hashchange popstate",f)};l.$$checkUrlChange=h;l.baseHref=function(){var a=N.attr("href");return a?a.replace(/^(https?\:)?\/\/[^\/]*/,""):""};l.defer=function(a,b){var c;E++;c=p(function(){delete t[c];e(a)},b||0); t[c]=!0;return c};l.defer.cancel=function(a){return t[a]?(delete t[a],r(a),e(y),!0):!1}}function Te(){this.$get=["$window","$log","$sniffer","$document",function(b,a,c,d){return new Hf(b,d,a,c)}]}function Ue(){this.$get=function(){function b(b,d){function e(a){a!=p&&(r?r==a&&(r=a.n):r=a,f(a.n,a.p),f(a,p),p=a,p.n=null)}function f(a,b){a!=b&&(a&&(a.p=b),b&&(b.n=a))}if(b in a)throw I("$cacheFactory")("iid",b);var g=0,h=P({},d,{id:b}),l={},k=d&&d.capacity||Number.MAX_VALUE,n={},p=null,r=null;return a[b]= {put:function(a,b){if(!v(b)){if(k<Number.MAX_VALUE){var c=n[a]||(n[a]={key:a});e(c)}a in l||g++;l[a]=b;g>k&&this.remove(r.key);return b}},get:function(a){if(k<Number.MAX_VALUE){var b=n[a];if(!b)return;e(b)}return l[a]},remove:function(a){if(k<Number.MAX_VALUE){var b=n[a];if(!b)return;b==p&&(p=b.p);b==r&&(r=b.n);f(b.n,b.p);delete n[a]}delete l[a];g--},removeAll:function(){l={};g=0;n={};p=r=null},destroy:function(){n=h=l=null;delete a[b]},info:function(){return P({},h,{size:g})}}}var a={};b.info=function(){var b= {};m(a,function(a,e){b[e]=a.info()});return b};b.get=function(b){return a[b]};return b}}function of(){this.$get=["$cacheFactory",function(b){return b("templates")}]}function Cc(b,a){function c(a,b,c){var d=/^\s*([@&]|=(\*?))(\??)\s*(\w*)\s*$/,e={};m(a,function(a,f){var h=a.match(d);if(!h)throw fa("iscp",b,f,a,c?"controller bindings definition":"isolate scope definition");e[f]={mode:h[1][0],collection:"*"===h[2],optional:"?"===h[3],attrName:h[4]||f}});return e}function d(a){var b=a.charAt(0);if(!b|| b!==F(b))throw fa("baddir",a);if(a!==a.trim())throw fa("baddir",a);}var e={},f=/^\s*directive\:\s*([\w\-]+)\s+(.*)$/,g=/(([\w\-]+)(?:\:([^;]+))?;?)/,h=Ud("ngSrc,ngSrcset,src,srcset"),l=/^(?:(\^\^?)?(\?)?(\^\^?)?)?/,k=/^(on[a-z]+|formaction)$/;this.directive=function r(a,f){Ta(a,"directive");G(a)?(d(a),qb(f,"directiveFactory"),e.hasOwnProperty(a)||(e[a]=[],b.factory(a+"Directive",["$injector","$exceptionHandler",function(b,d){var f=[];m(e[a],function(e,h){try{var g=b.invoke(e);x(g)?g={compile:qa(g)}: !g.compile&&g.link&&(g.compile=qa(g.link));g.priority=g.priority||0;g.index=h;g.name=g.name||a;g.require=g.require||g.controller&&g.name;g.restrict=g.restrict||"EA";var k=g,l=g,r=g.name,n={isolateScope:null,bindToController:null};B(l.scope)&&(!0===l.bindToController?(n.bindToController=c(l.scope,r,!0),n.isolateScope={}):n.isolateScope=c(l.scope,r,!1));B(l.bindToController)&&(n.bindToController=c(l.bindToController,r,!0));if(B(n.bindToController)){var S=l.controller,E=l.controllerAs;if(!S)throw fa("noctrl", r);var ca;a:if(E&&G(E))ca=E;else{if(G(S)){var m=Uc.exec(S);if(m){ca=m[3];break a}}ca=void 0}if(!ca)throw fa("noident",r);}var s=k.$$bindings=n;B(s.isolateScope)&&(g.$$isolateBindings=s.isolateScope);g.$$moduleName=e.$$moduleName;f.push(g)}catch(w){d(w)}});return f}])),e[a].push(f)):m(a,nc(r));return this};this.aHrefSanitizationWhitelist=function(b){return A(b)?(a.aHrefSanitizationWhitelist(b),this):a.aHrefSanitizationWhitelist()};this.imgSrcSanitizationWhitelist=function(b){return A(b)?(a.imgSrcSanitizationWhitelist(b), this):a.imgSrcSanitizationWhitelist()};var n=!0;this.debugInfoEnabled=function(a){return A(a)?(n=a,this):n};this.$get=["$injector","$interpolate","$exceptionHandler","$templateRequest","$parse","$controller","$rootScope","$document","$sce","$animate","$$sanitizeUri",function(a,b,c,d,u,q,z,N,ia,O,H){function L(a,b){try{a.addClass(b)}catch(c){}}function W(a,b,c,d,e){a instanceof C||(a=C(a));m(a,function(b,c){b.nodeType==Pa&&b.nodeValue.match(/\S+/)&&(a[c]=C(b).wrap("<span></span>").parent()[0])});var f= S(a,b,a,c,d,e);W.$$addScopeClass(a);var h=null;return function(b,c,d){qb(b,"scope");d=d||{};var e=d.parentBoundTranscludeFn,g=d.transcludeControllers;d=d.futureParentElement;e&&e.$$boundTransclude&&(e=e.$$boundTransclude);h||(h=(d=d&&d[0])?"foreignobject"!==wa(d)&&d.toString().match(/SVG/)?"svg":"html":"html");d="html"!==h?C(Xb(h,C("<div>").append(a).html())):c?Ra.clone.call(a):a;if(g)for(var k in g)d.data("$"+k+"Controller",g[k].instance);W.$$addScopeInfo(d,b);c&&c(d,b);f&&f(b,d,d,e);return d}}function S(a, b,c,d,e,f){function h(a,c,d,e){var f,k,l,r,n,t,O;if(q)for(O=Array(c.length),r=0;r<g.length;r+=3)f=g[r],O[f]=c[f];else O=c;r=0;for(n=g.length;r<n;)if(k=O[g[r++]],c=g[r++],f=g[r++],c){if(c.scope){if(l=a.$new(),W.$$addScopeInfo(C(k),l),t=c.$$destroyBindings)c.$$destroyBindings=null,l.$on("$destroyed",t)}else l=a;t=c.transcludeOnThisElement?ba(a,c.transclude,e):!c.templateOnThisElement&&e?e:!e&&b?ba(a,b):null;c(f,l,k,d,t,c)}else f&&f(a,k.childNodes,w,e)}for(var g=[],k,l,r,n,q,t=0;t<a.length;t++){k=new aa; l=ca(a[t],[],k,0===t?d:w,e);(f=l.length?D(l,a[t],k,b,c,null,[],[],f):null)&&f.scope&&W.$$addScopeClass(k.$$element);k=f&&f.terminal||!(r=a[t].childNodes)||!r.length?null:S(r,f?(f.transcludeOnThisElement||!f.templateOnThisElement)&&f.transclude:b);if(f||k)g.push(t,f,k),n=!0,q=q||f;f=null}return n?h:null}function ba(a,b,c){return function(d,e,f,h,g){d||(d=a.$new(!1,g),d.$$transcluded=!0);return b(d,e,{parentBoundTranscludeFn:c,transcludeControllers:f,futureParentElement:h})}}function ca(a,b,c,d,e){var h= c.$attr,k;switch(a.nodeType){case pa:na(b,ya(wa(a)),"E",d,e);for(var l,r,n,q=a.attributes,t=0,O=q&&q.length;t<O;t++){var K=!1,H=!1;l=q[t];k=l.name;r=T(l.value);l=ya(k);if(n=ja.test(l))k=k.replace(Vc,"").substr(8).replace(/_(.)/g,function(a,b){return b.toUpperCase()});var S=l.replace(/(Start|End)$/,"");I(S)&&l===S+"Start"&&(K=k,H=k.substr(0,k.length-5)+"end",k=k.substr(0,k.length-6));l=ya(k.toLowerCase());h[l]=k;if(n||!c.hasOwnProperty(l))c[l]=r,Qc(a,l)&&(c[l]=!0);V(a,b,r,l,n);na(b,l,"A",d,e,K,H)}a= a.className;B(a)&&(a=a.animVal);if(G(a)&&""!==a)for(;k=g.exec(a);)l=ya(k[2]),na(b,l,"C",d,e)&&(c[l]=T(k[3])),a=a.substr(k.index+k[0].length);break;case Pa:if(11===Wa)for(;a.parentNode&&a.nextSibling&&a.nextSibling.nodeType===Pa;)a.nodeValue+=a.nextSibling.nodeValue,a.parentNode.removeChild(a.nextSibling);Ka(b,a.nodeValue);break;case 8:try{if(k=f.exec(a.nodeValue))l=ya(k[1]),na(b,l,"M",d,e)&&(c[l]=T(k[2]))}catch(E){}}b.sort(M);return b}function za(a,b,c){var d=[],e=0;if(b&&a.hasAttribute&&a.hasAttribute(b)){do{if(!a)throw fa("uterdir", b,c);a.nodeType==pa&&(a.hasAttribute(b)&&e++,a.hasAttribute(c)&&e--);d.push(a);a=a.nextSibling}while(0<e)}else d.push(a);return C(d)}function s(a,b,c){return function(d,e,f,h,g){e=za(e[0],b,c);return a(d,e,f,h,g)}}function D(a,b,d,e,f,h,g,k,r){function n(a,b,c,d){if(a){c&&(a=s(a,c,d));a.require=D.require;a.directiveName=y;if(u===D||D.$$isolateScope)a=Z(a,{isolateScope:!0});g.push(a)}if(b){c&&(b=s(b,c,d));b.require=D.require;b.directiveName=y;if(u===D||D.$$isolateScope)b=Z(b,{isolateScope:!0});k.push(b)}} function t(a,b,c,d){var e;if(G(b)){var f=b.match(l);b=b.substring(f[0].length);var h=f[1]||f[3],f="?"===f[2];"^^"===h?c=c.parent():e=(e=d&&d[b])&&e.instance;e||(d="$"+b+"Controller",e=h?c.inheritedData(d):c.data(d));if(!e&&!f)throw fa("ctreq",b,a);}else if(J(b))for(e=[],h=0,f=b.length;h<f;h++)e[h]=t(a,b[h],c,d);return e||null}function O(a,b,c,d,e,f){var h=ha(),g;for(g in d){var k=d[g],l={$scope:k===u||k.$$isolateScope?e:f,$element:a,$attrs:b,$transclude:c},r=k.controller;"@"==r&&(r=b[k.name]);l=q(r, l,!0,k.controllerAs);h[k.name]=l;ia||a.data("$"+k.name+"Controller",l.instance)}return h}function K(a,c,e,f,h,l){function r(a,b,c){var d;ab(a)||(c=b,b=a,a=w);ia&&(d=ca);c||(c=ia?N.parent():N);return h(a,b,d,c,za)}var n,q,H,E,ca,z,N;b===e?(f=d,N=d.$$element):(N=C(e),f=new aa(N,d));u&&(E=c.$new(!0));h&&(z=r,z.$$boundTransclude=h);ba&&(ca=O(N,f,z,ba,E,c));u&&(W.$$addScopeInfo(N,E,!0,!(L&&(L===u||L===u.$$originalDirective))),W.$$addScopeClass(N,!0),E.$$isolateBindings=u.$$isolateBindings,Y(c,f,E,E.$$isolateBindings, u,E));if(ca){var Va=u||S,m;Va&&ca[Va.name]&&(q=Va.$$bindings.bindToController,(H=ca[Va.name])&&H.identifier&&q&&(m=H,l.$$destroyBindings=Y(c,f,H.instance,q,Va)));for(n in ca){H=ca[n];var D=H();D!==H.instance&&(H.instance=D,N.data("$"+n+"Controller",D),H===m&&(l.$$destroyBindings(),l.$$destroyBindings=Y(c,f,D,q,Va)))}}n=0;for(l=g.length;n<l;n++)q=g[n],$(q,q.isolateScope?E:c,N,f,q.require&&t(q.directiveName,q.require,N,ca),z);var za=c;u&&(u.template||null===u.templateUrl)&&(za=E);a&&a(za,e.childNodes, w,h);for(n=k.length-1;0<=n;n--)q=k[n],$(q,q.isolateScope?E:c,N,f,q.require&&t(q.directiveName,q.require,N,ca),z)}r=r||{};for(var H=-Number.MAX_VALUE,S=r.newScopeDirective,ba=r.controllerDirectives,u=r.newIsolateScopeDirective,L=r.templateDirective,z=r.nonTlbTranscludeDirective,N=!1,m=!1,ia=r.hasElementTranscludeDirective,v=d.$$element=C(b),D,y,M,Ka=e,na,I=0,F=a.length;I<F;I++){D=a[I];var P=D.$$start,R=D.$$end;P&&(v=za(b,P,R));M=w;if(H>D.priority)break;if(M=D.scope)D.templateUrl||(B(M)?(Q("new/isolated scope", u||S,D,v),u=D):Q("new/isolated scope",u,D,v)),S=S||D;y=D.name;!D.templateUrl&&D.controller&&(M=D.controller,ba=ba||ha(),Q("'"+y+"' controller",ba[y],D,v),ba[y]=D);if(M=D.transclude)N=!0,D.$$tlb||(Q("transclusion",z,D,v),z=D),"element"==M?(ia=!0,H=D.priority,M=v,v=d.$$element=C(X.createComment(" "+y+": "+d[y]+" ")),b=v[0],U(f,ua.call(M,0),b),Ka=W(M,e,H,h&&h.name,{nonTlbTranscludeDirective:z})):(M=C(Ub(b)).contents(),v.empty(),Ka=W(M,e));if(D.template)if(m=!0,Q("template",L,D,v),L=D,M=x(D.template)? D.template(v,d):D.template,M=ga(M),D.replace){h=D;M=Sb.test(M)?Wc(Xb(D.templateNamespace,T(M))):[];b=M[0];if(1!=M.length||b.nodeType!==pa)throw fa("tplrt",y,"");U(f,v,b);F={$attr:{}};M=ca(b,[],F);var If=a.splice(I+1,a.length-(I+1));u&&A(M);a=a.concat(M).concat(If);Xc(d,F);F=a.length}else v.html(M);if(D.templateUrl)m=!0,Q("template",L,D,v),L=D,D.replace&&(h=D),K=Jf(a.splice(I,a.length-I),v,d,f,N&&Ka,g,k,{controllerDirectives:ba,newScopeDirective:S!==D&&S,newIsolateScopeDirective:u,templateDirective:L, nonTlbTranscludeDirective:z}),F=a.length;else if(D.compile)try{na=D.compile(v,d,Ka),x(na)?n(null,na,P,R):na&&n(na.pre,na.post,P,R)}catch(V){c(V,xa(v))}D.terminal&&(K.terminal=!0,H=Math.max(H,D.priority))}K.scope=S&&!0===S.scope;K.transcludeOnThisElement=N;K.templateOnThisElement=m;K.transclude=Ka;r.hasElementTranscludeDirective=ia;return K}function A(a){for(var b=0,c=a.length;b<c;b++)a[b]=Nb(a[b],{$$isolateScope:!0})}function na(b,d,f,h,g,k,l){if(d===g)return null;g=null;if(e.hasOwnProperty(d)){var n; d=a.get(d+"Directive");for(var q=0,t=d.length;q<t;q++)try{n=d[q],(v(h)||h>n.priority)&&-1!=n.restrict.indexOf(f)&&(k&&(n=Nb(n,{$$start:k,$$end:l})),b.push(n),g=n)}catch(H){c(H)}}return g}function I(b){if(e.hasOwnProperty(b))for(var c=a.get(b+"Directive"),d=0,f=c.length;d<f;d++)if(b=c[d],b.multiElement)return!0;return!1}function Xc(a,b){var c=b.$attr,d=a.$attr,e=a.$$element;m(a,function(d,e){"$"!=e.charAt(0)&&(b[e]&&b[e]!==d&&(d+=("style"===e?";":" ")+b[e]),a.$set(e,d,!0,c[e]))});m(b,function(b,f){"class"== f?(L(e,b),a["class"]=(a["class"]?a["class"]+" ":"")+b):"style"==f?(e.attr("style",e.attr("style")+";"+b),a.style=(a.style?a.style+";":"")+b):"$"==f.charAt(0)||a.hasOwnProperty(f)||(a[f]=b,d[f]=c[f])})}function Jf(a,b,c,e,f,h,g,k){var l=[],r,n,q=b[0],t=a.shift(),H=Nb(t,{templateUrl:null,transclude:null,replace:null,$$originalDirective:t}),O=x(t.templateUrl)?t.templateUrl(b,c):t.templateUrl,E=t.templateNamespace;b.empty();d(O).then(function(d){var K,u;d=ga(d);if(t.replace){d=Sb.test(d)?Wc(Xb(E,T(d))): [];K=d[0];if(1!=d.length||K.nodeType!==pa)throw fa("tplrt",t.name,O);d={$attr:{}};U(e,b,K);var z=ca(K,[],d);B(t.scope)&&A(z);a=z.concat(a);Xc(c,d)}else K=q,b.html(d);a.unshift(H);r=D(a,K,c,f,b,t,h,g,k);m(e,function(a,c){a==K&&(e[c]=b[0])});for(n=S(b[0].childNodes,f);l.length;){d=l.shift();u=l.shift();var N=l.shift(),W=l.shift(),z=b[0];if(!d.$$destroyed){if(u!==q){var za=u.className;k.hasElementTranscludeDirective&&t.replace||(z=Ub(K));U(N,C(u),z);L(C(z),za)}u=r.transcludeOnThisElement?ba(d,r.transclude, W):W;r(n,d,z,e,u,r)}}l=null});return function(a,b,c,d,e){a=e;b.$$destroyed||(l?l.push(b,c,d,a):(r.transcludeOnThisElement&&(a=ba(b,r.transclude,e)),r(n,b,c,d,a,r)))}}function M(a,b){var c=b.priority-a.priority;return 0!==c?c:a.name!==b.name?a.name<b.name?-1:1:a.index-b.index}function Q(a,b,c,d){function e(a){return a?" (module: "+a+")":""}if(b)throw fa("multidir",b.name,e(b.$$moduleName),c.name,e(c.$$moduleName),a,xa(d));}function Ka(a,c){var d=b(c,!0);d&&a.push({priority:0,compile:function(a){a= a.parent();var b=!!a.length;b&&W.$$addBindingClass(a);return function(a,c){var e=c.parent();b||W.$$addBindingClass(e);W.$$addBindingInfo(e,d.expressions);a.$watch(d,function(a){c[0].nodeValue=a})}}})}function Xb(a,b){a=F(a||"html");switch(a){case "svg":case "math":var c=X.createElement("div");c.innerHTML="<"+a+">"+b+"</"+a+">";return c.childNodes[0].childNodes;default:return b}}function R(a,b){if("srcdoc"==b)return ia.HTML;var c=wa(a);if("xlinkHref"==b||"form"==c&&"action"==b||"img"!=c&&("src"==b|| "ngSrc"==b))return ia.RESOURCE_URL}function V(a,c,d,e,f){var g=R(a,e);f=h[e]||f;var l=b(d,!0,g,f);if(l){if("multiple"===e&&"select"===wa(a))throw fa("selmulti",xa(a));c.push({priority:100,compile:function(){return{pre:function(a,c,h){c=h.$$observers||(h.$$observers={});if(k.test(e))throw fa("nodomevents");var r=h[e];r!==d&&(l=r&&b(r,!0,g,f),d=r);l&&(h[e]=l(a),(c[e]||(c[e]=[])).$$inter=!0,(h.$$observers&&h.$$observers[e].$$scope||a).$watch(l,function(a,b){"class"===e&&a!=b?h.$updateClass(a,b):h.$set(e, a)}))}}}})}}function U(a,b,c){var d=b[0],e=b.length,f=d.parentNode,h,g;if(a)for(h=0,g=a.length;h<g;h++)if(a[h]==d){a[h++]=c;g=h+e-1;for(var k=a.length;h<k;h++,g++)g<k?a[h]=a[g]:delete a[h];a.length-=e-1;a.context===d&&(a.context=c);break}f&&f.replaceChild(c,d);a=X.createDocumentFragment();a.appendChild(d);C.hasData(d)&&(C(c).data(C(d).data()),ra?(Qb=!0,ra.cleanData([d])):delete C.cache[d[C.expando]]);d=1;for(e=b.length;d<e;d++)f=b[d],C(f).remove(),a.appendChild(f),delete b[d];b[0]=c;b.length=1}function Z(a, b){return P(function(){return a.apply(null,arguments)},a,b)}function $(a,b,d,e,f,h){try{a(b,d,e,f,h)}catch(g){c(g,xa(d))}}function Y(a,c,d,e,f,h){var g;m(e,function(e,h){var k=e.attrName,l=e.optional,r,n,q,K;switch(e.mode){case "@":l||ta.call(c,k)||(d[h]=c[k]=void 0);c.$observe(k,function(a){G(a)&&(d[h]=a)});c.$$observers[k].$$scope=a;G(c[k])&&(d[h]=b(c[k])(a));break;case "=":if(!ta.call(c,k)){if(l)break;c[k]=void 0}if(l&&!c[k])break;n=u(c[k]);K=n.literal?ka:function(a,b){return a===b||a!==a&&b!== b};q=n.assign||function(){r=d[h]=n(a);throw fa("nonassign",c[k],f.name);};r=d[h]=n(a);l=function(b){K(b,d[h])||(K(b,r)?q(a,b=d[h]):d[h]=b);return r=b};l.$stateful=!0;l=e.collection?a.$watchCollection(c[k],l):a.$watch(u(c[k],l),null,n.literal);g=g||[];g.push(l);break;case "&":n=c.hasOwnProperty(k)?u(c[k]):y;if(n===y&&l)break;d[h]=function(b){return n(a,b)}}});e=g?function(){for(var a=0,b=g.length;a<b;++a)g[a]()}:y;return h&&e!==y?(h.$on("$destroy",e),y):e}var aa=function(a,b){if(b){var c=Object.keys(b), d,e,f;d=0;for(e=c.length;d<e;d++)f=c[d],this[f]=b[f]}else this.$attr={};this.$$element=a};aa.prototype={$normalize:ya,$addClass:function(a){a&&0<a.length&&O.addClass(this.$$element,a)},$removeClass:function(a){a&&0<a.length&&O.removeClass(this.$$element,a)},$updateClass:function(a,b){var c=Yc(a,b);c&&c.length&&O.addClass(this.$$element,c);(c=Yc(b,a))&&c.length&&O.removeClass(this.$$element,c)},$set:function(a,b,d,e){var f=Qc(this.$$element[0],a),h=Zc[a],g=a;f?(this.$$element.prop(a,b),e=f):h&&(this[h]= b,g=h);this[a]=b;e?this.$attr[a]=e:(e=this.$attr[a])||(this.$attr[a]=e=zc(a,"-"));f=wa(this.$$element);if("a"===f&&"href"===a||"img"===f&&"src"===a)this[a]=b=H(b,"src"===a);else if("img"===f&&"srcset"===a){for(var f="",h=T(b),k=/(\s+\d+x\s*,|\s+\d+w\s*,|\s+,|,\s+)/,k=/\s/.test(h)?k:/(,)/,h=h.split(k),k=Math.floor(h.length/2),l=0;l<k;l++)var r=2*l,f=f+H(T(h[r]),!0),f=f+(" "+T(h[r+1]));h=T(h[2*l]).split(/\s/);f+=H(T(h[0]),!0);2===h.length&&(f+=" "+T(h[1]));this[a]=b=f}!1!==d&&(null===b||v(b)?this.$$element.removeAttr(e): this.$$element.attr(e,b));(a=this.$$observers)&&m(a[g],function(a){try{a(b)}catch(d){c(d)}})},$observe:function(a,b){var c=this,d=c.$$observers||(c.$$observers=ha()),e=d[a]||(d[a]=[]);e.push(b);z.$evalAsync(function(){e.$$inter||!c.hasOwnProperty(a)||v(c[a])||b(c[a])});return function(){cb(e,b)}}};var da=b.startSymbol(),ea=b.endSymbol(),ga="{{"==da||"}}"==ea?$a:function(a){return a.replace(/\{\{/g,da).replace(/}}/g,ea)},ja=/^ngAttr[A-Z]/;W.$$addBindingInfo=n?function(a,b){var c=a.data("$binding")|| [];J(b)?c=c.concat(b):c.push(b);a.data("$binding",c)}:y;W.$$addBindingClass=n?function(a){L(a,"ng-binding")}:y;W.$$addScopeInfo=n?function(a,b,c,d){a.data(c?d?"$isolateScopeNoTemplate":"$isolateScope":"$scope",b)}:y;W.$$addScopeClass=n?function(a,b){L(a,b?"ng-isolate-scope":"ng-scope")}:y;return W}]}function ya(b){return gb(b.replace(Vc,""))}function Yc(b,a){var c="",d=b.split(/\s+/),e=a.split(/\s+/),f=0;a:for(;f<d.length;f++){for(var g=d[f],h=0;h<e.length;h++)if(g==e[h])continue a;c+=(0<c.length? " ":"")+g}return c}function Wc(b){b=C(b);var a=b.length;if(1>=a)return b;for(;a--;)8===b[a].nodeType&&Kf.call(b,a,1);return b}function Ve(){var b={},a=!1;this.register=function(a,d){Ta(a,"controller");B(a)?P(b,a):b[a]=d};this.allowGlobals=function(){a=!0};this.$get=["$injector","$window",function(c,d){function e(a,b,c,d){if(!a||!B(a.$scope))throw I("$controller")("noscp",d,b);a.$scope[b]=c}return function(f,g,h,l){var k,n,p;h=!0===h;l&&G(l)&&(p=l);if(G(f)){l=f.match(Uc);if(!l)throw Lf("ctrlfmt",f); n=l[1];p=p||l[3];f=b.hasOwnProperty(n)?b[n]:Bc(g.$scope,n,!0)||(a?Bc(d,n,!0):w);Sa(f,n,!0)}if(h)return h=(J(f)?f[f.length-1]:f).prototype,k=Object.create(h||null),p&&e(g,p,k,n||f.name),P(function(){var a=c.invoke(f,k,g,n);a!==k&&(B(a)||x(a))&&(k=a,p&&e(g,p,k,n||f.name));return k},{instance:k,identifier:p});k=c.instantiate(f,g,n);p&&e(g,p,k,n||f.name);return k}}]}function We(){this.$get=["$window",function(b){return C(b.document)}]}function Xe(){this.$get=["$log",function(b){return function(a,c){b.error.apply(b, arguments)}}]}function Yb(b){return B(b)?da(b)?b.toISOString():eb(b):b}function bf(){this.$get=function(){return function(b){if(!b)return"";var a=[];mc(b,function(b,d){null===b||v(b)||(J(b)?m(b,function(b,c){a.push(la(d)+"="+la(Yb(b)))}):a.push(la(d)+"="+la(Yb(b))))});return a.join("&")}}}function cf(){this.$get=function(){return function(b){function a(b,e,f){null===b||v(b)||(J(b)?m(b,function(b,c){a(b,e+"["+(B(b)?c:"")+"]")}):B(b)&&!da(b)?mc(b,function(b,c){a(b,e+(f?"":"[")+c+(f?"":"]"))}):c.push(la(e)+ "="+la(Yb(b))))}if(!b)return"";var c=[];a(b,"",!0);return c.join("&")}}}function Zb(b,a){if(G(b)){var c=b.replace(Mf,"").trim();if(c){var d=a("Content-Type");(d=d&&0===d.indexOf($c))||(d=(d=c.match(Nf))&&Of[d[0]].test(c));d&&(b=uc(c))}}return b}function ad(b){var a=ha(),c;G(b)?m(b.split("\n"),function(b){c=b.indexOf(":");var e=F(T(b.substr(0,c)));b=T(b.substr(c+1));e&&(a[e]=a[e]?a[e]+", "+b:b)}):B(b)&&m(b,function(b,c){var f=F(c),g=T(b);f&&(a[f]=a[f]?a[f]+", "+g:g)});return a}function bd(b){var a; return function(c){a||(a=ad(b));return c?(c=a[F(c)],void 0===c&&(c=null),c):a}}function cd(b,a,c,d){if(x(d))return d(b,a,c);m(d,function(d){b=d(b,a,c)});return b}function af(){var b=this.defaults={transformResponse:[Zb],transformRequest:[function(a){return B(a)&&"[object File]"!==va.call(a)&&"[object Blob]"!==va.call(a)&&"[object FormData]"!==va.call(a)?eb(a):a}],headers:{common:{Accept:"application/json, text/plain, */*"},post:ja($b),put:ja($b),patch:ja($b)},xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN", paramSerializer:"$httpParamSerializer"},a=!1;this.useApplyAsync=function(b){return A(b)?(a=!!b,this):a};var c=!0;this.useLegacyPromiseExtensions=function(a){return A(a)?(c=!!a,this):c};var d=this.interceptors=[];this.$get=["$httpBackend","$$cookieReader","$cacheFactory","$rootScope","$q","$injector",function(e,f,g,h,l,k){function n(a){function d(a){var b=P({},a);b.data=a.data?cd(a.data,a.headers,a.status,f.transformResponse):a.data;a=a.status;return 200<=a&&300>a?b:l.reject(b)}function e(a,b){var c, d={};m(a,function(a,e){x(a)?(c=a(b),null!=c&&(d[e]=c)):d[e]=a});return d}if(!aa.isObject(a))throw I("$http")("badreq",a);var f=P({method:"get",transformRequest:b.transformRequest,transformResponse:b.transformResponse,paramSerializer:b.paramSerializer},a);f.headers=function(a){var c=b.headers,d=P({},a.headers),f,h,g,c=P({},c.common,c[F(a.method)]);a:for(f in c){h=F(f);for(g in d)if(F(g)===h)continue a;d[f]=c[f]}return e(d,ja(a))}(a);f.method=sb(f.method);f.paramSerializer=G(f.paramSerializer)?k.get(f.paramSerializer): f.paramSerializer;var h=[function(a){var c=a.headers,e=cd(a.data,bd(c),w,a.transformRequest);v(e)&&m(c,function(a,b){"content-type"===F(b)&&delete c[b]});v(a.withCredentials)&&!v(b.withCredentials)&&(a.withCredentials=b.withCredentials);return p(a,e).then(d,d)},w],g=l.when(f);for(m(E,function(a){(a.request||a.requestError)&&h.unshift(a.request,a.requestError);(a.response||a.responseError)&&h.push(a.response,a.responseError)});h.length;){a=h.shift();var r=h.shift(),g=g.then(a,r)}c?(g.success=function(a){Sa(a, "fn");g.then(function(b){a(b.data,b.status,b.headers,f)});return g},g.error=function(a){Sa(a,"fn");g.then(null,function(b){a(b.data,b.status,b.headers,f)});return g}):(g.success=dd("success"),g.error=dd("error"));return g}function p(c,d){function g(b,c,d,e){function f(){k(c,b,d,e)}L&&(200<=b&&300>b?L.put(ba,[b,c,ad(d),e]):L.remove(ba));a?h.$applyAsync(f):(f(),h.$$phase||h.$apply())}function k(a,b,d,e){b=-1<=b?b:0;(200<=b&&300>b?O.resolve:O.reject)({data:a,status:b,headers:bd(d),config:c,statusText:e})} function p(a){k(a.data,a.status,ja(a.headers()),a.statusText)}function E(){var a=n.pendingRequests.indexOf(c);-1!==a&&n.pendingRequests.splice(a,1)}var O=l.defer(),H=O.promise,L,m,S=c.headers,ba=r(c.url,c.paramSerializer(c.params));n.pendingRequests.push(c);H.then(E,E);!c.cache&&!b.cache||!1===c.cache||"GET"!==c.method&&"JSONP"!==c.method||(L=B(c.cache)?c.cache:B(b.cache)?b.cache:t);L&&(m=L.get(ba),A(m)?m&&x(m.then)?m.then(p,p):J(m)?k(m[1],m[0],ja(m[2]),m[3]):k(m,200,{},"OK"):L.put(ba,H));v(m)&&((m= ed(c.url)?f()[c.xsrfCookieName||b.xsrfCookieName]:w)&&(S[c.xsrfHeaderName||b.xsrfHeaderName]=m),e(c.method,ba,d,g,S,c.timeout,c.withCredentials,c.responseType));return H}function r(a,b){0<b.length&&(a+=(-1==a.indexOf("?")?"?":"&")+b);return a}var t=g("$http");b.paramSerializer=G(b.paramSerializer)?k.get(b.paramSerializer):b.paramSerializer;var E=[];m(d,function(a){E.unshift(G(a)?k.get(a):k.invoke(a))});n.pendingRequests=[];(function(a){m(arguments,function(a){n[a]=function(b,c){return n(P({},c||{}, {method:a,url:b}))}})})("get","delete","head","jsonp");(function(a){m(arguments,function(a){n[a]=function(b,c,d){return n(P({},d||{},{method:a,url:b,data:c}))}})})("post","put","patch");n.defaults=b;return n}]}function Pf(){return new Q.XMLHttpRequest}function df(){this.$get=["$browser","$window","$document",function(b,a,c){return Qf(b,Pf,b.defer,a.angular.callbacks,c[0])}]}function Qf(b,a,c,d,e){function f(a,b,c){var f=e.createElement("script"),n=null;f.type="text/javascript";f.src=a;f.async=!0; n=function(a){f.removeEventListener("load",n,!1);f.removeEventListener("error",n,!1);e.body.removeChild(f);f=null;var g=-1,t="unknown";a&&("load"!==a.type||d[b].called||(a={type:"error"}),t=a.type,g="error"===a.type?404:200);c&&c(g,t)};f.addEventListener("load",n,!1);f.addEventListener("error",n,!1);e.body.appendChild(f);return n}return function(e,h,l,k,n,p,r,t){function E(){q&&q();z&&z.abort()}function K(a,d,e,f,h){A(s)&&c.cancel(s);q=z=null;a(d,e,f,h);b.$$completeOutstandingRequest(y)}b.$$incOutstandingRequestCount(); h=h||b.url();if("jsonp"==F(e)){var u="_"+(d.counter++).toString(36);d[u]=function(a){d[u].data=a;d[u].called=!0};var q=f(h.replace("JSON_CALLBACK","angular.callbacks."+u),u,function(a,b){K(k,a,d[u].data,"",b);d[u]=y})}else{var z=a();z.open(e,h,!0);m(n,function(a,b){A(a)&&z.setRequestHeader(b,a)});z.onload=function(){var a=z.statusText||"",b="response"in z?z.response:z.responseText,c=1223===z.status?204:z.status;0===c&&(c=b?200:"file"==Aa(h).protocol?404:0);K(k,c,b,z.getAllResponseHeaders(),a)};e= function(){K(k,-1,null,null,"")};z.onerror=e;z.onabort=e;r&&(z.withCredentials=!0);if(t)try{z.responseType=t}catch(N){if("json"!==t)throw N;}z.send(v(l)?null:l)}if(0<p)var s=c(E,p);else p&&x(p.then)&&p.then(E)}}function Ze(){var b="{{",a="}}";this.startSymbol=function(a){return a?(b=a,this):b};this.endSymbol=function(b){return b?(a=b,this):a};this.$get=["$parse","$exceptionHandler","$sce",function(c,d,e){function f(a){return"\\\\\\"+a}function g(c){return c.replace(n,b).replace(p,a)}function h(f, h,n,p){function u(a){try{var b=a;a=n?e.getTrusted(n,b):e.valueOf(b);var c;if(p&&!A(a))c=a;else if(null==a)c="";else{switch(typeof a){case "string":break;case "number":a=""+a;break;default:a=eb(a)}c=a}return c}catch(h){d(La.interr(f,h))}}p=!!p;for(var q,m,N=0,s=[],O=[],H=f.length,L=[],W=[];N<H;)if(-1!=(q=f.indexOf(b,N))&&-1!=(m=f.indexOf(a,q+l)))N!==q&&L.push(g(f.substring(N,q))),N=f.substring(q+l,m),s.push(N),O.push(c(N,u)),N=m+k,W.push(L.length),L.push("");else{N!==H&&L.push(g(f.substring(N)));break}n&& 1<L.length&&La.throwNoconcat(f);if(!h||s.length){var S=function(a){for(var b=0,c=s.length;b<c;b++){if(p&&v(a[b]))return;L[W[b]]=a[b]}return L.join("")};return P(function(a){var b=0,c=s.length,e=Array(c);try{for(;b<c;b++)e[b]=O[b](a);return S(e)}catch(h){d(La.interr(f,h))}},{exp:f,expressions:s,$$watchDelegate:function(a,b){var c;return a.$watchGroup(O,function(d,e){var f=S(d);x(b)&&b.call(this,f,d!==e?c:f,a);c=f})}})}}var l=b.length,k=a.length,n=new RegExp(b.replace(/./g,f),"g"),p=new RegExp(a.replace(/./g, f),"g");h.startSymbol=function(){return b};h.endSymbol=function(){return a};return h}]}function $e(){this.$get=["$rootScope","$window","$q","$$q",function(b,a,c,d){function e(e,h,l,k){var n=4<arguments.length,p=n?ua.call(arguments,4):[],r=a.setInterval,t=a.clearInterval,E=0,K=A(k)&&!k,u=(K?d:c).defer(),q=u.promise;l=A(l)?l:0;q.then(null,null,n?function(){e.apply(null,p)}:e);q.$$intervalId=r(function(){u.notify(E++);0<l&&E>=l&&(u.resolve(E),t(q.$$intervalId),delete f[q.$$intervalId]);K||b.$apply()}, h);f[q.$$intervalId]=u;return q}var f={};e.cancel=function(b){return b&&b.$$intervalId in f?(f[b.$$intervalId].reject("canceled"),a.clearInterval(b.$$intervalId),delete f[b.$$intervalId],!0):!1};return e}]}function ac(b){b=b.split("/");for(var a=b.length;a--;)b[a]=ob(b[a]);return b.join("/")}function fd(b,a){var c=Aa(b);a.$$protocol=c.protocol;a.$$host=c.hostname;a.$$port=Y(c.port)||Rf[c.protocol]||null}function gd(b,a){var c="/"!==b.charAt(0);c&&(b="/"+b);var d=Aa(b);a.$$path=decodeURIComponent(c&& "/"===d.pathname.charAt(0)?d.pathname.substring(1):d.pathname);a.$$search=xc(d.search);a.$$hash=decodeURIComponent(d.hash);a.$$path&&"/"!=a.$$path.charAt(0)&&(a.$$path="/"+a.$$path)}function sa(b,a){if(0===a.indexOf(b))return a.substr(b.length)}function Ja(b){var a=b.indexOf("#");return-1==a?b:b.substr(0,a)}function Cb(b){return b.replace(/(#.+)|#$/,"$1")}function bc(b,a,c){this.$$html5=!0;c=c||"";fd(b,this);this.$$parse=function(b){var c=sa(a,b);if(!G(c))throw Db("ipthprfx",b,a);gd(c,this);this.$$path|| (this.$$path="/");this.$$compose()};this.$$compose=function(){var b=Pb(this.$$search),c=this.$$hash?"#"+ob(this.$$hash):"";this.$$url=ac(this.$$path)+(b?"?"+b:"")+c;this.$$absUrl=a+this.$$url.substr(1)};this.$$parseLinkUrl=function(d,e){if(e&&"#"===e[0])return this.hash(e.slice(1)),!0;var f,g;A(f=sa(b,d))?(g=f,g=A(f=sa(c,f))?a+(sa("/",f)||f):b+g):A(f=sa(a,d))?g=a+f:a==d+"/"&&(g=a);g&&this.$$parse(g);return!!g}}function cc(b,a,c){fd(b,this);this.$$parse=function(d){var e=sa(b,d)||sa(a,d),f;v(e)||"#"!== e.charAt(0)?this.$$html5?f=e:(f="",v(e)&&(b=d,this.replace())):(f=sa(c,e),v(f)&&(f=e));gd(f,this);d=this.$$path;var e=b,g=/^\/[A-Z]:(\/.*)/;0===f.indexOf(e)&&(f=f.replace(e,""));g.exec(f)||(d=(f=g.exec(d))?f[1]:d);this.$$path=d;this.$$compose()};this.$$compose=function(){var a=Pb(this.$$search),e=this.$$hash?"#"+ob(this.$$hash):"";this.$$url=ac(this.$$path)+(a?"?"+a:"")+e;this.$$absUrl=b+(this.$$url?c+this.$$url:"")};this.$$parseLinkUrl=function(a,c){return Ja(b)==Ja(a)?(this.$$parse(a),!0):!1}}function hd(b, a,c){this.$$html5=!0;cc.apply(this,arguments);this.$$parseLinkUrl=function(d,e){if(e&&"#"===e[0])return this.hash(e.slice(1)),!0;var f,g;b==Ja(d)?f=d:(g=sa(a,d))?f=b+c+g:a===d+"/"&&(f=a);f&&this.$$parse(f);return!!f};this.$$compose=function(){var a=Pb(this.$$search),e=this.$$hash?"#"+ob(this.$$hash):"";this.$$url=ac(this.$$path)+(a?"?"+a:"")+e;this.$$absUrl=b+c+this.$$url}}function Eb(b){return function(){return this[b]}}function id(b,a){return function(c){if(v(c))return this[b];this[b]=a(c);this.$$compose(); return this}}function ef(){var b="",a={enabled:!1,requireBase:!0,rewriteLinks:!0};this.hashPrefix=function(a){return A(a)?(b=a,this):b};this.html5Mode=function(b){return bb(b)?(a.enabled=b,this):B(b)?(bb(b.enabled)&&(a.enabled=b.enabled),bb(b.requireBase)&&(a.requireBase=b.requireBase),bb(b.rewriteLinks)&&(a.rewriteLinks=b.rewriteLinks),this):a};this.$get=["$rootScope","$browser","$sniffer","$rootElement","$window",function(c,d,e,f,g){function h(a,b,c){var e=k.url(),f=k.$$state;try{d.url(a,b,c),k.$$state= d.state()}catch(h){throw k.url(e),k.$$state=f,h;}}function l(a,b){c.$broadcast("$locationChangeSuccess",k.absUrl(),a,k.$$state,b)}var k,n;n=d.baseHref();var p=d.url(),r;if(a.enabled){if(!n&&a.requireBase)throw Db("nobase");r=p.substring(0,p.indexOf("/",p.indexOf("//")+2))+(n||"/");n=e.history?bc:hd}else r=Ja(p),n=cc;var t=r.substr(0,Ja(r).lastIndexOf("/")+1);k=new n(r,t,"#"+b);k.$$parseLinkUrl(p,p);k.$$state=d.state();var E=/^\s*(javascript|mailto):/i;f.on("click",function(b){if(a.rewriteLinks&&!b.ctrlKey&& !b.metaKey&&!b.shiftKey&&2!=b.which&&2!=b.button){for(var e=C(b.target);"a"!==wa(e[0]);)if(e[0]===f[0]||!(e=e.parent())[0])return;var h=e.prop("href"),l=e.attr("href")||e.attr("xlink:href");B(h)&&"[object SVGAnimatedString]"===h.toString()&&(h=Aa(h.animVal).href);E.test(h)||!h||e.attr("target")||b.isDefaultPrevented()||!k.$$parseLinkUrl(h,l)||(b.preventDefault(),k.absUrl()!=d.url()&&(c.$apply(),g.angular["ff-684208-preventDefault"]=!0))}});Cb(k.absUrl())!=Cb(p)&&d.url(k.absUrl(),!0);var K=!0;d.onUrlChange(function(a, b){v(sa(t,a))?g.location.href=a:(c.$evalAsync(function(){var d=k.absUrl(),e=k.$$state,f;k.$$parse(a);k.$$state=b;f=c.$broadcast("$locationChangeStart",a,d,b,e).defaultPrevented;k.absUrl()===a&&(f?(k.$$parse(d),k.$$state=e,h(d,!1,e)):(K=!1,l(d,e)))}),c.$$phase||c.$digest())});c.$watch(function(){var a=Cb(d.url()),b=Cb(k.absUrl()),f=d.state(),g=k.$$replace,r=a!==b||k.$$html5&&e.history&&f!==k.$$state;if(K||r)K=!1,c.$evalAsync(function(){var b=k.absUrl(),d=c.$broadcast("$locationChangeStart",b,a,k.$$state, f).defaultPrevented;k.absUrl()===b&&(d?(k.$$parse(a),k.$$state=f):(r&&h(b,g,f===k.$$state?null:k.$$state),l(a,f)))});k.$$replace=!1});return k}]}function ff(){var b=!0,a=this;this.debugEnabled=function(a){return A(a)?(b=a,this):b};this.$get=["$window",function(c){function d(a){a instanceof Error&&(a.stack?a=a.message&&-1===a.stack.indexOf(a.message)?"Error: "+a.message+"\n"+a.stack:a.stack:a.sourceURL&&(a=a.message+"\n"+a.sourceURL+":"+a.line));return a}function e(a){var b=c.console||{},e=b[a]||b.log|| y;a=!1;try{a=!!e.apply}catch(l){}return a?function(){var a=[];m(arguments,function(b){a.push(d(b))});return e.apply(b,a)}:function(a,b){e(a,null==b?"":b)}}return{log:e("log"),info:e("info"),warn:e("warn"),error:e("error"),debug:function(){var c=e("debug");return function(){b&&c.apply(a,arguments)}}()}}]}function Xa(b,a){b=B(b)&&b.toString?b.toString():b;if("__defineGetter__"===b||"__defineSetter__"===b||"__lookupGetter__"===b||"__lookupSetter__"===b||"__proto__"===b)throw ea("isecfld",a);return b} function Ba(b,a){if(b){if(b.constructor===b)throw ea("isecfn",a);if(b.window===b)throw ea("isecwindow",a);if(b.children&&(b.nodeName||b.prop&&b.attr&&b.find))throw ea("isecdom",a);if(b===Object)throw ea("isecobj",a);}return b}function jd(b,a){if(b){if(b.constructor===b)throw ea("isecfn",a);if(b===Sf||b===Tf||b===Uf)throw ea("isecff",a);}}function Vf(b,a){return"undefined"!==typeof b?b:a}function kd(b,a){return"undefined"===typeof b?a:"undefined"===typeof a?b:b+a}function U(b,a){var c,d;switch(b.type){case s.Program:c= !0;m(b.body,function(b){U(b.expression,a);c=c&&b.expression.constant});b.constant=c;break;case s.Literal:b.constant=!0;b.toWatch=[];break;case s.UnaryExpression:U(b.argument,a);b.constant=b.argument.constant;b.toWatch=b.argument.toWatch;break;case s.BinaryExpression:U(b.left,a);U(b.right,a);b.constant=b.left.constant&&b.right.constant;b.toWatch=b.left.toWatch.concat(b.right.toWatch);break;case s.LogicalExpression:U(b.left,a);U(b.right,a);b.constant=b.left.constant&&b.right.constant;b.toWatch=b.constant? []:[b];break;case s.ConditionalExpression:U(b.test,a);U(b.alternate,a);U(b.consequent,a);b.constant=b.test.constant&&b.alternate.constant&&b.consequent.constant;b.toWatch=b.constant?[]:[b];break;case s.Identifier:b.constant=!1;b.toWatch=[b];break;case s.MemberExpression:U(b.object,a);b.computed&&U(b.property,a);b.constant=b.object.constant&&(!b.computed||b.property.constant);b.toWatch=[b];break;case s.CallExpression:c=b.filter?!a(b.callee.name).$stateful:!1;d=[];m(b.arguments,function(b){U(b,a);c= c&&b.constant;b.constant||d.push.apply(d,b.toWatch)});b.constant=c;b.toWatch=b.filter&&!a(b.callee.name).$stateful?d:[b];break;case s.AssignmentExpression:U(b.left,a);U(b.right,a);b.constant=b.left.constant&&b.right.constant;b.toWatch=[b];break;case s.ArrayExpression:c=!0;d=[];m(b.elements,function(b){U(b,a);c=c&&b.constant;b.constant||d.push.apply(d,b.toWatch)});b.constant=c;b.toWatch=d;break;case s.ObjectExpression:c=!0;d=[];m(b.properties,function(b){U(b.value,a);c=c&&b.value.constant;b.value.constant|| d.push.apply(d,b.value.toWatch)});b.constant=c;b.toWatch=d;break;case s.ThisExpression:b.constant=!1,b.toWatch=[]}}function ld(b){if(1==b.length){b=b[0].expression;var a=b.toWatch;return 1!==a.length?a:a[0]!==b?a:w}}function md(b){return b.type===s.Identifier||b.type===s.MemberExpression}function nd(b){if(1===b.body.length&&md(b.body[0].expression))return{type:s.AssignmentExpression,left:b.body[0].expression,right:{type:s.NGValueParameter},operator:"="}}function od(b){return 0===b.body.length||1=== b.body.length&&(b.body[0].expression.type===s.Literal||b.body[0].expression.type===s.ArrayExpression||b.body[0].expression.type===s.ObjectExpression)}function pd(b,a){this.astBuilder=b;this.$filter=a}function qd(b,a){this.astBuilder=b;this.$filter=a}function Fb(b){return"constructor"==b}function dc(b){return x(b.valueOf)?b.valueOf():Wf.call(b)}function gf(){var b=ha(),a=ha();this.$get=["$filter",function(c){function d(a,b){return null==a||null==b?a===b:"object"===typeof a&&(a=dc(a),"object"===typeof a)? !1:a===b||a!==a&&b!==b}function e(a,b,c,e,f){var h=e.inputs,g;if(1===h.length){var k=d,h=h[0];return a.$watch(function(a){var b=h(a);d(b,k)||(g=e(a,w,w,[b]),k=b&&dc(b));return g},b,c,f)}for(var l=[],n=[],p=0,m=h.length;p<m;p++)l[p]=d,n[p]=null;return a.$watch(function(a){for(var b=!1,c=0,f=h.length;c<f;c++){var k=h[c](a);if(b||(b=!d(k,l[c])))n[c]=k,l[c]=k&&dc(k)}b&&(g=e(a,w,w,n));return g},b,c,f)}function f(a,b,c,d){var e,f;return e=a.$watch(function(a){return d(a)},function(a,c,d){f=a;x(b)&&b.apply(this, arguments);A(a)&&d.$$postDigest(function(){A(f)&&e()})},c)}function g(a,b,c,d){function e(a){var b=!0;m(a,function(a){A(a)||(b=!1)});return b}var f,h;return f=a.$watch(function(a){return d(a)},function(a,c,d){h=a;x(b)&&b.call(this,a,c,d);e(a)&&d.$$postDigest(function(){e(h)&&f()})},c)}function h(a,b,c,d){var e;return e=a.$watch(function(a){return d(a)},function(a,c,d){x(b)&&b.apply(this,arguments);e()},c)}function l(a,b){if(!b)return a;var c=a.$$watchDelegate,c=c!==g&&c!==f?function(c,d,e,f){e=a(c, d,e,f);return b(e,c,d)}:function(c,d,e,f){e=a(c,d,e,f);c=b(e,c,d);return A(e)?c:e};a.$$watchDelegate&&a.$$watchDelegate!==e?c.$$watchDelegate=a.$$watchDelegate:b.$stateful||(c.$$watchDelegate=e,c.inputs=a.inputs?a.inputs:[a]);return c}var k=Fa().noUnsafeEval,n={csp:k,expensiveChecks:!1},p={csp:k,expensiveChecks:!0};return function(d,k,E){var m,u,q;switch(typeof d){case "string":q=d=d.trim();var s=E?a:b;m=s[q];m||(":"===d.charAt(0)&&":"===d.charAt(1)&&(u=!0,d=d.substring(2)),E=E?p:n,m=new ec(E),m= (new fc(m,c,E)).parse(d),m.constant?m.$$watchDelegate=h:u?m.$$watchDelegate=m.literal?g:f:m.inputs&&(m.$$watchDelegate=e),s[q]=m);return l(m,k);case "function":return l(d,k);default:return y}}}]}function jf(){this.$get=["$rootScope","$exceptionHandler",function(b,a){return rd(function(a){b.$evalAsync(a)},a)}]}function kf(){this.$get=["$browser","$exceptionHandler",function(b,a){return rd(function(a){b.defer(a)},a)}]}function rd(b,a){function c(a,b,c){function d(b){return function(c){e||(e=!0,b.call(a, c))}}var e=!1;return[d(b),d(c)]}function d(){this.$$state={status:0}}function e(a,b){return function(c){b.call(a,c)}}function f(c){!c.processScheduled&&c.pending&&(c.processScheduled=!0,b(function(){var b,d,e;e=c.pending;c.processScheduled=!1;c.pending=w;for(var f=0,h=e.length;f<h;++f){d=e[f][0];b=e[f][c.status];try{x(b)?d.resolve(b(c.value)):1===c.status?d.resolve(c.value):d.reject(c.value)}catch(g){d.reject(g),a(g)}}}))}function g(){this.promise=new d;this.resolve=e(this,this.resolve);this.reject= e(this,this.reject);this.notify=e(this,this.notify)}var h=I("$q",TypeError);P(d.prototype,{then:function(a,b,c){if(v(a)&&v(b)&&v(c))return this;var d=new g;this.$$state.pending=this.$$state.pending||[];this.$$state.pending.push([d,a,b,c]);0<this.$$state.status&&f(this.$$state);return d.promise},"catch":function(a){return this.then(null,a)},"finally":function(a,b){return this.then(function(b){return k(b,!0,a)},function(b){return k(b,!1,a)},b)}});P(g.prototype,{resolve:function(a){this.promise.$$state.status|| (a===this.promise?this.$$reject(h("qcycle",a)):this.$$resolve(a))},$$resolve:function(b){var d,e;e=c(this,this.$$resolve,this.$$reject);try{if(B(b)||x(b))d=b&&b.then;x(d)?(this.promise.$$state.status=-1,d.call(b,e[0],e[1],this.notify)):(this.promise.$$state.value=b,this.promise.$$state.status=1,f(this.promise.$$state))}catch(h){e[1](h),a(h)}},reject:function(a){this.promise.$$state.status||this.$$reject(a)},$$reject:function(a){this.promise.$$state.value=a;this.promise.$$state.status=2;f(this.promise.$$state)}, notify:function(c){var d=this.promise.$$state.pending;0>=this.promise.$$state.status&&d&&d.length&&b(function(){for(var b,e,f=0,h=d.length;f<h;f++){e=d[f][0];b=d[f][3];try{e.notify(x(b)?b(c):c)}catch(g){a(g)}}})}});var l=function(a,b){var c=new g;b?c.resolve(a):c.reject(a);return c.promise},k=function(a,b,c){var d=null;try{x(c)&&(d=c())}catch(e){return l(e,!1)}return d&&x(d.then)?d.then(function(){return l(a,b)},function(a){return l(a,!1)}):l(a,b)},n=function(a,b,c,d){var e=new g;e.resolve(a);return e.promise.then(b, c,d)},p=function t(a){if(!x(a))throw h("norslvr",a);if(!(this instanceof t))return new t(a);var b=new g;a(function(a){b.resolve(a)},function(a){b.reject(a)});return b.promise};p.defer=function(){return new g};p.reject=function(a){var b=new g;b.reject(a);return b.promise};p.when=n;p.resolve=n;p.all=function(a){var b=new g,c=0,d=J(a)?[]:{};m(a,function(a,e){c++;n(a).then(function(a){d.hasOwnProperty(e)||(d[e]=a,--c||b.resolve(d))},function(a){d.hasOwnProperty(e)||b.reject(a)})});0===c&&b.resolve(d); return b.promise};return p}function tf(){this.$get=["$window","$timeout",function(b,a){var c=b.requestAnimationFrame||b.webkitRequestAnimationFrame,d=b.cancelAnimationFrame||b.webkitCancelAnimationFrame||b.webkitCancelRequestAnimationFrame,e=!!c,f=e?function(a){var b=c(a);return function(){d(b)}}:function(b){var c=a(b,16.66,!1);return function(){a.cancel(c)}};f.supported=e;return f}]}function hf(){function b(a){function b(){this.$$watchers=this.$$nextSibling=this.$$childHead=this.$$childTail=null; this.$$listeners={};this.$$listenerCount={};this.$$watchersCount=0;this.$id=++nb;this.$$ChildScope=null}b.prototype=a;return b}var a=10,c=I("$rootScope"),d=null,e=null;this.digestTtl=function(b){arguments.length&&(a=b);return a};this.$get=["$injector","$exceptionHandler","$parse","$browser",function(f,g,h,l){function k(a){a.currentScope.$$destroyed=!0}function n(){this.$id=++nb;this.$$phase=this.$parent=this.$$watchers=this.$$nextSibling=this.$$prevSibling=this.$$childHead=this.$$childTail=null;this.$root= this;this.$$destroyed=!1;this.$$listeners={};this.$$listenerCount={};this.$$watchersCount=0;this.$$isolateBindings=null}function p(a){if(q.$$phase)throw c("inprog",q.$$phase);q.$$phase=a}function r(a,b){do a.$$watchersCount+=b;while(a=a.$parent)}function t(a,b,c){do a.$$listenerCount[c]-=b,0===a.$$listenerCount[c]&&delete a.$$listenerCount[c];while(a=a.$parent)}function E(){}function s(){for(;w.length;)try{w.shift()()}catch(a){g(a)}e=null}function u(){null===e&&(e=l.defer(function(){q.$apply(s)}))} n.prototype={constructor:n,$new:function(a,c){var d;c=c||this;a?(d=new n,d.$root=this.$root):(this.$$ChildScope||(this.$$ChildScope=b(this)),d=new this.$$ChildScope);d.$parent=c;d.$$prevSibling=c.$$childTail;c.$$childHead?(c.$$childTail.$$nextSibling=d,c.$$childTail=d):c.$$childHead=c.$$childTail=d;(a||c!=this)&&d.$on("$destroy",k);return d},$watch:function(a,b,c,e){var f=h(a);if(f.$$watchDelegate)return f.$$watchDelegate(this,b,c,f,a);var g=this,k=g.$$watchers,l={fn:b,last:E,get:f,exp:e||a,eq:!!c}; d=null;x(b)||(l.fn=y);k||(k=g.$$watchers=[]);k.unshift(l);r(this,1);return function(){0<=cb(k,l)&&r(g,-1);d=null}},$watchGroup:function(a,b){function c(){g=!1;k?(k=!1,b(e,e,h)):b(e,d,h)}var d=Array(a.length),e=Array(a.length),f=[],h=this,g=!1,k=!0;if(!a.length){var l=!0;h.$evalAsync(function(){l&&b(e,e,h)});return function(){l=!1}}if(1===a.length)return this.$watch(a[0],function(a,c,f){e[0]=a;d[0]=c;b(e,a===c?e:d,f)});m(a,function(a,b){var k=h.$watch(a,function(a,f){e[b]=a;d[b]=f;g||(g=!0,h.$evalAsync(c))}); f.push(k)});return function(){for(;f.length;)f.shift()()}},$watchCollection:function(a,b){function c(a){e=a;var b,d,h,g;if(!v(e)){if(B(e))if(Da(e))for(f!==p&&(f=p,t=f.length=0,l++),a=e.length,t!==a&&(l++,f.length=t=a),b=0;b<a;b++)g=f[b],h=e[b],d=g!==g&&h!==h,d||g===h||(l++,f[b]=h);else{f!==r&&(f=r={},t=0,l++);a=0;for(b in e)ta.call(e,b)&&(a++,h=e[b],g=f[b],b in f?(d=g!==g&&h!==h,d||g===h||(l++,f[b]=h)):(t++,f[b]=h,l++));if(t>a)for(b in l++,f)ta.call(e,b)||(t--,delete f[b])}else f!==e&&(f=e,l++);return l}} c.$stateful=!0;var d=this,e,f,g,k=1<b.length,l=0,n=h(a,c),p=[],r={},q=!0,t=0;return this.$watch(n,function(){q?(q=!1,b(e,e,d)):b(e,g,d);if(k)if(B(e))if(Da(e)){g=Array(e.length);for(var a=0;a<e.length;a++)g[a]=e[a]}else for(a in g={},e)ta.call(e,a)&&(g[a]=e[a]);else g=e})},$digest:function(){var b,f,h,k,n,r,t=a,m,u=[],D,v;p("$digest");l.$$checkUrlChange();this===q&&null!==e&&(l.defer.cancel(e),s());d=null;do{r=!1;for(m=this;z.length;){try{v=z.shift(),v.scope.$eval(v.expression,v.locals)}catch(w){g(w)}d= null}a:do{if(k=m.$$watchers)for(n=k.length;n--;)try{if(b=k[n])if((f=b.get(m))!==(h=b.last)&&!(b.eq?ka(f,h):"number"===typeof f&&"number"===typeof h&&isNaN(f)&&isNaN(h)))r=!0,d=b,b.last=b.eq?ga(f,null):f,b.fn(f,h===E?f:h,m),5>t&&(D=4-t,u[D]||(u[D]=[]),u[D].push({msg:x(b.exp)?"fn: "+(b.exp.name||b.exp.toString()):b.exp,newVal:f,oldVal:h}));else if(b===d){r=!1;break a}}catch(y){g(y)}if(!(k=m.$$watchersCount&&m.$$childHead||m!==this&&m.$$nextSibling))for(;m!==this&&!(k=m.$$nextSibling);)m=m.$parent}while(m= k);if((r||z.length)&&!t--)throw q.$$phase=null,c("infdig",a,u);}while(r||z.length);for(q.$$phase=null;N.length;)try{N.shift()()}catch(A){g(A)}},$destroy:function(){if(!this.$$destroyed){var a=this.$parent;this.$broadcast("$destroy");this.$$destroyed=!0;this===q&&l.$$applicationDestroyed();r(this,-this.$$watchersCount);for(var b in this.$$listenerCount)t(this,this.$$listenerCount[b],b);a&&a.$$childHead==this&&(a.$$childHead=this.$$nextSibling);a&&a.$$childTail==this&&(a.$$childTail=this.$$prevSibling); this.$$prevSibling&&(this.$$prevSibling.$$nextSibling=this.$$nextSibling);this.$$nextSibling&&(this.$$nextSibling.$$prevSibling=this.$$prevSibling);this.$destroy=this.$digest=this.$apply=this.$evalAsync=this.$applyAsync=y;this.$on=this.$watch=this.$watchGroup=function(){return y};this.$$listeners={};this.$parent=this.$$nextSibling=this.$$prevSibling=this.$$childHead=this.$$childTail=this.$root=this.$$watchers=null}},$eval:function(a,b){return h(a)(this,b)},$evalAsync:function(a,b){q.$$phase||z.length|| l.defer(function(){z.length&&q.$digest()});z.push({scope:this,expression:a,locals:b})},$$postDigest:function(a){N.push(a)},$apply:function(a){try{p("$apply");try{return this.$eval(a)}finally{q.$$phase=null}}catch(b){g(b)}finally{try{q.$digest()}catch(c){throw g(c),c;}}},$applyAsync:function(a){function b(){c.$eval(a)}var c=this;a&&w.push(b);u()},$on:function(a,b){var c=this.$$listeners[a];c||(this.$$listeners[a]=c=[]);c.push(b);var d=this;do d.$$listenerCount[a]||(d.$$listenerCount[a]=0),d.$$listenerCount[a]++; while(d=d.$parent);var e=this;return function(){var d=c.indexOf(b);-1!==d&&(c[d]=null,t(e,1,a))}},$emit:function(a,b){var c=[],d,e=this,f=!1,h={name:a,targetScope:e,stopPropagation:function(){f=!0},preventDefault:function(){h.defaultPrevented=!0},defaultPrevented:!1},k=db([h],arguments,1),l,n;do{d=e.$$listeners[a]||c;h.currentScope=e;l=0;for(n=d.length;l<n;l++)if(d[l])try{d[l].apply(null,k)}catch(p){g(p)}else d.splice(l,1),l--,n--;if(f)return h.currentScope=null,h;e=e.$parent}while(e);h.currentScope= null;return h},$broadcast:function(a,b){var c=this,d=this,e={name:a,targetScope:this,preventDefault:function(){e.defaultPrevented=!0},defaultPrevented:!1};if(!this.$$listenerCount[a])return e;for(var f=db([e],arguments,1),h,k;c=d;){e.currentScope=c;d=c.$$listeners[a]||[];h=0;for(k=d.length;h<k;h++)if(d[h])try{d[h].apply(null,f)}catch(l){g(l)}else d.splice(h,1),h--,k--;if(!(d=c.$$listenerCount[a]&&c.$$childHead||c!==this&&c.$$nextSibling))for(;c!==this&&!(d=c.$$nextSibling);)c=c.$parent}e.currentScope= null;return e}};var q=new n,z=q.$$asyncQueue=[],N=q.$$postDigestQueue=[],w=q.$$applyAsyncQueue=[];return q}]}function ee(){var b=/^\s*(https?|ftp|mailto|tel|file):/,a=/^\s*((https?|ftp|file|blob):|data:image\/)/;this.aHrefSanitizationWhitelist=function(a){return A(a)?(b=a,this):b};this.imgSrcSanitizationWhitelist=function(b){return A(b)?(a=b,this):a};this.$get=function(){return function(c,d){var e=d?a:b,f;f=Aa(c).href;return""===f||f.match(e)?c:"unsafe:"+f}}}function Xf(b){if("self"===b)return b; if(G(b)){if(-1<b.indexOf("***"))throw Ca("iwcard",b);b=sd(b).replace("\\*\\*",".*").replace("\\*","[^:/.?&;]*");return new RegExp("^"+b+"$")}if(Oa(b))return new RegExp("^"+b.source+"$");throw Ca("imatcher");}function td(b){var a=[];A(b)&&m(b,function(b){a.push(Xf(b))});return a}function mf(){this.SCE_CONTEXTS=oa;var b=["self"],a=[];this.resourceUrlWhitelist=function(a){arguments.length&&(b=td(a));return b};this.resourceUrlBlacklist=function(b){arguments.length&&(a=td(b));return a};this.$get=["$injector", function(c){function d(a,b){return"self"===a?ed(b):!!a.exec(b.href)}function e(a){var b=function(a){this.$$unwrapTrustedValue=function(){return a}};a&&(b.prototype=new a);b.prototype.valueOf=function(){return this.$$unwrapTrustedValue()};b.prototype.toString=function(){return this.$$unwrapTrustedValue().toString()};return b}var f=function(a){throw Ca("unsafe");};c.has("$sanitize")&&(f=c.get("$sanitize"));var g=e(),h={};h[oa.HTML]=e(g);h[oa.CSS]=e(g);h[oa.URL]=e(g);h[oa.JS]=e(g);h[oa.RESOURCE_URL]= e(h[oa.URL]);return{trustAs:function(a,b){var c=h.hasOwnProperty(a)?h[a]:null;if(!c)throw Ca("icontext",a,b);if(null===b||v(b)||""===b)return b;if("string"!==typeof b)throw Ca("itype",a);return new c(b)},getTrusted:function(c,e){if(null===e||v(e)||""===e)return e;var g=h.hasOwnProperty(c)?h[c]:null;if(g&&e instanceof g)return e.$$unwrapTrustedValue();if(c===oa.RESOURCE_URL){var g=Aa(e.toString()),p,r,t=!1;p=0;for(r=b.length;p<r;p++)if(d(b[p],g)){t=!0;break}if(t)for(p=0,r=a.length;p<r;p++)if(d(a[p], g)){t=!1;break}if(t)return e;throw Ca("insecurl",e.toString());}if(c===oa.HTML)return f(e);throw Ca("unsafe");},valueOf:function(a){return a instanceof g?a.$$unwrapTrustedValue():a}}}]}function lf(){var b=!0;this.enabled=function(a){arguments.length&&(b=!!a);return b};this.$get=["$parse","$sceDelegate",function(a,c){if(b&&8>Wa)throw Ca("iequirks");var d=ja(oa);d.isEnabled=function(){return b};d.trustAs=c.trustAs;d.getTrusted=c.getTrusted;d.valueOf=c.valueOf;b||(d.trustAs=d.getTrusted=function(a,b){return b}, d.valueOf=$a);d.parseAs=function(b,c){var e=a(c);return e.literal&&e.constant?e:a(c,function(a){return d.getTrusted(b,a)})};var e=d.parseAs,f=d.getTrusted,g=d.trustAs;m(oa,function(a,b){var c=F(b);d[gb("parse_as_"+c)]=function(b){return e(a,b)};d[gb("get_trusted_"+c)]=function(b){return f(a,b)};d[gb("trust_as_"+c)]=function(b){return g(a,b)}});return d}]}function nf(){this.$get=["$window","$document",function(b,a){var c={},d=Y((/android (\d+)/.exec(F((b.navigator||{}).userAgent))||[])[1]),e=/Boxee/i.test((b.navigator|| {}).userAgent),f=a[0]||{},g,h=/^(Moz|webkit|ms)(?=[A-Z])/,l=f.body&&f.body.style,k=!1,n=!1;if(l){for(var p in l)if(k=h.exec(p)){g=k[0];g=g.substr(0,1).toUpperCase()+g.substr(1);break}g||(g="WebkitOpacity"in l&&"webkit");k=!!("transition"in l||g+"Transition"in l);n=!!("animation"in l||g+"Animation"in l);!d||k&&n||(k=G(l.webkitTransition),n=G(l.webkitAnimation))}return{history:!(!b.history||!b.history.pushState||4>d||e),hasEvent:function(a){if("input"===a&&11>=Wa)return!1;if(v(c[a])){var b=f.createElement("div"); c[a]="on"+a in b}return c[a]},csp:Fa(),vendorPrefix:g,transitions:k,animations:n,android:d}}]}function pf(){this.$get=["$templateCache","$http","$q","$sce",function(b,a,c,d){function e(f,g){e.totalPendingRequests++;G(f)&&b.get(f)||(f=d.getTrustedResourceUrl(f));var h=a.defaults&&a.defaults.transformResponse;J(h)?h=h.filter(function(a){return a!==Zb}):h===Zb&&(h=null);return a.get(f,{cache:b,transformResponse:h})["finally"](function(){e.totalPendingRequests--}).then(function(a){b.put(f,a.data);return a.data}, function(a){if(!g)throw fa("tpload",f,a.status,a.statusText);return c.reject(a)})}e.totalPendingRequests=0;return e}]}function qf(){this.$get=["$rootScope","$browser","$location",function(b,a,c){return{findBindings:function(a,b,c){a=a.getElementsByClassName("ng-binding");var g=[];m(a,function(a){var d=aa.element(a).data("$binding");d&&m(d,function(d){c?(new RegExp("(^|\\s)"+sd(b)+"(\\s|\\||$)")).test(d)&&g.push(a):-1!=d.indexOf(b)&&g.push(a)})});return g},findModels:function(a,b,c){for(var g=["ng-", "data-ng-","ng\\:"],h=0;h<g.length;++h){var l=a.querySelectorAll("["+g[h]+"model"+(c?"=":"*=")+'"'+b+'"]');if(l.length)return l}},getLocation:function(){return c.url()},setLocation:function(a){a!==c.url()&&(c.url(a),b.$digest())},whenStable:function(b){a.notifyWhenNoOutstandingRequests(b)}}}]}function rf(){this.$get=["$rootScope","$browser","$q","$$q","$exceptionHandler",function(b,a,c,d,e){function f(f,l,k){x(f)||(k=l,l=f,f=y);var n=ua.call(arguments,3),p=A(k)&&!k,r=(p?d:c).defer(),t=r.promise,m; m=a.defer(function(){try{r.resolve(f.apply(null,n))}catch(a){r.reject(a),e(a)}finally{delete g[t.$$timeoutId]}p||b.$apply()},l);t.$$timeoutId=m;g[m]=r;return t}var g={};f.cancel=function(b){return b&&b.$$timeoutId in g?(g[b.$$timeoutId].reject("canceled"),delete g[b.$$timeoutId],a.defer.cancel(b.$$timeoutId)):!1};return f}]}function Aa(b){Wa&&(Z.setAttribute("href",b),b=Z.href);Z.setAttribute("href",b);return{href:Z.href,protocol:Z.protocol?Z.protocol.replace(/:$/,""):"",host:Z.host,search:Z.search? Z.search.replace(/^\?/,""):"",hash:Z.hash?Z.hash.replace(/^#/,""):"",hostname:Z.hostname,port:Z.port,pathname:"/"===Z.pathname.charAt(0)?Z.pathname:"/"+Z.pathname}}function ed(b){b=G(b)?Aa(b):b;return b.protocol===ud.protocol&&b.host===ud.host}function sf(){this.$get=qa(Q)}function vd(b){function a(a){try{return decodeURIComponent(a)}catch(b){return a}}var c=b[0]||{},d={},e="";return function(){var b,g,h,l,k;b=c.cookie||"";if(b!==e)for(e=b,b=e.split("; "),d={},h=0;h<b.length;h++)g=b[h],l=g.indexOf("="), 0<l&&(k=a(g.substring(0,l)),v(d[k])&&(d[k]=a(g.substring(l+1))));return d}}function wf(){this.$get=vd}function Jc(b){function a(c,d){if(B(c)){var e={};m(c,function(b,c){e[c]=a(c,b)});return e}return b.factory(c+"Filter",d)}this.register=a;this.$get=["$injector",function(a){return function(b){return a.get(b+"Filter")}}];a("currency",wd);a("date",xd);a("filter",Yf);a("json",Zf);a("limitTo",$f);a("lowercase",ag);a("number",yd);a("orderBy",zd);a("uppercase",bg)}function Yf(){return function(b,a,c){if(!Da(b)){if(null== b)return b;throw I("filter")("notarray",b);}var d;switch(gc(a)){case "function":break;case "boolean":case "null":case "number":case "string":d=!0;case "object":a=cg(a,c,d);break;default:return b}return Array.prototype.filter.call(b,a)}}function cg(b,a,c){var d=B(b)&&"$"in b;!0===a?a=ka:x(a)||(a=function(a,b){if(v(a))return!1;if(null===a||null===b)return a===b;if(B(b)||B(a)&&!pc(a))return!1;a=F(""+a);b=F(""+b);return-1!==a.indexOf(b)});return function(e){return d&&!B(e)?Ma(e,b.$,a,!1):Ma(e,b,a,c)}} function Ma(b,a,c,d,e){var f=gc(b),g=gc(a);if("string"===g&&"!"===a.charAt(0))return!Ma(b,a.substring(1),c,d);if(J(b))return b.some(function(b){return Ma(b,a,c,d)});switch(f){case "object":var h;if(d){for(h in b)if("$"!==h.charAt(0)&&Ma(b[h],a,c,!0))return!0;return e?!1:Ma(b,a,c,!1)}if("object"===g){for(h in a)if(e=a[h],!x(e)&&!v(e)&&(f="$"===h,!Ma(f?b:b[h],e,c,f,f)))return!1;return!0}return c(b,a);case "function":return!1;default:return c(b,a)}}function gc(b){return null===b?"null":typeof b}function wd(b){var a= b.NUMBER_FORMATS;return function(b,d,e){v(d)&&(d=a.CURRENCY_SYM);v(e)&&(e=a.PATTERNS[1].maxFrac);return null==b?b:Ad(b,a.PATTERNS[1],a.GROUP_SEP,a.DECIMAL_SEP,e).replace(/\u00A4/g,d)}}function yd(b){var a=b.NUMBER_FORMATS;return function(b,d){return null==b?b:Ad(b,a.PATTERNS[0],a.GROUP_SEP,a.DECIMAL_SEP,d)}}function Ad(b,a,c,d,e){if(B(b))return"";var f=0>b;b=Math.abs(b);var g=Infinity===b;if(!g&&!isFinite(b))return"";var h=b+"",l="",k=!1,n=[];g&&(l="\u221e");if(!g&&-1!==h.indexOf("e")){var p=h.match(/([\d\.]+)e(-?)(\d+)/); p&&"-"==p[2]&&p[3]>e+1?b=0:(l=h,k=!0)}if(g||k)0<e&&1>b&&(l=b.toFixed(e),b=parseFloat(l));else{g=(h.split(Bd)[1]||"").length;v(e)&&(e=Math.min(Math.max(a.minFrac,g),a.maxFrac));b=+(Math.round(+(b.toString()+"e"+e)).toString()+"e"+-e);var g=(""+b).split(Bd),h=g[0],g=g[1]||"",p=0,r=a.lgSize,t=a.gSize;if(h.length>=r+t)for(p=h.length-r,k=0;k<p;k++)0===(p-k)%t&&0!==k&&(l+=c),l+=h.charAt(k);for(k=p;k<h.length;k++)0===(h.length-k)%r&&0!==k&&(l+=c),l+=h.charAt(k);for(;g.length<e;)g+="0";e&&"0"!==e&&(l+=d+ g.substr(0,e))}0===b&&(f=!1);n.push(f?a.negPre:a.posPre,l,f?a.negSuf:a.posSuf);return n.join("")}function Gb(b,a,c){var d="";0>b&&(d="-",b=-b);for(b=""+b;b.length<a;)b="0"+b;c&&(b=b.substr(b.length-a));return d+b}function $(b,a,c,d){c=c||0;return function(e){e=e["get"+b]();if(0<c||e>-c)e+=c;0===e&&-12==c&&(e=12);return Gb(e,a,d)}}function Hb(b,a){return function(c,d){var e=c["get"+b](),f=sb(a?"SHORT"+b:b);return d[f][e]}}function Cd(b){var a=(new Date(b,0,1)).getDay();return new Date(b,0,(4>=a?5: 12)-a)}function Dd(b){return function(a){var c=Cd(a.getFullYear());a=+new Date(a.getFullYear(),a.getMonth(),a.getDate()+(4-a.getDay()))-+c;a=1+Math.round(a/6048E5);return Gb(a,b)}}function hc(b,a){return 0>=b.getFullYear()?a.ERAS[0]:a.ERAS[1]}function xd(b){function a(a){var b;if(b=a.match(c)){a=new Date(0);var f=0,g=0,h=b[8]?a.setUTCFullYear:a.setFullYear,l=b[8]?a.setUTCHours:a.setHours;b[9]&&(f=Y(b[9]+b[10]),g=Y(b[9]+b[11]));h.call(a,Y(b[1]),Y(b[2])-1,Y(b[3]));f=Y(b[4]||0)-f;g=Y(b[5]||0)-g;h=Y(b[6]|| 0);b=Math.round(1E3*parseFloat("0."+(b[7]||0)));l.call(a,f,g,h,b)}return a}var c=/^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;return function(c,e,f){var g="",h=[],l,k;e=e||"mediumDate";e=b.DATETIME_FORMATS[e]||e;G(c)&&(c=dg.test(c)?Y(c):a(c));V(c)&&(c=new Date(c));if(!da(c)||!isFinite(c.getTime()))return c;for(;e;)(k=eg.exec(e))?(h=db(h,k,1),e=h.pop()):(h.push(e),e=null);var n=c.getTimezoneOffset();f&&(n=vc(f,c.getTimezoneOffset()),c=Ob(c, f,!0));m(h,function(a){l=fg[a];g+=l?l(c,b.DATETIME_FORMATS,n):a.replace(/(^'|'$)/g,"").replace(/''/g,"'")});return g}}function Zf(){return function(b,a){v(a)&&(a=2);return eb(b,a)}}function $f(){return function(b,a,c){a=Infinity===Math.abs(Number(a))?Number(a):Y(a);if(isNaN(a))return b;V(b)&&(b=b.toString());if(!J(b)&&!G(b))return b;c=!c||isNaN(c)?0:Y(c);c=0>c&&c>=-b.length?b.length+c:c;return 0<=a?b.slice(c,c+a):0===c?b.slice(a,b.length):b.slice(Math.max(0,c+a),c)}}function zd(b){function a(a,c){c= c?-1:1;return a.map(function(a){var d=1,h=$a;if(x(a))h=a;else if(G(a)){if("+"==a.charAt(0)||"-"==a.charAt(0))d="-"==a.charAt(0)?-1:1,a=a.substring(1);if(""!==a&&(h=b(a),h.constant))var l=h(),h=function(a){return a[l]}}return{get:h,descending:d*c}})}function c(a){switch(typeof a){case "number":case "boolean":case "string":return!0;default:return!1}}return function(b,e,f){if(!Da(b))return b;J(e)||(e=[e]);0===e.length&&(e=["+"]);var g=a(e,f);g.push({get:function(){return{}},descending:f?-1:1});b=Array.prototype.map.call(b, function(a,b){return{value:a,predicateValues:g.map(function(d){var e=d.get(a);d=typeof e;if(null===e)d="string",e="null";else if("string"===d)e=e.toLowerCase();else if("object"===d)a:{if("function"===typeof e.valueOf&&(e=e.valueOf(),c(e)))break a;if(pc(e)&&(e=e.toString(),c(e)))break a;e=b}return{value:e,type:d}})}});b.sort(function(a,b){for(var c=0,d=0,e=g.length;d<e;++d){var c=a.predicateValues[d],f=b.predicateValues[d],t=0;c.type===f.type?c.value!==f.value&&(t=c.value<f.value?-1:1):t=c.type<f.type? -1:1;if(c=t*g[d].descending)break}return c});return b=b.map(function(a){return a.value})}}function Na(b){x(b)&&(b={link:b});b.restrict=b.restrict||"AC";return qa(b)}function Ed(b,a,c,d,e){var f=this,g=[];f.$error={};f.$$success={};f.$pending=w;f.$name=e(a.name||a.ngForm||"")(c);f.$dirty=!1;f.$pristine=!0;f.$valid=!0;f.$invalid=!1;f.$submitted=!1;f.$$parentForm=Ib;f.$rollbackViewValue=function(){m(g,function(a){a.$rollbackViewValue()})};f.$commitViewValue=function(){m(g,function(a){a.$commitViewValue()})}; f.$addControl=function(a){Ta(a.$name,"input");g.push(a);a.$name&&(f[a.$name]=a);a.$$parentForm=f};f.$$renameControl=function(a,b){var c=a.$name;f[c]===a&&delete f[c];f[b]=a;a.$name=b};f.$removeControl=function(a){a.$name&&f[a.$name]===a&&delete f[a.$name];m(f.$pending,function(b,c){f.$setValidity(c,null,a)});m(f.$error,function(b,c){f.$setValidity(c,null,a)});m(f.$$success,function(b,c){f.$setValidity(c,null,a)});cb(g,a);a.$$parentForm=Ib};Fd({ctrl:this,$element:b,set:function(a,b,c){var d=a[b];d? -1===d.indexOf(c)&&d.push(c):a[b]=[c]},unset:function(a,b,c){var d=a[b];d&&(cb(d,c),0===d.length&&delete a[b])},$animate:d});f.$setDirty=function(){d.removeClass(b,Ya);d.addClass(b,Jb);f.$dirty=!0;f.$pristine=!1;f.$$parentForm.$setDirty()};f.$setPristine=function(){d.setClass(b,Ya,Jb+" ng-submitted");f.$dirty=!1;f.$pristine=!0;f.$submitted=!1;m(g,function(a){a.$setPristine()})};f.$setUntouched=function(){m(g,function(a){a.$setUntouched()})};f.$setSubmitted=function(){d.addClass(b,"ng-submitted"); f.$submitted=!0;f.$$parentForm.$setSubmitted()}}function ic(b){b.$formatters.push(function(a){return b.$isEmpty(a)?a:a.toString()})}function jb(b,a,c,d,e,f){var g=F(a[0].type);if(!e.android){var h=!1;a.on("compositionstart",function(a){h=!0});a.on("compositionend",function(){h=!1;l()})}var l=function(b){k&&(f.defer.cancel(k),k=null);if(!h){var e=a.val();b=b&&b.type;"password"===g||c.ngTrim&&"false"===c.ngTrim||(e=T(e));(d.$viewValue!==e||""===e&&d.$$hasNativeValidators)&&d.$setViewValue(e,b)}};if(e.hasEvent("input"))a.on("input", l);else{var k,n=function(a,b,c){k||(k=f.defer(function(){k=null;b&&b.value===c||l(a)}))};a.on("keydown",function(a){var b=a.keyCode;91===b||15<b&&19>b||37<=b&&40>=b||n(a,this,this.value)});if(e.hasEvent("paste"))a.on("paste cut",n)}a.on("change",l);d.$render=function(){var b=d.$isEmpty(d.$viewValue)?"":d.$viewValue;a.val()!==b&&a.val(b)}}function Kb(b,a){return function(c,d){var e,f;if(da(c))return c;if(G(c)){'"'==c.charAt(0)&&'"'==c.charAt(c.length-1)&&(c=c.substring(1,c.length-1));if(gg.test(c))return new Date(c); b.lastIndex=0;if(e=b.exec(c))return e.shift(),f=d?{yyyy:d.getFullYear(),MM:d.getMonth()+1,dd:d.getDate(),HH:d.getHours(),mm:d.getMinutes(),ss:d.getSeconds(),sss:d.getMilliseconds()/1E3}:{yyyy:1970,MM:1,dd:1,HH:0,mm:0,ss:0,sss:0},m(e,function(b,c){c<a.length&&(f[a[c]]=+b)}),new Date(f.yyyy,f.MM-1,f.dd,f.HH,f.mm,f.ss||0,1E3*f.sss||0)}return NaN}}function kb(b,a,c,d){return function(e,f,g,h,l,k,n){function p(a){return a&&!(a.getTime&&a.getTime()!==a.getTime())}function r(a){return A(a)&&!da(a)?c(a)|| w:a}Gd(e,f,g,h);jb(e,f,g,h,l,k);var t=h&&h.$options&&h.$options.timezone,m;h.$$parserName=b;h.$parsers.push(function(b){return h.$isEmpty(b)?null:a.test(b)?(b=c(b,m),t&&(b=Ob(b,t)),b):w});h.$formatters.push(function(a){if(a&&!da(a))throw lb("datefmt",a);if(p(a))return(m=a)&&t&&(m=Ob(m,t,!0)),n("date")(a,d,t);m=null;return""});if(A(g.min)||g.ngMin){var s;h.$validators.min=function(a){return!p(a)||v(s)||c(a)>=s};g.$observe("min",function(a){s=r(a);h.$validate()})}if(A(g.max)||g.ngMax){var u;h.$validators.max= function(a){return!p(a)||v(u)||c(a)<=u};g.$observe("max",function(a){u=r(a);h.$validate()})}}}function Gd(b,a,c,d){(d.$$hasNativeValidators=B(a[0].validity))&&d.$parsers.push(function(b){var c=a.prop("validity")||{};return c.badInput&&!c.typeMismatch?w:b})}function Hd(b,a,c,d,e){if(A(d)){b=b(d);if(!b.constant)throw lb("constexpr",c,d);return b(a)}return e}function jc(b,a){b="ngClass"+b;return["$animate",function(c){function d(a,b){var c=[],d=0;a:for(;d<a.length;d++){for(var e=a[d],n=0;n<b.length;n++)if(e== b[n])continue a;c.push(e)}return c}function e(a){var b=[];return J(a)?(m(a,function(a){b=b.concat(e(a))}),b):G(a)?a.split(" "):B(a)?(m(a,function(a,c){a&&(b=b.concat(c.split(" ")))}),b):a}return{restrict:"AC",link:function(f,g,h){function l(a,b){var c=g.data("$classCounts")||ha(),d=[];m(a,function(a){if(0<b||c[a])c[a]=(c[a]||0)+b,c[a]===+(0<b)&&d.push(a)});g.data("$classCounts",c);return d.join(" ")}function k(b){if(!0===a||f.$index%2===a){var k=e(b||[]);if(!n){var m=l(k,1);h.$addClass(m)}else if(!ka(b, n)){var s=e(n),m=d(k,s),k=d(s,k),m=l(m,1),k=l(k,-1);m&&m.length&&c.addClass(g,m);k&&k.length&&c.removeClass(g,k)}}n=ja(b)}var n;f.$watch(h[b],k,!0);h.$observe("class",function(a){k(f.$eval(h[b]))});"ngClass"!==b&&f.$watch("$index",function(c,d){var g=c&1;if(g!==(d&1)){var k=e(f.$eval(h[b]));g===a?(g=l(k,1),h.$addClass(g)):(g=l(k,-1),h.$removeClass(g))}})}}}]}function Fd(b){function a(a,b){b&&!f[a]?(l.addClass(e,a),f[a]=!0):!b&&f[a]&&(l.removeClass(e,a),f[a]=!1)}function c(b,c){b=b?"-"+zc(b,"-"):""; a(mb+b,!0===c);a(Id+b,!1===c)}var d=b.ctrl,e=b.$element,f={},g=b.set,h=b.unset,l=b.$animate;f[Id]=!(f[mb]=e.hasClass(mb));d.$setValidity=function(b,e,f){v(e)?(d.$pending||(d.$pending={}),g(d.$pending,b,f)):(d.$pending&&h(d.$pending,b,f),Jd(d.$pending)&&(d.$pending=w));bb(e)?e?(h(d.$error,b,f),g(d.$$success,b,f)):(g(d.$error,b,f),h(d.$$success,b,f)):(h(d.$error,b,f),h(d.$$success,b,f));d.$pending?(a(Kd,!0),d.$valid=d.$invalid=w,c("",null)):(a(Kd,!1),d.$valid=Jd(d.$error),d.$invalid=!d.$valid,c("", d.$valid));e=d.$pending&&d.$pending[b]?w:d.$error[b]?!1:d.$$success[b]?!0:null;c(b,e);d.$$parentForm.$setValidity(b,e,d)}}function Jd(b){if(b)for(var a in b)if(b.hasOwnProperty(a))return!1;return!0}var hg=/^\/(.+)\/([a-z]*)$/,F=function(b){return G(b)?b.toLowerCase():b},ta=Object.prototype.hasOwnProperty,sb=function(b){return G(b)?b.toUpperCase():b},Wa,C,ra,ua=[].slice,Kf=[].splice,ig=[].push,va=Object.prototype.toString,qc=Object.getPrototypeOf,Ea=I("ng"),aa=Q.angular||(Q.angular={}),Rb,nb=0;Wa= X.documentMode;y.$inject=[];$a.$inject=[];var J=Array.isArray,sc=/^\[object (Uint8(Clamped)?)|(Uint16)|(Uint32)|(Int8)|(Int16)|(Int32)|(Float(32)|(64))Array\]$/,T=function(b){return G(b)?b.trim():b},sd=function(b){return b.replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g,"\\$1").replace(/\x08/g,"\\x08")},Fa=function(){if(!A(Fa.rules)){var b=X.querySelector("[ng-csp]")||X.querySelector("[data-ng-csp]");if(b){var a=b.getAttribute("ng-csp")||b.getAttribute("data-ng-csp");Fa.rules={noUnsafeEval:!a||-1!==a.indexOf("no-unsafe-eval"), noInlineStyle:!a||-1!==a.indexOf("no-inline-style")}}else{b=Fa;try{new Function(""),a=!1}catch(c){a=!0}b.rules={noUnsafeEval:a,noInlineStyle:!1}}}return Fa.rules},pb=function(){if(A(pb.name_))return pb.name_;var b,a,c=Qa.length,d,e;for(a=0;a<c;++a)if(d=Qa[a],b=X.querySelector("["+d.replace(":","\\:")+"jq]")){e=b.getAttribute(d+"jq");break}return pb.name_=e},Qa=["ng-","data-ng-","ng:","x-ng-"],$d=/[A-Z]/g,Ac=!1,Qb,pa=1,Pa=3,de={full:"1.4.6",major:1,minor:4,dot:6,codeName:"multiplicative-elevation"}; R.expando="ng339";var hb=R.cache={},Cf=1;R._data=function(b){return this.cache[b[this.expando]]||{}};var xf=/([\:\-\_]+(.))/g,yf=/^moz([A-Z])/,jg={mouseleave:"mouseout",mouseenter:"mouseover"},Tb=I("jqLite"),Bf=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,Sb=/<|&#?\w+;/,zf=/<([\w:]+)/,Af=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,ma={option:[1,'<select multiple="multiple">',"</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>", "</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ma.optgroup=ma.option;ma.tbody=ma.tfoot=ma.colgroup=ma.caption=ma.thead;ma.th=ma.td;var Ra=R.prototype={ready:function(b){function a(){c||(c=!0,b())}var c=!1;"complete"===X.readyState?setTimeout(a):(this.on("DOMContentLoaded",a),R(Q).on("load",a))},toString:function(){var b=[];m(this,function(a){b.push(""+a)});return"["+b.join(", ")+"]"},eq:function(b){return 0<=b?C(this[b]):C(this[this.length+b])},length:0, push:ig,sort:[].sort,splice:[].splice},Bb={};m("multiple selected checked disabled readOnly required open".split(" "),function(b){Bb[F(b)]=b});var Rc={};m("input select option textarea button form details".split(" "),function(b){Rc[b]=!0});var Zc={ngMinlength:"minlength",ngMaxlength:"maxlength",ngMin:"min",ngMax:"max",ngPattern:"pattern"};m({data:Vb,removeData:vb,hasData:function(b){for(var a in hb[b.ng339])return!0;return!1}},function(b,a){R[a]=b});m({data:Vb,inheritedData:Ab,scope:function(b){return C.data(b, "$scope")||Ab(b.parentNode||b,["$isolateScope","$scope"])},isolateScope:function(b){return C.data(b,"$isolateScope")||C.data(b,"$isolateScopeNoTemplate")},controller:Oc,injector:function(b){return Ab(b,"$injector")},removeAttr:function(b,a){b.removeAttribute(a)},hasClass:xb,css:function(b,a,c){a=gb(a);if(A(c))b.style[a]=c;else return b.style[a]},attr:function(b,a,c){var d=b.nodeType;if(d!==Pa&&2!==d&&8!==d)if(d=F(a),Bb[d])if(A(c))c?(b[a]=!0,b.setAttribute(a,d)):(b[a]=!1,b.removeAttribute(d));else return b[a]|| (b.attributes.getNamedItem(a)||y).specified?d:w;else if(A(c))b.setAttribute(a,c);else if(b.getAttribute)return b=b.getAttribute(a,2),null===b?w:b},prop:function(b,a,c){if(A(c))b[a]=c;else return b[a]},text:function(){function b(a,b){if(v(b)){var d=a.nodeType;return d===pa||d===Pa?a.textContent:""}a.textContent=b}b.$dv="";return b}(),val:function(b,a){if(v(a)){if(b.multiple&&"select"===wa(b)){var c=[];m(b.options,function(a){a.selected&&c.push(a.value||a.text)});return 0===c.length?null:c}return b.value}b.value= a},html:function(b,a){if(v(a))return b.innerHTML;ub(b,!0);b.innerHTML=a},empty:Pc},function(b,a){R.prototype[a]=function(a,d){var e,f,g=this.length;if(b!==Pc&&v(2==b.length&&b!==xb&&b!==Oc?a:d)){if(B(a)){for(e=0;e<g;e++)if(b===Vb)b(this[e],a);else for(f in a)b(this[e],f,a[f]);return this}e=b.$dv;g=v(e)?Math.min(g,1):g;for(f=0;f<g;f++){var h=b(this[f],a,d);e=e?e+h:h}return e}for(e=0;e<g;e++)b(this[e],a,d);return this}});m({removeData:vb,on:function a(c,d,e,f){if(A(f))throw Tb("onargs");if(Kc(c)){var g= wb(c,!0);f=g.events;var h=g.handle;h||(h=g.handle=Ef(c,f));for(var g=0<=d.indexOf(" ")?d.split(" "):[d],l=g.length;l--;){d=g[l];var k=f[d];k||(f[d]=[],"mouseenter"===d||"mouseleave"===d?a(c,jg[d],function(a){var c=a.relatedTarget;c&&(c===this||this.contains(c))||h(a,d)}):"$destroy"!==d&&c.addEventListener(d,h,!1),k=f[d]);k.push(e)}}},off:Nc,one:function(a,c,d){a=C(a);a.on(c,function f(){a.off(c,d);a.off(c,f)});a.on(c,d)},replaceWith:function(a,c){var d,e=a.parentNode;ub(a);m(new R(c),function(c){d? e.insertBefore(c,d.nextSibling):e.replaceChild(c,a);d=c})},children:function(a){var c=[];m(a.childNodes,function(a){a.nodeType===pa&&c.push(a)});return c},contents:function(a){return a.contentDocument||a.childNodes||[]},append:function(a,c){var d=a.nodeType;if(d===pa||11===d){c=new R(c);for(var d=0,e=c.length;d<e;d++)a.appendChild(c[d])}},prepend:function(a,c){if(a.nodeType===pa){var d=a.firstChild;m(new R(c),function(c){a.insertBefore(c,d)})}},wrap:function(a,c){c=C(c).eq(0).clone()[0];var d=a.parentNode; d&&d.replaceChild(c,a);c.appendChild(a)},remove:Wb,detach:function(a){Wb(a,!0)},after:function(a,c){var d=a,e=a.parentNode;c=new R(c);for(var f=0,g=c.length;f<g;f++){var h=c[f];e.insertBefore(h,d.nextSibling);d=h}},addClass:zb,removeClass:yb,toggleClass:function(a,c,d){c&&m(c.split(" "),function(c){var f=d;v(f)&&(f=!xb(a,c));(f?zb:yb)(a,c)})},parent:function(a){return(a=a.parentNode)&&11!==a.nodeType?a:null},next:function(a){return a.nextElementSibling},find:function(a,c){return a.getElementsByTagName? a.getElementsByTagName(c):[]},clone:Ub,triggerHandler:function(a,c,d){var e,f,g=c.type||c,h=wb(a);if(h=(h=h&&h.events)&&h[g])e={preventDefault:function(){this.defaultPrevented=!0},isDefaultPrevented:function(){return!0===this.defaultPrevented},stopImmediatePropagation:function(){this.immediatePropagationStopped=!0},isImmediatePropagationStopped:function(){return!0===this.immediatePropagationStopped},stopPropagation:y,type:g,target:a},c.type&&(e=P(e,c)),c=ja(h),f=d?[e].concat(d):[e],m(c,function(c){e.isImmediatePropagationStopped()|| c.apply(a,f)})}},function(a,c){R.prototype[c]=function(c,e,f){for(var g,h=0,l=this.length;h<l;h++)v(g)?(g=a(this[h],c,e,f),A(g)&&(g=C(g))):Mc(g,a(this[h],c,e,f));return A(g)?g:this};R.prototype.bind=R.prototype.on;R.prototype.unbind=R.prototype.off});Ua.prototype={put:function(a,c){this[Ga(a,this.nextUid)]=c},get:function(a){return this[Ga(a,this.nextUid)]},remove:function(a){var c=this[a=Ga(a,this.nextUid)];delete this[a];return c}};var vf=[function(){this.$get=[function(){return Ua}]}],Tc=/^[^\(]*\(\s*([^\)]*)\)/m, kg=/,/,lg=/^\s*(_?)(\S+?)\1\s*$/,Sc=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg,Ha=I("$injector");fb.$$annotate=function(a,c,d){var e;if("function"===typeof a){if(!(e=a.$inject)){e=[];if(a.length){if(c)throw G(d)&&d||(d=a.name||Ff(a)),Ha("strictdi",d);c=a.toString().replace(Sc,"");c=c.match(Tc);m(c[1].split(kg),function(a){a.replace(lg,function(a,c,d){e.push(d)})})}a.$inject=e}}else J(a)?(c=a.length-1,Sa(a[c],"fn"),e=a.slice(0,c)):Sa(a,"fn",!0);return e};var Ld=I("$animate"),Se=function(){this.$get=["$q", "$$rAF",function(a,c){function d(){}d.all=y;d.chain=y;d.prototype={end:y,cancel:y,resume:y,pause:y,complete:y,then:function(d,f){return a(function(a){c(function(){a()})}).then(d,f)}};return d}]},Re=function(){var a=new Ua,c=[];this.$get=["$$AnimateRunner","$rootScope",function(d,e){function f(a,c,d){var e=!1;c&&(c=G(c)?c.split(" "):J(c)?c:[],m(c,function(c){c&&(e=!0,a[c]=d)}));return e}function g(){m(c,function(c){var d=a.get(c);if(d){var e=Gf(c.attr("class")),f="",g="";m(d,function(a,c){a!==!!e[c]&& (a?f+=(f.length?" ":"")+c:g+=(g.length?" ":"")+c)});m(c,function(a){f&&zb(a,f);g&&yb(a,g)});a.remove(c)}});c.length=0}return{enabled:y,on:y,off:y,pin:y,push:function(h,l,k,n){n&&n();k=k||{};k.from&&h.css(k.from);k.to&&h.css(k.to);if(k.addClass||k.removeClass)if(l=k.addClass,n=k.removeClass,k=a.get(h)||{},l=f(k,l,!0),n=f(k,n,!1),l||n)a.put(h,k),c.push(h),1===c.length&&e.$$postDigest(g);return new d}}}]},Pe=["$provide",function(a){var c=this;this.$$registeredAnimations=Object.create(null);this.register= function(d,e){if(d&&"."!==d.charAt(0))throw Ld("notcsel",d);var f=d+"-animation";c.$$registeredAnimations[d.substr(1)]=f;a.factory(f,e)};this.classNameFilter=function(a){if(1===arguments.length&&(this.$$classNameFilter=a instanceof RegExp?a:null)&&/(\s+|\/)ng-animate(\s+|\/)/.test(this.$$classNameFilter.toString()))throw Ld("nongcls","ng-animate");return this.$$classNameFilter};this.$get=["$$animateQueue",function(a){function c(a,d,e){if(e){var l;a:{for(l=0;l<e.length;l++){var k=e[l];if(1===k.nodeType){l= k;break a}}l=void 0}!l||l.parentNode||l.previousElementSibling||(e=null)}e?e.after(a):d.prepend(a)}return{on:a.on,off:a.off,pin:a.pin,enabled:a.enabled,cancel:function(a){a.end&&a.end()},enter:function(f,g,h,l){g=g&&C(g);h=h&&C(h);g=g||h.parent();c(f,g,h);return a.push(f,"enter",Ia(l))},move:function(f,g,h,l){g=g&&C(g);h=h&&C(h);g=g||h.parent();c(f,g,h);return a.push(f,"move",Ia(l))},leave:function(c,e){return a.push(c,"leave",Ia(e),function(){c.remove()})},addClass:function(c,e,h){h=Ia(h);h.addClass= ib(h.addclass,e);return a.push(c,"addClass",h)},removeClass:function(c,e,h){h=Ia(h);h.removeClass=ib(h.removeClass,e);return a.push(c,"removeClass",h)},setClass:function(c,e,h,l){l=Ia(l);l.addClass=ib(l.addClass,e);l.removeClass=ib(l.removeClass,h);return a.push(c,"setClass",l)},animate:function(c,e,h,l,k){k=Ia(k);k.from=k.from?P(k.from,e):e;k.to=k.to?P(k.to,h):h;k.tempClasses=ib(k.tempClasses,l||"ng-inline-animate");return a.push(c,"animate",k)}}}]}],Qe=function(){this.$get=["$$rAF","$q",function(a, c){var d=function(){};d.prototype={done:function(a){this.defer&&this.defer[!0===a?"reject":"resolve"]()},end:function(){this.done()},cancel:function(){this.done(!0)},getPromise:function(){this.defer||(this.defer=c.defer());return this.defer.promise},then:function(a,c){return this.getPromise().then(a,c)},"catch":function(a){return this.getPromise()["catch"](a)},"finally":function(a){return this.getPromise()["finally"](a)}};return function(c,f){function g(){a(function(){f.addClass&&(c.addClass(f.addClass), f.addClass=null);f.removeClass&&(c.removeClass(f.removeClass),f.removeClass=null);f.to&&(c.css(f.to),f.to=null);h||l.done();h=!0});return l}f.from&&(c.css(f.from),f.from=null);var h,l=new d;return{start:g,end:g}}}]},fa=I("$compile");Cc.$inject=["$provide","$$sanitizeUriProvider"];var Vc=/^((?:x|data)[\:\-_])/i,Lf=I("$controller"),Uc=/^(\S+)(\s+as\s+(\w+))?$/,Ye=function(){this.$get=["$document",function(a){return function(c){c?!c.nodeType&&c instanceof C&&(c=c[0]):c=a[0].body;return c.offsetWidth+ 1}}]},$c="application/json",$b={"Content-Type":$c+";charset=utf-8"},Nf=/^\[|^\{(?!\{)/,Of={"[":/]$/,"{":/}$/},Mf=/^\)\]\}',?\n/,mg=I("$http"),dd=function(a){return function(){throw mg("legacy",a);}},La=aa.$interpolateMinErr=I("$interpolate");La.throwNoconcat=function(a){throw La("noconcat",a);};La.interr=function(a,c){return La("interr",a,c.toString())};var ng=/^([^\?#]*)(\?([^#]*))?(#(.*))?$/,Rf={http:80,https:443,ftp:21},Db=I("$location"),og={$$html5:!1,$$replace:!1,absUrl:Eb("$$absUrl"),url:function(a){if(v(a))return this.$$url; var c=ng.exec(a);(c[1]||""===a)&&this.path(decodeURIComponent(c[1]));(c[2]||c[1]||""===a)&&this.search(c[3]||"");this.hash(c[5]||"");return this},protocol:Eb("$$protocol"),host:Eb("$$host"),port:Eb("$$port"),path:id("$$path",function(a){a=null!==a?a.toString():"";return"/"==a.charAt(0)?a:"/"+a}),search:function(a,c){switch(arguments.length){case 0:return this.$$search;case 1:if(G(a)||V(a))a=a.toString(),this.$$search=xc(a);else if(B(a))a=ga(a,{}),m(a,function(c,e){null==c&&delete a[e]}),this.$$search= a;else throw Db("isrcharg");break;default:v(c)||null===c?delete this.$$search[a]:this.$$search[a]=c}this.$$compose();return this},hash:id("$$hash",function(a){return null!==a?a.toString():""}),replace:function(){this.$$replace=!0;return this}};m([hd,cc,bc],function(a){a.prototype=Object.create(og);a.prototype.state=function(c){if(!arguments.length)return this.$$state;if(a!==bc||!this.$$html5)throw Db("nostate");this.$$state=v(c)?null:c;return this}});var ea=I("$parse"),Sf=Function.prototype.call, Tf=Function.prototype.apply,Uf=Function.prototype.bind,Lb=ha();m("+ - * / % === !== == != < > <= >= && || ! = |".split(" "),function(a){Lb[a]=!0});var pg={n:"\n",f:"\f",r:"\r",t:"\t",v:"\v","'":"'",'"':'"'},ec=function(a){this.options=a};ec.prototype={constructor:ec,lex:function(a){this.text=a;this.index=0;for(this.tokens=[];this.index<this.text.length;)if(a=this.text.charAt(this.index),'"'===a||"'"===a)this.readString(a);else if(this.isNumber(a)||"."===a&&this.isNumber(this.peek()))this.readNumber(); else if(this.isIdent(a))this.readIdent();else if(this.is(a,"(){}[].,;:?"))this.tokens.push({index:this.index,text:a}),this.index++;else if(this.isWhitespace(a))this.index++;else{var c=a+this.peek(),d=c+this.peek(2),e=Lb[c],f=Lb[d];Lb[a]||e||f?(a=f?d:e?c:a,this.tokens.push({index:this.index,text:a,operator:!0}),this.index+=a.length):this.throwError("Unexpected next character ",this.index,this.index+1)}return this.tokens},is:function(a,c){return-1!==c.indexOf(a)},peek:function(a){a=a||1;return this.index+ a<this.text.length?this.text.charAt(this.index+a):!1},isNumber:function(a){return"0"<=a&&"9">=a&&"string"===typeof a},isWhitespace:function(a){return" "===a||"\r"===a||"\t"===a||"\n"===a||"\v"===a||"\u00a0"===a},isIdent:function(a){return"a"<=a&&"z">=a||"A"<=a&&"Z">=a||"_"===a||"$"===a},isExpOperator:function(a){return"-"===a||"+"===a||this.isNumber(a)},throwError:function(a,c,d){d=d||this.index;c=A(c)?"s "+c+"-"+this.index+" ["+this.text.substring(c,d)+"]":" "+d;throw ea("lexerr",a,c,this.text); },readNumber:function(){for(var a="",c=this.index;this.index<this.text.length;){var d=F(this.text.charAt(this.index));if("."==d||this.isNumber(d))a+=d;else{var e=this.peek();if("e"==d&&this.isExpOperator(e))a+=d;else if(this.isExpOperator(d)&&e&&this.isNumber(e)&&"e"==a.charAt(a.length-1))a+=d;else if(!this.isExpOperator(d)||e&&this.isNumber(e)||"e"!=a.charAt(a.length-1))break;else this.throwError("Invalid exponent")}this.index++}this.tokens.push({index:c,text:a,constant:!0,value:Number(a)})},readIdent:function(){for(var a= this.index;this.index<this.text.length;){var c=this.text.charAt(this.index);if(!this.isIdent(c)&&!this.isNumber(c))break;this.index++}this.tokens.push({index:a,text:this.text.slice(a,this.index),identifier:!0})},readString:function(a){var c=this.index;this.index++;for(var d="",e=a,f=!1;this.index<this.text.length;){var g=this.text.charAt(this.index),e=e+g;if(f)"u"===g?(f=this.text.substring(this.index+1,this.index+5),f.match(/[\da-f]{4}/i)||this.throwError("Invalid unicode escape [\\u"+f+"]"),this.index+= 4,d+=String.fromCharCode(parseInt(f,16))):d+=pg[g]||g,f=!1;else if("\\"===g)f=!0;else{if(g===a){this.index++;this.tokens.push({index:c,text:e,constant:!0,value:d});return}d+=g}this.index++}this.throwError("Unterminated quote",c)}};var s=function(a,c){this.lexer=a;this.options=c};s.Program="Program";s.ExpressionStatement="ExpressionStatement";s.AssignmentExpression="AssignmentExpression";s.ConditionalExpression="ConditionalExpression";s.LogicalExpression="LogicalExpression";s.BinaryExpression="BinaryExpression"; s.UnaryExpression="UnaryExpression";s.CallExpression="CallExpression";s.MemberExpression="MemberExpression";s.Identifier="Identifier";s.Literal="Literal";s.ArrayExpression="ArrayExpression";s.Property="Property";s.ObjectExpression="ObjectExpression";s.ThisExpression="ThisExpression";s.NGValueParameter="NGValueParameter";s.prototype={ast:function(a){this.text=a;this.tokens=this.lexer.lex(a);a=this.program();0!==this.tokens.length&&this.throwError("is an unexpected token",this.tokens[0]);return a}, program:function(){for(var a=[];;)if(0<this.tokens.length&&!this.peek("}",")",";","]")&&a.push(this.expressionStatement()),!this.expect(";"))return{type:s.Program,body:a}},expressionStatement:function(){return{type:s.ExpressionStatement,expression:this.filterChain()}},filterChain:function(){for(var a=this.expression();this.expect("|");)a=this.filter(a);return a},expression:function(){return this.assignment()},assignment:function(){var a=this.ternary();this.expect("=")&&(a={type:s.AssignmentExpression, left:a,right:this.assignment(),operator:"="});return a},ternary:function(){var a=this.logicalOR(),c,d;return this.expect("?")&&(c=this.expression(),this.consume(":"))?(d=this.expression(),{type:s.ConditionalExpression,test:a,alternate:c,consequent:d}):a},logicalOR:function(){for(var a=this.logicalAND();this.expect("||");)a={type:s.LogicalExpression,operator:"||",left:a,right:this.logicalAND()};return a},logicalAND:function(){for(var a=this.equality();this.expect("&&");)a={type:s.LogicalExpression, operator:"&&",left:a,right:this.equality()};return a},equality:function(){for(var a=this.relational(),c;c=this.expect("==","!=","===","!==");)a={type:s.BinaryExpression,operator:c.text,left:a,right:this.relational()};return a},relational:function(){for(var a=this.additive(),c;c=this.expect("<",">","<=",">=");)a={type:s.BinaryExpression,operator:c.text,left:a,right:this.additive()};return a},additive:function(){for(var a=this.multiplicative(),c;c=this.expect("+","-");)a={type:s.BinaryExpression,operator:c.text, left:a,right:this.multiplicative()};return a},multiplicative:function(){for(var a=this.unary(),c;c=this.expect("*","/","%");)a={type:s.BinaryExpression,operator:c.text,left:a,right:this.unary()};return a},unary:function(){var a;return(a=this.expect("+","-","!"))?{type:s.UnaryExpression,operator:a.text,prefix:!0,argument:this.unary()}:this.primary()},primary:function(){var a;this.expect("(")?(a=this.filterChain(),this.consume(")")):this.expect("[")?a=this.arrayDeclaration():this.expect("{")?a=this.object(): this.constants.hasOwnProperty(this.peek().text)?a=ga(this.constants[this.consume().text]):this.peek().identifier?a=this.identifier():this.peek().constant?a=this.constant():this.throwError("not a primary expression",this.peek());for(var c;c=this.expect("(","[",".");)"("===c.text?(a={type:s.CallExpression,callee:a,arguments:this.parseArguments()},this.consume(")")):"["===c.text?(a={type:s.MemberExpression,object:a,property:this.expression(),computed:!0},this.consume("]")):"."===c.text?a={type:s.MemberExpression, object:a,property:this.identifier(),computed:!1}:this.throwError("IMPOSSIBLE");return a},filter:function(a){a=[a];for(var c={type:s.CallExpression,callee:this.identifier(),arguments:a,filter:!0};this.expect(":");)a.push(this.expression());return c},parseArguments:function(){var a=[];if(")"!==this.peekToken().text){do a.push(this.expression());while(this.expect(","))}return a},identifier:function(){var a=this.consume();a.identifier||this.throwError("is not a valid identifier",a);return{type:s.Identifier, name:a.text}},constant:function(){return{type:s.Literal,value:this.consume().value}},arrayDeclaration:function(){var a=[];if("]"!==this.peekToken().text){do{if(this.peek("]"))break;a.push(this.expression())}while(this.expect(","))}this.consume("]");return{type:s.ArrayExpression,elements:a}},object:function(){var a=[],c;if("}"!==this.peekToken().text){do{if(this.peek("}"))break;c={type:s.Property,kind:"init"};this.peek().constant?c.key=this.constant():this.peek().identifier?c.key=this.identifier(): this.throwError("invalid key",this.peek());this.consume(":");c.value=this.expression();a.push(c)}while(this.expect(","))}this.consume("}");return{type:s.ObjectExpression,properties:a}},throwError:function(a,c){throw ea("syntax",c.text,a,c.index+1,this.text,this.text.substring(c.index));},consume:function(a){if(0===this.tokens.length)throw ea("ueoe",this.text);var c=this.expect(a);c||this.throwError("is unexpected, expecting ["+a+"]",this.peek());return c},peekToken:function(){if(0===this.tokens.length)throw ea("ueoe", this.text);return this.tokens[0]},peek:function(a,c,d,e){return this.peekAhead(0,a,c,d,e)},peekAhead:function(a,c,d,e,f){if(this.tokens.length>a){a=this.tokens[a];var g=a.text;if(g===c||g===d||g===e||g===f||!(c||d||e||f))return a}return!1},expect:function(a,c,d,e){return(a=this.peek(a,c,d,e))?(this.tokens.shift(),a):!1},constants:{"true":{type:s.Literal,value:!0},"false":{type:s.Literal,value:!1},"null":{type:s.Literal,value:null},undefined:{type:s.Literal,value:w},"this":{type:s.ThisExpression}}}; pd.prototype={compile:function(a,c){var d=this,e=this.astBuilder.ast(a);this.state={nextId:0,filters:{},expensiveChecks:c,fn:{vars:[],body:[],own:{}},assign:{vars:[],body:[],own:{}},inputs:[]};U(e,d.$filter);var f="",g;this.stage="assign";if(g=nd(e))this.state.computing="assign",f=this.nextId(),this.recurse(g,f),this.return_(f),f="fn.assign="+this.generateFunction("assign","s,v,l");g=ld(e.body);d.stage="inputs";m(g,function(a,c){var e="fn"+c;d.state[e]={vars:[],body:[],own:{}};d.state.computing=e; var f=d.nextId();d.recurse(a,f);d.return_(f);d.state.inputs.push(e);a.watchId=c});this.state.computing="fn";this.stage="main";this.recurse(e);f='"'+this.USE+" "+this.STRICT+'";\n'+this.filterPrefix()+"var fn="+this.generateFunction("fn","s,l,a,i")+f+this.watchFns()+"return fn;";f=(new Function("$filter","ensureSafeMemberName","ensureSafeObject","ensureSafeFunction","ifDefined","plus","text",f))(this.$filter,Xa,Ba,jd,Vf,kd,a);this.state=this.stage=w;f.literal=od(e);f.constant=e.constant;return f}, USE:"use",STRICT:"strict",watchFns:function(){var a=[],c=this.state.inputs,d=this;m(c,function(c){a.push("var "+c+"="+d.generateFunction(c,"s"))});c.length&&a.push("fn.inputs=["+c.join(",")+"];");return a.join("")},generateFunction:function(a,c){return"function("+c+"){"+this.varsPrefix(a)+this.body(a)+"};"},filterPrefix:function(){var a=[],c=this;m(this.state.filters,function(d,e){a.push(d+"=$filter("+c.escape(e)+")")});return a.length?"var "+a.join(",")+";":""},varsPrefix:function(a){return this.state[a].vars.length? "var "+this.state[a].vars.join(",")+";":""},body:function(a){return this.state[a].body.join("")},recurse:function(a,c,d,e,f,g){var h,l,k=this,n,p;e=e||y;if(!g&&A(a.watchId))c=c||this.nextId(),this.if_("i",this.lazyAssign(c,this.computedMember("i",a.watchId)),this.lazyRecurse(a,c,d,e,f,!0));else switch(a.type){case s.Program:m(a.body,function(c,d){k.recurse(c.expression,w,w,function(a){l=a});d!==a.body.length-1?k.current().body.push(l,";"):k.return_(l)});break;case s.Literal:p=this.escape(a.value); this.assign(c,p);e(p);break;case s.UnaryExpression:this.recurse(a.argument,w,w,function(a){l=a});p=a.operator+"("+this.ifDefined(l,0)+")";this.assign(c,p);e(p);break;case s.BinaryExpression:this.recurse(a.left,w,w,function(a){h=a});this.recurse(a.right,w,w,function(a){l=a});p="+"===a.operator?this.plus(h,l):"-"===a.operator?this.ifDefined(h,0)+a.operator+this.ifDefined(l,0):"("+h+")"+a.operator+"("+l+")";this.assign(c,p);e(p);break;case s.LogicalExpression:c=c||this.nextId();k.recurse(a.left,c);k.if_("&&"=== a.operator?c:k.not(c),k.lazyRecurse(a.right,c));e(c);break;case s.ConditionalExpression:c=c||this.nextId();k.recurse(a.test,c);k.if_(c,k.lazyRecurse(a.alternate,c),k.lazyRecurse(a.consequent,c));e(c);break;case s.Identifier:c=c||this.nextId();d&&(d.context="inputs"===k.stage?"s":this.assign(this.nextId(),this.getHasOwnProperty("l",a.name)+"?l:s"),d.computed=!1,d.name=a.name);Xa(a.name);k.if_("inputs"===k.stage||k.not(k.getHasOwnProperty("l",a.name)),function(){k.if_("inputs"===k.stage||"s",function(){f&& 1!==f&&k.if_(k.not(k.nonComputedMember("s",a.name)),k.lazyAssign(k.nonComputedMember("s",a.name),"{}"));k.assign(c,k.nonComputedMember("s",a.name))})},c&&k.lazyAssign(c,k.nonComputedMember("l",a.name)));(k.state.expensiveChecks||Fb(a.name))&&k.addEnsureSafeObject(c);e(c);break;case s.MemberExpression:h=d&&(d.context=this.nextId())||this.nextId();c=c||this.nextId();k.recurse(a.object,h,w,function(){k.if_(k.notNull(h),function(){if(a.computed)l=k.nextId(),k.recurse(a.property,l),k.addEnsureSafeMemberName(l), f&&1!==f&&k.if_(k.not(k.computedMember(h,l)),k.lazyAssign(k.computedMember(h,l),"{}")),p=k.ensureSafeObject(k.computedMember(h,l)),k.assign(c,p),d&&(d.computed=!0,d.name=l);else{Xa(a.property.name);f&&1!==f&&k.if_(k.not(k.nonComputedMember(h,a.property.name)),k.lazyAssign(k.nonComputedMember(h,a.property.name),"{}"));p=k.nonComputedMember(h,a.property.name);if(k.state.expensiveChecks||Fb(a.property.name))p=k.ensureSafeObject(p);k.assign(c,p);d&&(d.computed=!1,d.name=a.property.name)}},function(){k.assign(c, "undefined")});e(c)},!!f);break;case s.CallExpression:c=c||this.nextId();a.filter?(l=k.filter(a.callee.name),n=[],m(a.arguments,function(a){var c=k.nextId();k.recurse(a,c);n.push(c)}),p=l+"("+n.join(",")+")",k.assign(c,p),e(c)):(l=k.nextId(),h={},n=[],k.recurse(a.callee,l,h,function(){k.if_(k.notNull(l),function(){k.addEnsureSafeFunction(l);m(a.arguments,function(a){k.recurse(a,k.nextId(),w,function(a){n.push(k.ensureSafeObject(a))})});h.name?(k.state.expensiveChecks||k.addEnsureSafeObject(h.context), p=k.member(h.context,h.name,h.computed)+"("+n.join(",")+")"):p=l+"("+n.join(",")+")";p=k.ensureSafeObject(p);k.assign(c,p)},function(){k.assign(c,"undefined")});e(c)}));break;case s.AssignmentExpression:l=this.nextId();h={};if(!md(a.left))throw ea("lval");this.recurse(a.left,w,h,function(){k.if_(k.notNull(h.context),function(){k.recurse(a.right,l);k.addEnsureSafeObject(k.member(h.context,h.name,h.computed));p=k.member(h.context,h.name,h.computed)+a.operator+l;k.assign(c,p);e(c||p)})},1);break;case s.ArrayExpression:n= [];m(a.elements,function(a){k.recurse(a,k.nextId(),w,function(a){n.push(a)})});p="["+n.join(",")+"]";this.assign(c,p);e(p);break;case s.ObjectExpression:n=[];m(a.properties,function(a){k.recurse(a.value,k.nextId(),w,function(c){n.push(k.escape(a.key.type===s.Identifier?a.key.name:""+a.key.value)+":"+c)})});p="{"+n.join(",")+"}";this.assign(c,p);e(p);break;case s.ThisExpression:this.assign(c,"s");e("s");break;case s.NGValueParameter:this.assign(c,"v"),e("v")}},getHasOwnProperty:function(a,c){var d= a+"."+c,e=this.current().own;e.hasOwnProperty(d)||(e[d]=this.nextId(!1,a+"&&("+this.escape(c)+" in "+a+")"));return e[d]},assign:function(a,c){if(a)return this.current().body.push(a,"=",c,";"),a},filter:function(a){this.state.filters.hasOwnProperty(a)||(this.state.filters[a]=this.nextId(!0));return this.state.filters[a]},ifDefined:function(a,c){return"ifDefined("+a+","+this.escape(c)+")"},plus:function(a,c){return"plus("+a+","+c+")"},return_:function(a){this.current().body.push("return ",a,";")}, if_:function(a,c,d){if(!0===a)c();else{var e=this.current().body;e.push("if(",a,"){");c();e.push("}");d&&(e.push("else{"),d(),e.push("}"))}},not:function(a){return"!("+a+")"},notNull:function(a){return a+"!=null"},nonComputedMember:function(a,c){return a+"."+c},computedMember:function(a,c){return a+"["+c+"]"},member:function(a,c,d){return d?this.computedMember(a,c):this.nonComputedMember(a,c)},addEnsureSafeObject:function(a){this.current().body.push(this.ensureSafeObject(a),";")},addEnsureSafeMemberName:function(a){this.current().body.push(this.ensureSafeMemberName(a), ";")},addEnsureSafeFunction:function(a){this.current().body.push(this.ensureSafeFunction(a),";")},ensureSafeObject:function(a){return"ensureSafeObject("+a+",text)"},ensureSafeMemberName:function(a){return"ensureSafeMemberName("+a+",text)"},ensureSafeFunction:function(a){return"ensureSafeFunction("+a+",text)"},lazyRecurse:function(a,c,d,e,f,g){var h=this;return function(){h.recurse(a,c,d,e,f,g)}},lazyAssign:function(a,c){var d=this;return function(){d.assign(a,c)}},stringEscapeRegex:/[^ a-zA-Z0-9]/g, stringEscapeFn:function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)},escape:function(a){if(G(a))return"'"+a.replace(this.stringEscapeRegex,this.stringEscapeFn)+"'";if(V(a))return a.toString();if(!0===a)return"true";if(!1===a)return"false";if(null===a)return"null";if("undefined"===typeof a)return"undefined";throw ea("esc");},nextId:function(a,c){var d="v"+this.state.nextId++;a||this.current().vars.push(d+(c?"="+c:""));return d},current:function(){return this.state[this.state.computing]}}; qd.prototype={compile:function(a,c){var d=this,e=this.astBuilder.ast(a);this.expression=a;this.expensiveChecks=c;U(e,d.$filter);var f,g;if(f=nd(e))g=this.recurse(f);f=ld(e.body);var h;f&&(h=[],m(f,function(a,c){var e=d.recurse(a);a.input=e;h.push(e);a.watchId=c}));var l=[];m(e.body,function(a){l.push(d.recurse(a.expression))});f=0===e.body.length?function(){}:1===e.body.length?l[0]:function(a,c){var d;m(l,function(e){d=e(a,c)});return d};g&&(f.assign=function(a,c,d){return g(a,d,c)});h&&(f.inputs= h);f.literal=od(e);f.constant=e.constant;return f},recurse:function(a,c,d){var e,f,g=this,h;if(a.input)return this.inputs(a.input,a.watchId);switch(a.type){case s.Literal:return this.value(a.value,c);case s.UnaryExpression:return f=this.recurse(a.argument),this["unary"+a.operator](f,c);case s.BinaryExpression:return e=this.recurse(a.left),f=this.recurse(a.right),this["binary"+a.operator](e,f,c);case s.LogicalExpression:return e=this.recurse(a.left),f=this.recurse(a.right),this["binary"+a.operator](e, f,c);case s.ConditionalExpression:return this["ternary?:"](this.recurse(a.test),this.recurse(a.alternate),this.recurse(a.consequent),c);case s.Identifier:return Xa(a.name,g.expression),g.identifier(a.name,g.expensiveChecks||Fb(a.name),c,d,g.expression);case s.MemberExpression:return e=this.recurse(a.object,!1,!!d),a.computed||(Xa(a.property.name,g.expression),f=a.property.name),a.computed&&(f=this.recurse(a.property)),a.computed?this.computedMember(e,f,c,d,g.expression):this.nonComputedMember(e,f, g.expensiveChecks,c,d,g.expression);case s.CallExpression:return h=[],m(a.arguments,function(a){h.push(g.recurse(a))}),a.filter&&(f=this.$filter(a.callee.name)),a.filter||(f=this.recurse(a.callee,!0)),a.filter?function(a,d,e,g){for(var r=[],m=0;m<h.length;++m)r.push(h[m](a,d,e,g));a=f.apply(w,r,g);return c?{context:w,name:w,value:a}:a}:function(a,d,e,p){var r=f(a,d,e,p),m;if(null!=r.value){Ba(r.context,g.expression);jd(r.value,g.expression);m=[];for(var s=0;s<h.length;++s)m.push(Ba(h[s](a,d,e,p), g.expression));m=Ba(r.value.apply(r.context,m),g.expression)}return c?{value:m}:m};case s.AssignmentExpression:return e=this.recurse(a.left,!0,1),f=this.recurse(a.right),function(a,d,h,p){var r=e(a,d,h,p);a=f(a,d,h,p);Ba(r.value,g.expression);r.context[r.name]=a;return c?{value:a}:a};case s.ArrayExpression:return h=[],m(a.elements,function(a){h.push(g.recurse(a))}),function(a,d,e,f){for(var g=[],m=0;m<h.length;++m)g.push(h[m](a,d,e,f));return c?{value:g}:g};case s.ObjectExpression:return h=[],m(a.properties, function(a){h.push({key:a.key.type===s.Identifier?a.key.name:""+a.key.value,value:g.recurse(a.value)})}),function(a,d,e,f){for(var g={},m=0;m<h.length;++m)g[h[m].key]=h[m].value(a,d,e,f);return c?{value:g}:g};case s.ThisExpression:return function(a){return c?{value:a}:a};case s.NGValueParameter:return function(a,d,e,f){return c?{value:e}:e}}},"unary+":function(a,c){return function(d,e,f,g){d=a(d,e,f,g);d=A(d)?+d:0;return c?{value:d}:d}},"unary-":function(a,c){return function(d,e,f,g){d=a(d,e,f,g); d=A(d)?-d:0;return c?{value:d}:d}},"unary!":function(a,c){return function(d,e,f,g){d=!a(d,e,f,g);return c?{value:d}:d}},"binary+":function(a,c,d){return function(e,f,g,h){var l=a(e,f,g,h);e=c(e,f,g,h);l=kd(l,e);return d?{value:l}:l}},"binary-":function(a,c,d){return function(e,f,g,h){var l=a(e,f,g,h);e=c(e,f,g,h);l=(A(l)?l:0)-(A(e)?e:0);return d?{value:l}:l}},"binary*":function(a,c,d){return function(e,f,g,h){e=a(e,f,g,h)*c(e,f,g,h);return d?{value:e}:e}},"binary/":function(a,c,d){return function(e, f,g,h){e=a(e,f,g,h)/c(e,f,g,h);return d?{value:e}:e}},"binary%":function(a,c,d){return function(e,f,g,h){e=a(e,f,g,h)%c(e,f,g,h);return d?{value:e}:e}},"binary===":function(a,c,d){return function(e,f,g,h){e=a(e,f,g,h)===c(e,f,g,h);return d?{value:e}:e}},"binary!==":function(a,c,d){return function(e,f,g,h){e=a(e,f,g,h)!==c(e,f,g,h);return d?{value:e}:e}},"binary==":function(a,c,d){return function(e,f,g,h){e=a(e,f,g,h)==c(e,f,g,h);return d?{value:e}:e}},"binary!=":function(a,c,d){return function(e, f,g,h){e=a(e,f,g,h)!=c(e,f,g,h);return d?{value:e}:e}},"binary<":function(a,c,d){return function(e,f,g,h){e=a(e,f,g,h)<c(e,f,g,h);return d?{value:e}:e}},"binary>":function(a,c,d){return function(e,f,g,h){e=a(e,f,g,h)>c(e,f,g,h);return d?{value:e}:e}},"binary<=":function(a,c,d){return function(e,f,g,h){e=a(e,f,g,h)<=c(e,f,g,h);return d?{value:e}:e}},"binary>=":function(a,c,d){return function(e,f,g,h){e=a(e,f,g,h)>=c(e,f,g,h);return d?{value:e}:e}},"binary&&":function(a,c,d){return function(e,f,g,h){e= a(e,f,g,h)&&c(e,f,g,h);return d?{value:e}:e}},"binary||":function(a,c,d){return function(e,f,g,h){e=a(e,f,g,h)||c(e,f,g,h);return d?{value:e}:e}},"ternary?:":function(a,c,d,e){return function(f,g,h,l){f=a(f,g,h,l)?c(f,g,h,l):d(f,g,h,l);return e?{value:f}:f}},value:function(a,c){return function(){return c?{context:w,name:w,value:a}:a}},identifier:function(a,c,d,e,f){return function(g,h,l,k){g=h&&a in h?h:g;e&&1!==e&&g&&!g[a]&&(g[a]={});h=g?g[a]:w;c&&Ba(h,f);return d?{context:g,name:a,value:h}:h}}, computedMember:function(a,c,d,e,f){return function(g,h,l,k){var n=a(g,h,l,k),p,m;null!=n&&(p=c(g,h,l,k),Xa(p,f),e&&1!==e&&n&&!n[p]&&(n[p]={}),m=n[p],Ba(m,f));return d?{context:n,name:p,value:m}:m}},nonComputedMember:function(a,c,d,e,f,g){return function(h,l,k,n){h=a(h,l,k,n);f&&1!==f&&h&&!h[c]&&(h[c]={});l=null!=h?h[c]:w;(d||Fb(c))&&Ba(l,g);return e?{context:h,name:c,value:l}:l}},inputs:function(a,c){return function(d,e,f,g){return g?g[c]:a(d,e,f)}}};var fc=function(a,c,d){this.lexer=a;this.$filter= c;this.options=d;this.ast=new s(this.lexer);this.astCompiler=d.csp?new qd(this.ast,c):new pd(this.ast,c)};fc.prototype={constructor:fc,parse:function(a){return this.astCompiler.compile(a,this.options.expensiveChecks)}};ha();ha();var Wf=Object.prototype.valueOf,Ca=I("$sce"),oa={HTML:"html",CSS:"css",URL:"url",RESOURCE_URL:"resourceUrl",JS:"js"},fa=I("$compile"),Z=X.createElement("a"),ud=Aa(Q.location.href);vd.$inject=["$document"];Jc.$inject=["$provide"];wd.$inject=["$locale"];yd.$inject=["$locale"]; var Bd=".",fg={yyyy:$("FullYear",4),yy:$("FullYear",2,0,!0),y:$("FullYear",1),MMMM:Hb("Month"),MMM:Hb("Month",!0),MM:$("Month",2,1),M:$("Month",1,1),dd:$("Date",2),d:$("Date",1),HH:$("Hours",2),H:$("Hours",1),hh:$("Hours",2,-12),h:$("Hours",1,-12),mm:$("Minutes",2),m:$("Minutes",1),ss:$("Seconds",2),s:$("Seconds",1),sss:$("Milliseconds",3),EEEE:Hb("Day"),EEE:Hb("Day",!0),a:function(a,c){return 12>a.getHours()?c.AMPMS[0]:c.AMPMS[1]},Z:function(a,c,d){a=-1*d;return a=(0<=a?"+":"")+(Gb(Math[0<a?"floor": "ceil"](a/60),2)+Gb(Math.abs(a%60),2))},ww:Dd(2),w:Dd(1),G:hc,GG:hc,GGG:hc,GGGG:function(a,c){return 0>=a.getFullYear()?c.ERANAMES[0]:c.ERANAMES[1]}},eg=/((?:[^yMdHhmsaZEwG']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z|G+|w+))(.*)/,dg=/^\-?\d+$/;xd.$inject=["$locale"];var ag=qa(F),bg=qa(sb);zd.$inject=["$parse"];var fe=qa({restrict:"E",compile:function(a,c){if(!c.href&&!c.xlinkHref)return function(a,c){if("a"===c[0].nodeName.toLowerCase()){var f="[object SVGAnimatedString]"===va.call(c.prop("href"))? "xlink:href":"href";c.on("click",function(a){c.attr(f)||a.preventDefault()})}}}}),tb={};m(Bb,function(a,c){function d(a,d,f){a.$watch(f[e],function(a){f.$set(c,!!a)})}if("multiple"!=a){var e=ya("ng-"+c),f=d;"checked"===a&&(f=function(a,c,f){f.ngModel!==f[e]&&d(a,c,f)});tb[e]=function(){return{restrict:"A",priority:100,link:f}}}});m(Zc,function(a,c){tb[c]=function(){return{priority:100,link:function(a,e,f){if("ngPattern"===c&&"/"==f.ngPattern.charAt(0)&&(e=f.ngPattern.match(hg))){f.$set("ngPattern", new RegExp(e[1],e[2]));return}a.$watch(f[c],function(a){f.$set(c,a)})}}}});m(["src","srcset","href"],function(a){var c=ya("ng-"+a);tb[c]=function(){return{priority:99,link:function(d,e,f){var g=a,h=a;"href"===a&&"[object SVGAnimatedString]"===va.call(e.prop("href"))&&(h="xlinkHref",f.$attr[h]="xlink:href",g=null);f.$observe(c,function(c){c?(f.$set(h,c),Wa&&g&&e.prop(g,f[h])):"href"===a&&f.$set(h,null)})}}}});var Ib={$addControl:y,$$renameControl:function(a,c){a.$name=c},$removeControl:y,$setValidity:y, $setDirty:y,$setPristine:y,$setSubmitted:y};Ed.$inject=["$element","$attrs","$scope","$animate","$interpolate"];var Md=function(a){return["$timeout","$parse",function(c,d){function e(a){return""===a?d('this[""]').assign:d(a).assign||y}return{name:"form",restrict:a?"EAC":"E",require:["form","^^?form"],controller:Ed,compile:function(d,g){d.addClass(Ya).addClass(mb);var h=g.name?"name":a&&g.ngForm?"ngForm":!1;return{pre:function(a,d,f,g){var m=g[0];if(!("action"in f)){var t=function(c){a.$apply(function(){m.$commitViewValue(); m.$setSubmitted()});c.preventDefault()};d[0].addEventListener("submit",t,!1);d.on("$destroy",function(){c(function(){d[0].removeEventListener("submit",t,!1)},0,!1)})}(g[1]||m.$$parentForm).$addControl(m);var s=h?e(m.$name):y;h&&(s(a,m),f.$observe(h,function(c){m.$name!==c&&(s(a,w),m.$$parentForm.$$renameControl(m,c),s=e(m.$name),s(a,m))}));d.on("$destroy",function(){m.$$parentForm.$removeControl(m);s(a,w);P(m,Ib)})}}}}}]},ge=Md(),te=Md(!0),gg=/\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z)/, qg=/^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/,rg=/^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i,sg=/^\s*(\-|\+)?(\d+|(\d*(\.\d*)))([eE][+-]?\d+)?\s*$/,Nd=/^(\d{4})-(\d{2})-(\d{2})$/,Od=/^(\d{4})-(\d\d)-(\d\d)T(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/,kc=/^(\d{4})-W(\d\d)$/,Pd=/^(\d{4})-(\d\d)$/,Qd=/^(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/,Rd={text:function(a,c,d,e,f,g){jb(a,c,d,e,f,g);ic(e)},date:kb("date", Nd,Kb(Nd,["yyyy","MM","dd"]),"yyyy-MM-dd"),"datetime-local":kb("datetimelocal",Od,Kb(Od,"yyyy MM dd HH mm ss sss".split(" ")),"yyyy-MM-ddTHH:mm:ss.sss"),time:kb("time",Qd,Kb(Qd,["HH","mm","ss","sss"]),"HH:mm:ss.sss"),week:kb("week",kc,function(a,c){if(da(a))return a;if(G(a)){kc.lastIndex=0;var d=kc.exec(a);if(d){var e=+d[1],f=+d[2],g=d=0,h=0,l=0,k=Cd(e),f=7*(f-1);c&&(d=c.getHours(),g=c.getMinutes(),h=c.getSeconds(),l=c.getMilliseconds());return new Date(e,0,k.getDate()+f,d,g,h,l)}}return NaN},"yyyy-Www"), month:kb("month",Pd,Kb(Pd,["yyyy","MM"]),"yyyy-MM"),number:function(a,c,d,e,f,g){Gd(a,c,d,e);jb(a,c,d,e,f,g);e.$$parserName="number";e.$parsers.push(function(a){return e.$isEmpty(a)?null:sg.test(a)?parseFloat(a):w});e.$formatters.push(function(a){if(!e.$isEmpty(a)){if(!V(a))throw lb("numfmt",a);a=a.toString()}return a});if(A(d.min)||d.ngMin){var h;e.$validators.min=function(a){return e.$isEmpty(a)||v(h)||a>=h};d.$observe("min",function(a){A(a)&&!V(a)&&(a=parseFloat(a,10));h=V(a)&&!isNaN(a)?a:w;e.$validate()})}if(A(d.max)|| d.ngMax){var l;e.$validators.max=function(a){return e.$isEmpty(a)||v(l)||a<=l};d.$observe("max",function(a){A(a)&&!V(a)&&(a=parseFloat(a,10));l=V(a)&&!isNaN(a)?a:w;e.$validate()})}},url:function(a,c,d,e,f,g){jb(a,c,d,e,f,g);ic(e);e.$$parserName="url";e.$validators.url=function(a,c){var d=a||c;return e.$isEmpty(d)||qg.test(d)}},email:function(a,c,d,e,f,g){jb(a,c,d,e,f,g);ic(e);e.$$parserName="email";e.$validators.email=function(a,c){var d=a||c;return e.$isEmpty(d)||rg.test(d)}},radio:function(a,c, d,e){v(d.name)&&c.attr("name",++nb);c.on("click",function(a){c[0].checked&&e.$setViewValue(d.value,a&&a.type)});e.$render=function(){c[0].checked=d.value==e.$viewValue};d.$observe("value",e.$render)},checkbox:function(a,c,d,e,f,g,h,l){var k=Hd(l,a,"ngTrueValue",d.ngTrueValue,!0),n=Hd(l,a,"ngFalseValue",d.ngFalseValue,!1);c.on("click",function(a){e.$setViewValue(c[0].checked,a&&a.type)});e.$render=function(){c[0].checked=e.$viewValue};e.$isEmpty=function(a){return!1===a};e.$formatters.push(function(a){return ka(a, k)});e.$parsers.push(function(a){return a?k:n})},hidden:y,button:y,submit:y,reset:y,file:y},Dc=["$browser","$sniffer","$filter","$parse",function(a,c,d,e){return{restrict:"E",require:["?ngModel"],link:{pre:function(f,g,h,l){l[0]&&(Rd[F(h.type)]||Rd.text)(f,g,h,l[0],c,a,d,e)}}}}],tg=/^(true|false|\d+)$/,Le=function(){return{restrict:"A",priority:100,compile:function(a,c){return tg.test(c.ngValue)?function(a,c,f){f.$set("value",a.$eval(f.ngValue))}:function(a,c,f){a.$watch(f.ngValue,function(a){f.$set("value", a)})}}}},le=["$compile",function(a){return{restrict:"AC",compile:function(c){a.$$addBindingClass(c);return function(c,e,f){a.$$addBindingInfo(e,f.ngBind);e=e[0];c.$watch(f.ngBind,function(a){e.textContent=v(a)?"":a})}}}}],ne=["$interpolate","$compile",function(a,c){return{compile:function(d){c.$$addBindingClass(d);return function(d,f,g){d=a(f.attr(g.$attr.ngBindTemplate));c.$$addBindingInfo(f,d.expressions);f=f[0];g.$observe("ngBindTemplate",function(a){f.textContent=v(a)?"":a})}}}}],me=["$sce","$parse", "$compile",function(a,c,d){return{restrict:"A",compile:function(e,f){var g=c(f.ngBindHtml),h=c(f.ngBindHtml,function(a){return(a||"").toString()});d.$$addBindingClass(e);return function(c,e,f){d.$$addBindingInfo(e,f.ngBindHtml);c.$watch(h,function(){e.html(a.getTrustedHtml(g(c))||"")})}}}}],Ke=qa({restrict:"A",require:"ngModel",link:function(a,c,d,e){e.$viewChangeListeners.push(function(){a.$eval(d.ngChange)})}}),oe=jc("",!0),qe=jc("Odd",0),pe=jc("Even",1),re=Na({compile:function(a,c){c.$set("ngCloak", w);a.removeClass("ng-cloak")}}),se=[function(){return{restrict:"A",scope:!0,controller:"@",priority:500}}],Ic={},ug={blur:!0,focus:!0};m("click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste".split(" "),function(a){var c=ya("ng-"+a);Ic[c]=["$parse","$rootScope",function(d,e){return{restrict:"A",compile:function(f,g){var h=d(g[c],null,!0);return function(c,d){d.on(a,function(d){var f=function(){h(c,{$event:d})}; ug[a]&&e.$$phase?c.$evalAsync(f):c.$apply(f)})}}}}]});var ve=["$animate",function(a){return{multiElement:!0,transclude:"element",priority:600,terminal:!0,restrict:"A",$$tlb:!0,link:function(c,d,e,f,g){var h,l,k;c.$watch(e.ngIf,function(c){c?l||g(function(c,f){l=f;c[c.length++]=X.createComment(" end ngIf: "+e.ngIf+" ");h={clone:c};a.enter(c,d.parent(),d)}):(k&&(k.remove(),k=null),l&&(l.$destroy(),l=null),h&&(k=rb(h.clone),a.leave(k).then(function(){k=null}),h=null))})}}}],we=["$templateRequest","$anchorScroll", "$animate",function(a,c,d){return{restrict:"ECA",priority:400,terminal:!0,transclude:"element",controller:aa.noop,compile:function(e,f){var g=f.ngInclude||f.src,h=f.onload||"",l=f.autoscroll;return function(e,f,m,r,t){var s=0,v,u,q,z=function(){u&&(u.remove(),u=null);v&&(v.$destroy(),v=null);q&&(d.leave(q).then(function(){u=null}),u=q,q=null)};e.$watch(g,function(g){var m=function(){!A(l)||l&&!e.$eval(l)||c()},p=++s;g?(a(g,!0).then(function(a){if(p===s){var c=e.$new();r.template=a;a=t(c,function(a){z(); d.enter(a,null,f).then(m)});v=c;q=a;v.$emit("$includeContentLoaded",g);e.$eval(h)}},function(){p===s&&(z(),e.$emit("$includeContentError",g))}),e.$emit("$includeContentRequested",g)):(z(),r.template=null)})}}}}],Ne=["$compile",function(a){return{restrict:"ECA",priority:-400,require:"ngInclude",link:function(c,d,e,f){/SVG/.test(d[0].toString())?(d.empty(),a(Lc(f.template,X).childNodes)(c,function(a){d.append(a)},{futureParentElement:d})):(d.html(f.template),a(d.contents())(c))}}}],xe=Na({priority:450, compile:function(){return{pre:function(a,c,d){a.$eval(d.ngInit)}}}}),Je=function(){return{restrict:"A",priority:100,require:"ngModel",link:function(a,c,d,e){var f=c.attr(d.$attr.ngList)||", ",g="false"!==d.ngTrim,h=g?T(f):f;e.$parsers.push(function(a){if(!v(a)){var c=[];a&&m(a.split(h),function(a){a&&c.push(g?T(a):a)});return c}});e.$formatters.push(function(a){return J(a)?a.join(f):w});e.$isEmpty=function(a){return!a||!a.length}}}},mb="ng-valid",Id="ng-invalid",Ya="ng-pristine",Jb="ng-dirty",Kd= "ng-pending",lb=I("ngModel"),vg=["$scope","$exceptionHandler","$attrs","$element","$parse","$animate","$timeout","$rootScope","$q","$interpolate",function(a,c,d,e,f,g,h,l,k,n){this.$modelValue=this.$viewValue=Number.NaN;this.$$rawModelValue=w;this.$validators={};this.$asyncValidators={};this.$parsers=[];this.$formatters=[];this.$viewChangeListeners=[];this.$untouched=!0;this.$touched=!1;this.$pristine=!0;this.$dirty=!1;this.$valid=!0;this.$invalid=!1;this.$error={};this.$$success={};this.$pending= w;this.$name=n(d.name||"",!1)(a);this.$$parentForm=Ib;var p=f(d.ngModel),r=p.assign,t=p,s=r,K=null,u,q=this;this.$$setOptions=function(a){if((q.$options=a)&&a.getterSetter){var c=f(d.ngModel+"()"),h=f(d.ngModel+"($$$p)");t=function(a){var d=p(a);x(d)&&(d=c(a));return d};s=function(a,c){x(p(a))?h(a,{$$$p:q.$modelValue}):r(a,q.$modelValue)}}else if(!p.assign)throw lb("nonassign",d.ngModel,xa(e));};this.$render=y;this.$isEmpty=function(a){return v(a)||""===a||null===a||a!==a};var z=0;Fd({ctrl:this,$element:e, set:function(a,c){a[c]=!0},unset:function(a,c){delete a[c]},$animate:g});this.$setPristine=function(){q.$dirty=!1;q.$pristine=!0;g.removeClass(e,Jb);g.addClass(e,Ya)};this.$setDirty=function(){q.$dirty=!0;q.$pristine=!1;g.removeClass(e,Ya);g.addClass(e,Jb);q.$$parentForm.$setDirty()};this.$setUntouched=function(){q.$touched=!1;q.$untouched=!0;g.setClass(e,"ng-untouched","ng-touched")};this.$setTouched=function(){q.$touched=!0;q.$untouched=!1;g.setClass(e,"ng-touched","ng-untouched")};this.$rollbackViewValue= function(){h.cancel(K);q.$viewValue=q.$$lastCommittedViewValue;q.$render()};this.$validate=function(){if(!V(q.$modelValue)||!isNaN(q.$modelValue)){var a=q.$$rawModelValue,c=q.$valid,d=q.$modelValue,e=q.$options&&q.$options.allowInvalid;q.$$runValidators(a,q.$$lastCommittedViewValue,function(f){e||c===f||(q.$modelValue=f?a:w,q.$modelValue!==d&&q.$$writeModelToScope())})}};this.$$runValidators=function(a,c,d){function e(){var d=!0;m(q.$validators,function(e,f){var g=e(a,c);d=d&&g;h(f,g)});return d? !0:(m(q.$asyncValidators,function(a,c){h(c,null)}),!1)}function f(){var d=[],e=!0;m(q.$asyncValidators,function(f,g){var k=f(a,c);if(!k||!x(k.then))throw lb("$asyncValidators",k);h(g,w);d.push(k.then(function(){h(g,!0)},function(a){e=!1;h(g,!1)}))});d.length?k.all(d).then(function(){g(e)},y):g(!0)}function h(a,c){l===z&&q.$setValidity(a,c)}function g(a){l===z&&d(a)}z++;var l=z;(function(){var a=q.$$parserName||"parse";if(v(u))h(a,null);else return u||(m(q.$validators,function(a,c){h(c,null)}),m(q.$asyncValidators, function(a,c){h(c,null)})),h(a,u),u;return!0})()?e()?f():g(!1):g(!1)};this.$commitViewValue=function(){var a=q.$viewValue;h.cancel(K);if(q.$$lastCommittedViewValue!==a||""===a&&q.$$hasNativeValidators)q.$$lastCommittedViewValue=a,q.$pristine&&this.$setDirty(),this.$$parseAndValidate()};this.$$parseAndValidate=function(){var c=q.$$lastCommittedViewValue;if(u=v(c)?w:!0)for(var d=0;d<q.$parsers.length;d++)if(c=q.$parsers[d](c),v(c)){u=!1;break}V(q.$modelValue)&&isNaN(q.$modelValue)&&(q.$modelValue=t(a)); var e=q.$modelValue,f=q.$options&&q.$options.allowInvalid;q.$$rawModelValue=c;f&&(q.$modelValue=c,q.$modelValue!==e&&q.$$writeModelToScope());q.$$runValidators(c,q.$$lastCommittedViewValue,function(a){f||(q.$modelValue=a?c:w,q.$modelValue!==e&&q.$$writeModelToScope())})};this.$$writeModelToScope=function(){s(a,q.$modelValue);m(q.$viewChangeListeners,function(a){try{a()}catch(d){c(d)}})};this.$setViewValue=function(a,c){q.$viewValue=a;q.$options&&!q.$options.updateOnDefault||q.$$debounceViewValueCommit(c)}; this.$$debounceViewValueCommit=function(c){var d=0,e=q.$options;e&&A(e.debounce)&&(e=e.debounce,V(e)?d=e:V(e[c])?d=e[c]:V(e["default"])&&(d=e["default"]));h.cancel(K);d?K=h(function(){q.$commitViewValue()},d):l.$$phase?q.$commitViewValue():a.$apply(function(){q.$commitViewValue()})};a.$watch(function(){var c=t(a);if(c!==q.$modelValue&&(q.$modelValue===q.$modelValue||c===c)){q.$modelValue=q.$$rawModelValue=c;u=w;for(var d=q.$formatters,e=d.length,f=c;e--;)f=d[e](f);q.$viewValue!==f&&(q.$viewValue= q.$$lastCommittedViewValue=f,q.$render(),q.$$runValidators(c,f,y))}return c})}],Ie=["$rootScope",function(a){return{restrict:"A",require:["ngModel","^?form","^?ngModelOptions"],controller:vg,priority:1,compile:function(c){c.addClass(Ya).addClass("ng-untouched").addClass(mb);return{pre:function(a,c,f,g){var h=g[0];c=g[1]||h.$$parentForm;h.$$setOptions(g[2]&&g[2].$options);c.$addControl(h);f.$observe("name",function(a){h.$name!==a&&h.$$parentForm.$$renameControl(h,a)});a.$on("$destroy",function(){h.$$parentForm.$removeControl(h)})}, post:function(c,e,f,g){var h=g[0];if(h.$options&&h.$options.updateOn)e.on(h.$options.updateOn,function(a){h.$$debounceViewValueCommit(a&&a.type)});e.on("blur",function(e){h.$touched||(a.$$phase?c.$evalAsync(h.$setTouched):c.$apply(h.$setTouched))})}}}}}],wg=/(\s+|^)default(\s+|$)/,Me=function(){return{restrict:"A",controller:["$scope","$attrs",function(a,c){var d=this;this.$options=ga(a.$eval(c.ngModelOptions));A(this.$options.updateOn)?(this.$options.updateOnDefault=!1,this.$options.updateOn=T(this.$options.updateOn.replace(wg, function(){d.$options.updateOnDefault=!0;return" "}))):this.$options.updateOnDefault=!0}]}},ye=Na({terminal:!0,priority:1E3}),xg=I("ngOptions"),yg=/^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+group\s+by\s+([\s\S]+?))?(?:\s+disable\s+when\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?$/,Ge=["$compile","$parse",function(a,c){function d(a,d,e){function f(a,c,d,e,h){this.selectValue=a;this.viewValue=c;this.label= d;this.group=e;this.disabled=h}function n(a){var c;if(!s&&Da(a))c=a;else{c=[];for(var d in a)a.hasOwnProperty(d)&&"$"!==d.charAt(0)&&c.push(d)}return c}var m=a.match(yg);if(!m)throw xg("iexp",a,xa(d));var r=m[5]||m[7],s=m[6];a=/ as /.test(m[0])&&m[1];var v=m[9];d=c(m[2]?m[1]:r);var w=a&&c(a)||d,u=v&&c(v),q=v?function(a,c){return u(e,c)}:function(a){return Ga(a)},z=function(a,c){return q(a,x(a,c))},y=c(m[2]||m[1]),A=c(m[3]||""),O=c(m[4]||""),H=c(m[8]),C={},x=s?function(a,c){C[s]=c;C[r]=a;return C}: function(a){C[r]=a;return C};return{trackBy:v,getTrackByValue:z,getWatchables:c(H,function(a){var c=[];a=a||[];for(var d=n(a),f=d.length,h=0;h<f;h++){var g=a===d?h:d[h],k=x(a[g],g),g=q(a[g],k);c.push(g);if(m[2]||m[1])g=y(e,k),c.push(g);m[4]&&(k=O(e,k),c.push(k))}return c}),getOptions:function(){for(var a=[],c={},d=H(e)||[],h=n(d),g=h.length,m=0;m<g;m++){var p=d===h?m:h[m],r=x(d[p],p),s=w(e,r),p=q(s,r),t=y(e,r),u=A(e,r),r=O(e,r),s=new f(p,s,t,u,r);a.push(s);c[p]=s}return{items:a,selectValueMap:c,getOptionFromViewValue:function(a){return c[z(a)]}, getViewValueFromOption:function(a){return v?aa.copy(a.viewValue):a.viewValue}}}}}var e=X.createElement("option"),f=X.createElement("optgroup");return{restrict:"A",terminal:!0,require:["select","?ngModel"],link:function(c,h,l,k){function n(a,c){a.element=c;c.disabled=a.disabled;a.value!==c.value&&(c.value=a.selectValue);a.label!==c.label&&(c.label=a.label,c.textContent=a.label)}function p(a,c,d,e){c&&F(c.nodeName)===d?d=c:(d=e.cloneNode(!1),c?a.insertBefore(d,c):a.appendChild(d));return d}function r(a){for(var c;a;)c= a.nextSibling,Wb(a),a=c}function s(a){var c=q&&q[0],d=H&&H[0];if(c||d)for(;a&&(a===c||a===d);)a=a.nextSibling;return a}function v(){var a=x&&u.readValue();x=B.getOptions();var c={},d=h[0].firstChild;O&&h.prepend(q);d=s(d);x.items.forEach(function(a){var g,k;a.group?(g=c[a.group],g||(g=p(h[0],d,"optgroup",f),d=g.nextSibling,g.label=a.group,g=c[a.group]={groupElement:g,currentOptionElement:g.firstChild}),k=p(g.groupElement,g.currentOptionElement,"option",e),n(a,k),g.currentOptionElement=k.nextSibling): (k=p(h[0],d,"option",e),n(a,k),d=k.nextSibling)});Object.keys(c).forEach(function(a){r(c[a].currentOptionElement)});r(d);w.$render();if(!w.$isEmpty(a)){var g=u.readValue();(B.trackBy?ka(a,g):a===g)||(w.$setViewValue(g),w.$render())}}var w=k[1];if(w){var u=k[0];k=l.multiple;for(var q,z=0,y=h.children(),A=y.length;z<A;z++)if(""===y[z].value){q=y.eq(z);break}var O=!!q,H=C(e.cloneNode(!1));H.val("?");var x,B=d(l.ngOptions,h,c);k?(w.$isEmpty=function(a){return!a||0===a.length},u.writeValue=function(a){x.items.forEach(function(a){a.element.selected= !1});a&&a.forEach(function(a){(a=x.getOptionFromViewValue(a))&&!a.disabled&&(a.element.selected=!0)})},u.readValue=function(){var a=h.val()||[],c=[];m(a,function(a){(a=x.selectValueMap[a])&&!a.disabled&&c.push(x.getViewValueFromOption(a))});return c},B.trackBy&&c.$watchCollection(function(){if(J(w.$viewValue))return w.$viewValue.map(function(a){return B.getTrackByValue(a)})},function(){w.$render()})):(u.writeValue=function(a){var c=x.getOptionFromViewValue(a);c&&!c.disabled?h[0].value!==c.selectValue&& (H.remove(),O||q.remove(),h[0].value=c.selectValue,c.element.selected=!0,c.element.setAttribute("selected","selected")):null===a||O?(H.remove(),O||h.prepend(q),h.val(""),q.prop("selected",!0),q.attr("selected",!0)):(O||q.remove(),h.prepend(H),h.val("?"),H.prop("selected",!0),H.attr("selected",!0))},u.readValue=function(){var a=x.selectValueMap[h.val()];return a&&!a.disabled?(O||q.remove(),H.remove(),x.getViewValueFromOption(a)):null},B.trackBy&&c.$watch(function(){return B.getTrackByValue(w.$viewValue)}, function(){w.$render()}));O?(q.remove(),a(q)(c),q.removeClass("ng-scope")):q=C(e.cloneNode(!1));v();c.$watchCollection(B.getWatchables,v)}}}}],ze=["$locale","$interpolate","$log",function(a,c,d){var e=/{}/g,f=/^when(Minus)?(.+)$/;return{link:function(g,h,l){function k(a){h.text(a||"")}var n=l.count,p=l.$attr.when&&h.attr(l.$attr.when),r=l.offset||0,s=g.$eval(p)||{},w={},A=c.startSymbol(),u=c.endSymbol(),q=A+n+"-"+r+u,z=aa.noop,x;m(l,function(a,c){var d=f.exec(c);d&&(d=(d[1]?"-":"")+F(d[2]),s[d]=h.attr(l.$attr[c]))}); m(s,function(a,d){w[d]=c(a.replace(e,q))});g.$watch(n,function(c){var e=parseFloat(c),f=isNaN(e);f||e in s||(e=a.pluralCat(e-r));e===x||f&&V(x)&&isNaN(x)||(z(),f=w[e],v(f)?(null!=c&&d.debug("ngPluralize: no rule defined for '"+e+"' in "+p),z=y,k()):z=g.$watch(f,k),x=e)})}}}],Ae=["$parse","$animate",function(a,c){var d=I("ngRepeat"),e=function(a,c,d,e,k,m,p){a[d]=e;k&&(a[k]=m);a.$index=c;a.$first=0===c;a.$last=c===p-1;a.$middle=!(a.$first||a.$last);a.$odd=!(a.$even=0===(c&1))};return{restrict:"A", multiElement:!0,transclude:"element",priority:1E3,terminal:!0,$$tlb:!0,compile:function(f,g){var h=g.ngRepeat,l=X.createComment(" end ngRepeat: "+h+" "),k=h.match(/^\s*([\s\S]+?)\s+in\s+([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+track\s+by\s+([\s\S]+?))?\s*$/);if(!k)throw d("iexp",h);var n=k[1],p=k[2],r=k[3],s=k[4],k=n.match(/^(?:(\s*[\$\w]+)|\(\s*([\$\w]+)\s*,\s*([\$\w]+)\s*\))$/);if(!k)throw d("iidexp",n);var v=k[3]||k[1],y=k[2];if(r&&(!/^[$a-zA-Z_][$a-zA-Z0-9_]*$/.test(r)||/^(null|undefined|this|\$index|\$first|\$middle|\$last|\$even|\$odd|\$parent|\$root|\$id)$/.test(r)))throw d("badident", r);var u,q,z,A,x={$id:Ga};s?u=a(s):(z=function(a,c){return Ga(c)},A=function(a){return a});return function(a,f,g,k,n){u&&(q=function(c,d,e){y&&(x[y]=c);x[v]=d;x.$index=e;return u(a,x)});var s=ha();a.$watchCollection(p,function(g){var k,p,t=f[0],u,x=ha(),B,G,J,M,I,F,L;r&&(a[r]=g);if(Da(g))I=g,p=q||z;else for(L in p=q||A,I=[],g)ta.call(g,L)&&"$"!==L.charAt(0)&&I.push(L);B=I.length;L=Array(B);for(k=0;k<B;k++)if(G=g===I?k:I[k],J=g[G],M=p(G,J,k),s[M])F=s[M],delete s[M],x[M]=F,L[k]=F;else{if(x[M])throw m(L, function(a){a&&a.scope&&(s[a.id]=a)}),d("dupes",h,M,J);L[k]={id:M,scope:w,clone:w};x[M]=!0}for(u in s){F=s[u];M=rb(F.clone);c.leave(M);if(M[0].parentNode)for(k=0,p=M.length;k<p;k++)M[k].$$NG_REMOVED=!0;F.scope.$destroy()}for(k=0;k<B;k++)if(G=g===I?k:I[k],J=g[G],F=L[k],F.scope){u=t;do u=u.nextSibling;while(u&&u.$$NG_REMOVED);F.clone[0]!=u&&c.move(rb(F.clone),null,C(t));t=F.clone[F.clone.length-1];e(F.scope,k,v,J,y,G,B)}else n(function(a,d){F.scope=d;var f=l.cloneNode(!1);a[a.length++]=f;c.enter(a, null,C(t));t=f;F.clone=a;x[F.id]=F;e(F.scope,k,v,J,y,G,B)});s=x})}}}}],Be=["$animate",function(a){return{restrict:"A",multiElement:!0,link:function(c,d,e){c.$watch(e.ngShow,function(c){a[c?"removeClass":"addClass"](d,"ng-hide",{tempClasses:"ng-hide-animate"})})}}}],ue=["$animate",function(a){return{restrict:"A",multiElement:!0,link:function(c,d,e){c.$watch(e.ngHide,function(c){a[c?"addClass":"removeClass"](d,"ng-hide",{tempClasses:"ng-hide-animate"})})}}}],Ce=Na(function(a,c,d){a.$watch(d.ngStyle, function(a,d){d&&a!==d&&m(d,function(a,d){c.css(d,"")});a&&c.css(a)},!0)}),De=["$animate",function(a){return{require:"ngSwitch",controller:["$scope",function(){this.cases={}}],link:function(c,d,e,f){var g=[],h=[],l=[],k=[],n=function(a,c){return function(){a.splice(c,1)}};c.$watch(e.ngSwitch||e.on,function(c){var d,e;d=0;for(e=l.length;d<e;++d)a.cancel(l[d]);d=l.length=0;for(e=k.length;d<e;++d){var s=rb(h[d].clone);k[d].$destroy();(l[d]=a.leave(s)).then(n(l,d))}h.length=0;k.length=0;(g=f.cases["!"+ c]||f.cases["?"])&&m(g,function(c){c.transclude(function(d,e){k.push(e);var f=c.element;d[d.length++]=X.createComment(" end ngSwitchWhen: ");h.push({clone:d});a.enter(d,f.parent(),f)})})})}}}],Ee=Na({transclude:"element",priority:1200,require:"^ngSwitch",multiElement:!0,link:function(a,c,d,e,f){e.cases["!"+d.ngSwitchWhen]=e.cases["!"+d.ngSwitchWhen]||[];e.cases["!"+d.ngSwitchWhen].push({transclude:f,element:c})}}),Fe=Na({transclude:"element",priority:1200,require:"^ngSwitch",multiElement:!0,link:function(a, c,d,e,f){e.cases["?"]=e.cases["?"]||[];e.cases["?"].push({transclude:f,element:c})}}),He=Na({restrict:"EAC",link:function(a,c,d,e,f){if(!f)throw I("ngTransclude")("orphan",xa(c));f(function(a){c.empty();c.append(a)})}}),he=["$templateCache",function(a){return{restrict:"E",terminal:!0,compile:function(c,d){"text/ng-template"==d.type&&a.put(d.id,c[0].text)}}}],zg={$setViewValue:y,$render:y},Ag=["$element","$scope","$attrs",function(a,c,d){var e=this,f=new Ua;e.ngModelCtrl=zg;e.unknownOption=C(X.createElement("option")); e.renderUnknownOption=function(c){c="? "+Ga(c)+" ?";e.unknownOption.val(c);a.prepend(e.unknownOption);a.val(c)};c.$on("$destroy",function(){e.renderUnknownOption=y});e.removeUnknownOption=function(){e.unknownOption.parent()&&e.unknownOption.remove()};e.readValue=function(){e.removeUnknownOption();return a.val()};e.writeValue=function(c){e.hasOption(c)?(e.removeUnknownOption(),a.val(c),""===c&&e.emptyOption.prop("selected",!0)):null==c&&e.emptyOption?(e.removeUnknownOption(),a.val("")):e.renderUnknownOption(c)}; e.addOption=function(a,c){Ta(a,'"option value"');""===a&&(e.emptyOption=c);var d=f.get(a)||0;f.put(a,d+1)};e.removeOption=function(a){var c=f.get(a);c&&(1===c?(f.remove(a),""===a&&(e.emptyOption=w)):f.put(a,c-1))};e.hasOption=function(a){return!!f.get(a)}}],ie=function(){return{restrict:"E",require:["select","?ngModel"],controller:Ag,link:function(a,c,d,e){var f=e[1];if(f){var g=e[0];g.ngModelCtrl=f;f.$render=function(){g.writeValue(f.$viewValue)};c.on("change",function(){a.$apply(function(){f.$setViewValue(g.readValue())})}); if(d.multiple){g.readValue=function(){var a=[];m(c.find("option"),function(c){c.selected&&a.push(c.value)});return a};g.writeValue=function(a){var d=new Ua(a);m(c.find("option"),function(a){a.selected=A(d.get(a.value))})};var h,l=NaN;a.$watch(function(){l!==f.$viewValue||ka(h,f.$viewValue)||(h=ja(f.$viewValue),f.$render());l=f.$viewValue});f.$isEmpty=function(a){return!a||0===a.length}}}}}},ke=["$interpolate",function(a){return{restrict:"E",priority:100,compile:function(c,d){if(A(d.value))var e=a(d.value, !0);else{var f=a(c.text(),!0);f||d.$set("value",c.text())}return function(a,c,d){function k(a){p.addOption(a,c);p.ngModelCtrl.$render();c[0].hasAttribute("selected")&&(c[0].selected=!0)}var m=c.parent(),p=m.data("$selectController")||m.parent().data("$selectController");if(p&&p.ngModelCtrl){if(e){var r;d.$observe("value",function(a){A(r)&&p.removeOption(r);r=a;k(a)})}else f?a.$watch(f,function(a,c){d.$set("value",a);c!==a&&p.removeOption(c);k(a)}):k(d.value);c.on("$destroy",function(){p.removeOption(d.value); p.ngModelCtrl.$render()})}}}}}],je=qa({restrict:"E",terminal:!1}),Fc=function(){return{restrict:"A",require:"?ngModel",link:function(a,c,d,e){e&&(d.required=!0,e.$validators.required=function(a,c){return!d.required||!e.$isEmpty(c)},d.$observe("required",function(){e.$validate()}))}}},Ec=function(){return{restrict:"A",require:"?ngModel",link:function(a,c,d,e){if(e){var f,g=d.ngPattern||d.pattern;d.$observe("pattern",function(a){G(a)&&0<a.length&&(a=new RegExp("^"+a+"$"));if(a&&!a.test)throw I("ngPattern")("noregexp", g,a,xa(c));f=a||w;e.$validate()});e.$validators.pattern=function(a,c){return e.$isEmpty(c)||v(f)||f.test(c)}}}}},Hc=function(){return{restrict:"A",require:"?ngModel",link:function(a,c,d,e){if(e){var f=-1;d.$observe("maxlength",function(a){a=Y(a);f=isNaN(a)?-1:a;e.$validate()});e.$validators.maxlength=function(a,c){return 0>f||e.$isEmpty(c)||c.length<=f}}}}},Gc=function(){return{restrict:"A",require:"?ngModel",link:function(a,c,d,e){if(e){var f=0;d.$observe("minlength",function(a){f=Y(a)||0;e.$validate()}); e.$validators.minlength=function(a,c){return e.$isEmpty(c)||c.length>=f}}}}};Q.angular.bootstrap?console.log("WARNING: Tried to load angular more than once."):(ae(),ce(aa),aa.module("ngLocale",[],["$provide",function(a){function c(a){a+="";var c=a.indexOf(".");return-1==c?0:a.length-c-1}a.value("$locale",{DATETIME_FORMATS:{AMPMS:["AM","PM"],DAY:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),ERANAMES:["Before Christ","Anno Domini"],ERAS:["BC","AD"],FIRSTDAYOFWEEK:6,MONTH:"January February March April May June July August September October November December".split(" "), SHORTDAY:"Sun Mon Tue Wed Thu Fri Sat".split(" "),SHORTMONTH:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),WEEKENDRANGE:[5,6],fullDate:"EEEE, MMMM d, y",longDate:"MMMM d, y",medium:"MMM d, y h:mm:ss a",mediumDate:"MMM d, y",mediumTime:"h:mm:ss a","short":"M/d/yy h:mm a",shortDate:"M/d/yy",shortTime:"h:mm a"},NUMBER_FORMATS:{CURRENCY_SYM:"$",DECIMAL_SEP:".",GROUP_SEP:",",PATTERNS:[{gSize:3,lgSize:3,maxFrac:3,minFrac:0,minInt:1,negPre:"-",negSuf:"",posPre:"",posSuf:""},{gSize:3,lgSize:3, maxFrac:2,minFrac:2,minInt:1,negPre:"-\u00a4",negSuf:"",posPre:"\u00a4",posSuf:""}]},id:"en-us",pluralCat:function(a,e){var f=a|0,g=e;w===g&&(g=Math.min(c(a),3));Math.pow(10,g);return 1==f&&0==g?"one":"other"}})}]),C(X).ready(function(){Xd(X,yc)}))})(window,document);!window.angular.$$csp().noInlineStyle&&window.angular.element(document.head).prepend('<style type="text/css">@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide:not(.ng-hide-animate){display:none !important;}ng\\:form{display:block;}.ng-animate-shim{visibility:hidden;}.ng-anchor{position:absolute;}</style>');
var path = require('path'); var fs = require('fs'); var async = require('async'); var redis = require('redis'); var sprintf = require('sprintf').sprintf; var GitHubApi = require('github4'); var request = require('request'); var handlebars = require('handlebars'); var subRedisClient = null; var redisClient = null; var github = null; var NOMIC_ORG = process.env.TRESLEK_NOMIC_ORG; var NOMIC_REPO = process.env.TRESLEK_NOMIC_REPO; var NOMIC_USER = process.env.TRESLEK_NOMIC_USER; var NOMIC_CHANNEL = process.env.TRESLEK_NOMIC_CHANNEL; var NOMIC_REPO_PATH = process.env.TRESLEK_NOMIC_REPO_PATH; var NOMIC_PLAYER_BLACKLIST = process.env.TRESLEK_NOMIC_PLAYER_BLACKLIST.split(','); function loadTemplate(template, callback) { fs.readFile(path.join(__dirname, 'templates', template), function(err, file) { if (err) { throw err; } callback(null, handlebars.compile(file.toString())); }); } var Nomic = function() { this.commands = ['nomic-players', 'nomic-score']; this.unload = ['endRedis']; this.auto = ['listen']; this.usage = {}; }; Nomic.prototype.endRedis = function(callback) { subRedisClient.end(); subRedisClient = null; redisClient.quit(); redisClient = null; github = null; callback(); }; Nomic.prototype._parseScoreboard = function(callback) { var scoreboardUrl = sprintf('https://raw.githubusercontent.com/%s/%s/master/SCOREBOARD.md', NOMIC_ORG, NOMIC_REPO); var scores = {}; request.get(scoreboardUrl, function (error, response, body) { if (error || response.statusCode != 200) { callback(error); return; } body.split('\n').filter(function (line) { return line[0] === '@'; }).map(function (line) { var score = line.split('|').map(function (item) { return item.trim(); }); scores[score[0].slice(1)] = { score: parseInt(score[1], 10) }; }); callback(null, scores); }); }; Nomic.prototype._writeScoreboard = function(scores, callback) { loadTemplate('scoreboard.tmpl', function(err, template) { if (err) { callback(err); return; } var outputScores = Object.keys(scores).map(function(player) { return { name: player, score: scores[player].score } }).sort(function(a, b) { return b.score - a.score; }); fs.writeFile(path.join(NOMIC_REPO_PATH, 'SCOREBOARD.md'), template({scores: outputScores}), function (err) { if (err) throw err; }); callback(); }); }; Nomic.prototype['nomic-score'] = function(bot, to, from, msg, callback) { this._parseScoreboard(function(err, scores) { if(err) { bot.say('Error getting scores.'); callback(); return; } Object.keys(scores).forEach(function(player) { bot.say(to, sprintf('%s: %s', player, scores[player].score)); }); callback(); }); }; Nomic.prototype._getActivePlayers = function(callback) { var players = [NOMIC_ORG]; function getForks(err, res) { if (err) { bot.say(to, "Error getting players."); callback(); return; } players = players.concat(res.map(function (fork) { if (NOMIC_PLAYER_BLACKLIST.indexOf(fork.owner.login) === -1) { return fork.owner.login; } else { return false; } }).filter(function(player) { return player; })); if (github.hasNextPage(res)) { github.getNextPage(res, getForks); } else { callback(null, players); } } github.repos.getForks({ user: NOMIC_ORG, repo: NOMIC_REPO, per_page: 100 }, getForks); }; Nomic.prototype['nomic-players'] = function(bot, to, from, msg, callback) { this._getActivePlayers(function(err, players) { if (err) { bot.say(to, "Unable to retrieve players."); callback(); return; } bot.say(to, players.join(', ')); callback(); }); }; Nomic.prototype._handleVote = function(player, pr, vote) { var voteStore = sprintf("%s:%s:nomic:%s", NOMIC_ORG, NOMIC_REPO, pr); redisClient.zadd(voteStore, vote, player, function(err, callback) { console.log('added vote!'); if (err) { console.error('Unable to register vote by player:' + player); return; } console.log(sprintf('Successfully registered vote by player %s on %s'), player, pr); }); }; Nomic.prototype.commentCreated = function(bot, data) { var plusOne = /^:\+1:$|^\+1$|^-1$|^:-1:$/, vote = /([\+-]1)/, matches = []; if (plusOne.test(data.comment.body.trim())) { matches = data.comment.body.match(vote); if (!matches) { return; } this._handleVote(data.comment.user.login, data.issue.number, matches[0]); bot.say(NOMIC_CHANNEL, sprintf("%s voted %s on %s - %s", data.comment.user.login, matches[0], data.issue.title, data.issue.html_url)); } }; Nomic.prototype.listen = function(bot) { if (!subRedisClient) { subRedisClient = redis.createClient(bot.redisConf.port, bot.redisConf.host); subRedisClient.auth(bot.redisConf.pass, function() {}); } if (!redisClient) { redisClient = redis.createClient(bot.redisConf.port, bot.redisConf.host); redisClient.auth(bot.redisConf.pass, function() {}); } if (!github) { github = new GitHubApi({ version: "3.0.0", debug: true, protocol: "https", host: "api.github.com", pathPrefix: "", timeout: 5000, headers: { "user-agent": "treslek-nomic" } }); github.authenticate({ type: "basic", username: NOMIC_USER, password: process.env.TRESLEK_NOMIC_GITHUB_TOKEN }); } var pattern = [bot.redisConf.prefix, 'webhookChannels:treslek-nomic'].join(':'), self = this; subRedisClient.on("message", function(channel, message) { message = message.toString(); var data = JSON.parse(JSON.parse(message).body), output; if (data) { if (data.action === "created" && data.comment && data.issue.state === "open" && data.issue.user.login !== data.comment.user.login) { self._getActivePlayers(function(err, players) { if (players.indexOf(data.comment.user.login) !== -1) { self.commentCreated(bot, data); } }); } else if (data.action === "opened") { self._getActivePlayers(function(err, players) { if (players.indexOf(data.pull_request.user.login !== -1)) { self._handleVote(data.pull_request.user.login, data.pull_request.number, 1); } }); output = sprintf("New PR \"%s\" by %s at %s", data.pull_request.title, data.pull_request.user.login, data.pull_request.html_url, data.pull_request.body); } else if (data.action === "closed") { output = sprintf("PR %s closed by %s", data.number, data.pull_request.merged_by.login); } if (output) { bot.say(NOMIC_CHANNEL, output); } } }); subRedisClient.subscribe(pattern); }; exports.Plugin = Nomic;
/** * A basic Nightwatch custom command * which demonstrates usage of ES6 async/await instead of using callbacks. * The command name is the filename and the exported "command" function is the command. * * Example usage: * browser.openHomepage(); * * For more information on writing custom commands see: * https://nightwatchjs.org/guide/extending-nightwatch/#writing-custom-commands * */ module.exports = { command: async function () { // Other Nightwatch commands are available via "this" // .init() simply calls .url() command with the value of the "launch_url" setting this.init() this.waitForElementVisible('#app') const result = await this.elements('css selector', '#app ul') this.assert.strictEqual(result.value.length, 3) }, }