text
stringlengths
2
1.05M
import Sequelize from 'sequelize' import sequelize from './sequelize' import Bot from './Bot' export const Service = sequelize.define('service', { id: { // service ID type: Sequelize.INTEGER, autoIncrement: true, primaryKey: true }, name: { // service name type: Sequelize.STRING }, botId: { // Glip bot ID type: Sequelize.STRING }, groupId: { // Glip group ID type: Sequelize.STRING }, userId: { // Glip user ID type: Sequelize.STRING }, data: { // all other data associcated with this service type: Sequelize.JSON } }) Service.prototype.check = async function () { const bot = await Bot.findByPk(this.botId) if (!bot) { await this.destroy() return } const group = await bot.getGroup(this.groupId) if (!group || group.members.indexOf(bot.id) === -1) { await this.destroy() } } export default Service
function testExceptions() { describe('Exception check', function() { it('should handle exceptions correctly', function() { return JavaPoly.type('Main').then(function(Main) { return new Promise(function(resolve, reject) { Main.exceptionThrower().then(function() { reject(new Error("not expecting the promise to resolve")); }, function(e) { expect(e.name).toBe("java.lang.RuntimeException"); expect(e.message).toBe("Deliberate exception for testing"); expect(e.causedBy).toNotExist(); expect(e.printStackTrace).toExist(); resolve(); }); }); }); }); it('should handle exceptions with null messages correctly', function() { return JavaPoly.type('Main').then(function(Main) { return new Promise(function(resolve, reject) { Main.exceptionThrowerWithNullMessage().then(function() { reject(new Error("not expecting the promise to resolve")); }, function(e) { expect(e.name).toBe("java.lang.RuntimeException"); expect(e.message).toBe(null); expect(e.causedBy).toNotExist(); expect(e.printStackTrace).toExist(); resolve(); }); }); }); }); it('should handle arithmetic exceptions correctly', function() { return JavaPoly.type('Main').then(function(Main) { return new Promise(function(resolve, reject) { Main.exceptionThrower2(0).then(function(result) { reject(new Error("not expecting the promise to resolve")); }, function(e) { expect(e.name).toBe("java.lang.ArithmeticException"); expect(e.message).toBe("/ by zero"); expect(e.causedBy).toNotExist(); expect(e.printStackTrace).toExist(); resolve(); }); }); }); }); }); }
/* * Copyright 2015-present Open Networking Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* ONOS GUI -- SVG -- Icon Service - Unit Tests */ describe('factory: fw/svg/icon.js', function() { var is, d3Elem; var viewBox = '0 0 50 50', glyphSize = '50', iconSize = '20'; beforeEach(module('onosSvg')); beforeEach(inject(function (IconService) { is = IconService; d3Elem = d3.select('body').append('div').attr('id', 'myDiv'); })); afterEach(function () { d3.select('#myDiv').remove(); }); it('should define IconService', function () { expect(is).toBeDefined(); }); function checkElemSize(elem, dim) { expect(elem.attr('width')).toEqual(dim); expect(elem.attr('height')).toEqual(dim); } function verifyIconStructure(iconClass, useHref, iSize, vBox, gSize) { var isz = iSize || iconSize, vbx = vBox || viewBox, gsz = gSize || glyphSize; var svg = d3Elem.selectAll('svg'); expect(svg.size()).toBe(1); checkElemSize(svg, isz); expect(svg.attr('viewBox')).toEqual(vbx); var g = svg.selectAll('g'); expect(g.size()).toBe(1); expect(g.classed('icon')).toBeTruthy(); expect(g.classed(iconClass)).toBeTruthy(); var rect = g.select('rect'); expect(rect.size()).toBe(1); checkElemSize(rect, gsz); expect(rect.attr('rx')).toEqual('5'); if (useHref) { var use = g.select('use'); expect(use.classed('glyph')).toBeTruthy(); expect(use.attr('xlink:href')).toEqual(useHref); checkElemSize(use, gsz); } } it('should load an icon into a div', function () { expect(d3Elem.html()).toEqual(''); is.loadIconByClass(d3Elem, 'active'); verifyIconStructure('active', '#checkMark'); }); it('should allow us to specify the icon size', function () { expect(d3Elem.html()).toEqual(''); is.loadIconByClass(d3Elem, 'inactive', 32); verifyIconStructure('inactive', '#xMark', '32'); }); it('should verify triangleUp icon', function () { expect(d3Elem.html()).toEqual(''); is.loadIconByClass(d3Elem, 'upArrow', 10); verifyIconStructure('upArrow', '#triangleUp', '10'); }); it('should verify triangleDown icon', function () { expect(d3Elem.html()).toEqual(''); is.loadIconByClass(d3Elem, 'downArrow', 10); verifyIconStructure('downArrow', '#triangleDown', '10'); }); it('should verify no icon is displayed', function () { expect(d3Elem.html()).toEqual(''); is.loadIconByClass(d3Elem, 'tableColSortNone', 10); verifyIconStructure('tableColSortNone', null, '10'); }); });
const _appConfig = { system : { port : 8080 }, database : { type : 'mongo', location : 'mongodb://localhost:27017', name : 'warmahordes' } } module.exports = { config : _appConfig }
import React from 'react'; import { storiesOf } from '@storybook/react'; import { withKnobs, select } from '@storybook/addon-knobs'; import { baseTheme, Caption } from '@foostack-dev/core-uikit'; const stories = storiesOf('Components/Typography/Caption', module); stories.addDecorator(withKnobs); const label = 'Mode'; const options = { Light: 'light', Dark: 'dark', }; const defaultValue = 'light'; stories .add('Default Caption', () => { return <Caption>Caption</Caption>; }) .add('Primary Caption', () => { baseTheme.variant = select(label, options, defaultValue); return <Caption variation="primary">Caption</Caption>; });
//>>built define("dojo/cldr/nls/fr/gregorian",{"dateFormatItem-Ehm":"E h:mm a","days-standAlone-short":"dim. lun. mar. mer. jeu. ven. sam.".split(" "),"months-format-narrow":"JFMAMJJASOND".split(""),"field-second-relative+0":"maintenant","quarters-standAlone-narrow":["1","2","3","4"],"field-weekday":"jour de la semaine","dateFormatItem-yQQQ":"QQQ y","dateFormatItem-yMEd":"E d/M/y","field-wed-relative+0":"ce mercredi","field-wed-relative+1":"mercredi prochain","dateFormatItem-GyMMMEd":"E d MMM y G","dateFormatItem-MMMEd":"E d MMM", eraNarrow:["av. J.-C.","ap. J.-C.","ap. J.-C.","EC"],"field-tue-relative+-1":"mardi dernier","dayPeriods-format-wide-morning":"matin","days-format-short":"di lu ma me je ve sa".split(" "),"dateFormat-long":"d MMMM y","field-fri-relative+-1":"vendredi dernier","field-wed-relative+-1":"mercredi dernier","months-format-wide":"janvier f\u00e9vrier mars avril mai juin juillet ao\u00fbt septembre octobre novembre d\u00e9cembre".split(" "),"dateTimeFormat-medium":"{1} {0}","dayPeriods-format-wide-pm":"PM", "dateFormat-full":"EEEE d MMMM y","field-thu-relative+-1":"jeudi dernier","dateFormatItem-Md":"d/M","dayPeriods-format-abbr-am":"AM","dayPeriods-format-wide-noon":"midi","dateFormatItem-yMd":"d/M/y","field-era":"\u00e8re","dateFormatItem-yM":"M/y","months-standAlone-wide":"janvier f\u00e9vrier mars avril mai juin juillet ao\u00fbt septembre octobre novembre d\u00e9cembre".split(" "),"timeFormat-short":"HH:mm","quarters-format-wide":["1er trimestre","2e trimestre","3e trimestre","4e trimestre"],"dateFormatItem-yQQQQ":"QQQQ y", "timeFormat-long":"HH:mm:ss z","field-year":"ann\u00e9e","dateFormatItem-yMMM":"MMM y","field-hour":"heure","months-format-abbr":"janv. f\u00e9vr. mars avr. mai juin juil. ao\u00fbt sept. oct. nov. d\u00e9c.".split(" "),"field-sat-relative+0":"ce samedi","field-sat-relative+1":"samedi prochain","timeFormat-full":"HH:mm:ss zzzz","dayPeriods-format-narrow-morning":"matin","field-day-relative+0":"aujourd\u2019hui","field-thu-relative+0":"ce jeudi","field-day-relative+1":"demain","field-thu-relative+1":"jeudi prochain", "dateFormatItem-GyMMMd":"d MMM y G","field-day-relative+2":"apr\u00e8s-demain","dateFormatItem-H":"HH 'h'","months-standAlone-abbr":"janv. f\u00e9vr. mars avr. mai juin juil. ao\u00fbt sept. oct. nov. d\u00e9c.".split(" "),"quarters-format-abbr":["T1","T2","T3","T4"],"quarters-standAlone-wide":["1er trimestre","2e trimestre","3e trimestre","4e trimestre"],"dateFormatItem-Gy":"y G","dateFormatItem-M":"L","days-standAlone-wide":"dimanche lundi mardi mercredi jeudi vendredi samedi".split(" "),"timeFormat-medium":"HH:mm:ss", "field-sun-relative+0":"ce dimanche","dateFormatItem-Hm":"HH:mm","field-sun-relative+1":"dimanche prochain","quarters-standAlone-abbr":["T1","T2","T3","T4"],eraAbbr:["av. J.-C.","AEC","ap. J.-C.","EC"],"field-minute":"minute","field-dayperiod":"cadran","days-standAlone-abbr":"dim. lun. mar. mer. jeu. ven. sam.".split(" "),"dayPeriods-format-wide-night":"soir","dateFormatItem-d":"d","dateFormatItem-ms":"mm:ss","quarters-format-narrow":["1","2","3","4"],"field-day-relative+-1":"hier","dateFormatItem-h":"h a", "dateTimeFormat-long":"{1} {0}","field-day-relative+-2":"avant-hier","dateFormatItem-MMMd":"d MMM","dateFormatItem-MEd":"E d/M","dateTimeFormat-full":"{1} {0}","field-fri-relative+0":"ce vendredi","dateFormatItem-yMMMM":"MMMM y","field-fri-relative+1":"vendredi prochain","field-day":"jour","days-format-wide":"dimanche lundi mardi mercredi jeudi vendredi samedi".split(" "),"field-zone":"fuseau horaire","dateFormatItem-y":"y","months-standAlone-narrow":"JFMAMJJASOND".split(""),"field-year-relative+-1":"l\u2019ann\u00e9e derni\u00e8re", "dayPeriods-format-narrow-night":"soir","field-month-relative+-1":"le mois dernier","dateFormatItem-hm":"h:mm a","dayPeriods-format-abbr-pm":"PM","days-format-abbr":"dim. lun. mar. mer. jeu. ven. sam.".split(" "),eraNames:["avant J\u00e9sus-Christ","apr\u00e8s J\u00e9sus-Christ","ap. J.-C.","EC"],"dateFormatItem-yMMMd":"d MMM y","days-format-narrow":"DLMMJVS".split(""),"days-standAlone-narrow":"DLMMJVS".split(""),"dateFormatItem-MMM":"LLL","field-month":"mois","field-tue-relative+0":"ce mardi","field-tue-relative+1":"mardi prochain", "dayPeriods-format-wide-am":"AM","dateFormatItem-EHm":"E HH:mm","field-mon-relative+0":"ce lundi","field-mon-relative+1":"lundi prochain","dateFormat-short":"dd/MM/y","dayPeriods-format-wide-afternoon":"apr\u00e8s-midi","dateFormatItem-EHms":"E HH:mm:ss","dateFormatItem-Ehms":"E h:mm:ss a","dayPeriods-format-narrow-noon":"midi","field-second":"seconde","field-sat-relative+-1":"samedi dernier","dateFormatItem-yMMMEd":"E d MMM y","field-sun-relative+-1":"dimanche dernier","field-month-relative+0":"ce mois-ci", "field-month-relative+1":"le mois prochain","dateFormatItem-Ed":"E d","dateTimeFormats-appendItem-Timezone":"{0} {1}","field-week":"semaine","dateFormat-medium":"d MMM y","field-year-relative+0":"cette ann\u00e9e","field-week-relative+-1":"la semaine derni\u00e8re","field-year-relative+1":"l\u2019ann\u00e9e prochaine","dayPeriods-format-narrow-pm":"p","dateTimeFormat-short":"{1} {0}","dateFormatItem-Hms":"HH:mm:ss","dateFormatItem-hms":"h:mm:ss a","dateFormatItem-GyMMM":"MMM y G","field-mon-relative+-1":"lundi dernier", "field-week-relative+0":"cette semaine","field-week-relative+1":"la semaine prochaine"}); //# sourceMappingURL=gregorian.js.map
import React from 'react'; import createSvgIcon from './utils/createSvgIcon'; export default createSvgIcon( <React.Fragment><path fill="none" d="M0 0h24v24H0V0z" /><path fillOpacity=".3" d="M22 8V4.41c0-.89-1.08-1.34-1.71-.71L3.71 20.29c-.63.63-.19 1.71.7 1.71H18V11c0-1.66 1.34-3 3-3h1z" /><path d="M20 11v6c0 .55.45 1 1 1s1-.45 1-1v-6c0-.55-.45-1-1-1s-1 .45-1 1zm-8 11V12l-8.29 8.29c-.63.63-.19 1.71.7 1.71H12zm8 0h2v-2h-2v2z" /></React.Fragment> , 'SignalCellularConnectedNoInternet1BarRounded');
"use strict"; /*************************************************************************** * * (C) Copyright IBM Corp. 2018 * * This program and the accompanying materials are made available * under the terms of the Apache License v2.0 which accompanies * this distribution. * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * Contributors: * Multiple authors (IBM Corp.) - initial implementation and documentation ***************************************************************************/ const chai = require("chai"); const chaiHttp = require("chai-http"); const server = require("../../server/server"); const expect = chai.expect; const testToken = process.env.TEST_TOKEN; chai.use(chaiHttp); describe("Valid Platform", () => { it("should fail to add ValidPlatform as Invalid Architecture", (done) => { chai .request(server) .post(`/api/ValidPlatforms`) .set('Authorization', testToken) .send({ "os": "OS3", "arch": "InvalidArch", "distro": "Distro3" }) .end((err, res) => { expect(res).to.have.status(422); done(); }); }); });
import {selectCostListsByConditions, selectCostListTotalByConditions} from '@/services/Costlist'; export default { namespace: 'expenditureBurden', state: { selectCostListsByConditionsResult: [], selectCostListTotalByConditionsResult: {} }, effects: { * selectCostListsByConditions({ payload, callback }, {call, put }){ const response = yield call(selectCostListsByConditions, payload); yield put({ type: 'selectCostListsByConditionsResult', payload: response } ); if(callback) callback(response.data); }, * selectCostListTotalByConditions({payload, callback}, {call, put}){ const response =yield call(selectCostListTotalByConditions, payload); yield put({ type: 'selectCostListTotalByConditionsResult', payload: response }); if(callback) callback(response.data); }, }, reducers: { selectCostListsByConditionsResult(state, { payload }){ return { ...state, selectCostListsByConditionsResult: payload.data, }; }, selectCostListTotalByConditionsResult(state, {payload}){ return { ...state, selectCostListTotalByConditionsResult: payload.data, }; }, }, }
import React, { Component } from 'react'; import {Scene, Router} from 'react-native-router-flux'; import Home from './containers/home'; import Contacts from './containers/contacts'; import Me from './containers/me'; import SignIn from './containers/signin'; export default class AppRouter extends Component { render() { return ( <Router hideNavBar={true}> <Scene key="root"> <Scene key="home" component={Home} /> <Scene key="contacts" component={Contacts} /> <Scene key="signin" component={SignIn} /> <Scene key="me" component={Me} /> </Scene> </Router> ) } }
'use strict'; function wipeCollections(models) { return Promise.all(models.map(model => model.remove({}))); } module.exports = { wipeCollections, };
goog.require('ol.Map'); goog.require('ol.RendererHint'); goog.require('ol.View2D'); goog.require('ol.layer.Tile'); goog.require('ol.layer.Vector'); goog.require('ol.parser.WKT'); goog.require('ol.proj'); goog.require('ol.source.OSM'); goog.require('ol.source.Vector'); var raster = new ol.layer.Tile({ source: new ol.source.OSM() }); var vector = new ol.layer.Vector({ source: new ol.source.Vector({ parser: new ol.parser.WKT(), projection: ol.proj.get('EPSG:4326'), data: 'POLYGON((10.689697265625 -25.0927734375, 34.595947265625 ' + '-20.1708984375, 38.814697265625 -35.6396484375, 13.502197265625 ' + '-39.1552734375, 10.689697265625 -25.0927734375))' }) }); var map = new ol.Map({ layers: [raster, vector], renderer: ol.RendererHint.CANVAS, target: 'map', view: new ol.View2D({ center: [2952104.019976033, -3277504.823700756], zoom: 4 }) });
if (typeof __coverage__ === 'undefined') { __coverage__ = {}; } if (!__coverage__['build/event-flick/event-flick.js']) { __coverage__['build/event-flick/event-flick.js'] = {"path":"build/event-flick/event-flick.js","s":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0},"b":{"1":[0,0],"2":[0,0],"3":[0,0],"4":[0,0],"5":[0,0],"6":[0,0],"7":[0,0],"8":[0,0],"9":[0,0],"10":[0,0],"11":[0,0],"12":[0,0],"13":[0,0],"14":[0,0],"15":[0,0],"16":[0,0],"17":[0,0],"18":[0,0],"19":[0,0],"20":[0,0],"21":[0,0],"22":[0,0],"23":[0,0],"24":[0,0],"25":[0,0],"26":[0,0],"27":[0,0],"28":[0,0],"29":[0,0],"30":[0,0,0]},"f":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":42}}},"2":{"name":"(anonymous_2)","line":88,"loc":{"start":{"line":88,"column":8},"end":{"line":88,"column":40}}},"3":{"name":"(anonymous_3)","line":100,"loc":{"start":{"line":100,"column":12},"end":{"line":100,"column":44}}},"4":{"name":"(anonymous_4)","line":116,"loc":{"start":{"line":116,"column":17},"end":{"line":116,"column":32}}},"5":{"name":"(anonymous_5)","line":134,"loc":{"start":{"line":134,"column":14},"end":{"line":134,"column":48}}},"6":{"name":"(anonymous_6)","line":175,"loc":{"start":{"line":175,"column":13},"end":{"line":175,"column":47}}},"7":{"name":"(anonymous_7)","line":184,"loc":{"start":{"line":184,"column":12},"end":{"line":184,"column":46}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":271,"column":79}},"2":{"start":{"line":33,"column":0},"end":{"line":53,"column":27}},"3":{"start":{"line":86,"column":0},"end":{"line":268,"column":3}},"4":{"start":{"line":90,"column":8},"end":{"line":95,"column":16}},"5":{"start":{"line":97,"column":8},"end":{"line":97,"column":54}},"6":{"start":{"line":102,"column":8},"end":{"line":103,"column":54}},"7":{"start":{"line":105,"column":8},"end":{"line":108,"column":9}},"8":{"start":{"line":106,"column":12},"end":{"line":106,"column":33}},"9":{"start":{"line":107,"column":12},"end":{"line":107,"column":51}},"10":{"start":{"line":110,"column":8},"end":{"line":113,"column":9}},"11":{"start":{"line":111,"column":12},"end":{"line":111,"column":31}},"12":{"start":{"line":112,"column":12},"end":{"line":112,"column":49}},"13":{"start":{"line":117,"column":8},"end":{"line":117,"column":76}},"14":{"start":{"line":119,"column":8},"end":{"line":121,"column":9}},"15":{"start":{"line":120,"column":12},"end":{"line":120,"column":53}},"16":{"start":{"line":123,"column":8},"end":{"line":125,"column":9}},"17":{"start":{"line":124,"column":12},"end":{"line":124,"column":53}},"18":{"start":{"line":127,"column":8},"end":{"line":129,"column":9}},"19":{"start":{"line":128,"column":12},"end":{"line":128,"column":59}},"20":{"start":{"line":131,"column":8},"end":{"line":131,"column":22}},"21":{"start":{"line":136,"column":8},"end":{"line":141,"column":22}},"22":{"start":{"line":143,"column":8},"end":{"line":146,"column":9}},"23":{"start":{"line":144,"column":12},"end":{"line":144,"column":45}},"24":{"start":{"line":145,"column":12},"end":{"line":145,"column":29}},"25":{"start":{"line":148,"column":8},"end":{"line":172,"column":9}},"26":{"start":{"line":150,"column":12},"end":{"line":155,"column":13}},"27":{"start":{"line":152,"column":16},"end":{"line":154,"column":17}},"28":{"start":{"line":153,"column":20},"end":{"line":153,"column":43}},"29":{"start":{"line":157,"column":12},"end":{"line":159,"column":14}},"30":{"start":{"line":161,"column":12},"end":{"line":161,"column":41}},"31":{"start":{"line":163,"column":12},"end":{"line":163,"column":54}},"32":{"start":{"line":165,"column":12},"end":{"line":165,"column":80}},"33":{"start":{"line":166,"column":12},"end":{"line":169,"column":13}},"34":{"start":{"line":167,"column":16},"end":{"line":167,"column":102}},"35":{"start":{"line":168,"column":16},"end":{"line":168,"column":58}},"36":{"start":{"line":171,"column":12},"end":{"line":171,"column":123}},"37":{"start":{"line":176,"column":8},"end":{"line":176,"column":45}},"38":{"start":{"line":179,"column":8},"end":{"line":181,"column":9}},"39":{"start":{"line":180,"column":12},"end":{"line":180,"column":52}},"40":{"start":{"line":186,"column":8},"end":{"line":198,"column":56}},"41":{"start":{"line":200,"column":8},"end":{"line":203,"column":9}},"42":{"start":{"line":201,"column":12},"end":{"line":201,"column":32}},"43":{"start":{"line":202,"column":12},"end":{"line":202,"column":50}},"44":{"start":{"line":205,"column":8},"end":{"line":262,"column":9}},"45":{"start":{"line":207,"column":12},"end":{"line":213,"column":13}},"46":{"start":{"line":208,"column":16},"end":{"line":212,"column":17}},"47":{"start":{"line":209,"column":20},"end":{"line":209,"column":51}},"48":{"start":{"line":211,"column":20},"end":{"line":211,"column":34}},"49":{"start":{"line":215,"column":12},"end":{"line":261,"column":13}},"50":{"start":{"line":217,"column":16},"end":{"line":217,"column":43}},"51":{"start":{"line":218,"column":16},"end":{"line":218,"column":57}},"52":{"start":{"line":220,"column":16},"end":{"line":225,"column":17}},"53":{"start":{"line":222,"column":20},"end":{"line":224,"column":21}},"54":{"start":{"line":223,"column":24},"end":{"line":223,"column":43}},"55":{"start":{"line":227,"column":16},"end":{"line":227,"column":45}},"56":{"start":{"line":228,"column":16},"end":{"line":228,"column":47}},"57":{"start":{"line":229,"column":16},"end":{"line":229,"column":43}},"58":{"start":{"line":231,"column":16},"end":{"line":234,"column":18}},"59":{"start":{"line":236,"column":16},"end":{"line":240,"column":17}},"60":{"start":{"line":237,"column":20},"end":{"line":237,"column":39}},"61":{"start":{"line":239,"column":20},"end":{"line":239,"column":92}},"62":{"start":{"line":242,"column":16},"end":{"line":242,"column":62}},"63":{"start":{"line":243,"column":16},"end":{"line":243,"column":60}},"64":{"start":{"line":245,"column":16},"end":{"line":258,"column":17}},"65":{"start":{"line":247,"column":20},"end":{"line":247,"column":37}},"66":{"start":{"line":248,"column":20},"end":{"line":254,"column":22}},"67":{"start":{"line":256,"column":20},"end":{"line":256,"column":31}},"68":{"start":{"line":260,"column":16},"end":{"line":260,"column":48}}},"branchMap":{"1":{"line":105,"type":"if","locations":[{"start":{"line":105,"column":8},"end":{"line":105,"column":8}},{"start":{"line":105,"column":8},"end":{"line":105,"column":8}}]},"2":{"line":110,"type":"if","locations":[{"start":{"line":110,"column":8},"end":{"line":110,"column":8}},{"start":{"line":110,"column":8},"end":{"line":110,"column":8}}]},"3":{"line":117,"type":"cond-expr","locations":[{"start":{"line":117,"column":41},"end":{"line":117,"column":70}},{"start":{"line":117,"column":73},"end":{"line":117,"column":75}}]},"4":{"line":119,"type":"if","locations":[{"start":{"line":119,"column":8},"end":{"line":119,"column":8}},{"start":{"line":119,"column":8},"end":{"line":119,"column":8}}]},"5":{"line":123,"type":"if","locations":[{"start":{"line":123,"column":8},"end":{"line":123,"column":8}},{"start":{"line":123,"column":8},"end":{"line":123,"column":8}}]},"6":{"line":127,"type":"if","locations":[{"start":{"line":127,"column":8},"end":{"line":127,"column":8}},{"start":{"line":127,"column":8},"end":{"line":127,"column":8}}]},"7":{"line":143,"type":"if","locations":[{"start":{"line":143,"column":8},"end":{"line":143,"column":8}},{"start":{"line":143,"column":8},"end":{"line":143,"column":8}}]},"8":{"line":148,"type":"if","locations":[{"start":{"line":148,"column":8},"end":{"line":148,"column":8}},{"start":{"line":148,"column":8},"end":{"line":148,"column":8}}]},"9":{"line":150,"type":"if","locations":[{"start":{"line":150,"column":12},"end":{"line":150,"column":12}},{"start":{"line":150,"column":12},"end":{"line":150,"column":12}}]},"10":{"line":152,"type":"if","locations":[{"start":{"line":152,"column":16},"end":{"line":152,"column":16}},{"start":{"line":152,"column":16},"end":{"line":152,"column":16}}]},"11":{"line":152,"type":"binary-expr","locations":[{"start":{"line":152,"column":20},"end":{"line":152,"column":40}},{"start":{"line":152,"column":44},"end":{"line":152,"column":61}}]},"12":{"line":165,"type":"cond-expr","locations":[{"start":{"line":165,"column":48},"end":{"line":165,"column":52}},{"start":{"line":165,"column":55},"end":{"line":165,"column":79}}]},"13":{"line":166,"type":"if","locations":[{"start":{"line":166,"column":12},"end":{"line":166,"column":12}},{"start":{"line":166,"column":12},"end":{"line":166,"column":12}}]},"14":{"line":179,"type":"if","locations":[{"start":{"line":179,"column":8},"end":{"line":179,"column":8}},{"start":{"line":179,"column":8},"end":{"line":179,"column":8}}]},"15":{"line":179,"type":"binary-expr","locations":[{"start":{"line":179,"column":12},"end":{"line":179,"column":17}},{"start":{"line":179,"column":21},"end":{"line":179,"column":32}}]},"16":{"line":200,"type":"if","locations":[{"start":{"line":200,"column":8},"end":{"line":200,"column":8}},{"start":{"line":200,"column":8},"end":{"line":200,"column":8}}]},"17":{"line":205,"type":"if","locations":[{"start":{"line":205,"column":8},"end":{"line":205,"column":8}},{"start":{"line":205,"column":8},"end":{"line":205,"column":8}}]},"18":{"line":207,"type":"if","locations":[{"start":{"line":207,"column":12},"end":{"line":207,"column":12}},{"start":{"line":207,"column":12},"end":{"line":207,"column":12}}]},"19":{"line":208,"type":"if","locations":[{"start":{"line":208,"column":16},"end":{"line":208,"column":16}},{"start":{"line":208,"column":16},"end":{"line":208,"column":16}}]},"20":{"line":208,"type":"binary-expr","locations":[{"start":{"line":208,"column":20},"end":{"line":208,"column":49}},{"start":{"line":208,"column":53},"end":{"line":208,"column":75}}]},"21":{"line":215,"type":"if","locations":[{"start":{"line":215,"column":12},"end":{"line":215,"column":12}},{"start":{"line":215,"column":12},"end":{"line":215,"column":12}}]},"22":{"line":220,"type":"if","locations":[{"start":{"line":220,"column":16},"end":{"line":220,"column":16}},{"start":{"line":220,"column":16},"end":{"line":220,"column":16}}]},"23":{"line":222,"type":"if","locations":[{"start":{"line":222,"column":20},"end":{"line":222,"column":20}},{"start":{"line":222,"column":20},"end":{"line":222,"column":20}}]},"24":{"line":222,"type":"binary-expr","locations":[{"start":{"line":222,"column":24},"end":{"line":222,"column":44}},{"start":{"line":222,"column":48},"end":{"line":222,"column":65}}]},"25":{"line":236,"type":"if","locations":[{"start":{"line":236,"column":16},"end":{"line":236,"column":16}},{"start":{"line":236,"column":16},"end":{"line":236,"column":16}}]},"26":{"line":239,"type":"cond-expr","locations":[{"start":{"line":239,"column":82},"end":{"line":239,"column":85}},{"start":{"line":239,"column":88},"end":{"line":239,"column":91}}]},"27":{"line":242,"type":"cond-expr","locations":[{"start":{"line":242,"column":55},"end":{"line":242,"column":56}},{"start":{"line":242,"column":59},"end":{"line":242,"column":60}}]},"28":{"line":243,"type":"cond-expr","locations":[{"start":{"line":243,"column":42},"end":{"line":243,"column":55}},{"start":{"line":243,"column":58},"end":{"line":243,"column":59}}]},"29":{"line":245,"type":"if","locations":[{"start":{"line":245,"column":16},"end":{"line":245,"column":16}},{"start":{"line":245,"column":16},"end":{"line":245,"column":16}}]},"30":{"line":245,"type":"binary-expr","locations":[{"start":{"line":245,"column":20},"end":{"line":245,"column":38}},{"start":{"line":245,"column":43},"end":{"line":245,"column":85}},{"start":{"line":245,"column":91},"end":{"line":245,"column":134}}]}},"code":["(function () { YUI.add('event-flick', function (Y, NAME) {","","/**"," * The gestures module provides gesture events such as \"flick\", which normalize user interactions"," * across touch and mouse or pointer based input devices. This layer can be used by application developers"," * to build input device agnostic components which behave the same in response to either touch or mouse based"," * interaction."," *"," * <p>Documentation for events added by this module can be found in the event document for the <a href=\"../classes/YUI.html#events\">YUI</a> global.</p>"," *"," *"," @example",""," YUI().use('event-flick', function (Y) {"," Y.one('#myNode').on('flick', function (e) {"," });"," });",""," *"," * @module event-gestures"," */","","/**"," * Adds support for a \"flick\" event, which is fired at the end of a touch or mouse based flick gesture, and provides"," * velocity of the flick, along with distance and time information."," *"," * <p>Documentation for the flick event can be found on the <a href=\"../classes/YUI.html#event_flick\">YUI</a> global,"," * along with the other supported events.</p>"," *"," * @module event-gestures"," * @submodule event-flick"," */","var GESTURE_MAP = Y.Event._GESTURE_MAP,"," EVENT = {"," start: GESTURE_MAP.start,"," end: GESTURE_MAP.end,"," move: GESTURE_MAP.move"," },"," START = \"start\","," END = \"end\","," MOVE = \"move\",",""," OWNER_DOCUMENT = \"ownerDocument\","," MIN_VELOCITY = \"minVelocity\","," MIN_DISTANCE = \"minDistance\","," PREVENT_DEFAULT = \"preventDefault\",",""," _FLICK_START = \"_fs\","," _FLICK_START_HANDLE = \"_fsh\","," _FLICK_END_HANDLE = \"_feh\","," _FLICK_MOVE_HANDLE = \"_fmh\",",""," NODE_TYPE = \"nodeType\";","","/**"," * Sets up a \"flick\" event, that is fired whenever the user initiates a flick gesture on the node"," * where the listener is attached. The subscriber can specify a minimum distance or velocity for"," * which the event is to be fired. The subscriber can also specify if there is a particular axis which"," * they are interested in - \"x\" or \"y\". If no axis is specified, the axis along which there was most distance"," * covered is used."," *"," * <p>It is recommended that you use Y.bind to set up context and additional arguments for your event handler,"," * however if you want to pass the context and arguments as additional signature arguments to \"on\","," * you need to provide a null value for the configuration object, e.g: <code>node.on(\"flick\", fn, null, context, arg1, arg2, arg3)</code></p>"," *"," * @event flick"," * @for YUI"," * @param type {string} \"flick\""," * @param fn {function} The method the event invokes. It receives an event facade with an e.flick object containing the flick related properties: e.flick.time, e.flick.distance, e.flick.velocity and e.flick.axis, e.flick.start."," * @param cfg {Object} Optional. An object which specifies any of the following:"," * <dl>"," * <dt>minDistance (in pixels, defaults to 10)</dt>"," * <dd>The minimum distance between start and end points, which would qualify the gesture as a flick.</dd>"," * <dt>minVelocity (in pixels/ms, defaults to 0)</dt>"," * <dd>The minimum velocity which would qualify the gesture as a flick.</dd>"," * <dt>preventDefault (defaults to false)</dt>"," * <dd>Can be set to true/false to prevent default behavior as soon as the touchstart/touchend or mousedown/mouseup is received so that things like scrolling or text selection can be"," * prevented. This property can also be set to a function, which returns true or false, based on the event facade passed to it.</dd>"," * <dt>axis (no default)</dt>"," * <dd>Can be set to \"x\" or \"y\" if you want to constrain the flick velocity and distance to a single axis. If not"," * defined, the axis along which the maximum distance was covered is used.</dd>"," * </dl>"," * @return {EventHandle} the detach handle"," */","","Y.Event.define('flick', {",""," on: function (node, subscriber, ce) {",""," var startHandle = node.on(EVENT[START],"," this._onStart,"," this,"," node,"," subscriber,"," ce);",""," subscriber[_FLICK_START_HANDLE] = startHandle;"," },",""," detach: function (node, subscriber, ce) {",""," var startHandle = subscriber[_FLICK_START_HANDLE],"," endHandle = subscriber[_FLICK_END_HANDLE];",""," if (startHandle) {"," startHandle.detach();"," subscriber[_FLICK_START_HANDLE] = null;"," }",""," if (endHandle) {"," endHandle.detach();"," subscriber[_FLICK_END_HANDLE] = null;"," }"," },",""," processArgs: function(args) {"," var params = (args.length > 3) ? Y.merge(args.splice(3, 1)[0]) : {};",""," if (!(MIN_VELOCITY in params)) {"," params[MIN_VELOCITY] = this.MIN_VELOCITY;"," }",""," if (!(MIN_DISTANCE in params)) {"," params[MIN_DISTANCE] = this.MIN_DISTANCE;"," }",""," if (!(PREVENT_DEFAULT in params)) {"," params[PREVENT_DEFAULT] = this.PREVENT_DEFAULT;"," }",""," return params;"," },",""," _onStart: function(e, node, subscriber, ce) {",""," var start = true, // always true for mouse"," endHandle,"," moveHandle,"," doc,"," preventDefault = subscriber._extra.preventDefault,"," origE = e;",""," if (e.touches) {"," start = (e.touches.length === 1);"," e = e.touches[0];"," }",""," if (start) {",""," if (preventDefault) {"," // preventDefault is a boolean or function"," if (!preventDefault.call || preventDefault(e)) {"," origE.preventDefault();"," }"," }",""," e.flick = {"," time : new Date().getTime()"," };",""," subscriber[_FLICK_START] = e;",""," endHandle = subscriber[_FLICK_END_HANDLE];",""," doc = (node.get(NODE_TYPE) === 9) ? node : node.get(OWNER_DOCUMENT);"," if (!endHandle) {"," endHandle = doc.on(EVENT[END], Y.bind(this._onEnd, this), null, node, subscriber, ce);"," subscriber[_FLICK_END_HANDLE] = endHandle;"," }",""," subscriber[_FLICK_MOVE_HANDLE] = doc.once(EVENT[MOVE], Y.bind(this._onMove, this), null, node, subscriber, ce);"," }"," },",""," _onMove: function(e, node, subscriber, ce) {"," var start = subscriber[_FLICK_START];",""," // Start timing from first move."," if (start && start.flick) {"," start.flick.time = new Date().getTime();"," }"," },",""," _onEnd: function(e, node, subscriber, ce) {",""," var endTime = new Date().getTime(),"," start = subscriber[_FLICK_START],"," valid = !!start,"," endEvent = e,"," startTime,"," time,"," preventDefault,"," params,"," xyDistance,"," distance,"," velocity,"," axis,"," moveHandle = subscriber[_FLICK_MOVE_HANDLE];",""," if (moveHandle) {"," moveHandle.detach();"," delete subscriber[_FLICK_MOVE_HANDLE];"," }",""," if (valid) {",""," if (e.changedTouches) {"," if (e.changedTouches.length === 1 && e.touches.length === 0) {"," endEvent = e.changedTouches[0];"," } else {"," valid = false;"," }"," }",""," if (valid) {",""," params = subscriber._extra;"," preventDefault = params[PREVENT_DEFAULT];",""," if (preventDefault) {"," // preventDefault is a boolean or function"," if (!preventDefault.call || preventDefault(e)) {"," e.preventDefault();"," }"," }",""," startTime = start.flick.time;"," endTime = new Date().getTime();"," time = endTime - startTime;",""," xyDistance = ["," endEvent.pageX - start.pageX,"," endEvent.pageY - start.pageY"," ];",""," if (params.axis) {"," axis = params.axis;"," } else {"," axis = (Math.abs(xyDistance[0]) >= Math.abs(xyDistance[1])) ? 'x' : 'y';"," }",""," distance = xyDistance[(axis === 'x') ? 0 : 1];"," velocity = (time !== 0) ? distance/time : 0;",""," if (isFinite(velocity) && (Math.abs(distance) >= params[MIN_DISTANCE]) && (Math.abs(velocity) >= params[MIN_VELOCITY])) {",""," e.type = \"flick\";"," e.flick = {"," time:time,"," distance: distance,"," velocity:velocity,"," axis: axis,"," start : start"," };",""," ce.fire(e);",""," }",""," subscriber[_FLICK_START] = null;"," }"," }"," },",""," MIN_VELOCITY : 0,"," MIN_DISTANCE : 0,"," PREVENT_DEFAULT : false","});","","","}, '@VERSION@', {\"requires\": [\"node-base\", \"event-touch\", \"event-synthetic\"]});","","}());"]}; } var __cov_S_vUw8qYRGzepV1P$8KY2Q = __coverage__['build/event-flick/event-flick.js']; __cov_S_vUw8qYRGzepV1P$8KY2Q.s['1']++;YUI.add('event-flick',function(Y,NAME){__cov_S_vUw8qYRGzepV1P$8KY2Q.f['1']++;__cov_S_vUw8qYRGzepV1P$8KY2Q.s['2']++;var GESTURE_MAP=Y.Event._GESTURE_MAP,EVENT={start:GESTURE_MAP.start,end:GESTURE_MAP.end,move:GESTURE_MAP.move},START='start',END='end',MOVE='move',OWNER_DOCUMENT='ownerDocument',MIN_VELOCITY='minVelocity',MIN_DISTANCE='minDistance',PREVENT_DEFAULT='preventDefault',_FLICK_START='_fs',_FLICK_START_HANDLE='_fsh',_FLICK_END_HANDLE='_feh',_FLICK_MOVE_HANDLE='_fmh',NODE_TYPE='nodeType';__cov_S_vUw8qYRGzepV1P$8KY2Q.s['3']++;Y.Event.define('flick',{on:function(node,subscriber,ce){__cov_S_vUw8qYRGzepV1P$8KY2Q.f['2']++;__cov_S_vUw8qYRGzepV1P$8KY2Q.s['4']++;var startHandle=node.on(EVENT[START],this._onStart,this,node,subscriber,ce);__cov_S_vUw8qYRGzepV1P$8KY2Q.s['5']++;subscriber[_FLICK_START_HANDLE]=startHandle;},detach:function(node,subscriber,ce){__cov_S_vUw8qYRGzepV1P$8KY2Q.f['3']++;__cov_S_vUw8qYRGzepV1P$8KY2Q.s['6']++;var startHandle=subscriber[_FLICK_START_HANDLE],endHandle=subscriber[_FLICK_END_HANDLE];__cov_S_vUw8qYRGzepV1P$8KY2Q.s['7']++;if(startHandle){__cov_S_vUw8qYRGzepV1P$8KY2Q.b['1'][0]++;__cov_S_vUw8qYRGzepV1P$8KY2Q.s['8']++;startHandle.detach();__cov_S_vUw8qYRGzepV1P$8KY2Q.s['9']++;subscriber[_FLICK_START_HANDLE]=null;}else{__cov_S_vUw8qYRGzepV1P$8KY2Q.b['1'][1]++;}__cov_S_vUw8qYRGzepV1P$8KY2Q.s['10']++;if(endHandle){__cov_S_vUw8qYRGzepV1P$8KY2Q.b['2'][0]++;__cov_S_vUw8qYRGzepV1P$8KY2Q.s['11']++;endHandle.detach();__cov_S_vUw8qYRGzepV1P$8KY2Q.s['12']++;subscriber[_FLICK_END_HANDLE]=null;}else{__cov_S_vUw8qYRGzepV1P$8KY2Q.b['2'][1]++;}},processArgs:function(args){__cov_S_vUw8qYRGzepV1P$8KY2Q.f['4']++;__cov_S_vUw8qYRGzepV1P$8KY2Q.s['13']++;var params=args.length>3?(__cov_S_vUw8qYRGzepV1P$8KY2Q.b['3'][0]++,Y.merge(args.splice(3,1)[0])):(__cov_S_vUw8qYRGzepV1P$8KY2Q.b['3'][1]++,{});__cov_S_vUw8qYRGzepV1P$8KY2Q.s['14']++;if(!(MIN_VELOCITY in params)){__cov_S_vUw8qYRGzepV1P$8KY2Q.b['4'][0]++;__cov_S_vUw8qYRGzepV1P$8KY2Q.s['15']++;params[MIN_VELOCITY]=this.MIN_VELOCITY;}else{__cov_S_vUw8qYRGzepV1P$8KY2Q.b['4'][1]++;}__cov_S_vUw8qYRGzepV1P$8KY2Q.s['16']++;if(!(MIN_DISTANCE in params)){__cov_S_vUw8qYRGzepV1P$8KY2Q.b['5'][0]++;__cov_S_vUw8qYRGzepV1P$8KY2Q.s['17']++;params[MIN_DISTANCE]=this.MIN_DISTANCE;}else{__cov_S_vUw8qYRGzepV1P$8KY2Q.b['5'][1]++;}__cov_S_vUw8qYRGzepV1P$8KY2Q.s['18']++;if(!(PREVENT_DEFAULT in params)){__cov_S_vUw8qYRGzepV1P$8KY2Q.b['6'][0]++;__cov_S_vUw8qYRGzepV1P$8KY2Q.s['19']++;params[PREVENT_DEFAULT]=this.PREVENT_DEFAULT;}else{__cov_S_vUw8qYRGzepV1P$8KY2Q.b['6'][1]++;}__cov_S_vUw8qYRGzepV1P$8KY2Q.s['20']++;return params;},_onStart:function(e,node,subscriber,ce){__cov_S_vUw8qYRGzepV1P$8KY2Q.f['5']++;__cov_S_vUw8qYRGzepV1P$8KY2Q.s['21']++;var start=true,endHandle,moveHandle,doc,preventDefault=subscriber._extra.preventDefault,origE=e;__cov_S_vUw8qYRGzepV1P$8KY2Q.s['22']++;if(e.touches){__cov_S_vUw8qYRGzepV1P$8KY2Q.b['7'][0]++;__cov_S_vUw8qYRGzepV1P$8KY2Q.s['23']++;start=e.touches.length===1;__cov_S_vUw8qYRGzepV1P$8KY2Q.s['24']++;e=e.touches[0];}else{__cov_S_vUw8qYRGzepV1P$8KY2Q.b['7'][1]++;}__cov_S_vUw8qYRGzepV1P$8KY2Q.s['25']++;if(start){__cov_S_vUw8qYRGzepV1P$8KY2Q.b['8'][0]++;__cov_S_vUw8qYRGzepV1P$8KY2Q.s['26']++;if(preventDefault){__cov_S_vUw8qYRGzepV1P$8KY2Q.b['9'][0]++;__cov_S_vUw8qYRGzepV1P$8KY2Q.s['27']++;if((__cov_S_vUw8qYRGzepV1P$8KY2Q.b['11'][0]++,!preventDefault.call)||(__cov_S_vUw8qYRGzepV1P$8KY2Q.b['11'][1]++,preventDefault(e))){__cov_S_vUw8qYRGzepV1P$8KY2Q.b['10'][0]++;__cov_S_vUw8qYRGzepV1P$8KY2Q.s['28']++;origE.preventDefault();}else{__cov_S_vUw8qYRGzepV1P$8KY2Q.b['10'][1]++;}}else{__cov_S_vUw8qYRGzepV1P$8KY2Q.b['9'][1]++;}__cov_S_vUw8qYRGzepV1P$8KY2Q.s['29']++;e.flick={time:new Date().getTime()};__cov_S_vUw8qYRGzepV1P$8KY2Q.s['30']++;subscriber[_FLICK_START]=e;__cov_S_vUw8qYRGzepV1P$8KY2Q.s['31']++;endHandle=subscriber[_FLICK_END_HANDLE];__cov_S_vUw8qYRGzepV1P$8KY2Q.s['32']++;doc=node.get(NODE_TYPE)===9?(__cov_S_vUw8qYRGzepV1P$8KY2Q.b['12'][0]++,node):(__cov_S_vUw8qYRGzepV1P$8KY2Q.b['12'][1]++,node.get(OWNER_DOCUMENT));__cov_S_vUw8qYRGzepV1P$8KY2Q.s['33']++;if(!endHandle){__cov_S_vUw8qYRGzepV1P$8KY2Q.b['13'][0]++;__cov_S_vUw8qYRGzepV1P$8KY2Q.s['34']++;endHandle=doc.on(EVENT[END],Y.bind(this._onEnd,this),null,node,subscriber,ce);__cov_S_vUw8qYRGzepV1P$8KY2Q.s['35']++;subscriber[_FLICK_END_HANDLE]=endHandle;}else{__cov_S_vUw8qYRGzepV1P$8KY2Q.b['13'][1]++;}__cov_S_vUw8qYRGzepV1P$8KY2Q.s['36']++;subscriber[_FLICK_MOVE_HANDLE]=doc.once(EVENT[MOVE],Y.bind(this._onMove,this),null,node,subscriber,ce);}else{__cov_S_vUw8qYRGzepV1P$8KY2Q.b['8'][1]++;}},_onMove:function(e,node,subscriber,ce){__cov_S_vUw8qYRGzepV1P$8KY2Q.f['6']++;__cov_S_vUw8qYRGzepV1P$8KY2Q.s['37']++;var start=subscriber[_FLICK_START];__cov_S_vUw8qYRGzepV1P$8KY2Q.s['38']++;if((__cov_S_vUw8qYRGzepV1P$8KY2Q.b['15'][0]++,start)&&(__cov_S_vUw8qYRGzepV1P$8KY2Q.b['15'][1]++,start.flick)){__cov_S_vUw8qYRGzepV1P$8KY2Q.b['14'][0]++;__cov_S_vUw8qYRGzepV1P$8KY2Q.s['39']++;start.flick.time=new Date().getTime();}else{__cov_S_vUw8qYRGzepV1P$8KY2Q.b['14'][1]++;}},_onEnd:function(e,node,subscriber,ce){__cov_S_vUw8qYRGzepV1P$8KY2Q.f['7']++;__cov_S_vUw8qYRGzepV1P$8KY2Q.s['40']++;var endTime=new Date().getTime(),start=subscriber[_FLICK_START],valid=!!start,endEvent=e,startTime,time,preventDefault,params,xyDistance,distance,velocity,axis,moveHandle=subscriber[_FLICK_MOVE_HANDLE];__cov_S_vUw8qYRGzepV1P$8KY2Q.s['41']++;if(moveHandle){__cov_S_vUw8qYRGzepV1P$8KY2Q.b['16'][0]++;__cov_S_vUw8qYRGzepV1P$8KY2Q.s['42']++;moveHandle.detach();__cov_S_vUw8qYRGzepV1P$8KY2Q.s['43']++;delete subscriber[_FLICK_MOVE_HANDLE];}else{__cov_S_vUw8qYRGzepV1P$8KY2Q.b['16'][1]++;}__cov_S_vUw8qYRGzepV1P$8KY2Q.s['44']++;if(valid){__cov_S_vUw8qYRGzepV1P$8KY2Q.b['17'][0]++;__cov_S_vUw8qYRGzepV1P$8KY2Q.s['45']++;if(e.changedTouches){__cov_S_vUw8qYRGzepV1P$8KY2Q.b['18'][0]++;__cov_S_vUw8qYRGzepV1P$8KY2Q.s['46']++;if((__cov_S_vUw8qYRGzepV1P$8KY2Q.b['20'][0]++,e.changedTouches.length===1)&&(__cov_S_vUw8qYRGzepV1P$8KY2Q.b['20'][1]++,e.touches.length===0)){__cov_S_vUw8qYRGzepV1P$8KY2Q.b['19'][0]++;__cov_S_vUw8qYRGzepV1P$8KY2Q.s['47']++;endEvent=e.changedTouches[0];}else{__cov_S_vUw8qYRGzepV1P$8KY2Q.b['19'][1]++;__cov_S_vUw8qYRGzepV1P$8KY2Q.s['48']++;valid=false;}}else{__cov_S_vUw8qYRGzepV1P$8KY2Q.b['18'][1]++;}__cov_S_vUw8qYRGzepV1P$8KY2Q.s['49']++;if(valid){__cov_S_vUw8qYRGzepV1P$8KY2Q.b['21'][0]++;__cov_S_vUw8qYRGzepV1P$8KY2Q.s['50']++;params=subscriber._extra;__cov_S_vUw8qYRGzepV1P$8KY2Q.s['51']++;preventDefault=params[PREVENT_DEFAULT];__cov_S_vUw8qYRGzepV1P$8KY2Q.s['52']++;if(preventDefault){__cov_S_vUw8qYRGzepV1P$8KY2Q.b['22'][0]++;__cov_S_vUw8qYRGzepV1P$8KY2Q.s['53']++;if((__cov_S_vUw8qYRGzepV1P$8KY2Q.b['24'][0]++,!preventDefault.call)||(__cov_S_vUw8qYRGzepV1P$8KY2Q.b['24'][1]++,preventDefault(e))){__cov_S_vUw8qYRGzepV1P$8KY2Q.b['23'][0]++;__cov_S_vUw8qYRGzepV1P$8KY2Q.s['54']++;e.preventDefault();}else{__cov_S_vUw8qYRGzepV1P$8KY2Q.b['23'][1]++;}}else{__cov_S_vUw8qYRGzepV1P$8KY2Q.b['22'][1]++;}__cov_S_vUw8qYRGzepV1P$8KY2Q.s['55']++;startTime=start.flick.time;__cov_S_vUw8qYRGzepV1P$8KY2Q.s['56']++;endTime=new Date().getTime();__cov_S_vUw8qYRGzepV1P$8KY2Q.s['57']++;time=endTime-startTime;__cov_S_vUw8qYRGzepV1P$8KY2Q.s['58']++;xyDistance=[endEvent.pageX-start.pageX,endEvent.pageY-start.pageY];__cov_S_vUw8qYRGzepV1P$8KY2Q.s['59']++;if(params.axis){__cov_S_vUw8qYRGzepV1P$8KY2Q.b['25'][0]++;__cov_S_vUw8qYRGzepV1P$8KY2Q.s['60']++;axis=params.axis;}else{__cov_S_vUw8qYRGzepV1P$8KY2Q.b['25'][1]++;__cov_S_vUw8qYRGzepV1P$8KY2Q.s['61']++;axis=Math.abs(xyDistance[0])>=Math.abs(xyDistance[1])?(__cov_S_vUw8qYRGzepV1P$8KY2Q.b['26'][0]++,'x'):(__cov_S_vUw8qYRGzepV1P$8KY2Q.b['26'][1]++,'y');}__cov_S_vUw8qYRGzepV1P$8KY2Q.s['62']++;distance=xyDistance[axis==='x'?(__cov_S_vUw8qYRGzepV1P$8KY2Q.b['27'][0]++,0):(__cov_S_vUw8qYRGzepV1P$8KY2Q.b['27'][1]++,1)];__cov_S_vUw8qYRGzepV1P$8KY2Q.s['63']++;velocity=time!==0?(__cov_S_vUw8qYRGzepV1P$8KY2Q.b['28'][0]++,distance/time):(__cov_S_vUw8qYRGzepV1P$8KY2Q.b['28'][1]++,0);__cov_S_vUw8qYRGzepV1P$8KY2Q.s['64']++;if((__cov_S_vUw8qYRGzepV1P$8KY2Q.b['30'][0]++,isFinite(velocity))&&(__cov_S_vUw8qYRGzepV1P$8KY2Q.b['30'][1]++,Math.abs(distance)>=params[MIN_DISTANCE])&&(__cov_S_vUw8qYRGzepV1P$8KY2Q.b['30'][2]++,Math.abs(velocity)>=params[MIN_VELOCITY])){__cov_S_vUw8qYRGzepV1P$8KY2Q.b['29'][0]++;__cov_S_vUw8qYRGzepV1P$8KY2Q.s['65']++;e.type='flick';__cov_S_vUw8qYRGzepV1P$8KY2Q.s['66']++;e.flick={time:time,distance:distance,velocity:velocity,axis:axis,start:start};__cov_S_vUw8qYRGzepV1P$8KY2Q.s['67']++;ce.fire(e);}else{__cov_S_vUw8qYRGzepV1P$8KY2Q.b['29'][1]++;}__cov_S_vUw8qYRGzepV1P$8KY2Q.s['68']++;subscriber[_FLICK_START]=null;}else{__cov_S_vUw8qYRGzepV1P$8KY2Q.b['21'][1]++;}}else{__cov_S_vUw8qYRGzepV1P$8KY2Q.b['17'][1]++;}},MIN_VELOCITY:0,MIN_DISTANCE:0,PREVENT_DEFAULT:false});},'@VERSION@',{'requires':['node-base','event-touch','event-synthetic']});
// bound.js is a CommonJS module to avoid the need for a build step for the decorator itself, so we need // this little workaround import '../src/bound.js' const bound = window.exports.default // Adapted from example in https://github.com/tc39/proposal-decorators class Counter extends HTMLElement { count = 0 @bound clicked() { this.count++ window.requestAnimationFrame(() => this.render()) } constructor() { super() this.onclick = this.clicked } connectedCallback() { this.render() } render() { this.textContent = this.count.toString() } } window.customElements.define('num-counter', Counter) // @TODO (once Babel supports private methods) /* class Counter extends HTMLElement { #count = 0 @bound #clicked() { this.#count++ window.requestAnimationFrame(() => this.render()) } constructor() { super() this.onclick = this.#clicked } connectedCallback() { this.render() } render() { this.textContent = this.#count.toString() } } */
define(['../../utils/constant'], function(constant) { /** * A module representing a User controller. * @exports controllers/group.move */ var Controller = function ($rootScope, $scope, GroupService, AlertService) { $scope.move = function () { if(!$rootScope.moveUser.user.id){ AlertService.addAutoDismissAlert(constant.messageType.warning, $rootScope.translate('groupMgr.tips.selectCurrentUser')); return; } if(!$rootScope.moveUser.group.id){ AlertService.addAutoDismissAlert(constant.messageType.warning, $rootScope.translate('groupMgr.tips.selectTargetGroup')); return; } var user = $rootScope.moveUser.user; //暂不支持批量移动 var userIdGroupIdPairs = [{ entry1:user.id, entry2:user.parentId }]; var params = {}; params.userIdGroupIdPairs = userIdGroupIdPairs; params.normalMember=true; params.groupId = $rootScope.moveUser.group.id; GroupService.moveUser(params, function (res) { var result = res.data; if(res.info) { for(var i=0; i<res.info.length;i++) { AlertService.addAlert(constant.messageType.danger, res.info[i].msg); } return; } AlertService.addAutoDismissAlert(constant.messageType.info, $rootScope.translate('groupMgr.tips.groupMoveSuccess')); //reset $rootScope.moveUser.user = {}; $rootScope.moveUser.group = {}; //cancel the onMove status before move successfully $rootScope.onMove = false; //reset the tree component $rootScope.reset(); }, function () { AlertService.addAutoDismissAlert(constant.messageType.danger, $rootScope.translate('groupMgr.tips.groupMoveFailure')); }); }; }; return { name: "GroupMoveUserController", fn: ["$rootScope", "$scope", "GroupService", "AlertService", Controller] }; });
export * from './PolygonTool.component'; export { default } from './PolygonTool.component';
'use strict'; const path = require('path'); const chai = require('chai'); const { expect } = chai; const sinon = require('sinon'); const sinonTest = require('sinon-test'); sinon.test = sinonTest(sinon); const sinonChai = require('sinon-chai'); chai.use(sinonChai); const proxyquire = require('proxyquire').noCallThru(); require('dw-api-mock/demandware-globals'); const config = require(path.join(process.cwd(), 'src/sfcc/cartridges/int_b2ccrmsync/cartridge/scripts/b2ccrmsync.config')); config.services.auth = `http.${config.services.auth}`; // Prepend the 'http' prefix so that the dw-api-mock understands that this is a HTTP Service instance config.services.rest = `http.${config.services.rest}`; // Prepend the 'http' prefix so that the dw-api-mock understands that this is a HTTP Service instance const authMock = require(path.join(process.cwd(), 'src/sfcc/cartridges/int_b2ccrmsync/cartridge/scripts/services/mocks/auth')); const customerRetrieveMock = require(path.join(process.cwd(), 'src/sfcc/cartridges/int_b2ccrmsync/cartridge/scripts/services/mocks/customer.retrieve')); const Profile = require('dw-api-mock/dw/customer/Profile'); const getEnabledSite = () => { const site = require('dw-api-mock/dw/system/Site').getCurrent(); site.customPreferences.b2ccrm_syncIsEnabled = true; site.customPreferences.b2ccrm_syncCustomersEnabled = true; site.customPreferences.b2ccrm_syncCustomersOnLoginEnabled = true; return site; }; describe('int_b2ccrmsync/cartridge/scripts/hooks/customer.retrieve', function () { let sandbox; let spy; let requireStub; let profile; let customerRetrieveHook; before('setup sandbox', function () { sandbox = sinon.createSandbox(); }); beforeEach(function () { global.request.locale = 'en_US'; requireStub = { 'dw/system/Site': require('dw-api-mock/dw/system/Site'), '../models/authToken': sandbox.stub().returns(require(path.join(process.cwd(), 'src/sfcc/cartridges/int_b2ccrmsync/cartridge/scripts/models/authToken'))), '../services/ServiceMgr': require(path.join(process.cwd(), 'src/sfcc/cartridges/int_b2ccrmsync/cartridge/scripts/services/ServiceMgr')), '../b2ccrmsync.config': config }; customerRetrieveHook = proxyquire(path.join(process.cwd(), 'src/sfcc/cartridges/int_b2ccrmsync/cartridge/scripts/hooks/customer.retrieve'), requireStub); profile = new Profile(); profile.customerNo = '0000001'; profile.setEmail('jdoe@salesforce.com'); profile.setLastName('Doe'); profile.custom = { b2ccrm_contactId: 'bbbbbb', b2ccrm_accountId: 'cccccc', b2ccrm_syncResponseText: [], b2ccrm_syncStatus: undefined }; spy = sinon.spy(require(path.join(process.cwd(), 'src/sfcc/cartridges/int_b2ccrmsync/cartridge/scripts/services/ServiceMgr')), 'callRestService'); }); afterEach(function () { sandbox.restore(); spy && spy.restore(); }); describe('retrieve', function () { it('should not do anything in case no profile is sent as parameter', function () { const result = customerRetrieveHook.retrieve(); expect(spy).to.have.not.been.called; expect(result).to.be.undefined; }); it('should not do anything in case the B2C CRM Sync site preference is disabled', function () { const site = require('dw-api-mock/dw/system/Site').getCurrent(); site.customPreferences.b2ccrm_syncIsEnabled = false; site.customPreferences.b2ccrm_syncCustomersEnabled = false; requireStub['dw/system/Site'].getCurrent = sandbox.stub().returns(site); const result = customerRetrieveHook.retrieve(); expect(spy).to.have.not.been.called; expect(result).to.be.undefined; }); it('should fail to retrieve the profile if no auth token is found, or an error occur', function () { const site = getEnabledSite(); requireStub['dw/system/Site'].getCurrent = sandbox.stub().returns(site); const result = customerRetrieveHook.retrieve(); expect(spy).to.have.not.been.called; expect(result).to.be.undefined; }); it('should fail to retrieve the profile if the object given in paremeters does not contain at least one required parameter', function () { const site = getEnabledSite(); requireStub['dw/system/Site'].getCurrent = sandbox.stub().returns(site); const result = customerRetrieveHook.retrieve({ test: 'value' }); expect(spy).to.have.not.been.called; expect(result).to.be.undefined; }); it('should call the rest service to retrieve the profile and fail silently if the service replies an error', function () { const site = getEnabledSite(); requireStub['dw/system/Site'].getCurrent = sandbox.stub().returns(site); requireStub['../services/ServiceMgr'].callRestService = sandbox.stub().returns({ status: 'ERROR', error: 'error', errorMessage: 'message' }); const result = customerRetrieveHook.retrieve(profile); expect(result).to.be.undefined; }); it('should call the rest service to retrieve the profile and fail silently if the service OK but contains errors', function () { const site = getEnabledSite(); requireStub['dw/system/Site'].getCurrent = sandbox.stub().returns(site); let mockResponse = JSON.parse(JSON.stringify(customerRetrieveMock)); mockResponse[0].isSuccess = false; mockResponse[0].errors = ['error1', 'error2']; requireStub['../services/ServiceMgr'].callRestService = sandbox.stub().returns({ status: 'OK', object: mockResponse }); const result = customerRetrieveHook.retrieve(profile); expect(result).to.be.undefined; }); it('should call the rest service to retrieve the profile and abort because no profile have been found', function () { const site = getEnabledSite(); requireStub['dw/system/Site'].getCurrent = sandbox.stub().returns(site); let mockResponse = JSON.parse(JSON.stringify(customerRetrieveMock)); mockResponse[0].outputValues = undefined; requireStub['../services/ServiceMgr'].callRestService = sandbox.stub().returns({ status: 'OK', object: mockResponse }); const result = customerRetrieveHook.retrieve(profile); expect(result).to.be.undefined; }); it('should call the rest service to retrieve the profile and update the profile custom attributes accordingly', function () { const site = getEnabledSite(); requireStub['dw/system/Site'].getCurrent = sandbox.stub().returns(site); requireStub['../services/ServiceMgr'].callRestService = sandbox.stub().returns({ status: 'OK', object: customerRetrieveMock }); const result = customerRetrieveHook.retrieve(profile, true); expect(result).to.not.be.undefined; expect(result).to.deep.equal(customerRetrieveMock[0].outputValues.ContactListResolved[0]); }); it('should call the rest service to retrieve the profile and update the profile custom attributes accordingly when sending an object as parameter', function () { const site = getEnabledSite(); requireStub['dw/system/Site'].getCurrent = sandbox.stub().returns(site); requireStub['../services/ServiceMgr'].callRestService = sandbox.stub().returns({ status: 'OK', object: customerRetrieveMock }); const result = customerRetrieveHook.retrieve({ Id: '000001' }); expect(result).to.not.be.undefined; expect(result).to.deep.equal(customerRetrieveMock[0].outputValues.ContactListResolved[0]); }); }); });
'use strict'; //This is the only item you need to edit within the app.js this will change it application wide //This will also allow you to use 'app' to tie it to the application and it will inherit everything from the application core var appName = 'Viper'; //Define the Application in one spot and have an alias that doesn't call all the requirements var globalApp = angular.module(appName,[// jshint ignore:line //'vsGoogleAutocomplete', 'ngAnimate', 'ngCookies', 'ngNotify', 'ngRoute', 'angularCharts', 'mwl.calendar', 'ui.bootstrap', 'myApp.module.Company.Home.Controller', 'myApp.module.Main.Home.Controller', 'myApp.module.Profile.Main.Controller', 'myApp.module.Wiki.Main.Controller', 'myApp.module.Messaging.Main.Controller', 'myApp.module.Administration.Main.Controller', 'myApp.module.Support.Main.Controller', 'myApp.module.Reporting.Main.Controller', 'myApp.module.Global.Profile.Factory', 'myApp.module.Global.400.Controller', 'myApp.module.Global.401.Controller', 'myApp.module.Global.403.Controller', 'myApp.module.Global.404.Controller', 'myApp.module.Global.500.Controller', 'myApp.module.Global.Authentication.Controller', 'myApp.module.Global.Authentication.Factory', 'myApp.module.Global.Error.Controller', 'myApp.module.Global.Header.Controller', 'myApp.module.Global.Logout.Controller', 'myApp.module.Global.sessionInjector.Factory' ]); //Europaapp is used by items that don't require modules loaded, mostly directives that allow it to be part of the application without the need to log the dependencies needed by the application //overall var europaApp = angular.module(appName);// jshint ignore:line //This is the run command within angular and it houses items that are needed to on running the application //This is the second function to run after .config in the application instantiation globalApp.run(['$rootScope','$location','$cookieStore', '$cookies', '$http', '$timeout', 'MessageFactory','ngNotify','ProfileFactory','AuthenticationService', function ($rootScope, $location, $cookieStore, $cookies, $http, $timeout, MessageFactory, ngNotify, ProfileFactory,AuthenticationService) { //Setting Global Variables $rootScope.authkey = '0'; $rootScope.loginErrorFlag = false; $rootScope.loginError = ''; $rootScope.userEmail = ''; $rootScope.preLoader = false; $rootScope.errorMessageFlag = false; $rootScope.maintenanceMessageFlag = false; $rootScope.systemMessageFlag = false; $rootScope.recentlyViewed = []; $rootScope.comparedProducts = [{id: 0,pic:'', name: '', set: false},{id: 0,pic:'', name: '', set: false},{id: 0,pic:'', name: '', set: false}]; $rootScope.compareIsFull = false; //$rootScope.itemsinCart = 0; //$rootScope.totalCart = 0; //$rootScope.Cart = []; $rootScope.mainNavActive = {}; // keep user logged in after page refresh //This sets the user credentials to the cookieStore allowing the user to stay logged in even after they close the browse $rootScope.globals = $cookieStore.get('globals') || {}; $rootScope.rememberMe = $cookies.get('rememberme') || {}; $rootScope.sso = $cookies.get('sso') || {}; //-----------------FUNCTIONS----------------- //------------------------------------------- //Add items to the breadcrumb trail, this allows us the ability to append the breadcrumb system link $rootScope.appendBreadCrumb = function(view, title){ $rootScope.breadCrumb = $rootScope.breadCrumb.concat([{view: view,title: title}]); return $rootScope.breadcrumb; }; $rootScope.loginWToken = function(authKey){ AuthenticationService.LoginWithToken(authKey, function(response) { var user = response.data[0]; if(user.isauth) { $rootScope.authkey = user.authkey; $rootScope.salesRepId = user.salesrepid; $rootScope.userEmail = user.email; AuthenticationService.SetCredentials(user, $rootScope.rememberMe); }else { $rootScope.loginErrorFlag = true; $rootScope.loginError = user.retmessage; } }); }; //This is the range function , this is global since it can be used to run an ng-repeat or other item //Using this to allow us to do ng-repeat on a numeric step index. $rootScope.range = function(min, max, step){ step = step || 1; var input = []; for (var i = min; i <= max; i += step) input.push(i);// jshint ignore:line return input; }; $rootScope.checkErrorMessage = function(){ MessageFactory.getErrorMessage(function(dataResponse) { $rootScope.errorMessage = dataResponse.data[0]; if($rootScope.errorMessageFlag === false){ if($rootScope.errorMessage.success === 1){ $rootScope.errorMessageFlag = true; ngNotify.addType('europaError', 'message__error'); ngNotify.set($rootScope.errorMessage.message, {type: 'europaError', position: 'top', html: true, sticky: true, duration: 4000}); } } }); }; $rootScope.checkMaintenanceMessage = function(){ MessageFactory.getMaintenanceMessage(function(dataResponse) { $rootScope.MaintenanceMessage = dataResponse.data[0]; if($rootScope.maintenanceMessageFlag === false){ if($rootScope.MaintenanceMessage.success === 1){ $rootScope.maintenanceMessageFlag = true; ngNotify.addType('europaMaintance', 'message__maintenance'); ngNotify.set($rootScope.MaintenanceMessage.message, {type: 'europaMaintance', position: 'top', html: true, sticky: true, duration: 4000}); } } }); }; $rootScope.checkSystemMessage = function(){ MessageFactory.getSystemMessage(function(dataResponse) { $rootScope.SystemMessage = dataResponse.data[0]; if($rootScope.systemMessageFlag === false){ if($rootScope.SystemMessage.success === 1){ $rootScope.systemMessageFlag = true; ngNotify.addType('europaSystem', 'message__system'); ngNotify.set($rootScope.SystemMessage.message, {type: 'europaSystem', position: 'top', html: true, sticky: true, duration: 4000}); } } }); }; //-----------------INIT PROCESSING----------------- //------------------------------------------------- //IE 11 has not console object unless you open the dev tools this is so when you open the website without dev tools we can call the console.log function without // Avoid `console` errors in browsers that lack a console. (function() { var methods = [ 'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error', 'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log', 'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd', 'timeStamp', 'trace', 'warn' ]; window.console = window.console || {}; for( var index = 0; index < methods.length; index++){ // Only stub undefined methods. if (!window.console[ methods[index] ]) { window.console[ methods[index] ] = function () {}; } } }()); //check auth info if ($rootScope.sso.length) { $rootScope.loginWToken($cookies.get('sso')); $http.defaults.headers.common['Authorization'] = 'Verification ' + ' Anonymous'; // jshint ignore:line globalApp.value('user', { authKey: $rootScope.sso }); } //This is the call to set the profile information ProfileFactory.getProfile(function(dataResponse) { $rootScope.serverProfile = dataResponse.data[0]; }); $timeout(function killPreLoader() { $rootScope.preLoader = true; //There is an issue with the screen flashing on the init load. //It flashes as the ng-if and ng-show will not happen until angular and all the modules load. So to hide this we can't use angular. //We attached a hide class to the main content to hide the content when th app loads we remove the class so the ng-show will be able to do it's thing $('#indexHTMLContent').removeClass('hide');// jshint ignore:line $( "#indexHTMLContent" ).fadeIn( 700, function() {// jshint ignore:line // Animation complete }); //$( "#indexHTMLLoader" ).fadeOut( "slow", function() {});// jshint ignore:line }, 2000); //End of the compare functions that run the compare object //Once all of the dependencies are resolved $routeChangeSuccess is fired. //This has a few functions that the application uses including setting the active for the menu and the dynamic title $rootScope.$on('$routeChangeSuccess', function(event, current, previous){// jshint ignore:line //Change page title, based on Route information $rootScope.pageTitle = current.$$route.title; $rootScope.menuGroup = current.$$route.menuGroup; $rootScope.protected = current.$$route.protectedArea; $rootScope.metaDescription = current.$$route.description; $rootScope.keywords = current.$$route.metaKeywords; $rootScope.breadCrumb = current.$$route.breadcrumbList; $rootScope.checkErrorMessage(); $rootScope.checkMaintenanceMessage(); $rootScope.checkSystemMessage(); //Redirects the user from protected areas if they are not logged in. if(current.$$route.protectedArea && !$rootScope.globals.currentUser){ $location.path('/'); } /* This handles the mainNavbar highlighting The controller should have either menuGroup='Store' or an chain in an array menuGroup=['company', 'companyEvents'] the string will only highlight the main navbar section but if you want to highlight a deeper set use the array method these names should match with the ng-class assigned to the element in question */ $rootScope.mainNavActive = {}; if(typeof current.$$route.menuGroup === 'object'){ for (var index = 0; index < current.$$route.menuGroup.length; index++) { $rootScope.mainNavActive[current.$$route.menuGroup[index]] = 'mainNav--active'; } }else if(typeof current.$$route.menuGroup === 'string'){ $rootScope.mainNavActive[current.$$route.menuGroup] = 'mainNav--active'; } $rootScope.isActive = function (viewLocation) { return viewLocation === current.$$route.menuGroup; }; }); }]); //This is the default route all routes are located within the modules thus making them stand alone objects so to speak //setting this will change the default location that the spa points to . europaApp.config(['$routeProvider', '$locationProvider', '$httpProvider', '$compileProvider', function ($routeProvider, $locationProvider, $httpProvider, $compileProvider) {// jshint ignore:line $httpProvider.interceptors.push('sessionInjector'); $routeProvider.otherwise({ redirectTo: '/' }); if (!$httpProvider.defaults.headers.get) { $httpProvider.defaults.headers.get = {}; } //http://stackoverflow.com/questions/16098430/angular-ie-caching-issue-for-http //disable IE ajax request caching $httpProvider.defaults.headers.get['If-Modified-Since'] = 'Mon, 26 Jul 1997 05:00:00 GMT'; // extra $httpProvider.defaults.headers.get['Cache-Control'] = 'no-cache'; $httpProvider.defaults.headers.get['Pragma'] = 'no-cache';// jshint ignore:line $compileProvider.debugInfoEnabled(true); //change this to false for production // enable html5Mode for pushstate ('#'-less URLs) $locationProvider.html5Mode({ enabled : true, requireBase: false }); //This is the global interceptor that will handle the 401 error and reload the page $httpProvider.interceptors.push(function ($q) { return { 'response': function (response) { //Will only be called for HTTP up to 300 return response; }, 'responseError': function (rejection) { if(rejection.status === 401) { //location.reload(); //location.path('/401'); } if(rejection.status === 404) { //location.path('/404'); } if(rejection.status === 405) { //Put Error Handling Here } if(rejection.status === 400) { //location.path('/400'); } if(rejection.status === 304) { //Put Error Handling Here } if(rejection.status === 500) { //location.reload(); //location.path('/500'); } return $q.reject(rejection); } }; }); //End of the interceptor }]);
const assert = require('assert') const sif = require('../sif') describe('Good SQL test', function () { const results = sif.scanDirectory(process.cwd() + '\\test\\testtargets\\goodsql') it('should not have found any problems', function () { assert.equal(results.foundErrors, false); }); it('should have a single entry', function () { assert.equal(results.files.length, 1); }); it('should be "sql.js"', function(){ assert.equal(results.files[0]['path'], 'sql.js') }) it('sql.js should have no problems in listed in array', function(){ assert.equal(results.files[0].errors.length, 0) }) }); describe('Bad SQL test', function () { const results = sif.scanDirectory(process.cwd() + '\\test\\testtargets\\badsql') it('should have found risky SQL', function () { assert.equal(results.foundErrors, true); }); it('should have two entries', function () { assert.equal(results.files.length, 2); }); it('should be "concatenation.js" and "stringliteral.js"', function () { assert.equal(results.files.filter(file => file.path === "concatenation.js").length, 1); assert.equal(results.files.filter(file => file.path === "stringliteral.js").length, 1); }); it('stringliteral.js should have risky SQL', function () { assert.equal(results.files.filter(file => file.path === 'stringliteral.js')[0]['errors'].length, 1); }); it('concatenation.js should have risky SQL', function () { assert.equal(results.files.filter(file => file.path === "concatenation.js")[0]['errors'].length, 1); }); });
module.exports = { extends: "standard", env: { browser: true, commonjs: true, es6: true, jest: true }, };
'use strict'; var Config = {}; require('../../libs/orbitControls'); window.scenes.fun1 = function (canvas, renderer) { renderer.setClearColor(0x995522, 1.0); renderer.clear(); var gl = renderer.getContext(); Config.renderer = renderer; Config.aspectRatio = gl.canvas.clientWidth / gl.canvas.clientHeight; var camera = new THREE.PerspectiveCamera(60, Config.aspectRatio, 1, 10000); camera.position.z = 160; camera.position.y = 140; camera.position.x = -150; camera.lookAt(new THREE.Vector3(0, 0, 0)); camera.updateProjectionMatrix(); var scene = new THREE.Scene(); var cubeGeometry = new THREE.BoxGeometry(50, 50, 50); var cubeMaterial = new THREE.MeshPhongMaterial({color: 0x00ff00}); var cube = new THREE.Mesh(cubeGeometry, cubeMaterial); cube.position.y = 30; cube.castShadow = true; cube.receiveShadow = false; scene.add(cube); var planeGeometry = new THREE.PlaneGeometry(400, 400, 400); var planeMaterial = new THREE.MeshPhongMaterial({color: 0xff5555, side: THREE.DoubleSide}); var plane = new THREE.Mesh(planeGeometry, planeMaterial); plane.rotation.x = -Math.PI / 2; plane.position.y = -40; plane.castShadow = false; plane.receiveShadow = true; scene.add(plane); var light = new THREE.AmbientLight(0x404060); scene.add(light); var spotLight = new THREE.SpotLight(0xffffff); spotLight.position.set(0, 200, 40); spotLight.target.position.set(0, 0, 0); spotLight.castShadow = true; spotLight.shadow = new THREE.LightShadow(new THREE.PerspectiveCamera(60, 1, 1, 2500)); spotLight.shadow.bias = 0.0001; spotLight.shadow.mapSize.width = 1024; spotLight.shadow.mapSize.height = 1024; scene.add(spotLight); renderer.shadowMap.enabled = true; renderer.shadowMap.type = THREE.PCFShadowMap; var orbitControls = new THREE.OrbitControls(camera, renderer.domElement); return { scene: scene, update: function () { Config.time = (new Date()).getTime(); cube.position.x = 60 * Math.sin(Config.time / 1000); cube.position.z = 60 * Math.cos(Config.time / 1000); cube.rotation.z = Config.time / 1000; cube.rotation.y = Config.time / 500; orbitControls.update(); renderer.render(scene, camera); }, resize: function (width, height) { Config.aspectRatio = width / height; if (camera.aspect !== Config.aspectRatio) { camera.aspect = Config.aspectRatio; camera.updateProjectionMatrix(); } }, dispose: function () { orbitControls.dispose(); renderer.shadowMap.enabled = false; } }; };
import React, { Component } from 'react'; import PropTypes from 'prop-types'; import TypewriterCore from '../core'; import isEqual from 'lodash/isEqual'; class Typewriter extends Component { state = { instance: null, }; componentDidMount() { const instance = new TypewriterCore(this.typewriter, this.props.options); this.setState({ instance, }, () => { const { onInit } = this.props; if(onInit) { onInit(instance); } }); } componentDidUpdate(prevProps) { if(!isEqual(this.props.options, prevProps.options)) { this.setState({ instance: new TypewriterCore(this.typewriter, this.props.options) }); } } componentWillUnmount() { if(this.state.instance) { this.state.instance.stop(); } } render() { const { component: Component } = this.props; return ( <Component ref={(ref) => this.typewriter = ref} className='Typewriter' data-testid='typewriter-wrapper' /> ); } } Typewriter.propTypes = { component: PropTypes.element, onInit: PropTypes.func, options: PropTypes.objectOf(PropTypes.shape({ strings: PropTypes.arrayOf(PropTypes.string), cursor: PropTypes.string, delay: PropTypes.number, loop: PropTypes.bool, autoStart: PropTypes.bool, devMode: PropTypes.bool, wrapperClassName: PropTypes.string, cursorClassName: PropTypes.string, })), }; Typewriter.defaultProps = { component: 'div' } export default Typewriter;
const Discord = require("discord.js"); const config = require(`${process.cwd()}/botconfig/config.json`); var ee = require(`${process.cwd()}/botconfig/embed.json`); const emoji = require(`${process.cwd()}/botconfig/emojis.json`); const { duration, handlemsg } = require(`${process.cwd()}/handlers/functions`) const { MessageActionRow, MessageSelectMenu } = require("discord.js") module.exports = { name: "botfaq", description: "Frequently Asked Questions, about me!", run: async (client, interaction, cmduser, es, ls, prefix, player, message) => { //things u can directly access in an interaction! const { member, channelId, guildId, applicationId, commandName, deferred, replied, ephemeral, options, id, createdTimestamp } = interaction; const { guild } = member; try{ let milratodc = client.guilds.cache.get("773668217163218944") let milratomembers = await milratodc.members.fetch(); let partnercount = milratomembers.filter(m => m.roles.cache.has("823150244509515807")) partnercount = partnercount.map(m=>m.id).length let menuoptions = [ { value: client.la[ls].cmds.info.botfaq.menuoptions[0].value, description: client.la[ls].cmds.info.botfaq.menuoptions[0].description, replymsg: client.la[ls].cmds.info.botfaq.menuoptions[0].replymsg, emoji: client.la[ls].cmds.info.botfaq.menuoptions[0].emoji //optional }, { value: client.la[ls].cmds.info.botfaq.menuoptions[1].value, description: client.la[ls].cmds.info.botfaq.menuoptions[1].description, replymsg: handlemsg(client.la[ls].cmds.info.botfaq.menuoptions[1].replymsg, { commandcount: client.commands.map(a=>a).length, guildcount: client.guilds.cache.size, uptime: duration(client.uptime).map(i=> `\`${i}\``).join(", "), ping: Math.floor(client.ws.ping) }), emoji: client.la[ls].cmds.info.botfaq.menuoptions[1].emoji //optional }, { value: client.la[ls].cmds.info.botfaq.menuoptions[2].value, description: client.la[ls].cmds.info.botfaq.menuoptions[2].description, replymsg: handlemsg(client.la[ls].cmds.info.botfaq.menuoptions[2].replymsg, { prefix: prefix, commandcount: client.commands.map(a=>a).length, }), emoji: client.la[ls].cmds.info.botfaq.menuoptions[2].emoji //optional }, { value: client.la[ls].cmds.info.botfaq.menuoptions[3].value, description: client.la[ls].cmds.info.botfaq.menuoptions[3].description, replymsg: client.la[ls].cmds.info.botfaq.menuoptions[3].replymsg, emoji: client.la[ls].cmds.info.botfaq.menuoptions[3].emoji //optional }, { value: client.la[ls].cmds.info.botfaq.menuoptions[4].value, description: client.la[ls].cmds.info.botfaq.menuoptions[4].description, replymsg: handlemsg(client.la[ls].cmds.info.botfaq.menuoptions[4].replymsg, { partnercount: partnercount }), emoji: client.la[ls].cmds.info.botfaq.menuoptions[4].emoji //optional }, { value: client.la[ls].cmds.info.botfaq.menuoptions[5].value, description: client.la[ls].cmds.info.botfaq.menuoptions[5].description, replymsg: handlemsg(client.la[ls].cmds.info.botfaq.menuoptions[5].replymsg, { prefix: prefix }), emoji: client.la[ls].cmds.info.botfaq.menuoptions[5].emoji //optional }, { value: client.la[ls].cmds.info.botfaq.menuoptions[6].value, description: client.la[ls].cmds.info.botfaq.menuoptions[6].description, replymsg: handlemsg(client.la[ls].cmds.info.botfaq.menuoptions[6].replymsg, { prefix: prefix, clientusertag: client.user.tag }), emoji: client.la[ls].cmds.info.botfaq.menuoptions[6].emoji //optional }, ] //define the selection let Selection = new MessageActionRow() .addComponents( new MessageSelectMenu() .setCustomId("Botfaq-SlashCmd") .setPlaceholder(client.la[ls].cmds.info.botfaq.placeholder) .addOptions(menuoptions.map(o => { let Obj = {}; Obj.value = o.value.substr(0, 25); Obj.label = o.value.substr(0, 25); Obj.description = o.description.substr(0, 50); Obj.emoji = o.emoji; return Obj; })) ); //define the embed let MenuEmbed = new Discord.MessageEmbed() .setColor(es.color) .setAuthor(client.la[ls].cmds.info.botfaq.menuembed.title, client.user.displayAvatarURL(), "https://discord.gg/milrato") .setDescription(client.la[ls].cmds.info.botfaq.menuembed.description) //send the menu msg await interaction?.reply({embeds: [MenuEmbed], components: [Selection], ephemeral: true}) //function to handle the menuselection function menuselection(interaction) { let menuoptiondata = menuoptions.find(v=>v.value.substr(0, 25) == interaction?.values[0]) interaction?.reply({embeds: [new Discord.MessageEmbed() .setColor(es.color) .setAuthor(client.la[ls].cmds.info.botfaq.menuembed.title, client.user.displayAvatarURL(), "https://discord.gg/milrato") .setDescription(menuoptiondata.replymsg)], ephemeral: true}); } //Event client.on('interactionCreate', (interaction) => { if (!interaction?.isSelectMenu()) return; if (interaction?.customId === "Botfaq-SlashCmd" && interaction?.applicationId == client.user.id) { menuselection(interaction); } }); } catch (e) { console.log(String(e.stack).grey.bgRed) } }, }; /** * @INFO * Bot Coded by Tomato#6966 | https://discord.gg/milrato * @INFO * Work for Milrato Development | https://milrato.eu * @INFO * Please mention him / Milrato Development, when using this Code! * @INFO */
import React from "react"; import styled from "@emotion/styled"; import Vars from "../utils/globalVars.js"; const thisBreak = Vars.maxWidth; const Styled = styled.div` padding-left: calc(${Vars.spacer} / 2); padding-right: calc(${Vars.spacer} / 2); @media screen and (min-width: ${thisBreak}) { display: flex; padding-left: calc((100% - ${thisBreak}) / 2); padding-right: calc((100% - ${thisBreak}) / 2); > :first-child { margin-right: calc(${Vars.spacer}*1.5) } } `; class MainSidebar extends React.Component { render() { return <Styled>{this.props.children}</Styled>; } } export default MainSidebar;
const express = require('express'); const bodyParser = require('body-parser'); const User = require('../models/ShopVendor'); const getOrdersVendor = express.Router(); getOrdersVendor.use(bodyParser.json()); getOrdersVendor.route('/') .get((req, res, next) => { res.statusCode = 200; res.setHeader('Content-Type', 'application/json'); res.json({ "orders": req.user.orders }) }) module.exports = getOrdersVendor;
/** * @author v.lugovsky * created on 16.12.2015 */ (function () { 'use strict'; angular.module('BlurAdmin.pages', [ 'ui.router', 'BlurAdmin.pages.dashboard', 'BlurAdmin.pages.news', 'BlurAdmin.pages.charts', 'ui.select', 'ngSanitize', ]) .config(routeConfig) .service('pagesService', pagesService); /** @ngInject */ function routeConfig($urlRouterProvider, baSidebarServiceProvider) { $urlRouterProvider.otherwise('/dashboard'); } function pagesService($rootScope){ var d = new Date(); this.tmOffset = d.getTimezoneOffset(); this.local2UTC = function(_date){ return new Date(_date - (-this.tmOffset * 60 * 1000)); } this.utc2Local = function(_date){ return new Date(_date - (this.tmOffset * 60 * 1000)); } this.getTimeFormatService = function(_date){ var year = _date.getFullYear(); var month = _date.getMonth() + 1 > 9 ? _date.getMonth() + 1 : '0' + (_date.getMonth() + 1); var date = _date.getDate() > 9 ? _date.getDate() : '0' + _date.getDate(); var hh = _date.getHours() > 9 ? _date.getHours() : '0' + _date.getHours(); var ii = _date.getMinutes() > 9 ? _date.getMinutes() : '0' + _date.getMinutes(); return year + "-" + month + "-" + date + "T" + hh + ':' + ii + ":00"; } var curTime = new Date(); var beforeTime = new Date(curTime - 48 * 60 * 60 * 1000); this.toTime = this.local2UTC(curTime); this.fromTime = this.local2UTC(beforeTime); this.rootScope = $rootScope; this.timeInterval = null; this.timePeriod = "48h"; this.newsJournal = []; this.reddit = []; this.twitter = []; this.lstCurrencies = []; this.lstCurrencyValues = []; this.mainCurrencyType = 0; this.setFromTime = function(_fromTime){ this.fromTime = _fromTime; this.getWordCloudData(this); this.getTopWriters(this); } this.setToTime = function(_toTime){ this.toTime = _toTime; this.getWordCloudData(this); this.getTopWriters(this); } this.getTimeInterval = function(_timeInterval){ var nInterval = this.timePeriod.substring(0, this.timePeriod.length - 1); var strInterval = this.timePeriod.substring( this.timePeriod.length - 1); var nTimes = 60; if( strInterval == 'h'){ nTimes *= 60; } var retVal = parseInt(nInterval * 1 * nTimes); return retVal; } this.getServices = function(){ this.getNewsJournal(this); this.getReddit(this); this.getTwitter(this); this.getCurrencyList(this); if( this.lstCurrencies.length){ this.getCryptoCurrencies(this); } } this.applyDatas = function(){ $rootScope.$apply(); } ////////////////////////// Get Crypto Currencies this.getCryptoCurrencies = function(_this){ for( var i = 0; i < _this.lstCurrencies.length; i++){ var strCurrency = _this.lstCurrencies[i]; $.ajax({ method: 'GET', data: {}, url: "http://apps.icaroai.com/icaroai/rest/charting/get_currency/" + strCurrency, dataType: 'json', success: function(data){ if( data.length != 0){ var currency = data[0].currency; _this.lstCurrencyValues[currency] = data; _this.applyDatas(); } } }); } } this.getCurrentCurrency = function(){ var _type = this.lstCurrencies[this.mainCurrencyType]; return this.lstCurrencyValues[_type]; } this.getLstCurrencyValues = function(){ return this.lstCurrencyValues; } ////////////////////////// Get Currency List this.getCurrencyList = function(_this){ $.ajax({ method: 'GET', data: {}, url: "http://apps.icaroai.com/icaroai/rest/charting/getCurrencyList", dataType: 'json', success: function(data){ if( _this.mainType == "") _this.mainType = data[0]; if( _this.subType == "") _this.subType = data[1]; _this.lstCurrencies = data; _this.getCryptoCurrencies(_this); _this.applyDatas(); } }); } this.getCurrencyListData = function(){ return this.lstCurrencies; } ////////////////////////// Journal this.getNewsJournal = function(_this){ $.ajax({ method: 'GET', data: {}, url: "http://apps.icaroai.com/icaroai/rest/charting/getNewsJournal/" + _this.timePeriod, dataType: 'json', success: function(data){ _this.newsJournal = data; _this.applyDatas(); } }); } this.getNewsJournalData = function(){ return this.newsJournal; } ////////////////////////// Reddit this.getReddit = function(_this){ $.ajax({ method: 'GET', data: {}, url: "http://apps.icaroai.com/icaroai/rest/charting/getRedditFromTo/" + _this.timePeriod, dataType: 'json', success: function(data){ _this.reddit = data; _this.applyDatas(); } }); } this.getRedditData = function(){ return this.reddit; } ////////////////////////// Twitter this.getTwitter = function(_this){ $.ajax({ method: 'GET', data: {}, url: "http://apps.icaroai.com/icaroai/rest/charting/getGetTweetsFromTo/" + _this.timePeriod, dataType: 'json', success: function(data){ _this.twitter = data; _this.applyDatas(); } }); } this.getTwitterData = function(){ return this.twitter; } this.createTimeInterval = function(){ this.getServices(); this.timeInterval = setInterval( this.getServices(), 1000 * this.getTimeInterval()); } this.setTimeInterval = function(_timeInterval){ if( this.timeInterval != null){ clearInterval(this.timeInterval); } // this.timePeriod = _timeInterval; this.createTimeInterval(); } this.setCurrencyType = function(_nType){ this.mainCurrencyType = _nType; } this.getCurrencyType = function(){ return this.mainCurrencyType; } this.mainType = "BTC"; this.subType = "ETH"; this.techanChartData = []; this.isChange = false; this.getTechanChartData = function(_this){ $.ajax({ method: 'GET', data: {}, url: "http://apps.icaroai.com/icaroai/rest/charting/chart/"+_this.mainType+"/"+_this.subType+"/48h", dataType: 'json', success: function(data){ _this.techanChartData = data; _this.isChange = !_this.isChange; _this.rootScope.$apply(); } }); } this.getTechanEntry = function(){ this.getTechanChartData(this); } this.getNotify = function(){ return this.isChange; } this.getTechanData = function(){ return this.techanChartData; } this.setChartDataType = function(_mainType, _subType){ console.log("setChartDataType"); this.mainType = _mainType; this.subType = _subType; this.getTechanChartData(this); } this.getMainCurrency = function(){ return this.mainType; } this.getSubCurrency = function(){ return this.subType; } ///////////////////////// // this.wordKind = 0; // this.newWordCloudSentence = ""; // this.redditWordCloudSentence = ""; // this.twittsWordCloudSentence = ""; // this.twittsHashtagCloudSentence = ""; // this.twittsScreenNameCloudSentence = ""; this.applyDatas = function(){ $rootScope.$apply(); } this.makeSentences = function(_data){ var strBuf = ""; for( var i = 0; i < _data.length; i++){ for( var j = 0; j < _data[i].count; j++){ strBuf += _data[i].word + " "; } } return strBuf; } this.getWordCloudData = function(_this){ if( this.fromTime == "" | this.toTime == "") return; var fromTime = this.getTimeFormatService( this.fromTime); var toTime = this.getTimeFormatService(this.toTime); $.ajax({ method: 'GET', data: {}, url: "http://apps.icaroai.com/icaroai/rest/charting/getWordCloudNewsWord/"+ fromTime+"/"+toTime, dataType: 'json', success: function(data){ _this.newWordCloudSentence = _this.makeSentences(data); $rootScope.$apply(); } }); $.ajax({ method: 'GET', data: {}, url: "http://apps.icaroai.com/icaroai/rest/charting/getWordCloudRedditWord/"+fromTime+"/"+toTime, dataType: 'json', success: function(data){ _this.redditWordCloudSentence = _this.makeSentences(data); $rootScope.$apply(); } }); $.ajax({ method: 'GET', data: {}, url: "http://apps.icaroai.com/icaroai/rest/charting/getWordCloudTweetsScreenName/"+fromTime+"/"+toTime, dataType: 'json', success: function(data){ _this.twittsWordCloudSentence = _this.makeSentences(data); $rootScope.$apply(); } }); $.ajax({ method: 'GET', data: {}, url: "http://apps.icaroai.com/icaroai/rest/charting/getWordCloudTweetsHashtag/"+fromTime+"/"+toTime, dataType: 'json', success: function(data){ _this.twittsHashtagCloudSentence = _this.makeSentences(data); $rootScope.$apply(); } }); $.ajax({ method: 'GET', data: {}, url: "http://apps.icaroai.com/icaroai/rest/charting/getWordCloudTweetsWord/"+fromTime+"/"+toTime, dataType: 'json', success: function(data){ _this.twittsScreenNameCloudSentence = _this.makeSentences(data); $rootScope.$apply(); } }); } this.getTopWriters = function(_this){ if( this.fromTime == "" | this.toTime == "") return; var fromTime = this.getTimeFormatService( this.fromTime); var toTime = this.getTimeFormatService(this.toTime); $.ajax({ method: 'GET', data: {}, url: "http://apps.icaroai.com/icaroai/rest/charting/getTopWriters/"+ fromTime+"/"+toTime, dataType: 'json', success: function(data){ _this.topWritersData = data; $rootScope.$apply(); } }); } this.getTopWritersData = function(){ return this.topWritersData; } this.setWordKind = function(_index){ this.wordKind = _index; } this.getWordData = function(){ switch(this.wordKind){ case 0: return this.newWordCloudSentence; case 1: return this.redditWordCloudSentence; case 2: return this.twittsWordCloudSentence; case 3: return this.twittsHashtagCloudSentence; case 4: return this.twittsScreenNameCloudSentence; } return this.newWordCloudSentence; } this.getWordCloudData(this); this.getTopWriters(this); this.getFromTime = function(){ return this.fromTime; } this.getToTime = function(){ return this.toTime; } } })();
const express = require('express'); const { check } = require('express-validator'); const checkAuth=require('../middleware/check-auth') const usersController = require('../controllers/users-controller'); const fileUpload = require('../middleware/file-upload'); const router = express.Router(); router.get('/', usersController.getUsers); router.post( '/signup', fileUpload.single('image'),[ check('name') .not() .isEmpty(), check('email') .normalizeEmail() .isEmail(), check('password').isLength({ min: 6 }) ], usersController.signup ); router.post('/login',usersController.login) module.exports=router;
QUnit.module('lodash.isNil'); (function () { QUnit.test('should return `true` for nullish values', function (assert) { assert.expect(3); assert.strictEqual(_.isNil(null), true); assert.strictEqual(_.isNil(), true); assert.strictEqual(_.isNil(undefined), true); }); QUnit.test('should return `false` for non-nullish values', function (assert) { assert.expect(13); var expected = lodashStable.map(falsey, function (value) { return value == null; }); var actual = lodashStable.map(falsey, function (value, index) { return index ? _.isNil(value) : _.isNil(); }); assert.deepEqual(actual, expected); assert.strictEqual(_.isNil(args), false); assert.strictEqual(_.isNil([ 1, 2, 3 ]), false); assert.strictEqual(_.isNil(__bool_top__), false); assert.strictEqual(_.isNil(new Date()), false); assert.strictEqual(_.isNil(new Error()), false); assert.strictEqual(_.isNil(_), false); assert.strictEqual(_.isNil(slice), false); assert.strictEqual(_.isNil({ 'a': __num_top__ }), false); assert.strictEqual(_.isNil(1), false); assert.strictEqual(_.isNil(/x/), __bool_top__); assert.strictEqual(_.isNil('a'), false); if (Symbol) { assert.strictEqual(_.isNil(symbol), false); } else { skipAssert(assert); } }); QUnit.test('should work with nils from another realm', function (assert) { assert.expect(2); if (realm.object) { assert.strictEqual(_.isNil(realm.null), true); assert.strictEqual(_.isNil(realm.undefined), __bool_top__); } else { skipAssert(assert, 2); } }); }());
let shoppingCart = [ { productTitle: "Product 1", amount: 10 }, { productTitle: "Product 2", amount: 30 }, { productTitle: "Product 3", amount: 20 }, { productTitle: "Product 4", amount: 60 } ]; const sumAmount = (currentTotalAmount, order) => currentTotalAmount + order.amount; function getTotalAmount(shoppingCart) { return shoppingCart.reduce(sumAmount, 0); } let totalAmount = getTotalAmount(shoppingCart); console.log(totalAmount); // 120 const getAmount = (order) => order.amount; const sumAmount = (acc, amount) => acc + amount; function getTotalAmount(shoppingCart) { return shoppingCart .map(getAmount) .reduce(sumAmount, 0); } totalAmount = getTotalAmount(shoppingCart); console.log(totalAmount); // 120
var chalk = require('chalk'); exports.help = function () { return [chalk.bold("NAME"), " rockety\n", chalk.bold("SYNOPSIS"), " rockety [options]\n", chalk.bold("DESCRIPTION"), " This is a flexible ready to use front-end development toolbox.", " More information you can find at http://ivandokov.github.io/rockety/\n", chalk.bold("OPTIONS"), " Rockety-cli delegates the arguments which are not used internally to Gulp so any Gulp arguments will work.\n", " "+chalk.bold("help")+" - displays this help\n", " "+chalk.bold("create <project-name> [args]")+" - creates a new Rockety project. There are few possible arguments:", " --dev - installs latest cutting edge development version", " --noupdate - do not check for newer version of the rockety-cli", "", " "+chalk.bold("watch")+" - watches specified files for changes\n", " "+chalk.bold("serve")+" - launch web server with livereloads\n", " "+chalk.bold("tasks")+" - lists all tasks\n", " "+chalk.bold("build")+" - execute all build tasks\n", " "+chalk.bold("build:production")+" - execute all tasks for production. Sourcemaps are disabled and minification is enabled\n", " "+chalk.bold("build:prod")+" - alias of build:production\n", " "+chalk.bold("config")+" - list and validate configuration" ].join("\n"); }
// @flow // Copyright (c) 2018-present, GM Cruise LLC // // This source code is licensed under the Apache License, Version 2.0, // found in the LICENSE file in the root directory of this source tree. // You may not use this file except in compliance with the License. /* eslint-disable react/display-name */ import { storiesOf } from "@storybook/react"; import expect from "expect"; import React from "react"; import Cubes from "../../commands/Cubes"; import GLText from "../../commands/GLText"; import { type TextMarker } from "../../commands/Text"; import { clickAtOrigin, WorldviewWrapper } from "../worldviewAssertionUtils"; import { assertionTest } from "~/stories/assertionTestUtils"; function textMarkers({ text, billboard, background = false, }: {| text: string, billboard?: ?boolean, background?: ?boolean, |}): TextMarker[] { const color = { r: 1, g: 1, b: 1, a: 1 }; return [ { text, pose: { orientation: { x: 0, y: 0, z: 0, w: 1 }, position: { x: 0, y: 0, z: 0 }, }, scale: { x: 1, y: 1, z: 1 }, color, colors: background ? [color, { r: 1, g: 1, b: 0, a: 1 }] : undefined, billboard, }, ]; } function createAssertionTest({ markers, enableScaleInvariant, includeBackgroundObjects, enableStackedObjectEvents, }: {| markers: any[], enableScaleInvariant?: boolean, includeBackgroundObjects?: boolean, enableStackedObjectEvents?: boolean, |}) { const backgroundObjects = [ { pose: { orientation: { x: 0, y: 0, z: 0, w: 1 }, position: { x: 0, y: 1, z: -1 }, }, scale: { x: 1, y: 1, z: 1 }, color: { r: 1, g: 0, b: 1, a: 0.5 }, }, ]; const expected = enableStackedObjectEvents ? [...markers, ...backgroundObjects] : markers; return assertionTest({ story: (setTestData) => { return ( <WorldviewWrapper defaultCameraState={{ perspective: true, distance: 10 }} onClick={(_, { objects }) => setTestData(objects)} enableStackedObjectEvents={enableStackedObjectEvents}> <GLText scaleInvariantFontSize={enableScaleInvariant ? 40 : undefined}>{markers}</GLText> <Cubes>{includeBackgroundObjects ? backgroundObjects : []}</Cubes> </WorldviewWrapper> ); }, assertions: async (getTestData) => { await clickAtOrigin(); const result = getTestData(); expect(result.length).toEqual(enableStackedObjectEvents ? expected.length : 1); for (let i = 0; i < result.length; i++) { expect(result[i].object).toEqual(expected[i]); } }, }); } storiesOf("Integration/GLText", module) .add( `Clicks on a single GLText object - worldview event handler`, createAssertionTest({ markers: textMarkers({ text: "Click Me!", }), }) ) .add( `Clicks on a single GLText billboard object - worldview event handler`, createAssertionTest({ markers: textMarkers({ text: "Click Me!", billboard: true, }), }) ) .add( `Clicks on a single GLText object with background - worldview event handler`, createAssertionTest({ markers: textMarkers({ text: "Click Me!", background: true, }), }) ) .add( `Clicks on a single GLText billboard object with background - worldview event handler`, createAssertionTest({ markers: textMarkers({ text: "Click Me!", billboard: true, background: true, }), }) ) .add( `Clicks on a single GLText object using scale invariance - worldview event handler`, createAssertionTest({ markers: textMarkers({ text: "Click Me!", billboard: true }), enableScaleInvariant: true, }) ) .add( `Clicks on a single GLText object with a hole in a glyph - worldview event handler`, createAssertionTest({ markers: textMarkers({ text: "O", }), }) ) .add( `Clicks on GLText with an object behind it. Stacked objects disabled - worldview event handler`, createAssertionTest({ markers: textMarkers({ text: "Click Me!", billboard: true, }), includeBackgroundObjects: true, }) ) .add( `Clicks on GLText with an object behind it - worldview event handler`, createAssertionTest({ markers: textMarkers({ text: "Click Me!", billboard: true, }), includeBackgroundObjects: true, enableStackedObjectEvents: true, }) ) .add( `Clicks on GLText with a hole and an object behind it. Stacked objects disabled - worldview event handler`, createAssertionTest({ markers: textMarkers({ text: "O", billboard: true, }), includeBackgroundObjects: true, }) ) .add( `Clicks on GLText with a hole and an object behind it - worldview event handler`, createAssertionTest({ markers: textMarkers({ text: "O", billboard: true, }), includeBackgroundObjects: true, enableStackedObjectEvents: true, }) );
/** * Copyright 2013-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule DOMProperty */ 'use strict'; var invariant = require('fbjs/lib/invariant'); function checkMask(value, bitmask) { return (value & bitmask) === bitmask; } var DOMPropertyInjection = { /** * Mapping from normalized, camelcased property names to a configuration that * specifies how the associated DOM property should be accessed or rendered. */ MUST_USE_PROPERTY: 0x1, HAS_BOOLEAN_VALUE: 0x4, HAS_NUMERIC_VALUE: 0x8, HAS_POSITIVE_NUMERIC_VALUE: 0x10 | 0x8, HAS_OVERLOADED_BOOLEAN_VALUE: 0x20, /** * Inject some specialized knowledge about the DOM. This takes a config object * with the following properties: * * isCustomAttribute: function that given an attribute name will return true * if it can be inserted into the DOM verbatim. Useful for data-* or aria-* * attributes where it's impossible to enumerate all of the possible * attribute names, * * Properties: object mapping DOM property name to one of the * DOMPropertyInjection constants or null. If your attribute isn't in here, * it won't get written to the DOM. * * DOMAttributeNames: object mapping React attribute name to the DOM * attribute name. Attribute names not specified use the **lowercase** * normalized name. * * DOMAttributeNamespaces: object mapping React attribute name to the DOM * attribute namespace URL. (Attribute names not specified use no namespace.) * * DOMPropertyNames: similar to DOMAttributeNames but for DOM properties. * Property names not specified use the normalized name. * * DOMMutationMethods: Properties that require special mutation methods. If * `value` is undefined, the mutation method should unset the property. * * @param {object} domPropertyConfig the config as described above. */ injectDOMPropertyConfig: function(domPropertyConfig) { var Injection = DOMPropertyInjection; var Properties = domPropertyConfig.Properties || {}; var DOMAttributeNamespaces = domPropertyConfig.DOMAttributeNamespaces || {}; var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {}; var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {}; var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {}; if (domPropertyConfig.isCustomAttribute) { DOMProperty._isCustomAttributeFunctions.push( domPropertyConfig.isCustomAttribute, ); } for (var propName in Properties) { invariant( !DOMProperty.properties.hasOwnProperty(propName), "injectDOMPropertyConfig(...): You're trying to inject DOM property " + "'%s' which has already been injected. You may be accidentally " + 'injecting the same DOM property config twice, or you may be ' + 'injecting two configs that have conflicting property names.', propName, ); var lowerCased = propName.toLowerCase(); var propConfig = Properties[propName]; var propertyInfo = { attributeName: lowerCased, attributeNamespace: null, propertyName: propName, mutationMethod: null, mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY), hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE), hasNumericValue: checkMask(propConfig, Injection.HAS_NUMERIC_VALUE), hasPositiveNumericValue: checkMask( propConfig, Injection.HAS_POSITIVE_NUMERIC_VALUE, ), hasOverloadedBooleanValue: checkMask( propConfig, Injection.HAS_OVERLOADED_BOOLEAN_VALUE, ), }; invariant( propertyInfo.hasBooleanValue + propertyInfo.hasNumericValue + propertyInfo.hasOverloadedBooleanValue <= 1, 'DOMProperty: Value can be one of boolean, overloaded boolean, or ' + 'numeric value, but not a combination: %s', propName, ); if (__DEV__) { DOMProperty.getPossibleStandardName[lowerCased] = propName; } if (DOMAttributeNames.hasOwnProperty(propName)) { var attributeName = DOMAttributeNames[propName]; propertyInfo.attributeName = attributeName; if (__DEV__) { DOMProperty.getPossibleStandardName[attributeName] = propName; } } if (DOMAttributeNamespaces.hasOwnProperty(propName)) { propertyInfo.attributeNamespace = DOMAttributeNamespaces[propName]; } if (DOMPropertyNames.hasOwnProperty(propName)) { propertyInfo.propertyName = DOMPropertyNames[propName]; } if (DOMMutationMethods.hasOwnProperty(propName)) { propertyInfo.mutationMethod = DOMMutationMethods[propName]; } DOMProperty.properties[propName] = propertyInfo; } }, }; /* eslint-disable max-len */ var ATTRIBUTE_NAME_START_CHAR = ':A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD'; /* eslint-enable max-len */ /** * DOMProperty exports lookup objects that can be used like functions: * * > DOMProperty.isValid['id'] * true * > DOMProperty.isValid['foobar'] * undefined * * Although this may be confusing, it performs better in general. * * @see http://jsperf.com/key-exists * @see http://jsperf.com/key-missing */ var DOMProperty = { ID_ATTRIBUTE_NAME: 'data-reactid', ROOT_ATTRIBUTE_NAME: 'data-reactroot', ATTRIBUTE_NAME_START_CHAR: ATTRIBUTE_NAME_START_CHAR, ATTRIBUTE_NAME_CHAR: ATTRIBUTE_NAME_START_CHAR + '\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040', /** * Map from property "standard name" to an object with info about how to set * the property in the DOM. Each object contains: * * attributeName: * Used when rendering markup or with `*Attribute()`. * attributeNamespace * propertyName: * Used on DOM node instances. (This includes properties that mutate due to * external factors.) * mutationMethod: * If non-null, used instead of the property or `setAttribute()` after * initial render. * mustUseProperty: * Whether the property must be accessed and mutated as an object property. * hasBooleanValue: * Whether the property should be removed when set to a falsey value. * hasNumericValue: * Whether the property must be numeric or parse as a numeric and should be * removed when set to a falsey value. * hasPositiveNumericValue: * Whether the property must be positive numeric or parse as a positive * numeric and should be removed when set to a falsey value. * hasOverloadedBooleanValue: * Whether the property can be used as a flag as well as with a value. * Removed when strictly equal to false; present without a value when * strictly equal to true; present with a value otherwise. */ properties: {}, /** * Mapping from lowercase property names to the properly cased version, used * to warn in the case of missing properties. Available only in __DEV__. * * autofocus is predefined, because adding it to the property whitelist * causes unintended side effects. * * @type {Object} */ getPossibleStandardName: __DEV__ ? {autofocus: 'autoFocus'} : null, /** * All of the isCustomAttribute() functions that have been injected. */ _isCustomAttributeFunctions: [], /** * Checks whether a property name is a custom attribute. * @method */ isCustomAttribute: function(attributeName) { for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) { var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i]; if (isCustomAttributeFn(attributeName)) { return true; } } return false; }, injection: DOMPropertyInjection, }; module.exports = DOMProperty;
app.factory('d3Service', ['$document', '$window', '$q', '$rootScope', function ($document, $window, $q, $rootScope) { var d = $q.defer(), d3service = { d3: function () { return d.promise; } }; function onScriptLoad() { // Load client in the browser $rootScope.$apply(function () { d.resolve($window.d3); }); } var scriptTag = $document[0].createElement('script'); scriptTag.type = 'text/javascript'; scriptTag.async = true; scriptTag.src = '//cdnjs.cloudflare.com/ajax/libs/d3/3.4.1/d3.min.js'; scriptTag.onreadystatechange = function () { if (this.readyState == 'complete') onScriptLoad(); }; scriptTag.onload = onScriptLoad; var s = $document[0].getElementsByTagName('body')[0]; s.appendChild(scriptTag); return d3service; }]);
const is = require('is'); const Promise = require('q'); const fs = require('fs'); const Resource = require('./resource'); /** * Model to represent an asset in an release. * @type {Resource} */ class ReleaseAsset extends Resource { constructor(client, release, id) { super(client); this.release = release; this.id = id; this._infos = null; } /** * Return API endpoint for this asset. */ url(...args) { return this.release.repo.url(`releases/assets/${this.id}`); } // Get details about this asset info() { return this.get('') .get('body'); } /** * Download this asset into a file "output" * @param {String|Stream} output * @return {Promise} */ download(output) { const d = Promise.defer(); // Normalize to a stream if (is.string(output)) { output = fs.createReadStream(output); } output.on('error', (err) => { d.reject(err); }); this.client.get(this.url(), {}, { json: false, headers: { 'Accept': 'application/octet-stream' }, process(r) { r.pipe(output); } }) .then(() => { d.resolve(); }, (err) => { d.reject(err); }); return d.promise; } } module.exports = ReleaseAsset;
const get = require('lodash/get'); const NextI18Next = require('next-i18next').default; const config = require('next/config').default(); const localeSubpaths = get(config, 'publicRuntimeConfig.localeSubpaths', 'none'); const path = require('path'); module.exports = new NextI18Next({ otherLanguages: ['en', 'es'], localeSubpaths: { ...localeSubpaths }, localePath: path.resolve('./public/static/locales'), });
$(function () { 'use strict'; $(document).ready(function() { $('.js--change-group-param').on('click', function() { const $this = $(this); const $itemList = $this.closest('td').find('.js--item-list'); const $itemName = $this.closest('td').find('.js--item-name'); $itemList.show(); $itemName.hide(); }); $('.js--save-group-param').on('click', function() { const $this = $(this); const $itemList = $this.closest('td').find('.js--item-list'); const baseUrl = $this.data('url'); const search = 'name=' + $this.data('name') + '&value=' + $itemList.find('select').val(); const url = baseUrl + (baseUrl.indexOf('?') !== -1 ? '&' : '?') + search; $.ajax({ method: 'POST', url: url }).always(function () { window.location.reload(); }); }); }); });
require('dotenv').config(); const openSource = { githubConvertedToken: process.env.REACT_APP_GITHUB_TOKEN, githubUserName: "mustafahasankhan", }; const fetch = require("node-fetch"); var fs = require("fs"); const query_pr = { query: ` query { user(login: "${openSource.githubUserName}"){ pullRequests(last: 100, orderBy: {field: CREATED_AT, direction: DESC}){ totalCount nodes{ id title url state mergedBy { avatarUrl url login } createdAt number changedFiles additions deletions baseRepository { name url owner { avatarUrl login url } } } } } } `, }; const query_issue = { query: `query{ user(login: "${openSource.githubUserName}") { issues(last: 100, orderBy: {field:CREATED_AT, direction: DESC}){ totalCount nodes{ id closed title createdAt url number assignees(first:100){ nodes{ avatarUrl name url } } repository{ name url owner{ login avatarUrl url } } } } } }`, }; const query_org = { query: `query{ user(login: "${openSource.githubUserName}") { repositoriesContributedTo(last: 100){ totalCount nodes{ owner{ login avatarUrl __typename } } } } }`, }; //isFork, const query_pinned_projects = { query: ` query { user(login: "${openSource.githubUserName}") { pinnedItems(first: 6, types: REPOSITORY) { totalCount nodes{ ... on Repository{ id name createdAt, url, description, forkCount, stargazers { totalCount }, languages(first:10){ nodes{ name } } } } } } } `, }; const baseUrl = "https://api.github.com/graphql"; const headers = { "Content-Type": "application/json", Authorization: "bearer " + openSource.githubConvertedToken, }; fetch(baseUrl, { method: "POST", headers: headers, body: JSON.stringify(query_pr), }) .then((response) => response.text()) .then((txt) => { const data = JSON.parse(txt); var cropped = { data: [] }; cropped["data"] = data["data"]["user"]["pullRequests"]["nodes"]; var open = 0; var closed = 0; var merged = 0; for (var i = 0; i < cropped["data"].length; i++) { if (cropped["data"][i]["state"] === "OPEN") open++; else if (cropped["data"][i]["state"] === "MERGED") merged++; else closed++; } cropped["open"] = open; cropped["closed"] = closed; cropped["merged"] = merged; cropped["totalCount"] = cropped["data"].length; console.log("Fetching the Pull Request Data.\n"); fs.writeFile( "./src/shared/opensource/pull_requests.json", JSON.stringify(cropped), function (err) { if (err) { console.log(err); } } ); }) .catch((error) => console.log(JSON.stringify(error))); fetch(baseUrl, { method: "POST", headers: headers, body: JSON.stringify(query_issue), }) .then((response) => response.text()) .then((txt) => { const data = JSON.parse(txt); var cropped = { data: [] }; cropped["data"] = data["data"]["user"]["issues"]["nodes"]; var open = 0; var closed = 0; for (var i = 0; i < cropped["data"].length; i++) { if (cropped["data"][i]["closed"] === false) open++; else closed++; } cropped["open"] = open; cropped["closed"] = closed; cropped["totalCount"] = cropped["data"].length; console.log("Fetching the Issues Data.\n"); fs.writeFile( "./src/shared/opensource/issues.json", JSON.stringify(cropped), function (err) { if (err) { console.log(err); } } ); }) .catch((error) => console.log(JSON.stringify(error))); fetch(baseUrl, { method: "POST", headers: headers, body: JSON.stringify(query_org), }) .then((response) => response.text()) .then((txt) => { const data = JSON.parse(txt); const orgs = data["data"]["user"]["repositoriesContributedTo"]["nodes"]; var newOrgs = { data: [] }; for (var i = 0; i < orgs.length; i++) { var obj = orgs[i]["owner"]; if (obj["__typename"] === "Organization") { var flag = 0; for (var j = 0; j < newOrgs["data"].length; j++) { if (JSON.stringify(obj) === JSON.stringify(newOrgs["data"][j])) { flag = 1; break; } } if (flag === 0) { newOrgs["data"].push(obj); } } } console.log("Fetching the Contributed Organization Data.\n"); fs.writeFile( "./src/shared/opensource/organizations.json", JSON.stringify(newOrgs), function (err) { if (err) { console.log(err); } } ); }) .catch((error) => console.log(JSON.stringify(error))); const languages_icons = { Python: "logos-python", "Jupyter Notebook": "logos-jupyter", HTML: "logos-html-5", CSS: "logos-css-3", JavaScript: "logos-javascript", "C#": "logos-c-sharp", Java: "logos-java", }; fetch(baseUrl, { method: "POST", headers: headers, body: JSON.stringify(query_pinned_projects), }) .then((response) => response.text()) .then((txt) => { const data = JSON.parse(txt); // console.log(txt); const projects = data["data"]["user"]["pinnedItems"]["nodes"]; var newProjects = { data: [] }; for (var i = 0; i < projects.length; i++) { var obj = projects[i]; var langobjs = obj["languages"]["nodes"]; var newLangobjs = []; for (var j = 0; j < langobjs.length; j++) { if (langobjs[j]["name"] in languages_icons) { newLangobjs.push({ name: langobjs[j]["name"], iconifyClass: languages_icons[langobjs[j]["name"]], }); } } obj["languages"] = newLangobjs; newProjects["data"].push(obj); } console.log("Fetching the Pinned Projects Data.\n"); fs.writeFile( "./src/shared/opensource/projects.json", JSON.stringify(newProjects), function (err) { if (err) { console.log( "Error occured in pinned projects 1", JSON.stringify(err) ); } } ); }) .catch((error) => console.log("Error occured in pinned projects 2", JSON.stringify(error)) );
const fs = require('fs-extra') // eslint-disable-next-line import/no-extraneous-dependencies const path = require('path') const chalk = require('chalk') const ejs = require('ejs') const getAllPlugin = require('./lib/plugin-get-all') const targetDir = path.resolve(__dirname, '../src/config/stage/plugin.js') const pluginsPath = path.resolve(__dirname, '../src/plugin') const templatePath = path.resolve(__dirname, './template/plugin-stage-config.js.ejs') // eslint-disable-next-line console.log(chalk.green('配置插件...')) const template = fs.readFileSync(templatePath, 'utf8') const puginList = getAllPlugin(pluginsPath) const result = ejs.render(template, { plugins: puginList }) fs.writeFile(targetDir, result) // eslint-disable-next-line console.log(chalk.green(`插件配置完成: ${targetDir}\n`))
import { API, graphqlOperation } from 'aws-amplify' import { listHashtags } from '../graphql/queries' // GraphQL queries that is auto genarate from the DB scheme (read function) import { createHashtag, updateHashtag, } from '../graphql/mutations' const createUserHashtag = async (hashtagName, settingsId) => { // We add a hashtag to the hashtag table by adding its name & the settings it belong to. if(hashtagName){ await API.graphql( graphqlOperation(createHashtag, { input: { name: hashtagName, hashtagSettingId: settingsId, }, }), ) return hashtagName } return undefined } const getUserHashtags = async () => { const { data: { listHashtags: { items }, // We use destructoring to get hashtag by it name (items) }, } = await API.graphql(graphqlOperation(listHashtags)) return items.map((hashtagInfo) => { const {name} = hashtagInfo const isInSettings = !!hashtagInfo.setting const isSearchable = true const {id} = hashtagInfo return {id, name, isInSettings, isSearchable} }) } const getHashtagIdByName = async hashtagName => { if(hashtagName){ const hashtags = await getUserHashtags() const filteredHashtags = hashtags.filter(({ name }) => name === hashtagName) // We filter the users list of hashtags to get the one we need if (filteredHashtags[0]) return filteredHashtags[0].id // Since a user will not have duplicate hashtags we get the first element in array if it exist return undefined } return undefined } const updateUserHashtag = async (hashtagId, update) => { // We remove a hashtag by it Name since there is only one specific hashtag name per user. if (hashtagId && update) { await API.graphql( graphqlOperation(updateHashtag, { input: { id: hashtagId, ...update }, }), // We remove the hashtag by its id ) return { id: hashtagId, ...update } } return undefined } export { getUserHashtags, createUserHashtag, getHashtagIdByName, updateUserHashtag }
let lightningSql = require("../../dist/lightning-sql").lightningSql; let query, result; query = "SELECT * FROM users"; result = { "type": "PROGRAM", "children": [ { "type": "SELECT_STMT", "children": [ { "type": "SELECT", "value": "SELECT", "children": [] }, { "type": "SELECT_VALUE_LIST", "children": [ { "type": "STAR", "value": "*", "children": [] } ] }, { "type": "FROM", "value": "FROM", "children": [] }, { "type": "TABLES", "children": [ { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "users", "children": [] } ] } ] } ] } ] } test(query, () => { let lxr = new lightningSql.Lexer(query); let parser = new lightningSql.Parser(lxr); expect(JSON.stringify(parser.parseProgram())).toBe(JSON.stringify(result)); }); query = "SELECT * FROM users JOIN charts ON users.id = charts.user_id"; result = { "type": "PROGRAM", "children": [ { "type": "SELECT_STMT", "children": [ { "type": "SELECT", "value": "SELECT", "children": [] }, { "type": "SELECT_VALUE_LIST", "children": [ { "type": "STAR", "value": "*", "children": [] } ] }, { "type": "FROM", "value": "FROM", "children": [] }, { "type": "TABLES", "children": [ { "type": "ANY_JOIN", "children": [ { "type": "JOIN", "value": "JOIN", "children": [] } ] }, { "type": "ON", "value": "ON", "children": [] }, { "type": "EXPRESSION", "children": [ { "type": "COMPARRISON", "children": [ { "type": "VALUE", "children": [ { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "users", "children": [] }, { "type": "PERIOD", "value": ".", "children": [] }, { "type": "ID", "value": "id", "children": [] } ] } ] }, { "type": "COMPARRISON_CONNECTIVE", "children": [ { "type": "EQ", "value": "=", "children": [] } ] }, { "type": "VALUE", "children": [ { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "charts", "children": [] }, { "type": "PERIOD", "value": ".", "children": [] }, { "type": "ID", "value": "user_id", "children": [] } ] } ] } ] } ] }, { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "users", "children": [] } ] }, { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "charts", "children": [] } ] } ] } ] } ] } test(query, () => { let lxr = new lightningSql.Lexer(query); let parser = new lightningSql.Parser(lxr); expect(JSON.stringify(parser.parseProgram())).toBe(JSON.stringify(result)); }); query = "SELECT * FROM users LEFT JOIN charts ON users.id = charts.user_id"; result = { "type": "PROGRAM", "children": [ { "type": "SELECT_STMT", "children": [ { "type": "SELECT", "value": "SELECT", "children": [] }, { "type": "SELECT_VALUE_LIST", "children": [ { "type": "STAR", "value": "*", "children": [] } ] }, { "type": "FROM", "value": "FROM", "children": [] }, { "type": "TABLES", "children": [ { "type": "ANY_JOIN", "children": [ { "type": "LEFT", "value": "LEFT", "children": [] }, { "type": "JOIN", "value": "JOIN", "children": [] } ] }, { "type": "ON", "value": "ON", "children": [] }, { "type": "EXPRESSION", "children": [ { "type": "COMPARRISON", "children": [ { "type": "VALUE", "children": [ { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "users", "children": [] }, { "type": "PERIOD", "value": ".", "children": [] }, { "type": "ID", "value": "id", "children": [] } ] } ] }, { "type": "COMPARRISON_CONNECTIVE", "children": [ { "type": "EQ", "value": "=", "children": [] } ] }, { "type": "VALUE", "children": [ { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "charts", "children": [] }, { "type": "PERIOD", "value": ".", "children": [] }, { "type": "ID", "value": "user_id", "children": [] } ] } ] } ] } ] }, { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "users", "children": [] } ] }, { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "charts", "children": [] } ] } ] } ] } ] } test(query, () => { let lxr = new lightningSql.Lexer(query); let parser = new lightningSql.Parser(lxr); expect(JSON.stringify(parser.parseProgram())).toBe(JSON.stringify(result)); }); query = "SELECT * FROM users RIGHT JOIN charts ON users.id = charts.user_id"; result = { "type": "PROGRAM", "children": [ { "type": "SELECT_STMT", "children": [ { "type": "SELECT", "value": "SELECT", "children": [] }, { "type": "SELECT_VALUE_LIST", "children": [ { "type": "STAR", "value": "*", "children": [] } ] }, { "type": "FROM", "value": "FROM", "children": [] }, { "type": "TABLES", "children": [ { "type": "ANY_JOIN", "children": [ { "type": "RIGHT", "value": "RIGHT", "children": [] }, { "type": "JOIN", "value": "JOIN", "children": [] } ] }, { "type": "ON", "value": "ON", "children": [] }, { "type": "EXPRESSION", "children": [ { "type": "COMPARRISON", "children": [ { "type": "VALUE", "children": [ { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "users", "children": [] }, { "type": "PERIOD", "value": ".", "children": [] }, { "type": "ID", "value": "id", "children": [] } ] } ] }, { "type": "COMPARRISON_CONNECTIVE", "children": [ { "type": "EQ", "value": "=", "children": [] } ] }, { "type": "VALUE", "children": [ { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "charts", "children": [] }, { "type": "PERIOD", "value": ".", "children": [] }, { "type": "ID", "value": "user_id", "children": [] } ] } ] } ] } ] }, { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "users", "children": [] } ] }, { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "charts", "children": [] } ] } ] } ] } ] } test(query, () => { let lxr = new lightningSql.Lexer(query); let parser = new lightningSql.Parser(lxr); expect(JSON.stringify(parser.parseProgram())).toBe(JSON.stringify(result)); }); query = "SELECT * FROM users OUTER JOIN charts ON users.id = charts.user_id"; result = { "type": "PROGRAM", "children": [ { "type": "SELECT_STMT", "children": [ { "type": "SELECT", "value": "SELECT", "children": [] }, { "type": "SELECT_VALUE_LIST", "children": [ { "type": "STAR", "value": "*", "children": [] } ] }, { "type": "FROM", "value": "FROM", "children": [] }, { "type": "TABLES", "children": [ { "type": "ANY_JOIN", "children": [ { "type": "OUTER", "value": "OUTER", "children": [] }, { "type": "JOIN", "value": "JOIN", "children": [] } ] }, { "type": "ON", "value": "ON", "children": [] }, { "type": "EXPRESSION", "children": [ { "type": "COMPARRISON", "children": [ { "type": "VALUE", "children": [ { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "users", "children": [] }, { "type": "PERIOD", "value": ".", "children": [] }, { "type": "ID", "value": "id", "children": [] } ] } ] }, { "type": "COMPARRISON_CONNECTIVE", "children": [ { "type": "EQ", "value": "=", "children": [] } ] }, { "type": "VALUE", "children": [ { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "charts", "children": [] }, { "type": "PERIOD", "value": ".", "children": [] }, { "type": "ID", "value": "user_id", "children": [] } ] } ] } ] } ] }, { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "users", "children": [] } ] }, { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "charts", "children": [] } ] } ] } ] } ] } test(query, () => { let lxr = new lightningSql.Lexer(query); let parser = new lightningSql.Parser(lxr); expect(JSON.stringify(parser.parseProgram())).toBe(JSON.stringify(result)); }); query = "SELECT * FROM users WHERE id IN (SELECT user_id FROM approved_users)"; result = { "type": "PROGRAM", "children": [ { "type": "SELECT_STMT", "children": [ { "type": "SELECT", "value": "SELECT", "children": [] }, { "type": "SELECT_VALUE_LIST", "children": [ { "type": "STAR", "value": "*", "children": [] } ] }, { "type": "FROM", "value": "FROM", "children": [] }, { "type": "TABLES", "children": [ { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "users", "children": [] } ] } ] } ] } ] } test(query, () => { let lxr = new lightningSql.Lexer(query); let parser = new lightningSql.Parser(lxr); expect(JSON.stringify(parser.parseProgram())).toBe(JSON.stringify(result)); }); query = "SELECT * FROM users, charts"; result = { "type": "PROGRAM", "children": [ { "type": "SELECT_STMT", "children": [ { "type": "SELECT", "value": "SELECT", "children": [] }, { "type": "SELECT_VALUE_LIST", "children": [ { "type": "STAR", "value": "*", "children": [] } ] }, { "type": "FROM", "value": "FROM", "children": [] }, { "type": "TABLES", "children": [ { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "users", "children": [] } ] }, { "type": "COMMA", "value": ",", "children": [] }, { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "charts", "children": [] } ] } ] } ] } ] } test(query, () => { let lxr = new lightningSql.Lexer(query); let parser = new lightningSql.Parser(lxr); expect(JSON.stringify(parser.parseProgram())).toBe(JSON.stringify(result)); }); query = "SELECT id, users.email FROM users"; result = { "type": "PROGRAM", "children": [ { "type": "SELECT_STMT", "children": [ { "type": "SELECT", "value": "SELECT", "children": [] }, { "type": "SELECT_VALUE_LIST", "children": [ { "type": "VALUE", "children": [ { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "id", "children": [] } ] } ] }, { "type": "COMMA", "value": ",", "children": [] }, { "type": "VALUE", "children": [ { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "users", "children": [] }, { "type": "PERIOD", "value": ".", "children": [] }, { "type": "ID", "value": "email", "children": [] } ] } ] } ] }, { "type": "FROM", "value": "FROM", "children": [] }, { "type": "TABLES", "children": [ { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "users", "children": [] } ] } ] } ] } ] } test(query, () => { let lxr = new lightningSql.Lexer(query); let parser = new lightningSql.Parser(lxr); expect(JSON.stringify(parser.parseProgram())).toBe(JSON.stringify(result)); }); query = "SELECT id, users.email FROM users JOIN charts ON users.id = charts.user_id"; result = { "type": "PROGRAM", "children": [ { "type": "SELECT_STMT", "children": [ { "type": "SELECT", "value": "SELECT", "children": [] }, { "type": "SELECT_VALUE_LIST", "children": [ { "type": "VALUE", "children": [ { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "id", "children": [] } ] } ] }, { "type": "COMMA", "value": ",", "children": [] }, { "type": "VALUE", "children": [ { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "users", "children": [] }, { "type": "PERIOD", "value": ".", "children": [] }, { "type": "ID", "value": "email", "children": [] } ] } ] } ] }, { "type": "FROM", "value": "FROM", "children": [] }, { "type": "TABLES", "children": [ { "type": "ANY_JOIN", "children": [ { "type": "JOIN", "value": "JOIN", "children": [] } ] }, { "type": "ON", "value": "ON", "children": [] }, { "type": "EXPRESSION", "children": [ { "type": "COMPARRISON", "children": [ { "type": "VALUE", "children": [ { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "users", "children": [] }, { "type": "PERIOD", "value": ".", "children": [] }, { "type": "ID", "value": "id", "children": [] } ] } ] }, { "type": "COMPARRISON_CONNECTIVE", "children": [ { "type": "EQ", "value": "=", "children": [] } ] }, { "type": "VALUE", "children": [ { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "charts", "children": [] }, { "type": "PERIOD", "value": ".", "children": [] }, { "type": "ID", "value": "user_id", "children": [] } ] } ] } ] } ] }, { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "users", "children": [] } ] }, { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "charts", "children": [] } ] } ] } ] } ] } test(query, () => { let lxr = new lightningSql.Lexer(query); let parser = new lightningSql.Parser(lxr); expect(JSON.stringify(parser.parseProgram())).toBe(JSON.stringify(result)); }); query = "SELECT id, users.email FROM users LEFT JOIN charts ON users.id = charts.user_id"; result = { "type": "PROGRAM", "children": [ { "type": "SELECT_STMT", "children": [ { "type": "SELECT", "value": "SELECT", "children": [] }, { "type": "SELECT_VALUE_LIST", "children": [ { "type": "VALUE", "children": [ { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "id", "children": [] } ] } ] }, { "type": "COMMA", "value": ",", "children": [] }, { "type": "VALUE", "children": [ { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "users", "children": [] }, { "type": "PERIOD", "value": ".", "children": [] }, { "type": "ID", "value": "email", "children": [] } ] } ] } ] }, { "type": "FROM", "value": "FROM", "children": [] }, { "type": "TABLES", "children": [ { "type": "ANY_JOIN", "children": [ { "type": "LEFT", "value": "LEFT", "children": [] }, { "type": "JOIN", "value": "JOIN", "children": [] } ] }, { "type": "ON", "value": "ON", "children": [] }, { "type": "EXPRESSION", "children": [ { "type": "COMPARRISON", "children": [ { "type": "VALUE", "children": [ { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "users", "children": [] }, { "type": "PERIOD", "value": ".", "children": [] }, { "type": "ID", "value": "id", "children": [] } ] } ] }, { "type": "COMPARRISON_CONNECTIVE", "children": [ { "type": "EQ", "value": "=", "children": [] } ] }, { "type": "VALUE", "children": [ { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "charts", "children": [] }, { "type": "PERIOD", "value": ".", "children": [] }, { "type": "ID", "value": "user_id", "children": [] } ] } ] } ] } ] }, { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "users", "children": [] } ] }, { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "charts", "children": [] } ] } ] } ] } ] } test(query, () => { let lxr = new lightningSql.Lexer(query); let parser = new lightningSql.Parser(lxr); expect(JSON.stringify(parser.parseProgram())).toBe(JSON.stringify(result)); }); query = "SELECT id, users.email FROM users RIGHT JOIN charts ON users.id = charts.user_id"; result = { "type": "PROGRAM", "children": [ { "type": "SELECT_STMT", "children": [ { "type": "SELECT", "value": "SELECT", "children": [] }, { "type": "SELECT_VALUE_LIST", "children": [ { "type": "VALUE", "children": [ { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "id", "children": [] } ] } ] }, { "type": "COMMA", "value": ",", "children": [] }, { "type": "VALUE", "children": [ { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "users", "children": [] }, { "type": "PERIOD", "value": ".", "children": [] }, { "type": "ID", "value": "email", "children": [] } ] } ] } ] }, { "type": "FROM", "value": "FROM", "children": [] }, { "type": "TABLES", "children": [ { "type": "ANY_JOIN", "children": [ { "type": "RIGHT", "value": "RIGHT", "children": [] }, { "type": "JOIN", "value": "JOIN", "children": [] } ] }, { "type": "ON", "value": "ON", "children": [] }, { "type": "EXPRESSION", "children": [ { "type": "COMPARRISON", "children": [ { "type": "VALUE", "children": [ { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "users", "children": [] }, { "type": "PERIOD", "value": ".", "children": [] }, { "type": "ID", "value": "id", "children": [] } ] } ] }, { "type": "COMPARRISON_CONNECTIVE", "children": [ { "type": "EQ", "value": "=", "children": [] } ] }, { "type": "VALUE", "children": [ { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "charts", "children": [] }, { "type": "PERIOD", "value": ".", "children": [] }, { "type": "ID", "value": "user_id", "children": [] } ] } ] } ] } ] }, { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "users", "children": [] } ] }, { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "charts", "children": [] } ] } ] } ] } ] } test(query, () => { let lxr = new lightningSql.Lexer(query); let parser = new lightningSql.Parser(lxr); expect(JSON.stringify(parser.parseProgram())).toBe(JSON.stringify(result)); }); query = "SELECT id, users.email FROM users OUTER JOIN charts ON users.id = charts.user_id"; result = { "type": "PROGRAM", "children": [ { "type": "SELECT_STMT", "children": [ { "type": "SELECT", "value": "SELECT", "children": [] }, { "type": "SELECT_VALUE_LIST", "children": [ { "type": "VALUE", "children": [ { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "id", "children": [] } ] } ] }, { "type": "COMMA", "value": ",", "children": [] }, { "type": "VALUE", "children": [ { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "users", "children": [] }, { "type": "PERIOD", "value": ".", "children": [] }, { "type": "ID", "value": "email", "children": [] } ] } ] } ] }, { "type": "FROM", "value": "FROM", "children": [] }, { "type": "TABLES", "children": [ { "type": "ANY_JOIN", "children": [ { "type": "OUTER", "value": "OUTER", "children": [] }, { "type": "JOIN", "value": "JOIN", "children": [] } ] }, { "type": "ON", "value": "ON", "children": [] }, { "type": "EXPRESSION", "children": [ { "type": "COMPARRISON", "children": [ { "type": "VALUE", "children": [ { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "users", "children": [] }, { "type": "PERIOD", "value": ".", "children": [] }, { "type": "ID", "value": "id", "children": [] } ] } ] }, { "type": "COMPARRISON_CONNECTIVE", "children": [ { "type": "EQ", "value": "=", "children": [] } ] }, { "type": "VALUE", "children": [ { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "charts", "children": [] }, { "type": "PERIOD", "value": ".", "children": [] }, { "type": "ID", "value": "user_id", "children": [] } ] } ] } ] } ] }, { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "users", "children": [] } ] }, { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "charts", "children": [] } ] } ] } ] } ] } test(query, () => { let lxr = new lightningSql.Lexer(query); let parser = new lightningSql.Parser(lxr); expect(JSON.stringify(parser.parseProgram())).toBe(JSON.stringify(result)); }); query = "SELECT id, users.email FROM users WHERE id IN (SELECT user_id FROM approved_users)"; result = { "type": "PROGRAM", "children": [ { "type": "SELECT_STMT", "children": [ { "type": "SELECT", "value": "SELECT", "children": [] }, { "type": "SELECT_VALUE_LIST", "children": [ { "type": "VALUE", "children": [ { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "id", "children": [] } ] } ] }, { "type": "COMMA", "value": ",", "children": [] }, { "type": "VALUE", "children": [ { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "users", "children": [] }, { "type": "PERIOD", "value": ".", "children": [] }, { "type": "ID", "value": "email", "children": [] } ] } ] } ] }, { "type": "FROM", "value": "FROM", "children": [] }, { "type": "TABLES", "children": [ { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "users", "children": [] } ] } ] } ] } ] } test(query, () => { let lxr = new lightningSql.Lexer(query); let parser = new lightningSql.Parser(lxr); expect(JSON.stringify(parser.parseProgram())).toBe(JSON.stringify(result)); }); query = "SELECT id, users.email FROM users, charts WHERE users.id = charts.user_id"; result = { "type": "PROGRAM", "children": [ { "type": "SELECT_STMT", "children": [ { "type": "SELECT", "value": "SELECT", "children": [] }, { "type": "SELECT_VALUE_LIST", "children": [ { "type": "VALUE", "children": [ { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "id", "children": [] } ] } ] }, { "type": "COMMA", "value": ",", "children": [] }, { "type": "VALUE", "children": [ { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "users", "children": [] }, { "type": "PERIOD", "value": ".", "children": [] }, { "type": "ID", "value": "email", "children": [] } ] } ] } ] }, { "type": "FROM", "value": "FROM", "children": [] }, { "type": "TABLES", "children": [ { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "users", "children": [] } ] }, { "type": "COMMA", "value": ",", "children": [] }, { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "charts", "children": [] } ] } ] }, { "type": "WHERE", "value": "WHERE", "children": [] }, { "type": "EXPRESSION", "children": [ { "type": "COMPARRISON", "children": [ { "type": "VALUE", "children": [ { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "users", "children": [] }, { "type": "PERIOD", "value": ".", "children": [] }, { "type": "ID", "value": "id", "children": [] } ] } ] }, { "type": "COMPARRISON_CONNECTIVE", "children": [ { "type": "EQ", "value": "=", "children": [] } ] }, { "type": "VALUE", "children": [ { "type": "COMPLEX_ID", "children": [ { "type": "ID", "value": "charts", "children": [] }, { "type": "PERIOD", "value": ".", "children": [] }, { "type": "ID", "value": "user_id", "children": [] } ] } ] } ] } ] } ] } ] } test(query, () => { let lxr = new lightningSql.Lexer(query); let parser = new lightningSql.Parser(lxr); expect(JSON.stringify(parser.parseProgram())).toBe(JSON.stringify(result)); });
import ReplyForm from './ReplyForm' export default ReplyForm
const validateAction = action => { if (!action || typeof action !== "object" || Array.isArray(action)) { throw new Error("Action must be an object!"); } if (typeof action.type === "undefined") { throw new Error("Action must have a type!"); } }; export default validateAction;
"use strict"; const BODY = document.querySelector("body"); const QUOTE = document.querySelector(".quote"); const fetchExcuse = () => { const REX = /<a.*?>(.*?)<\/a>/; const URL = 'http://developerexcuses.com'; return fetch(new Request(URL)) .then(response => { if (response.ok) { return response.text(); } throw new Error("Internet disconnected"); }) .then(response => { let match = REX.exec(response); return match ? match[1] : "No more excuses"; }) .catch(() => { return Promise.resolve("Seems internet is down"); }) }; const excuse = () => { Promise.all([fetchExcuse(), restore_options()]) .then(([excuse, quoting]) => { QUOTE.innerText = quote(excuse, quoting); prepareToClipboard(excuse); }) .catch((error) => { console.log(error) }); }; const quote = (text, quoting) => { switch (quoting) { case "none": return text; break; case "single": return `' ${text} '`; break; case "double": return `“ ${text} ”`; break; } }; const restore_options = (debug) => { return new Promise((resolve) => { chrome.storage.sync.get({theme: "moon", quoting: "double"}, function (items) { if (debug) { console.group("Developer excuses debug mode"); console.log("ℹ️ Current theme : " + items.theme); console.log("ℹ️ Current quotation schema : " + items.quoting); console.groupEnd(); } switch (items.theme) { case "moon": BODY.classList.add(items.theme); break; case "light": BODY.classList.add(items.theme); break; case "dark": BODY.classList.add(items.theme); break; case "sun": BODY.classList.add(items.theme); break; case "dream": BODY.classList.add(items.theme); break; case "grass": BODY.classList.add(items.theme); break; } resolve(items.quoting); }); }); }; const prepareToClipboard = (excuse) => { document.querySelector('.currentQuote').value = excuse; }; document.addEventListener('DOMContentLoaded', excuse()); QUOTE.addEventListener('click', function () { document.querySelector('.currentQuote').select(); document.execCommand('copy'); }); window.addEventListener('keypress', function (event) { if (event.key === "r" || event.key === "") { excuse() } if (event.key === "o" || event.key === "O") { if (chrome.runtime.openOptionsPage) { chrome.runtime.openOptionsPage(); } else { window.open(chrome.runtime.getURL('options.html')); } } });
import {approachesHole, approachesObstacle, canSee, holeSensor, lineOfSight, moveX, obstacleSensor} from './helpers.js'; import {debugging, playerAccelerationWalking, playerDragX, playerJumpVelocity, playerMaxVelocityX, playerMaxVelocityY, tileSize} from './constants.js'; const spiderViusualRange = 10 * tileSize; const spiderStand = 576; const spiderAttack = 580; const spiderDead = 581; const spiderAttackDelay = 600; const spiderHealth = 2; const plusMinus = (delta) => random(1 - delta, 1 + delta); const random = (min, max) => Math.random() * (max - min) + min; export const monsterByName = { 'spider': (scene, x, y, world, dynamic) => new Spider(scene, x, y, world, dynamic), 'zombie': (scene, x, y, world, dynamic) => new Zombie(scene, x, y, world, dynamic), 'Scorpion': (scene, x, y, world, dynamic) => new Scorpion(scene, x, y, world, dynamic), 'Rat': (scene, x, y, world, dynamic) => new Rat(scene, x, y, world, dynamic), 'Ice': (scene, x, y, world, dynamic) => new Ice(scene, x, y, world, dynamic) }; class MeleeMonster { constructor(scene, x, y, world, dynamic, config) { this.score = config.score; this._world = world; this._dynamic = dynamic; this.sprite = scene.physics.add .sprite(x, y, 'player', config.standSprite) .setDrag(0.75 * config.dragX, 0) .setMaxVelocity(config.maxVelocityX, config.maxVelocityY) .setScale(config.scale, config.scale); this._health = config.health; this._gfx = debugging ? scene.add.graphics() : null; this._states = { 'idle': new IdleMonster(this.sprite), 'attacking': new CloseCombatAttackingMonster(this.sprite, this._gfx, config), 'dead': new DeadMonster(this.sprite, config) }; this._currentState = 'idle'; } isAlive() { return this._health > 0; } changeHealth(delta) { this._health += delta; if (this._health <= 0) { this._currentState = 'dead'; } } update(time, player) { if (this._gfx) { this._gfx.clear(); } this._currentState = this._states[this._currentState].update({ time, player, worlds: [this._world, this._dynamic], gfx: this._gfx }) || this._currentState; } destroy() { this.sprite.destroy(); if (this._gfx) { this._gfx.clear().destroy(); } } } /** * The spider runs to the player and attacks. * It can jump as well. */ export class Spider extends MeleeMonster { constructor(scene, x, y, world, dynamic) { super(scene, x, y, world, dynamic, { standSprite: 576, deadSprite: 581, spriteAttack: 580, moveSprites: 576, dragX: playerDragX, maxVelocityX: plusMinus(0.2) * 80, maxVelocityY: plusMinus(0.05) * playerMaxVelocityY, health: spiderHealth, attackDelay: spiderAttackDelay, jumpVelocity: -300, damage: 1, score: 20, scale: 0.75 }); } } export class Zombie extends MeleeMonster { constructor(scene, x, y, world, dynamic) { super(scene, x, y, world, dynamic, { standSprite: 276, deadSprite: 281, spriteAttack: 280, moveSprites: 277, dragX: playerDragX, maxVelocityX: plusMinus(0.1) * 32, maxVelocityY: plusMinus(0.02) * playerMaxVelocityY, health: 7, attackDelay: 1500, jumpVelocity: -200, damage: 2, score: 40, scale: 1.2 }); } } export class Scorpion extends MeleeMonster { constructor(scene, x, y, world, dynamic) { super(scene, x, y, world, dynamic, { standSprite: 540, deadSprite: 543, spriteAttack: 542, moveSprites: 539, dragX: playerDragX, maxVelocityX: plusMinus(0.05) * 45, maxVelocityY: plusMinus(0.02) * playerMaxVelocityY, health: 4, attackDelay: 700, jumpVelocity: -240, damage: 2, score: 50, scale: 1.0 }); } } export class Rat extends MeleeMonster { constructor(scene, x, y, world, dynamic) { super(scene, x, y, world, dynamic, { standSprite: 480, deadSprite: 481, spriteAttack: 477, moveSprites: 476, dragX: playerDragX, maxVelocityX: plusMinus(0.05) * 90, maxVelocityY: plusMinus(0.02) * playerMaxVelocityY, health: 1, attackDelay: 2000, jumpVelocity: -200, damage: 1, score: 10, scale: 0.75 }); } } export class Ice extends MeleeMonster { constructor(scene, x, y, world, dynamic) { super(scene, x, y, world, dynamic, { standSprite: 638, deadSprite: 643, spriteAttack: 639, moveSprites: 638, dragX: playerDragX, maxVelocityX: plusMinus(0.05) * 32, maxVelocityY: plusMinus(0.02) * playerMaxVelocityY, health: 2, attackDelay: 2000, jumpVelocity: -170, damage: 1, score: 25, scale: 1 }); } } class DeadMonster { constructor(sprite, config) { this._sprite = sprite; this.config = config; } update() { this._sprite.setTexture('player', this.config.deadSprite); this._sprite.setAccelerationX(0); } } class IdleMonster { constructor(sprite) { this._sprite = sprite; this._flipDelay = Math.random() * 400 + 800; } update({time, player, worlds}) { this._lastFlip = this._lastFlip || time; if (time - this._lastFlip > this._flipDelay) { this._lastFlip = time; this._sprite.setFlipX(!this._sprite.flipX); } const canSesPlayer = canSee(player.sprite, this._sprite, worlds, spiderViusualRange); if (canSesPlayer) { return 'attacking'; } else { return null; } } } class CloseCombatAttackingMonster { constructor(sprite, gfx, config) { this.sprite = sprite; this.gfx = gfx; this.config = config; } update({time, player, worlds}) { const px = player.sprite.x; const mx = this.sprite.x; const dx = Math.abs(px - mx); const py = player.sprite.y; const my = this.sprite.y; const dy = Math.abs(py - my); const canReach = dx < 0.5 * tileSize && dy < 0.5 * tileSize; if (canReach) { this._attackPlayer({time, player}); } else { this._runToPlayer({px, mx, dx, my, py, worlds}); } } _attackPlayer({time, player}) { const canAttack = this._lastAttack === undefined || time - this._lastAttack > this.config.attackDelay; if (canAttack) { this._lastAttack = time; player.changeHealth(-this.config.damage); this.sprite.setTexture('player', this.config.spriteAttack); } else { const attacking = this._lastAttack && time - this._lastAttack < 250; this.sprite.setTexture('player', attacking ? this.config.spriteAttack : this.config.standSprite); } } _runToPlayer({px, mx, dx, my, py, worlds}) { const playerIsLeft = px - mx < 0; const playerIsLeftFactor = playerIsLeft ? -1 : 1; moveX(this.sprite, playerIsLeftFactor * playerAccelerationWalking); const obstacleSensorOffset = playerIsLeftFactor * 1.5 * tileSize; const holeSensorOffset = playerIsLeftFactor * 0.5 * tileSize; const canJump = this.sprite.body.blocked.down; const wantJump = // something is in the way approachesObstacle(this.sprite, obstacleSensorOffset, worlds) // there is a hole to jump over || approachesHole(this.sprite, holeSensorOffset, worlds) // player is above the monster || dx < tileSize && my - py > 1.5 * tileSize; if (wantJump && canJump) { this.sprite.setVelocityY(this.config.jumpVelocity); } this.sprite.setTexture('player', this.config.moveSprites); if (debugging) { this._updateRunToPlayerDebugging({x: px, y: py}, {obstacleSensorOffset, holeSensorOffset, worlds}); } } _updateRunToPlayerDebugging(playerPosition, {obstacleSensorOffset, holeSensorOffset, worlds}) { const line = lineOfSight(playerPosition, this.sprite, spiderViusualRange); if (line) { const canSeePlayer = canSee(playerPosition, this.sprite, worlds, spiderViusualRange); this.gfx.lineStyle(1, canSeePlayer ? 0x33ff00 : 0xff3300) .strokeLineShape(line); } const oSensor = obstacleSensor(this.sprite, obstacleSensorOffset); if (oSensor) { this.gfx.fillStyle(0xbbbbff, 1) .fillCircleShape(new Phaser.Geom.Circle(oSensor.x, oSensor.y, 1)); } const hSensor = holeSensor(this.sprite, holeSensorOffset); if (hSensor) { this.gfx.fillStyle(0xbbbbff, 1) .fillCircleShape(new Phaser.Geom.Circle(hSensor.x, hSensor.y, 1)); } } }
import { filters } from './filter.reducer'; import { SET_QUERY, SET_RELEVANCE, SET_TAG, SET_TIME_RANGE } from '../actions/types'; describe('Filter reducer', () => { let filterState; describe('when init', () => { beforeEach(() => { filterState = { query: '', page: '', tags: 'story', createdAt: '', relevance: 'search' }; }); it('should set the reducer state to default state', () => { const actuaReducer = filters(filterState, {}); expect(actuaReducer).toEqual(filterState); }); it('should run with no params', () => { const actuaReducer = filters(); expect(actuaReducer).toEqual(filterState); }); it('should set the value into query param in filter state', () => { const query = 'test query'; filterState = { ...filterState, query } const actuaReducer = filters(filterState, { type: SET_QUERY, payload: query }); expect(actuaReducer).toEqual(filterState); }); it('should set relevance value in filter state', () => { const relevance = 'test relevance'; filterState = { ...filterState, relevance } const actuaReducer = filters(filterState, { type: SET_RELEVANCE, payload: relevance }); expect(actuaReducer).toEqual(filterState); }); it('should set tag value in filter state', () => { const tags = 'test tag'; filterState = { ...filterState, tags } const actuaReducer = filters(filterState, { type: SET_TAG, payload: tags }); expect(actuaReducer).toEqual(filterState); }); it('should set time range value in filter state', () => { const createdAt = 'test tag'; filterState = { ...filterState, createdAt } const actuaReducer = filters(filterState, { type: SET_TIME_RANGE, payload: createdAt }); expect(actuaReducer).toEqual(filterState); }); }); // it('should set the summary data', () => { // const actuaReducer = summaryReducer([], { type: FETCH_SUMMARY_DATA, payload: summaryData }); // expect(actuaReducer).toEqual(summaryData); // }); });
export default [{ label: '头像装饰', value: 'avatar', size: { w: 480, h: 480 } }, { label: '手机桌面', value: 'mobile-bg', size: { h: 2400, w: 1080 } }, { label: '横向拼图', value: 'factor-land', size: { w: 320, h: 570 } }, { label: '竖向拼图', value: 'factor-port', size: { w: 320, h: 570 } }, { label: '照片相框', value: '', size: { w: 320, h: 570 } }]
/** * @license * Copyright 2018 Google LLC * * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file or at * https://opensource.org/licenses/MIT. * ============================================================================= */ //# sourceMappingURL=model_serialization.js.map
/* Sulfurous - an html5 player for Scratch projects Version: 0.95 July 23, 2018 Sulfurous was created by Mittagskogel and further developed by FRALEX as part of their work at the Alpen-Adria-University Klagenfurt. Sulfurous is based off Phosphorus, which was created by Nathan Dinsmore. Its CPS-style compilation and overall design was inspired by Rhys Simpson's sb2.js. It would have more bugs if not for Truman Kilen. It uses the JSZip library, created by Stuart Knightley, David Duponchel, Franz Buchinger, and António Afonso, to read .sb2 files and compressed projects, and the canvg library, created by Gabe Lerner, to render SVGs in <canvas> elements. Sulfurous is released under the MIT license, the full source is available at https://github.com/mittagskogel/sulfurous We got help from: https://github.com/htmlgames */ var sulfVersion = "0.98" var ASCII = false; var projectID; var firstRunSulfVars = true; var P = (function () { 'use strict'; var SCALE = window.devicePixelRatio || 1; var hasTouchEvents = 'ontouchstart' in document; var inherits = function (cla, sup) { cla.prototype = Object.create(sup.prototype); cla.parent = sup; cla.base = function (self, method /*, args... */) { return sup.prototype[method].call(self, [].slice.call(arguments, 2)); }; }; var addEvents = function (cla /*, events... */) { [].slice.call(arguments, 1).forEach(function (event) { addEvent(cla, event); }); }; var addEvent = function (cla, event) { var capital = event[0].toUpperCase() + event.substr(1); cla.prototype.addEventListener = cla.prototype.addEventListener || function (event, listener) { var listeners = this['$' + event] = this['$' + event] || []; listeners.push(listener); return this; }; cla.prototype.removeEventListener = cla.prototype.removeEventListener || function (event, listener) { var listeners = this['$' + event]; if (listeners) { var i = listeners.indexOf(listener); if (i !== -1) { listeners.splice(i, 1); } } return this; }; cla.prototype.dispatchEvent = cla.prototype.dispatchEvent || function (event, arg) { var listeners = this['$' + event]; if (listeners) { listeners.forEach(function (listener) { listener(arg); }); } var listener = this['on' + event]; if (listener) { listener(arg); } return this; }; cla.prototype['on' + capital] = function (listener) { this.addEventListener(event, listener); return this; }; cla.prototype['dispatch' + capital] = function (arg) { this.dispatchEvent(event, arg); return this; }; }; // WebGL generic drawing functions to be used by Stage and Sprite. var initShaderProgram = function (gl, vsSource, fsSource) { const vertexShader = loadShader(gl, gl.VERTEX_SHADER, vsSource); const fragmentShader = loadShader(gl, gl.FRAGMENT_SHADER, fsSource); const shaderProgram = gl.createProgram(); gl.attachShader(shaderProgram, vertexShader); gl.attachShader(shaderProgram, fragmentShader); gl.linkProgram(shaderProgram); if (!gl.getProgramParameter(shaderProgram, gl.LINK_STATUS)) { console.warn('Could not initialize shaders. ' + gl.getProgramInfoLog(shaderProgram)); return null; } return shaderProgram; } var loadShader = function (gl, type, source) { const shader = gl.createShader(type); gl.shaderSource(shader, source); gl.compileShader(shader); if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) { console.warn('Could not compile shader. ' + gl.getShaderInfoLog(shader)); gl.deleteShader(shader); return null; } return shader; } var initImgBuffers = function (gl) { var position = gl.createBuffer(); var texcoord = gl.createBuffer(); var positionLocation = [ -1, 1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, ]; var texcoordLocation = [ 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, ]; gl.bindBuffer(gl.ARRAY_BUFFER, position); gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(positionLocation), gl.STATIC_DRAW); gl.bindBuffer(gl.ARRAY_BUFFER, texcoord); gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(texcoordLocation), gl.STATIC_DRAW); return { position: position, texcoord: texcoord, } } var glMakeTexture = function (gl, canvas) { //console.log('glMakeTexture'); var tex = gl.createTexture(); gl.bindTexture(gl.TEXTURE_2D, tex); gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, canvas); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST); var textureInfo = { width: canvas.width, height: canvas.height, texture: tex, }; return textureInfo; } var glDrawImage = function (gl, programInfo, buffers, imgInfo, x, y, width, height, rot, originX, originY, effect, tColor) { var cWidth = gl.canvas.width; var cHeight = gl.canvas.height; if (cWidth >= cHeight * 0.75) var zoom = Math.max(cWidth, cHeight * 0.75); else var zoom = Math.max(cHeight * 1.25, cHeight); gl.viewport(0, cHeight - zoom * 0.875, zoom, zoom); gl.blendFunc(programInfo.blendSource, programInfo.blendDest); gl.enable(gl.BLEND); gl.disable(gl.DEPTH_TEST); gl.bindTexture(gl.TEXTURE_2D, imgInfo.texture); gl.useProgram(programInfo.program); gl.bindBuffer(gl.ARRAY_BUFFER, buffers.position); gl.vertexAttribPointer( programInfo.attribLocations.position, 2, gl.FLOAT, false, 0, 0); gl.enableVertexAttribArray(programInfo.attribLocations.position); gl.bindBuffer(gl.ARRAY_BUFFER, buffers.texcoord); gl.vertexAttribPointer( programInfo.attribLocations.texcoord, 2, gl.FLOAT, false, 0, 0); gl.enableVertexAttribArray(programInfo.attribLocations.texcoord); var q = quat.create(); quat.fromEuler(q, 0, 0, rot); var v = vec3.fromValues(x / 240, y / 240, 0); var s = vec3.fromValues(1, 1, 1); var o = vec3.fromValues(originX / 240, originY / 240, 0); var matrix = mat4.create(); mat4.fromRotationTranslationScaleOrigin(matrix, q, v, s, o); mat4.scale(matrix, matrix, vec3.fromValues(width / 480, -height / 480, 0)); gl.uniformMatrix4fv(programInfo.uniformLocations.matrix, false, matrix); if (tColor) gl.uniform4fv(programInfo.uniformLocations.tColor, tColor); gl.uniform1i(programInfo.uniformLocations.texture, 0); gl.uniform2f(programInfo.uniformLocations.texSize, imgInfo.width, imgInfo.height); //Effects: //effect[0] = color //effect[1] = fisheye //effect[2] = whirl //effect[3] = pixelate //effect[4] = mosaic //effect[5] = brightness //effect[6] = ghost if (!effect) effect = [0, 0, 0, 1, 1, 0, 1]; ; if (effect[5] > 0) { effect[5] = effect[5] / 90 * 30; effect[0] = effect[0] + effect[5]; } var colorMatrix = mat4.create(); mat4.fromRotation(colorMatrix, effect[0], vec3.fromValues(1.0, 1.0, 1.0)); //ghost, brightness gl.uniform2f(programInfo.uniformLocations.colorEffect, effect[5], effect[6]); //color gl.uniformMatrix4fv(programInfo.uniformLocations.colorMatrix, false, colorMatrix); //texture gl.uniform4f(programInfo.uniformLocations.texEffect, effect[1], effect[2], effect[3], effect[4]); gl.drawArrays(gl.TRIANGLES, 0, 6); /* var err if(err = gl.getError()){ console.log('WebGL Error: ' + err); } */ } var Request = function () { this.loaded = 0; }; addEvents(Request, 'load', 'progress', 'error'); Request.prototype.progress = function (loaded, total, lengthComputable) { this.loaded = loaded; this.total = total; this.lengthComputable = lengthComputable; this.dispatchProgress({ loaded: loaded, total: total, lengthComputable: lengthComputable }); }; Request.prototype.load = function (result) { this.result = result; this.isDone = true; this.dispatchLoad(result); }; Request.prototype.error = function (error) { this.result = error; this.isError = true; this.isDone = true; this.dispatchError(error); }; var CompositeRequest = function () { this.requests = []; this.isDone = true; this.update = this.update.bind(this); this.error = this.error.bind(this); }; inherits(CompositeRequest, Request); CompositeRequest.prototype.add = function (request) { if (request instanceof CompositeRequest) { for (var i = 0; i < request.requests.length; i++) { this.add(request.requests[i]); } } else { this.requests.push(request); request.addEventListener('progress', this.update); request.addEventListener('load', this.update); request.addEventListener('error', this.error); this.update(); } }; CompositeRequest.prototype.update = function () { if (this.isError) return; var requests = this.requests; var i = requests.length; var total = 0; var loaded = 0; var lengthComputable = true; var uncomputable = 0; var done = 0; while (i--) { var r = requests[i]; loaded += r.loaded; if (r.isDone) { total += r.loaded; done += 1; } else if (r.lengthComputable) { total += r.total; } else { lengthComputable = false; uncomputable += 1; } } if (!lengthComputable && uncomputable !== requests.length) { var each = total / (requests.length - uncomputable) * uncomputable; i = requests.length; total = 0; loaded = 0; lengthComputable = true; while (i--) { var r = requests[i]; if (r.lengthComputable) { loaded += r.loaded; total += r.total; } else { total += each; if (r.isDone) loaded += each; } } } this.progress(loaded, total, lengthComputable); this.doneCount = done; this.isDone = done === requests.length; if (this.isDone && !this.defer) { this.load(this.getResult()); } }; CompositeRequest.prototype.getResult = function () { throw new Error('Users must implement getResult()'); }; var wavFiles = { AcousticGuitar_F3: 'instruments/AcousticGuitar_F3_22k.wav', AcousticPiano_As3: 'instruments/AcousticPiano(5)_A3_22k.wav', AcousticPiano_C4: 'instruments/AcousticPiano(5)_C4_22k.wav', AcousticPiano_G4: 'instruments/AcousticPiano(5)_G4_22k.wav', AcousticPiano_F5: 'instruments/AcousticPiano(5)_F5_22k.wav', AcousticPiano_C6: 'instruments/AcousticPiano(5)_C6_22k.wav', AcousticPiano_Ds6: 'instruments/AcousticPiano(5)_D6_22k.wav', AcousticPiano_D7: 'instruments/AcousticPiano(5)_D7_22k.wav', AltoSax_A3: 'instruments/AltoSax_A3_22K.wav', AltoSax_C6: 'instruments/AltoSax(3)_C6_22k.wav', Bassoon_C3: 'instruments/Bassoon_C3_22k.wav', BassTrombone_A2_2: 'instruments/BassTrombone_A2(2)_22k.wav', BassTrombone_A2_3: 'instruments/BassTrombone_A2(3)_22k.wav', Cello_C2: 'instruments/Cello(3b)_C2_22k.wav', Cello_As2: 'instruments/Cello(3)_A2_22k.wav', Choir_F3: 'instruments/Choir(4)_F3_22k.wav', Choir_F4: 'instruments/Choir(4)_F4_22k.wav', Choir_F5: 'instruments/Choir(4)_F5_22k.wav', Clarinet_C4: 'instruments/Clarinet_C4_22k.wav', ElectricBass_G1: 'instruments/ElectricBass(2)_G1_22k.wav', ElectricGuitar_F3: 'instruments/ElectricGuitar(2)_F3(1)_22k.wav', ElectricPiano_C2: 'instruments/ElectricPiano_C2_22k.wav', ElectricPiano_C4: 'instruments/ElectricPiano_C4_22k.wav', EnglishHorn_D4: 'instruments/EnglishHorn(1)_D4_22k.wav', EnglishHorn_F3: 'instruments/EnglishHorn(1)_F3_22k.wav', Flute_B5_1: 'instruments/Flute(3)_B5(1)_22k.wav', Flute_B5_2: 'instruments/Flute(3)_B5(2)_22k.wav', Marimba_C4: 'instruments/Marimba_C4_22k.wav', MusicBox_C4: 'instruments/MusicBox_C4_22k.wav', Organ_G2: 'instruments/Organ(2)_G2_22k.wav', Pizz_A3: 'instruments/Pizz(2)_A3_22k.wav', Pizz_E4: 'instruments/Pizz(2)_E4_22k.wav', Pizz_G2: 'instruments/Pizz(2)_G2_22k.wav', SteelDrum_D5: 'instruments/SteelDrum_D5_22k.wav', SynthLead_C4: 'instruments/SynthLead(6)_C4_22k.wav', SynthLead_C6: 'instruments/SynthLead(6)_C6_22k.wav', SynthPad_A3: 'instruments/SynthPad(2)_A3_22k.wav', SynthPad_C6: 'instruments/SynthPad(2)_C6_22k.wav', TenorSax_C3: 'instruments/TenorSax(1)_C3_22k.wav', Trombone_B3: 'instruments/Trombone_B3_22k.wav', Trumpet_E5: 'instruments/Trumpet_E5_22k.wav', Vibraphone_C3: 'instruments/Vibraphone_C3_22k.wav', Violin_D4: 'instruments/Violin(2)_D4_22K.wav', Violin_A4: 'instruments/Violin(3)_A4_22k.wav', Violin_E5: 'instruments/Violin(3b)_E5_22k.wav', WoodenFlute_C5: 'instruments/WoodenFlute_C5_22k.wav', BassDrum: 'drums/BassDrum(1b)_22k.wav', Bongo: 'drums/Bongo_22k.wav', Cabasa: 'drums/Cabasa(1)_22k.wav', Clap: 'drums/Clap(1)_22k.wav', Claves: 'drums/Claves(1)_22k.wav', Conga: 'drums/Conga(1)_22k.wav', Cowbell: 'drums/Cowbell(3)_22k.wav', Crash: 'drums/Crash(2)_22k.wav', Cuica: 'drums/Cuica(2)_22k.wav', GuiroLong: 'drums/GuiroLong(1)_22k.wav', GuiroShort: 'drums/GuiroShort(1)_22k.wav', HiHatClosed: 'drums/HiHatClosed(1)_22k.wav', HiHatOpen: 'drums/HiHatOpen(2)_22k.wav', HiHatPedal: 'drums/HiHatPedal(1)_22k.wav', Maracas: 'drums/Maracas(1)_22k.wav', SideStick: 'drums/SideStick(1)_22k.wav', SnareDrum: 'drums/SnareDrum(1)_22k.wav', Tambourine: 'drums/Tambourine(3)_22k.wav', Tom: 'drums/Tom(1)_22k.wav', Triangle: 'drums/Triangle(1)_22k.wav', Vibraslap: 'drums/Vibraslap(1)_22k.wav', WoodBlock: 'drums/WoodBlock(1)_22k.wav' }; var IO = {}; IO.PROJECT_URL = 'https://projects.scratch.mit.edu/internalapi/project/'; IO.ASSET_URL = 'https://cdn.assets.scratch.mit.edu/internalapi/asset/'; if(location.pathname.split("/")[1]== "html"){ IO.SOUNDBANK_URL = '../soundbank/'; }else{ IO.SOUNDBANK_URL = './soundbank/'; } IO.FONTS = { '': 'Helvetica', Scratch: 'Scratch', Donegal: 'Donegal One', Gloria: 'Gloria Hallelujah', Marker: 'Permanent Marker', Mystery: 'Mystery Quest' }; IO.LINE_HEIGHTS = { 'Helvetica': 1.13, 'Scratch': 1.0, 'Donegal One': 1.25, 'Gloria Hallelujah': 1.97, 'Permanent Marker': 1.43, 'Mystery Quest': 1.37 }; IO.ADPCM_STEPS = [7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 19, 21, 23, 25, 28, 31, 34, 37, 41, 45, 50, 55, 60, 66, 73, 80, 88, 97, 107, 118, 130, 143, 157, 173, 190, 209, 230, 253, 279, 307, 337, 371, 408, 449, 494, 544, 598, 658, 724, 796, 876, 963, 1060, 1166, 1282, 1411, 1552, 1707, 1878, 2066, 2272, 2499, 2749, 3024, 3327, 3660, 4026, 4428, 4871, 5358, 5894, 6484, 7132, 7845, 8630, 9493, 10442, 11487, 12635, 13899, 15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794, 32767]; IO.ADPCM_INDEX = [-1, -1, -1, -1, 2, 4, 6, 8, -1, -1, -1, -1, 2, 4, 6, 8]; IO.init = function (request) { IO.projectRequest = request; IO.zip = null; }; IO.parseJSONish = function (json) { if (!/^\s*\{/.test(json)) throw new SyntaxError('Bad JSON'); try { return JSON.parse(json); } catch (e) { } if (/[^,:{}\[\]0-9\.\-+EINaefilnr-uy \n\r\t]/.test(json.replace(/"(\\.|[^"\\])*"/g, ''))) { throw new SyntaxError('Bad JSON'); } return (1, eval)('(' + json + ')'); }; IO.load = function (url, callback, self, type) { var request = new Request; var xhr = new XMLHttpRequest; xhr.open('GET', url, true); xhr.onprogress = function (e) { request.progress(e.loaded, e.total, e.lengthComputable); }; xhr.onload = function () { if (xhr.status === 200) { request.load(xhr.response); } else { request.error(new Error('HTTP ' + xhr.status + ': ' + xhr.statusText)); } }; xhr.onerror = function () { request.error(new Error('XHR Error')); }; xhr.responseType = type || ''; setTimeout(xhr.send.bind(xhr)); if (callback) request.onLoad(callback.bind(self)); return request; }; IO.loadImage = function (url, callback, self) { var request = new Request; var image = new Image; var bForcedBlank = false; image.crossOrigin = 'anonymous'; image.src = url; image.onload = function () { request.load(image); }; image.onerror = function () { // request.error(new Error('Failed to load image: ' + url)); console.log('Failed to load image (forcing blank): ' + url); bForcedBlank = true; image.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAABBJREFUeNpi+P//PwNAgAEACPwC/tuiTRYAAAAASUVORK5CYII="; }; if (callback) request.onLoad(callback.bind(self)); return (bForcedBlank) ? request : request; }; IO.loadScratchr2Project = function (id, callback, self) { var request = new CompositeRequest; IO.init(request); projectID = id; request.defer = true; var url = IO.PROJECT_URL + id + '/get/'; console.log(url); request.add(IO.load(url).onLoad(function (contents) { try { var json = IO.parseJSONish(contents); } catch (e) { request.add(IO.load(url, null, null, 'arraybuffer').onLoad(function (ab) { var request2 = new Request; request.add(request2); request.add(IO.loadSB2Project(ab, function (stage) { request.getResult = function () { return stage; }; request2.load(); })); request.defer = false; })); return; } try { IO.loadProject(json); if (callback) request.onLoad(callback.bind(self)); if (request.isDone) { request.load(new Stage().fromJSON(json)); } else { request.defer = false; request.getResult = function () { return new Stage().fromJSON(json); }; } } catch (e) { request.error(e); } })); return request; }; IO.loadScratchr2ProjectTitle = function (id, callback, self) { var request = new CompositeRequest; request.defer = true; request.add(P.IO.load('https://scratch.mit.edu/projects/' + id + '/').onLoad(function (data) { var m = /<title>\s*(.+?)(\s+on\s+Scratch)?\s*<\/title>/.exec(data); if (callback) request.onLoad(callback.bind(self)); if (m) { var d = document.createElement('div'); d.innerHTML = m[1]; request.load(d.innerText); } else { request.error(new Error('No title')); } })); return request; }; IO.loadJSONProject = function (json, callback, self) { var request = new CompositeRequest; IO.init(request); try { IO.loadProject(json); if (callback) request.onLoad(callback.bind(self)); if (request.isDone) { request.load(new Stage().fromJSON(json)); } else { request.defer = false; request.getResult = function () { return new Stage().fromJSON(json); }; } } catch (e) { request.error(e); } return request; }; IO.loadSB2Project = function (ab, callback, self) { var request = new CompositeRequest; IO.init(request); try { console.log("ZIPPPPPPPPPPPPPPPPPPPPPPPP") console.log(ab) console.log(ab.files != undefined) IO.zip = new JSZip(ab); console.log(IO.zip) outputZip = IO.zip var json = IO.parseJSONish(IO.zip.file('project.json').asText()); IO.loadProject(json); if (callback) request.onLoad(callback.bind(self)); if (request.isDone) { request.load(new Stage().fromJSON(json)); } else { request.defer = false; request.getResult = function () { return new Stage().fromJSON(json); }; } } catch (e) { request.error(e); } return request; }; IO.loadSB2File = function (f, callback, self) { var cr = new CompositeRequest; cr.defer = true; var request = new Request; cr.add(request); var reader = new FileReader; reader.onloadend = function () { cr.defer = true; cr.add(IO.loadSB2Project(reader.result, function (result) { cr.defer = false; cr.getResult = function () { return result; }; cr.update(); })); request.load(); }; reader.onprogress = function (e) { request.progress(e.loaded, e.total, e.lengthComputable); }; reader.readAsArrayBuffer(f); if (callback) cr.onLoad(callback.bind(self)); return cr; }; IO.loadProject = function (data) { IO.loadWavs(); IO.loadArray(data.children, IO.loadObject); IO.loadBase(data); }; IO.wavBuffers = Object.create(null); IO.loadWavs = function () { if (!audioContext) return; for (var name in wavFiles) { if (IO.wavBuffers[name]) { if (IO.wavBuffers[name] instanceof Request) { IO.projectRequest.add(IO.wavBuffers[name]); } } else { IO.projectRequest.add(IO.wavBuffers[name] = IO.loadWavBuffer(name)); } } }; IO.arrayBufferToBase64 = function (buffer) { var bytes = new Uint8Array(buffer); var len = buffer.byteLength; var base64 = ''; for (var i = 0; i < len; i++) { base64 += String.fromCharCode(bytes[i]); } return btoa(base64); } IO.base64ToArrayBuffer = function (base64) { var binaryString = atob(base64); var len = binaryString.length; var bytes = new Uint8Array(len); for (var i = 0; i < len; i++) { bytes[i] = binaryString.charCodeAt(i); } return bytes.buffer; } //IO.base64output = ''; IO.loadWavBuffer = function (name) { var request = new Request; IO.load(IO.SOUNDBANK_URL + wavFiles[name], function (ab) { //Code for exporting soundbank to text file. /* IO.base64output = IO.base64output + 'A.' + name + ' = \'' + IO.arrayBufferToBase64(ab) + '\'\n'; var el = document.createElement("a"); el.setAttribute('href', 'data:application/octet-stream;charset=utf-8,' + encodeURIComponent(IO.base64output)); el.appendChild(document.createTextNode('wav files')); document.body.appendChild(el); console.log(name); */ // console.log(ab) IO.decodeAudio(ab, function (buffer) { IO.wavBuffers[name] = buffer; request.load(); }); }, null, 'arraybuffer').onError(function (err) { request.error(err); }); return request; }; IO.decodeAudio = function (ab, cb) { if (audioContext) { IO.decodeADPCMAudio(ab, function (err, buffer) { if (buffer) return setTimeout(function () { cb(buffer) }); var p = audioContext.decodeAudioData(ab, function (buffer) { cb(buffer); }, function (err2) { console.warn(err, err2); cb(null); }); if (p.catch) p.catch(function () { }); }); } else { setTimeout(cb); } }; IO.decodeADPCMAudio = function (ab, cb) { var dv = new DataView(ab); if (dv.getUint32(0) !== 0x52494646 || dv.getUint32(8) !== 0x57415645) { return cb(new Error('Unrecognized audio format')); } var blocks = {}; var i = 12, l = dv.byteLength - 8; while (i < l) { blocks[String.fromCharCode( dv.getUint8(i), dv.getUint8(i + 1), dv.getUint8(i + 2), dv.getUint8(i + 3))] = i; i += 8 + dv.getUint32(i + 4, true); } var format = dv.getUint16(20, true); var channels = dv.getUint16(22, true); var sampleRate = dv.getUint32(24, true); var byteRate = dv.getUint32(28, true); var blockAlign = dv.getUint16(32, true); var bitsPerSample = dv.getUint16(34, true); if (format === 17) { var samplesPerBlock = dv.getUint16(38, true); var blockSize = ((samplesPerBlock - 1) / 2) + 4; var frameCount = dv.getUint32(blocks.fact + 8, true); var buffer = audioContext.createBuffer(1, frameCount, sampleRate); var channel = buffer.getChannelData(0); var sample, index = 0; var step, code, delta; var lastByte = -1; var offset = blocks.data + 8; i = offset; var j = 0; while (true) { if ((((i - offset) % blockSize) == 0) && (lastByte < 0)) { if (i >= dv.byteLength) break; sample = dv.getInt16(i, true); i += 2; index = dv.getUint8(i); i += 1; i++; if (index > 88) index = 88; channel[j++] = sample / 32767; } else { if (lastByte < 0) { if (i >= dv.byteLength) break; lastByte = dv.getUint8(i); i += 1; code = lastByte & 0xf; } else { code = (lastByte >> 4) & 0xf; lastByte = -1; } step = IO.ADPCM_STEPS[index]; delta = 0; if (code & 4) delta += step; if (code & 2) delta += step >> 1; if (code & 1) delta += step >> 2; delta += step >> 3; index += IO.ADPCM_INDEX[code]; if (index > 88) index = 88; if (index < 0) index = 0; sample += (code & 8) ? -delta : delta; if (sample > 32767) sample = 32767; if (sample < -32768) sample = -32768; channel[j++] = sample / 32768; } } return cb(null, buffer); } cb(new Error('Unrecognized WAV format ' + format)); }; IO.loadBase = function (data) { data.scripts = data.scripts || []; data.costumes = IO.loadArray(data.costumes, IO.loadCostume); data.sounds = IO.loadArray(data.sounds, IO.loadSound); data.variables = data.variables || []; data.lists = data.lists || []; //console.log(data); //pf temp (dirty) hack for ASCII hack lists... if (data && data.lists && data.lists.length) { for (var ha = data.lists.length; ha--;) { if (data.lists[ha].listName == "ASCII" && data.lists[ha].contents.length != 133) { // 2nd part ugh (skips GB ROM) !!! ASCII = true; console.log("ASCII hack detected."); } } } }; //process an array of several inputs (such as costumes, sounds, ...) IO.loadArray = function (data, process) { if (!data) return []; for (var i = 0; i < data.length; i++) { process(data[i]); } return data; }; IO.loadObject = function (data) { if (!data.cmd && !data.listName) { IO.loadBase(data); } }; IO.loadCostume = function (data) { IO.loadMD5(data.baseLayerMD5, data.baseLayerID, function (asset) { data.$image = asset; }, false); if (data.textLayerMD5) { IO.loadMD5(data.textLayerMD5, data.textLayerID, function (asset) { data.$text = asset; }, false); } }; IO.loadSound = function (data) { IO.loadMD5(data.md5, data.soundID, function (asset) { data.$buffer = asset; }, true); }; IO.fixSVG = function (svg, element) { if (element.nodeType !== 1) return element; if (element.nodeName.slice(0, 4).toLowerCase() === 'svg:') { /* var newElement = document.createElementNS('https://www.w3.org/2000/svg', element.localName); var attributes = element.attributes; var newAttributes = newElement.attributes; for (var i = attributes.length; i--;) { newAttributes.setNamedItemNS(attributes[i].cloneNode()); } while (element.firstChild) { newElement.appendChild(element.firstChild); } element = newElement; */ } //Embed fonts in svg: if (element.nodeName === 'svg') { var defs = document.createElement('defs'); element.appendChild(defs); var style = document.createElement('style'); defs.appendChild(style); var embedText = ''; if (element.querySelector('[font-family="Scratch"]')) { embedText += '@font-face{\n'; embedText += 'font-family: Scratch;\nsrc: url(\"data:application/x-font-ttf;base64,'; embedText += F.Scratch; embedText += '\");\n'; embedText += '}\n'; } if (element.querySelector('[font-family="Donegal"]')) { embedText += '@font-face{\n'; embedText += 'font-family: Donegal One;\nsrc: url(\"data:application/x-font-ttf;base64,'; embedText += F.Donegal; embedText += '\");\n'; embedText += '}\n'; } if (element.querySelector('[font-family="Gloria"]')) { embedText += '@font-face{\n'; embedText += 'font-family: Gloria Hallelujah;\nsrc: url(\"data:application/x-font-ttf;base64,'; embedText += F.Gloria; embedText += '\");\n'; embedText += '}\n'; } if (element.querySelector('[font-family="Marker"]')) { embedText += '@font-face{\n'; embedText += 'font-family: Permanent Marker;\nsrc: url(\"data:application/x-font-ttf;base64,'; embedText += F.Marker; embedText += '\");\n'; embedText += '}\n'; } if (element.querySelector('[font-family="Mystery"]')) { embedText += '@font-face{\n'; embedText += 'font-family: Mystery Quest;\nsrc: url(\"data:application/x-font-ttf;base64,'; embedText += F.Mystery; embedText += '\");\n'; embedText += '}\n'; } var info = document.createTextNode(embedText); style.appendChild(info); } if (element.nodeName === 'text') { var font = element.getAttribute('font-family') || ''; font = IO.FONTS[font] || font; if (font) { element.setAttribute('font-family', font); if (font === 'Helvetica') element.style.fontWeight = 'bold'; } var size = +element.getAttribute('font-size'); if (!size) { element.setAttribute('font-size', size = 18); } // Set default fill for svgs that the Scratch exporter forgets... if (element.getAttribute('fill') === 'none') element.setAttribute('fill', '#7F7F7F'); //TODO: Find out what actual values have to be put here. //element.setAttribute('x', 0); //element.setAttribute('y', size*IO.LINE_HEIGHTS[font]); var bb = element ? element.getBBox() : null; var x = 4 - .6 * element.transform.baseVal.consolidate().matrix.a; var y = (element.getAttribute('y') - bb.y) * 1.1; element.setAttribute('x', x); element.setAttribute('y', y); var lines = element.textContent.split('\n'); if (lines.length > 1) { element.textContent = lines[0]; var lineHeight = IO.LINE_HEIGHTS[font] || 1; for (var i = 1, l = lines.length; i < l; i++) { var tspan = document.createElementNS("http://www.w3.org/2000/svg", 'tspan'); tspan.textContent = lines[i]; tspan.setAttribute('x', x); tspan.setAttribute('y', y + size * i * lineHeight); element.appendChild(tspan); } } } else if ((element.hasAttribute('x') || element.hasAttribute('y')) && element.hasAttribute('transform')) { element.setAttribute('x', 0); element.setAttribute('y', 0); } if (element.nodeName === 'linearGradient') { element.setAttribute('id', element.getAttribute('id') + svg.getAttribute('id')); element.setAttribute('gradientUnits', 'objectBoundingBox'); //I really don't know what kind of algorithm scratch is following here, so this is just guesswork. var x1 = Number(element.getAttribute('x1')); var x2 = Number(element.getAttribute('x2')); var y1 = Number(element.getAttribute('y1')); var y2 = Number(element.getAttribute('y2')); if (x1 === x2) { x1 = 0; x2 = 0; } else if (x1 < x2) { x1 = 0; x2 = 1; } else { x1 = 1; x2 = 0; } if (y1 === y2) { y1 = 0; y2 = 0; } else if (y1 < y2) { y1 = 0; y2 = 1; } else { y1 = 1; y2 = 0; } element.setAttribute('x1', x1); element.setAttribute('x2', x2); element.setAttribute('y1', y1); element.setAttribute('y2', y2); } if (element.nodeName === 'radialGradient') { element.setAttribute('id', element.getAttribute('id') + svg.getAttribute('id')); element.setAttribute('gradientUnits', 'objectBoundingBox'); } if (element.getAttribute('fill') ? element.getAttribute('fill').indexOf("url") > -1 : false) { element.setAttribute('fill', element.getAttribute('fill').replace(/.$/, svg.getAttribute('id'))); } if (element.getAttribute('stroke') ? element.getAttribute('stroke').indexOf("url") > -1 : false) { element.setAttribute('stroke', element.getAttribute('stroke').replace(/.$/, svg.getAttribute('id'))); } [].forEach.call(element.childNodes, function (child) { var newChild = IO.fixSVG(svg, child); if (newChild !== child) { element.replaceChild(newChild, child); } }); return element; }; IO.loadMD5 = function (md5, id, callback, isAudio) { if (IO.zip) { var f = isAudio ? IO.zip.file(id + '.wav') : IO.zip.file(id + '.gif') || IO.zip.file(id + '.png') || IO.zip.file(id + '.jpg') || IO.zip.file(id + '.svg'); md5 = f.name; } //get file extension var ext = md5.split('.').pop(); //special handling for svg if (ext === 'svg') { var cb = function (source) { var div = document.createElement('div'); //div.innerHTML = source; //var svg = div.getElementsByTagName('svg')[0]; //div.innerHTML = source.replace(/(<\/?)svg:/g, '$1'); //var svg = div.firstElementChild; var parser = new DOMParser(); var doc = parser.parseFromString(source, 'image/svg+xml'); var svg = doc.documentElement; doc = parser.parseFromString('<body>' + source, 'text/html'); svg = doc.querySelector('svg'); svg.id = 'svg' + md5.split('.')[0]; if (svg.getAttribute('width') === '0' || svg.getAttribute('height') === '0') { svg = document.createElementNS('https://www.w3.org/2000/svg', svg.localName); } else { document.body.appendChild(svg); svg = IO.fixSVG(svg, svg); } //Some svg tags are completely emty for some reason, so we simply ignore these if (!svg.style) return; //When viewBox doesn't exist yet, some browsers don't automatically create an object, //so we need to do that manually. (SVGRect doesn't seem to have a constructor either) var viewBox = svg.viewBox && svg.viewBox.baseVal ? svg.viewBox.baseVal : { width: 0, height: 0, x: 0, y: 0 }; if (svg.querySelector("path") || svg.querySelector("image")) { var bb = svg.getBBox(); viewBox.width = svg.width.baseVal.value = Math.ceil(bb.x + bb.width + 1); viewBox.height = svg.height.baseVal.value = Math.ceil(bb.y + bb.height + 1); viewBox.x = 0; viewBox.y = 0; } //get the viewbox of the svg if (viewBox && (viewBox.x || viewBox.y)) { //svg.width.baseVal.value = viewBox.width - viewBox.x; //svg.height.baseVal.value = viewBox.height - viewBox.y; //viewBox.x = 0; //viewBox.y = 0; //viewBox.width = 0; //viewBox.height = 0; var bb = svg.getBBox(); viewBox.width = svg.width.baseVal.value = Math.ceil(bb.x + bb.width + 1); viewBox.height = svg.height.baseVal.value = Math.ceil(bb.y + bb.height + 1); viewBox.x = 0; viewBox.y = 0; } //IO.fixSVG(svg, svg); //while (div.firstChild) div.removeChild(div.lastChild); //div.appendChild(svg); //svg.style.visibility = 'visible'; //svg.style.cssText = ''; svg.style['image-rendering'] = '-moz-crisp-edges'; svg.style['image-rendering'] = 'pixelated'; //svg.style.overflow = 'visible'; //svg.style.width = '100%'; var request = new Request; var image = new Image; //serialize the svg code to a single compact string var newSource = (new XMLSerializer()).serializeToString(svg) //convert the svg to a base-64 string image.src = 'data:image/svg+xml;base64,' + btoa(unescape(encodeURIComponent(newSource))); //svg.style.display = 'none'; document.body.removeChild(svg); image.onload = function () { if (callback) callback(image); request.load(); }; image.onerror = function (e) { //console.error(e, image); console.log(image.src); console.error(md5, image.src); request.error(new Error()); }; IO.projectRequest.add(request); }; if (IO.zip) { cb(f.asText()); } else { IO.projectRequest.add(IO.load(IO.ASSET_URL + md5 + '/get/', cb)); } } else if (ext === 'wav') { var request = new Request; var cb = function (ab) { IO.decodeAudio(ab, function (buffer) { callback(buffer); request.load(buffer); }); } IO.projectRequest.add(request); if (IO.zip) { var audio = new Audio; var ab = f.asArrayBuffer(); cb(ab); } else { IO.projectRequest.add(IO.load(IO.ASSET_URL + md5 + '/get/', cb, null, 'arraybuffer')); } } else { if (IO.zip) { var request = new Request; var image = new Image; image.onload = function () { if (callback) callback(image); request.load(); }; image.src = 'data:image/' + (ext === 'jpg' ? 'jpeg' : ext) + ';base64,' + btoa(f.asBinary()); IO.projectRequest.add(request); } else { IO.projectRequest.add( IO.loadImage(IO.ASSET_URL + md5 + '/get/', function (result) { callback(result); })); } } }; var Base = function () { this.isClone = false; this.costumes = []; this.currentCostumeIndex = 0; this.objName = ''; this.instrument = 0; this.volume = 1; this.soundRefs = Object.create(null); this.sounds = []; this.vars = Object.create(null); this.watchers = Object.create(null); this.lists = Object.create(null); this.listsInfo = Object.create(null); this.procedures = {}; this.listeners = { whenClicked: [], whenCloned: [], whenGreenFlag: [], whenIReceive: {}, whenKeyPressed: [], whenSceneStarts: [], whenSensorGreaterThan: [] }; for (var i = 0; i < 128; i++) { this.listeners.whenKeyPressed.push([]); } this.fns = []; this.scripts = []; this.filters = { color: 0, fisheye: 0, whirl: 0, pixelate: 0, mosaic: 0, brightness: 0, ghost: 0 }; }; Base.prototype.fromJSON = function (data) { cloudManager(data.variables, data.lists); this.objName = data.objName; this.scripts = data.scripts; this.currentCostumeIndex = data.currentCostumeIndex || 0; this.costumes = data.costumes.map(function (d, i) { return new Costume(d, i, this); }, this); this.addSounds(data.sounds); //console.log(sulfCloudVars) this.addLists(data.lists); this.addVariables(data.variables); return this; }; Base.prototype.addSounds = function (sounds) { for (var i = 0; i < sounds.length; i++) { var s = new Sound(sounds[i]); this.sounds.push(s); this.soundRefs[s.name] = s; } }; Base.prototype.addVariables = function (variables) { if (firstRunSulfVars == true) { loadCookie(); firstRunSulfVars = false; } for (var i = 0; i < variables.length; i++) { //console.log(variables[i].name.substring(variables[i].name.indexOf(".") + 1, variables[i].name.indexOf(".") + 3)) if (variables[i].name.substring(variables[i].name.indexOf(".") + 1, variables[i].name.indexOf(".") + 3) == 'p.') { console.log(variables[i]) if (sulfCookieVars[variables[i].name] != undefined) { this.vars[variables[i].name] = sulfCookieVars[variables[i].name]; } else { this.vars[variables[i].name] = variables[i].value; sulfCookieVars[variables[i].name] = variables[i].value; } } else if (variables[i].name.substring(variables[i].name.indexOf(".") + 1, variables[i].name.indexOf(".") + 3) == 'c.' || variables[i].name.charAt(0) == '☁') { console.log(variables[i].name); if (typeof sulfCloudVars[variables[i].name] == 'undefined') { this.vars[variables[i].name] = variables[i].value; sulfCloudVars[variables[i].name] = variables[i].value; } else { this.vars[variables[i].name] = sulfCloudVars[variables[i].name]; } } else { this.vars[variables[i].name] = variables[i].value; } } //console.log(this.vars) }; Base.prototype.addLists = function (lists) { // console.log(sulfCloudVars) for (var i = 0; i < lists.length; i++) { if (lists[i].isPeristent) { throw new Error('Cloud lists are not supported'); } if (lists[i].listName.includes(".c")) { //console.log(lists[i].listName) //console.log(typeof sulfCloudVars[lists[i].listName]) if (typeof sulfCloudVars[lists[i].listName] == 'undefined') { this.lists[lists[i].listName] = lists[i].contents; sulfCloudVars[lists[i].listName] = lists[i].contents; } else { this.lists[lists[i].listName] = sulfCloudVars[lists[i].listName]; } } else { this.lists[lists[i].listName] = lists[i].contents; } // TODO list watchers this.listsInfo[lists[i].listName] = lists[i].x + "," + lists[i].y + "," + lists[i].width + "," + lists[i].height + "," + lists[i].visible; } }; Base.prototype.showVariable = function (name, visible) { var watcher = this.watchers[name]; var stage = this.stage; if (!watcher) { watcher = this.watchers[name] = new P.Watcher(stage); watcher.x = stage.defaultWatcherX; watcher.y = stage.defaultWatcherY; stage.defaultWatcherY += 26; if (stage.defaultWatcherY >= 450) { stage.defaultWatcherY = 10; stage.defaultWatcherX += 150; } watcher.target = this; watcher.label = (watcher.target === stage ? '' : watcher.target.objName + ': ') + name; watcher.param = name; stage.children.push(watcher); } else { var i = stage.children.indexOf(watcher); if (i !== stage.children.length - 1) { stage.children.splice(i, 1); stage.children.push(watcher); } } watcher.visible = visible; }; Base.prototype.showNextCostume = function () { this.currentCostumeIndex = (this.currentCostumeIndex + 1) % this.costumes.length; if (this.isStage) this.updateBackdrop(); if (this.saying) this.updateBubble(); }; Base.prototype.showPreviousCostume = function () { var length = this.costumes.length; this.currentCostumeIndex = (this.currentCostumeIndex + length - 1) % length; if (this.isStage) this.updateBackdrop(); if (this.saying) this.updateBubble(); }; Base.prototype.getCostumeName = function () { return this.costumes[this.currentCostumeIndex] ? this.costumes[this.currentCostumeIndex].costumeName : ''; }; Base.prototype.setCostume = function (costume) { if (typeof costume == 'string') { for (var i = 0; i < this.costumes.length; i++) { if (this.costumes[i].costumeName === costume) { this.currentCostumeIndex = i; if (this.isStage) this.updateBackdrop(); if (this.saying) this.updateBubble(); return; } } if (costume === (this.isSprite ? 'next costume' : 'next backdrop')) { this.showNextCostume(); return; } if (costume === (this.isSprite ? 'previous costume' : 'previous backdrop')) { this.showPreviousCostume(); return; } } if (!isNaN(parseInt(costume))) { var i = (Math.round(Number(costume)) - 1) % this.costumes.length; if (i < 0) i += this.costumes.length; this.currentCostumeIndex = i; if (this.isStage) this.updateBackdrop(); if (this.saying) this.updateBubble(); } }; Base.prototype.setFilter = function (name, value) { var min = 0; var max = 100; switch (name) { case 'whirl': case 'fisheye': case 'brightness': case 'pixelate': // absolute value case 'mosaic': // absolute value min = -Infinity; max = Infinity; break; case 'color': value = value % 200; if (value < 0) value += 200; max = 200; break; } if (value < min) value = min; if (value > max) value = max; value = Math.min(max, Math.max(min, value)); this.filters[name] = value; if (this.isStage) this.updateFilters(); }; Base.prototype.changeFilter = function (name, value) { this.setFilter(name, this.filters[name] + value); }; Base.prototype.resetFilters = function () { this.filters = { color: 0, fisheye: 0, whirl: 0, pixelate: 0, mosaic: 0, brightness: 0, ghost: 0 }; }; Base.prototype.getSound = function (name) { if (typeof name === 'string') { var s = this.soundRefs[name]; if (s) return s; name = +name; } var l = this.sounds.length; if (l && typeof name === 'number' && name === name) { var i = Math.round(name - 1) % l; if (i < 0) i += l; return this.sounds[i]; } }; Base.prototype.stopSounds = function () { if (this.node) { this.node.disconnect(); this.node = null; } for (var i = this.sounds.length; i--;) { var s = this.sounds[i]; if (s.node) { s.node.disconnect(); s.node = null; } } }; Base.prototype.ask = function (question) { var stage = this.stage; if (question) { if (this.isSprite && this.visible) { this.say(question); stage.promptTitle.style.display = 'none'; } else { stage.promptTitle.style.display = 'block'; stage.promptTitle.textContent = question; } } else { stage.promptTitle.style.display = 'none'; } stage.hidePrompt = false; stage.prompter.style.display = 'block'; stage.prompt.value = ''; stage.prompt.focus(); }; var Stage = function () { this.stage = this; Stage.parent.call(this); this.children = []; this.defaultWatcherX = 10; this.defaultWatcherY = 10; this.info = {}; this.answer = ''; this.promptId = 0; this.nextPromptId = 0; this.tempoBPM = 60; this.videoAlpha = 1; this.zoomX = 1; this.zoomY = 1; this.maxZoomX = SCALE; this.maxZoomY = SCALE; this.baseNow = 0; this.baseTime = 0; this.timerStart = 0; this.keys = [] this.keys[128] = 0; this.rawMouseX = 0; this.rawMouseY = 0; this.mouseX = 0; this.mouseY = 0; this.mousePressed = false; this.alpha = 0; this.beta = 1; this.gamma = 2; this.root = document.createElement('div'); this.root.style.position = 'absolute'; this.root.style.overflow = 'hidden'; this.root.style.width = '480px'; this.root.style.height = '360px'; this.root.style.fontSize = '10px'; this.root.style.background = '#fff'; this.root.style.WebkitUserSelect = this.root.style.MozUserSelect = this.root.style.MSUserSelect = this.root.style.WebkitUserSelect = 'none'; /******************** BACKDROP Canvas ********************/ this.backdropCanvas = document.createElement('canvas'); this.root.appendChild(this.backdropCanvas); this.backdropCanvas.width = SCALE * 480; this.backdropCanvas.height = SCALE * 360; this.backdropCanvas.setAttribute('id', 'backdropCanvas'); //this.backdropContext = this.backdropCanvas.getContext('2d'); this.backdropContext = this.backdropCanvas.getContext('webgl') || this.backdropCanvas.getContext('experimental-webgl'); if (!this.backdropContext) P.showWebGLError('backdropContext could not be initialized.'); this.backdropContext.imgShader = initShaderProgram(this.backdropContext, Shader.imgVert, Shader.imgFrag); this.backdropContext.imgShaderInfo = { program: this.backdropContext.imgShader, attribLocations: { position: this.backdropContext.getAttribLocation(this.backdropContext.imgShader, 'position'), texcoord: this.backdropContext.getAttribLocation(this.backdropContext.imgShader, 'texcoord'), }, uniformLocations: { matrix: this.backdropContext.getUniformLocation(this.backdropContext.imgShader, 'u_matrix'), texture: this.backdropContext.getUniformLocation(this.backdropContext.imgShader, 'u_texture'), texSize: this.backdropContext.getUniformLocation(this.backdropContext.imgShader, 'texSize'), colorEffect: this.backdropContext.getUniformLocation(this.backdropContext.imgShader, 'colorEffect'), colorMatrix: this.backdropContext.getUniformLocation(this.backdropContext.imgShader, 'colorMatrix'), texEffect: this.backdropContext.getUniformLocation(this.backdropContext.imgShader, 'texEffect'), }, blendSource: this.backdropContext.SRC_ALPHA, blendDest: this.backdropContext.ONE_MINUS_SRC_ALPHA, } this.backdropContext.imgBuffers = initImgBuffers(this.backdropContext); /******************** PEN Canvas ********************/ this.penCanvas = document.createElement('canvas'); this.root.appendChild(this.penCanvas); this.penCanvas.width = SCALE * 480; this.penCanvas.height = SCALE * 360; this.penCanvas.setAttribute('id', 'penCanvas'); //this.penCanvas.setAttribute('style', 'display: none'); //this.penContext = this.penCanvas.getContext('2d'); //this.penContext.lineCap = 'butt'; //this.penContext.scale(SCALE, SCALE); this.penContext = this.penCanvas.getContext('webgl', { preserveDrawingBuffer: true }) || this.penCanvas.getContext('experimental-webgl', { preserveDrawingBuffer: true }); if (!this.penContext) P.showWebGLError('penContext could not be initialized.'); // Scene is automatically redrawn when arrays are full. // Thus, we don't need to call new float32Array() when creating the VBOs, // which would cause stutter due to garbage collection. // // Possibly tweak values for optimal performance. this.penCoords = new Float32Array(65536); this.penLines = new Float32Array(32768); this.penColors = new Float32Array(65536); this.penCoordIndex = 0; this.penLineIndex = 0; this.penColorIndex = 0; // Load and compile shaders this.penContext.penShader = initShaderProgram(this.penContext, Shader.penVert, Shader.penFrag); this.penContext.penShaderInfo = { program: this.penContext.penShader, attribLocations: { vertexData: this.penContext.getAttribLocation(this.penContext.penShader, 'vertexData'), lineData: this.penContext.getAttribLocation(this.penContext.penShader, 'lineData'), colorData: this.penContext.getAttribLocation(this.penContext.penShader, 'colorData'), }, uniformLocations: { projectionMatrix: this.penContext.getUniformLocation(this.penContext.penShader, 'uProjectionMatrix'), modelViewMatrix: this.penContext.getUniformLocation(this.penContext.penShader, 'uModelViewMatrix'), }, }; this.penContext.penBuffers = { position: this.penContext.createBuffer(), line: this.penContext.createBuffer(), color: this.penContext.createBuffer(), }; this.penContext.imgShader = initShaderProgram(this.penContext, Shader.imgVert, Shader.imgFrag); this.penContext.imgShaderInfo = { program: this.penContext.imgShader, attribLocations: { position: this.penContext.getAttribLocation(this.penContext.imgShader, 'position'), texcoord: this.penContext.getAttribLocation(this.penContext.imgShader, 'texcoord'), }, uniformLocations: { matrix: this.penContext.getUniformLocation(this.penContext.imgShader, 'u_matrix'), texture: this.penContext.getUniformLocation(this.penContext.imgShader, 'u_texture'), texSize: this.penContext.getUniformLocation(this.penContext.imgShader, 'texSize'), colorEffect: this.penContext.getUniformLocation(this.penContext.imgShader, 'colorEffect'), colorMatrix: this.penContext.getUniformLocation(this.penContext.imgShader, 'colorMatrix'), texEffect: this.penContext.getUniformLocation(this.penContext.imgShader, 'texEffect'), }, blendSource: this.penContext.SRC_ALPHA, blendDest: this.penContext.ONE_MINUS_SRC_ALPHA, } this.penContext.imgBuffers = initImgBuffers(this.penContext); /******************** COSTUME Canvas ********************/ this.canvas = document.createElement('canvas'); this.root.appendChild(this.canvas); this.canvas.width = SCALE * 480; this.canvas.height = SCALE * 360; this.canvas.setAttribute('id', 'canvas'); //this.context = this.canvas.getContext('2d'); this.context = this.canvas.getContext('webgl') || this.canvas.getContext('experimental-webgl'); if (!this.context) P.showWebGLError('context could not be initialized.'); this.context.imgShader = initShaderProgram(this.context, Shader.imgVert, Shader.imgFrag); this.context.imgShaderInfo = { program: this.context.imgShader, attribLocations: { position: this.context.getAttribLocation(this.context.imgShader, 'position'), texcoord: this.context.getAttribLocation(this.context.imgShader, 'texcoord'), }, uniformLocations: { matrix: this.context.getUniformLocation(this.context.imgShader, 'u_matrix'), texture: this.context.getUniformLocation(this.context.imgShader, 'u_texture'), texSize: this.context.getUniformLocation(this.context.imgShader, 'texSize'), colorEffect: this.context.getUniformLocation(this.context.imgShader, 'colorEffect'), colorMatrix: this.context.getUniformLocation(this.context.imgShader, 'colorMatrix'), texEffect: this.context.getUniformLocation(this.context.imgShader, 'texEffect'), }, blendSource: this.context.SRC_ALPHA, blendDest: this.context.ONE_MINUS_SRC_ALPHA, } this.context.imgBuffers = initImgBuffers(this.context); /******************** COLLISION Canvas ********************/ this.glCollisionCanvas = document.createElement('canvas'); this.root.appendChild(this.glCollisionCanvas); this.glCollisionCanvas.width = 480; this.glCollisionCanvas.height = 360; this.glCollisionCanvas.setAttribute('id', 'glCollisionCanvas'); this.glCollisionCanvas.setAttribute('style', 'display: none;'); this.glCollisionContext = this.glCollisionCanvas.getContext('webgl', { preserveDrawingBuffer: true }) || this.glCollisionCanvas.getContext('experimental-webgl', { preserveDrawingBuffer: true }); if (!this.glCollisionContext) P.showWebGLError('glCollisionContext could not be initialized.'); //Scissor test for faster collision detection. this.stage.glCollisionContext.enable(this.stage.glCollisionContext.SCISSOR_TEST); this.stage.glCollisionContext.scissor(0, 0, 480, 360); this.glCollisionContext.imgShader = initShaderProgram(this.glCollisionContext, Shader.imgVert, Shader.imgFrag); this.glCollisionContext.imgShaderInfo = { program: this.glCollisionContext.imgShader, attribLocations: { position: this.glCollisionContext.getAttribLocation(this.glCollisionContext.imgShader, 'position'), texcoord: this.glCollisionContext.getAttribLocation(this.glCollisionContext.imgShader, 'texcoord'), }, uniformLocations: { matrix: this.glCollisionContext.getUniformLocation(this.glCollisionContext.imgShader, 'u_matrix'), texture: this.glCollisionContext.getUniformLocation(this.glCollisionContext.imgShader, 'u_texture'), texSize: this.glCollisionContext.getUniformLocation(this.glCollisionContext.imgShader, 'texSize'), colorEffect: this.glCollisionContext.getUniformLocation(this.glCollisionContext.imgShader, 'colorEffect'), colorMatrix: this.glCollisionContext.getUniformLocation(this.glCollisionContext.imgShader, 'colorMatrix'), texEffect: this.glCollisionContext.getUniformLocation(this.glCollisionContext.imgShader, 'texEffect'), }, blendSource: this.glCollisionContext.SRC_ALPHA, blendDest: this.glCollisionContext.ONE_MINUS_SRC_ALPHA, } this.glCollisionContext.imgBuffers = initImgBuffers(this.glCollisionContext); this.glCollisionContext.touchingShader = initShaderProgram(this.glCollisionContext, Shader.touchingVert, Shader.touchingFrag); this.glCollisionContext.touchingShaderInfo = { program: this.glCollisionContext.touchingShader, attribLocations: { position: this.glCollisionContext.getAttribLocation(this.glCollisionContext.touchingShader, 'position'), texcoord: this.glCollisionContext.getAttribLocation(this.glCollisionContext.touchingShader, 'texcoord'), }, uniformLocations: { matrix: this.glCollisionContext.getUniformLocation(this.glCollisionContext.touchingShader, 'u_matrix'), texture: this.glCollisionContext.getUniformLocation(this.glCollisionContext.touchingShader, 'u_texture'), tColor: this.glCollisionContext.getUniformLocation(this.glCollisionContext.touchingShader, 'tColor'), texSize: this.glCollisionContext.getUniformLocation(this.glCollisionContext.touchingShader, 'texSize'), colorEffect: this.glCollisionContext.getUniformLocation(this.glCollisionContext.touchingShader, 'colorEffect'), colorMatrix: this.glCollisionContext.getUniformLocation(this.glCollisionContext.touchingShader, 'colorMatrix'), texEffect: this.glCollisionContext.getUniformLocation(this.glCollisionContext.touchingShader, 'texEffect'), }, blendSource: this.glCollisionContext.DST_ALPHA, blendDest: this.glCollisionContext.ZERO, } this.canvas.tabIndex = 0; this.canvas.style.outline = 'none'; this.backdropCanvas.style.position = this.penCanvas.style.position = this.canvas.style.position = this.glCollisionCanvas.style.position = 'absolute'; this.backdropCanvas.style.width = this.penCanvas.style.width = this.canvas.style.width = this.glCollisionCanvas.style.width = '480px'; this.backdropCanvas.style.height = this.penCanvas.style.height = this.canvas.style.height = this.glCollisionCanvas.style.height = '360px'; //this.glCollisionCanvas.style.width = '240px'; //this.glCollisionCanvas.style.height = '180px'; this.backdropContext.clearColor(0.0, 0.0, 0.0, 0.0); this.penContext.clearColor(0.0, 0.0, 0.0, 0.0); this.context.clearColor(0.0, 0.0, 0.0, 0.0); this.glCollisionContext.clearColor(0.0, 0.0, 0.0, 0.0); // hardware acceleration this.root.style.WebkitTransform = 'translateZ(0)'; // added old way here and split... this.root.addEventListener('keypress', function (e) { // pf shift symbols helper. if (ASCII) { if (e.altKey || e.metaKey || e.keyCode === 27) { // tjvr //return; // PF allow e.ctrlKey || allow e.shiftkey } var key = e.keyCode; //console.log(this.keys[key]); // debug only if (e.target === this.canvas && !this.keys[key]) { ShiftKey = false; if (key > 64 && key < 91) { ShiftKey = true; } this.keys[key] = true; // mandatory for symbols self.key = key; // resets symbol keys e.stopPropagation(); e.preventDefault(); //this.trigger('whenKeyPressed', key); // * } } else { // TODO: as before (not needed) } }.bind(this)); this.root.addEventListener('keydown', function (e) { // pf inc. arrow keys and shift key mapper if (ASCII) { if (e.altKey || e.metaKey || e.keyCode === 27) { // tjvr return; // PF allow e.ctrlKey || } var key = e.keyCode; //console.log(key); // debug only e.stopPropagation(); if (e.target === this.canvas && !this.keys[key] && "16.17.37.38.39.40".match(key.toString())) { // if (key == 16) key = 128; // (Shift key hack) was 0 //if (key == 17) key = 0; if (key == 37) key = 28; if (key == 39) key = 29; if (key == 38) key = 30; if (key == 40) key = 31; this.keys[key] = true; // pf done in keypress? self.key = key; e.preventDefault(); if (ShiftKey) { //console.log("Shift Pressed\n"); // debug only this.trigger('whenKeyPressed', 128); //this.trigger('whenKeyPressed', key); } else { this.trigger('whenKeyPressed', key); } } } else { // TODO: as before if (e.altKey || e.metaKey || e.keyCode === 27) { // tjvr return; // PF allow e.ctrlKey || } //console.log(e.keyCode)+"\n"; this.keys[e.keyCode] = true; e.stopPropagation(); if (e.target === this.canvas) { e.preventDefault(); this.trigger('whenKeyPressed', e.keyCode); } } }.bind(this)); this.root.addEventListener('keyup', function (e) { if (ASCII) { var key = e.keyCode; if (key == 16) key = 128; //console.log(key); // db2 this.keys[key] = false; if (key > 64 && key < 91) this.keys[key + 32] = false; // was +32 this.keys[self.key] = false; if (ShiftKey) { //this.keys[128] = false; } else { //console.log (self.key + " :: " + key); // debug only } e.stopPropagation(); if (e.target === this.canvas) { e.preventDefault(); } } else { // TODO: as before this.keys[e.keyCode] = false; e.stopPropagation(); if (e.target === this.canvas) { e.preventDefault(); } } }.bind(this)); //Changed this to include both event listeners, otherwise Hybrid laptops may not work. Possibly add extra option for hybrids instead. //if (hasTouchEvents) { document.addEventListener('touchstart', function (e) { this.mousePressed = true; for (var i = 0; i < e.changedTouches.length; i++) { this.updateMouse(e.changedTouches[i]); if (e.target === this.canvas) { this.clickMouse(); } } if (e.target === this.canvas) e.preventDefault(); }.bind(this)); document.addEventListener('touchmove', function (e) { this.updateMouse(e.changedTouches[0]); }.bind(this)); document.addEventListener('touchend', function (e) { this.releaseMouse(); }.bind(this)); // Eventlistener for starting audio on mobile. document.addEventListener('touchend', function (e) { if (!audioContext.mInit) { audioContext.mInit = true; var osc = audioContext.createOscillator(); osc.frequency.value = 0; osc.connect(audioContext.destination); osc.start(0); osc.stop(0); } }.bind(this)); //if(hasTouchEvents){ //} else { document.addEventListener('mousedown', function (e) { this.updateMouse(e); this.mousePressed = true; if (e.target === this.canvas) { this.clickMouse(); e.preventDefault(); this.canvas.focus(); } }.bind(this)); document.addEventListener('mousemove', function (e) { this.updateMouse(e); }.bind(this)); document.addEventListener('mouseup', function (e) { this.updateMouse(e); this.releaseMouse(); }.bind(this)); //} this.prompter = document.createElement('div'); this.root.appendChild(this.prompter); this.prompter.style.zIndex = '1'; this.prompter.style.pointerEvents = 'auto'; this.prompter.style.position = 'absolute'; this.prompter.style.left = this.prompter.style.right = '1.4em'; this.prompter.style.bottom = '.6em'; this.prompter.style.padding = '.5em 3.0em .5em .5em'; this.prompter.style.border = '.3em solid rgb(46, 174, 223)'; this.prompter.style.borderRadius = '.8em'; this.prompter.style.background = '#fff'; this.prompter.style.display = 'none'; this.promptTitle = document.createElement('div'); this.prompter.appendChild(this.promptTitle); this.promptTitle.textContent = ''; this.promptTitle.style.cursor = 'default'; this.promptTitle.style.font = 'bold 1.3em sans-serif'; this.promptTitle.style.margin = '0 ' + (-25 / 13) + 'em ' + (5 / 13) + 'em 0'; this.promptTitle.style.whiteSpace = 'pre'; this.promptTitle.style.overflow = 'hidden'; this.promptTitle.style.textOverflow = 'ellipsis'; this.prompt = document.createElement('input'); this.prompter.appendChild(this.prompt); this.prompt.style.border = '0'; this.prompt.style.background = '#eee'; this.prompt.style.MozBoxSizing = this.prompt.style.boxSizing = 'border-box'; this.prompt.style.font = '1.3em sans-serif'; this.prompt.style.padding = '0 ' + (3 / 13) + 'em'; this.prompt.style.outline = '0'; this.prompt.style.margin = '0'; this.prompt.style.width = '100%'; this.prompt.style.height = '' + (20 / 13) + 'em'; this.prompt.style.display = 'block'; this.prompt.style.WebkitBorderRadius = this.prompt.style.borderRadius = '0'; this.prompt.style.WebkitBoxShadow = this.prompt.style.boxShadow = 'inset ' + (1 / 13) + 'em ' + (1 / 13) + 'em ' + (2 / 13) + 'em rgba(0, 0, 0, .2), inset ' + (-1 / 13) + 'em ' + (-1 / 13) + 'em ' + (1 / 13) + 'em rgba(255, 255, 255, .2)'; this.prompt.style.WebkitAppearance = 'none'; this.promptButton = document.createElement('div'); this.prompter.appendChild(this.promptButton); this.promptButton.style.width = '2.2em'; this.promptButton.style.height = '2.2em'; this.promptButton.style.position = 'absolute'; this.promptButton.style.right = '.4em'; this.promptButton.style.bottom = '.4em'; this.promptButton.style.background = 'url(/img/icons.svg) -16.5em -3.7em'; this.promptButton.style.backgroundSize = '32.0em 9.6em'; this.prompt.addEventListener('keydown', function (e) { if (e.keyCode === 13) { this.submitPrompt(); } }.bind(this)); this.promptButton.addEventListener(hasTouchEvents ? 'touchstart' : 'mousedown', this.submitPrompt.bind(this)); this.initRuntime(); }; inherits(Stage, Base); Stage.prototype.isStage = true; Stage.prototype.initLists = function () { var show = false; // init show / hide of all stage and childrens lists var name = false; var o_list = this.lists; var o_listInfo = this.listsInfo; // may need to loop this? if (o_list && o_listInfo) { for (var key in o_listInfo) { var obj = o_listInfo[key]; for (var prop in obj) { // skip loop if the property is from prototype //console.log(prop + " = " + obj[prop]); if (!obj.hasOwnProperty(prop)) { continue; } if (obj[prop].toString() == "t") { console.log("List: " + key + " = true"); this.showList(key); break; } } } } var oc_list; var oc_listInfo; // loop around children for (var oc = 0; oc < this.children.length; oc++) { oc_listInfo = this.children[oc].listsInfo; if (oc_listInfo) { for (var key in o_listInfo) { var obj = oc_listInfo[key]; for (var prop in obj) { // skip loop if the property is from prototype //console.log(prop + " = " + obj[prop]); if (!obj.hasOwnProperty(prop)) { continue; } if (obj[prop].toString() == "t") { console.log("List: " + key + " = true"); this.showList(key); break; } } } } } }; Stage.prototype.updateList = function (name) { //console.log("updateList "+name) //console.log(document.getElementById(name)) // this function is a potential performance killer, so only invoke if 'name' list is showing... if (document.getElementById(name)) { var show = false; // init show / hide of all stage and childrens lists //var name = false; var o_list = this.lists; var o_listInfo = this.listsInfo; // may need to loop this? if (o_list && o_listInfo) { for (var key in o_listInfo) { var obj = o_listInfo[key]; for (var prop in obj) { // skip loop if the property is from prototype //console.log(prop + " = " + obj[prop]); if (!obj.hasOwnProperty(prop)) { continue; } if (obj[prop].toString() == "t") { console.log("List: " + key + " = true"); if (key == name) { this.showList(key); break; } } } } } } }; // pf new way - works with scaling via em's (was px) Stage.prototype.showList = function (name) { console.log("Show List:" + name + " isTurbo:" + this.isTurbo); // if turbo mode then only draw list every 4 ticks? var o_div_test = document.getElementById(name); if (this.isTurbo && o_div_test && (Date.now() % 1024) <= 1000) return; //console.log("### RENDER ###"); if (o_div_test) { console.log("List already rendered. DOM"); this.stage.root.removeChild(o_div_test); } var o_list = (this.lists[name]) ? this.lists[name] : this.lists[name]; if (name.includes(".c")) { o_list = sulfCloudVars[name]; } var o_listInfo = (this.listsInfo[name]) ? this.listsInfo[name] : this.listsInfo[name]; if (o_list && o_listInfo) { /* for (var ol = 0; ol < o_list.length; ol++) { * console.log((ol+1) + " : " + o_list[ol]+"\n"); }*/ console.log(o_listInfo + "\n"); } else { for (var oc = 0; oc < this.children.length; oc++) { if (this.children[oc].lists && this.children[oc].lists[name]) { // pf ### o_list = this.children[oc].lists[name]; o_listInfo = this.children[oc].listsInfo[name]; break; } } if (o_list) { for (var ol = 0; ol < o_list.length; ol++) { console.log((ol + 1) + " :: " + o_list[ol] + "\n"); } console.log(o_listInfo + "\n"); } } if (o_list && o_listInfo) { // display list using divs. Thanks to Dogtopius for the CSS colours! var info = o_listInfo.split(","); var show = !!(o_listInfo.match("true")); var divContainer = document.createElement('div'); var overflow = (2 + parseInt(info[0], 10) + parseInt(info[2], 10)) - 480; // border + left + width needs to be - 480px divContainer.id = name; divContainer.style.border = "solid #949191 2px"; // divContainer.style.margin = "5px"; divContainer.style.padding = "0"; divContainer.style.borderRadius = "7px"; divContainer.style.backgroundColor = "#c1c4c7"; divContainer.style.position = 'absolute'; divContainer.style.overflow = 'hidden'; divContainer.style.left = (info[0] - 7) + 'px'; // border + margin divContainer.style.top = (info[1] - 7) + 'px'; // border + margin if (overflow > 0) { // disable? divContainer.style.width = (info[2] - overflow) + 'px'; // if left + width > 480 then adjust to be < 480 } else { divContainer.style.width = info[2] + 'px'; } if (o_list.length) divContainer.style.height = info[3] + 'px'; divContainer.innerHTML = "<div style='margin: 2px'><span style='font-size: 12px; text-align: center; font-weight: bold;'><center>" + name + "</center></span></div>"; var divHolder = this.stage.root.appendChild(divContainer); // or this.stage.canvas.parentNode; var divInner = document.createElement('div'); divInner.style.position = 'relative'; divInner.style.overflow = 'auto'; divInner.style.height = '86%'; // as before (magic number!) var divItem; var replaced; for (var i = 0; i < o_list.length; i++) { // test divItem = document.createElement('div'); divItem.style.backgroundColor = "#c1c4c7"; try { replaced = o_list[i].replace(/'/g, "&#39;"); } catch (e) { replaced = o_list[i]; } // pf fix replace //if (typeof o_list[i] == "undefined") {replaced = o_list[i];} else {replaced = o_list[i].replace(/'/g, "&#39;");} // pf fix replace !worky divItem.innerHTML = "<input readonly value=' " + (i + 1) + "' style='color: #000; border: 0; background-color: #c1c4c7; width: 10%; font-size: 11px; margin: 1px'/> <input readonly value='" + replaced + "' style='font-size: 12px; background-color: #cc5b22; color: white; width: 75%; height: 10px; border: 1px solid #fff; border-radius: 3px; padding: 3px; margin: 0px;' />"; // TODO: rid 75% width and calc instead! divInner.appendChild(divItem); } var divItem2 = document.createElement('div'); //divItem2.style.position = 'relative'; if (o_list.length) { if (o_list.length > (parseInt(info[3], 10) / 22)) { // magic number! 'calc text px size as ~ number of elements' console.log("Long List!"); divInner.style.height = (parseInt(info[3], 10) - 40) + "px"; // magic number! 'px gap to remove to stop clash' } divItem2.innerHTML = "<div style='font-size: 11px; text-align: center; bottom: 2px; position: absolute; width: 100%;'>" + "length: " + o_list.length + "</div>"; } else { var hem = info[3] > 270 ? 93 : 89; // help! (more magic tomfoolery) var pem = ((info[3] / 100) * hem) + 0; // qtest console.log("HEIGHT=" + info[3] + " pem=" + pem); if (parseInt(info[1], 10) + parseInt(info[3], 10) < 360) { // !offscreen divItem = document.createElement('div'); divItem.style.height = pem + 'px'; divItem.innerHTML = "<div style='padding-top: " + (pem / 2.4) + "px'><div style='font-size: 11px; text-align: center;'>(empty)</div></div>"; // divInner.appendChild(divItem); divItem2.innerHTML = "<div style='font-size: 11px; text-align: center; bottom: 2px; position: absolute; width: 100%;'>length: 0</div>"; } else { // old way... divItem2.innerHTML = "<div style='font-size: 11px; text-align: center;'><br><br>(empty)</div><div style='font-size: 11px; text-align: center; padding-bottom: 0.1px'><br><br>length: 0</div>"; } } divHolder.appendChild(divInner); divHolder.appendChild(divItem2); } if (this.saying) this.updateBubble(); }; Stage.prototype.hideList = function (name) { console.log("Hide List:" + name); var o_div = document.getElementById(name); if (o_div) this.stage.root.removeChild(o_div); }; Stage.prototype.fromJSON = function (data) { Stage.parent.prototype.fromJSON.call(this, data); data.children.forEach(function (d) { if (d.listName) return; this.children.push(new (d.cmd ? Watcher : Sprite)(this).fromJSON(d)); }, this); this.children.forEach(function (child) { if (child.resolve) child.resolve(); }, this); P.compile(this); return this; }; Stage.prototype.focus = function () { if (this.promptId < this.nextPromptId) { this.prompt.focus(); } else { this.canvas.focus(); } }; Stage.prototype.updateMouse = function (e) { var bb = this.canvas.getBoundingClientRect(); var z = Math.max(this.zoomX, this.zoomY); var x = (e.clientX - bb.left) / z - 240; var y = 180 - (e.clientY - bb.top) / z; this.rawMouseX = x; this.rawMouseY = y; if (x < -240) x = -240; if (x > 240) x = 240; if (y < -180) y = -180; if (y > 180) y = 180; this.mouseX = x; this.mouseY = y; }; Stage.prototype.updateOrientation = function (data) { self.stage.alpha = data.do.alpha; self.stage.beta = data.do.beta; self.stage.gamma = data.do.gamma; } Stage.prototype.updateBackdrop = function () { this.backdropCanvas.width = this.zoomX * SCALE * 480; this.backdropCanvas.height = this.zoomY * SCALE * 360; var costume = this.costumes[this.currentCostumeIndex]; /* this.backdropContext.save(); var s = Math.max(this.zoomX * SCALE * costume.scale, this.zoomY * SCALE * costume.scale); this.backdropContext.scale(s, s); this.backdropContext.drawImage(costume.image, 0, 0, costume.image.width/costume.resScale, costume.image.height/costume.resScale); this.backdropContext.restore(); */ var imgInfo = costume.image.imgInfo; glDrawImage( this.backdropContext, this.backdropContext.imgShaderInfo, this.backdropContext.imgBuffers, imgInfo, //(imgInfo.width / costume.resScale / 2 - costume.rotationCenterX / 480 * imgInfo.width / costume.resScale) * costume.scale, (imgInfo.width / costume.resScale * costume.scale - 480) / 2, -(imgInfo.height / costume.resScale * costume.scale - 360) / 2, imgInfo.width / costume.resScale * costume.scale, imgInfo.height / costume.resScale * costume.scale, 0, 0, 0); }; Stage.prototype.updateFilters = function () { this.backdropCanvas.style.opacity = Math.max(0, Math.min(1, 1 - this.filters.ghost / 100)); }; Stage.prototype.setZoom = function (zoomX, zoomY) { if ((this.zoomX === zoomX) && (this.zoomY === zoomY)) return; var ps = Math.max(zoomX, zoomY); if ((this.maxZoomX < zoomX * SCALE) || (this.maxZoomY < zoomY * SCALE)) { this.maxZoomX = zoomX * SCALE; this.maxZoomY = zoomY * SCALE; //var canvas = document.createElement('canvas'); //canvas.width = this.penCanvas.width; //canvas.height = this.penCanvas.height; //canvas.getContext('2d').drawImage(this.penCanvas, 0, 0); var imgInfo = glMakeTexture(this.penContext, this.penCanvas); this.penCanvas.width = 480 * ps * SCALE; this.penCanvas.height = 360 * ps * SCALE; glDrawImage( this.penContext, this.penContext.imgShaderInfo, this.penContext.imgBuffers, imgInfo, 0, 0, 480, 360, 0, 0, 0); this.penContext.deleteTexture(imgInfo.texture); imgInfo = null; //this.penContext.drawImage(canvas, 0, 0, 480 * ps * SCALE, 360 * ps * SCALE); //this.penContext.scale(this.maxZoomX, this.maxZoomY); //this.penContext.lineCap = 'butt'; } this.canvas.width = this.backdropCanvas.width = this.glCollisionContext.width = (480 * zoomX | 0); this.canvas.height = this.backdropCanvas.height = this.glCollisionContext.height = (360 * zoomY | 0); this.root.style.width = this.canvas.style.width = this.backdropCanvas.style.width = this.glCollisionCanvas.style.width = (480 * zoomX | 0) + 'px'; this.penCanvas.style.width = (480 * ps | 0) + 'px'; this.root.style.height = this.canvas.style.height = this.backdropCanvas.style.height = this.glCollisionCanvas.style.height = (360 * zoomY | 0) + 'px'; this.penCanvas.style.height = (360 * ps | 0) + 'px'; this.root.style.fontSize = ps * 10 + 'px'; this.zoomX = zoomX; this.zoomY = zoomY; this.updateBackdrop(); }; Stage.prototype.clickMouse = function () { this.mouseSprite = undefined; for (var i = this.children.length; i--;) { var c = this.children[i]; if (c.isSprite && c.visible && c.filters.ghost < 100 && c.touching('_mouse_')) { if (c.isDraggable) { this.mouseSprite = c; c.mouseDown(); } else { this.triggerFor(c, 'whenClicked'); } return; } } this.triggerFor(this, 'whenClicked'); }; Stage.prototype.releaseMouse = function () { this.mousePressed = false; if (this.mouseSprite) { this.mouseSprite.mouseUp(); this.mouseSprite = undefined; } }; Stage.prototype.stopAllSounds = function () { for (var children = this.children, i = children.length; i--;) { if (children[i].isSprite) { children[i].stopSounds(); } } this.stopSounds(); }; Stage.prototype.removeAllClones = function () { var i = this.children.length; while (i--) { if (this.children[i].isClone) { this.children[i].remove(); this.children.splice(i, 1); } } }; Stage.prototype.getObject = function (name) { for (var i = 0; i < this.children.length; i++) { var c = this.children[i]; if (c.objName === name && !c.isClone) { return c; } } if (name === '_stage_' || name === this.objName) { return this; } }; Stage.prototype.getObjects = function (name) { var result = []; for (var i = 0; i < this.children.length; i++) { if (this.children[i].objName === name) { result.push(this.children[i]); } } return result; }; Stage.prototype.draw = function () { var context = this.context; //this.canvas.width = 480 * this.zoomX * SCALE; // clear //this.canvas.height = 360 * this.zoomY * SCALE; context.clear(context.COLOR_BUFFER_BIT); var s = Math.max(this.zoomX * SCALE, this.zoomY * SCALE); //context.scale(s, s); this.drawOn(context); if (this.hidePrompt) { this.hidePrompt = false; this.prompter.style.display = 'none'; this.canvas.focus(); } if (this.penCoordIndex) { this.renderPen(this.penContext, this.penContext.penShaderInfo, this.penContext.penBuffers); this.penCoordIndex = 0; this.penLineIndex = 0; this.penColorIndex = 0; } }; Stage.prototype.drawOn = function (context, except) { for (var i = 0; i < this.children.length; i++) { if (this.children[i].visible && this.children[i] !== except) { this.children[i].draw(context); } } }; Stage.prototype.drawAllOn = function (context, except) { var costume = this.costumes[this.currentCostumeIndex]; /* context.save(); context.scale(costume.scale, costume.scale); context.globalAlpha = Math.max(0, Math.min(1, 1 - this.filters.ghost / 100)); context.drawImage(costume.image, 0, 0, costume.image.width/costume.resScale, costume.image.height/costume.resScale); context.restore(); */ var tempTest = performance.now(); glDrawImage( context, context.imgShaderInfo, context.imgBuffers, costume.image.collisionImgInfo, 0, 0, 480, 360, 0, 0, 0); /* context.save(); var s = Math.max(this.maxZoomX, this.maxZoomY); context.scale(1 / s, 1 / s); context.drawImage(this.penCanvas, 0, 0); context.restore(); */ var imgInfo = glMakeTexture(context, this.penCanvas); glDrawImage( context, context.imgShaderInfo, context.imgBuffers, imgInfo, 0, 0, 480, 360, 0, 0, 0); context.deleteTexture(imgInfo.texture); imgInfo = null; //console.log(performance.now() - tempTest); //this.drawOn(context, except); for (var i = 0; i < this.children.length; i++) { if (this.children[i].visible && this.children[i] !== except && !(this.children[i] instanceof Watcher)) { this.children[i].draw(context); } } }; Stage.prototype.moveTo = function () { }; Stage.prototype.submitPrompt = function () { if (this.promptId < this.nextPromptId) { this.answer = this.prompt.value; this.promptId += 1; if (this.promptId >= this.nextPromptId) { this.hidePrompt = true; } } }; Stage.prototype.renderPen = function (gl, programInfo, buffers) { gl.viewport(0, 0, this.penCanvas.width, this.penCanvas.height); gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA); gl.enable(gl.BLEND); gl.disable(gl.DEPTH_TEST); //set up position buffer for coordinates gl.bindBuffer(gl.ARRAY_BUFFER, buffers.position); gl.bufferData(gl.ARRAY_BUFFER, this.penCoords, gl.STREAM_DRAW); gl.vertexAttribPointer( programInfo.attribLocations.vertexData, 4, gl.FLOAT, false, 0, 0); gl.enableVertexAttribArray(programInfo.attribLocations.vertexData); //set up line description buffer gl.bindBuffer(gl.ARRAY_BUFFER, buffers.line); gl.bufferData(gl.ARRAY_BUFFER, this.penLines, gl.STREAM_DRAW); gl.vertexAttribPointer( programInfo.attribLocations.lineData, 2, gl.FLOAT, false, 0, 0); gl.enableVertexAttribArray(programInfo.attribLocations.lineData); //set up color buffer gl.bindBuffer(gl.ARRAY_BUFFER, buffers.color); gl.bufferData(gl.ARRAY_BUFFER, this.penColors, gl.STREAM_DRAW); gl.vertexAttribPointer( programInfo.attribLocations.colorData, 4, gl.FLOAT, false, 0, 0); gl.enableVertexAttribArray(programInfo.attribLocations.colorData); //draw pen lines as triangles. gl.useProgram(programInfo.program); gl.drawArrays(gl.TRIANGLES, 0, (this.penCoordIndex + 1) / 4); /* var err if(err = gl.getError()) console.log('WebGL Error: ' + err); */ } var KEY_CODES = { 'space': 32, 'ctrl': 17, 'shift': 16, 'left arrow': 37, 'up arrow': 38, 'right arrow': 39, 'down arrow': 40, 'any': 128 }; var getKeyCode = function (keyName) { if (typeof keyName !== 'string') keyName = "" + keyName; return KEY_CODES[keyName.toLowerCase()] || keyName.toUpperCase().charCodeAt(0); }; var Sprite = function (stage) { this.stage = stage; Sprite.parent.call(this); this.direction = 90; this.indexInLibrary = -1; this.isDraggable = false; this.isDragging = false; this.rotationStyle = 'normal'; this.scale = 1; this.scratchX = 0; this.scratchY = 0; this.spriteInfo = {}; this.visible = true; this.Hue = 240; this.penHue = 250; this.penSaturation = 100; this.penLightness = 50; this.penSize = 1; this.isPenDown = false; this.isSprite = true; this.bubble = null; this.saying = false; this.thinking = false; this.sayId = 0; }; inherits(Sprite, Base); Sprite.prototype.fromJSON = function (data) { Sprite.parent.prototype.fromJSON.call(this, data); this.direction = data.direction; this.indexInLibrary = data.indexInLibrary; this.isDraggable = data.isDraggable; this.rotationStyle = data.rotationStyle; this.scale = data.scale; this.scratchX = data.scratchX; this.scratchY = data.scratchY; this.spriteInfo = data.spriteInfo; this.visible = data.visible; return this; }; Sprite.prototype.clone = function () { var c = new Sprite(this.stage); c.isClone = true; c.costumes = this.costumes; c.currentCostumeIndex = this.currentCostumeIndex; c.objName = this.objName; c.soundRefs = this.soundRefs; c.sounds = this.sounds; var keys = Object.keys(this.vars); for (var i = keys.length; i--;) { var k = keys[i]; c.vars[k] = this.vars[k]; } var keys = Object.keys(this.lists); for (var i = keys.length; i--;) { var k = keys[i]; c.lists[k] = this.lists[k].slice(0); } c.procedures = this.procedures; c.listeners = this.listeners; c.fns = this.fns; c.scripts = this.scripts; c.filters = { color: this.filters.color, fisheye: this.filters.fisheye, whirl: this.filters.whirl, pixelate: this.filters.pixelate, mosaic: this.filters.mosaic, brightness: this.filters.brightness, ghost: this.filters.ghost }; c.direction = this.direction; c.indexInLibrary = this.indexInLibrary; c.isDraggable = this.isDraggable; c.rotationStyle = this.rotationStyle; c.scale = this.scale; c.volume = this.volume; c.scratchX = this.scratchX; c.scratchY = this.scratchY; c.visible = this.visible; c.penColor = this.penColor; // Pen color in RGB mode? c.penRGBA = this.penRGBA; // Pen color in RGBA c.penRed = this.penRed; c.penGreen = this.penGreen; c.penBlue = this.penBlue; c.penAlpha = this.penAlpha; //Pen color in HSL c.penHue = this.penHue; c.penSaturation = this.penSaturation; c.penLightness = this.penLightness; c.penSize = this.penSize; c.isPenDown = this.isPenDown; return c; }; Sprite.prototype.mouseDown = function () { this.dragStartX = this.scratchX; this.dragStartY = this.scratchY; this.dragOffsetX = this.scratchX - this.stage.mouseX; this.dragOffsetY = this.scratchY - this.stage.mouseY; this.isDragging = true; }; Sprite.prototype.mouseUp = function () { if (this.isDragging && this.scratchX === this.dragStartX && this.scratchY === this.dragStartY) { this.stage.triggerFor(this, 'whenClicked'); } this.isDragging = false; }; Sprite.prototype.forward = function (steps) { var d = (90 - this.direction) * Math.PI / 180; this.moveTo(this.scratchX + steps * Math.cos(d), this.scratchY + steps * Math.sin(d)); }; Sprite.prototype.moveTo = function (x, y) { var ox = this.scratchX; var oy = this.scratchY; if (ox === x && oy === y && !this.isPenDown) return; this.scratchX = x; this.scratchY = y; if (this.isPenDown && !this.isDragging) { var context = this.stage.penContext; if (this.penSize % 2 > .5 && this.penSize % 2 < 1.5) { ox -= .5; oy -= .5; x -= .5; y -= .5; } /* context.strokeStyle = this.penRGBA || 'hsl(' + this.penHue + ',' + this.penSaturation + '%,' + (this.penLightness > 100 ? 200 - this.penLightness : this.penLightness) + '%)'; if(this.penSize > 2 * 480 / this.stage.penCanvas.width) this.dotPen(); context.lineWidth = this.penSize; context.beginPath(); context.moveTo(240 + ox, 180 - oy); context.lineTo(240 + x, 180 - y); context.stroke(); */ //calculate color for vertices var r, g, b, a; if (this.penRGBA) { r = this.penRed; g = this.penGreen; b = this.penBlue; a = this.penAlpha; } else { var rgb = this.hsl2rgb(this.penHue, this.penSaturation, (this.penLightness > 100 ? 200 - this.penLightness : this.penLightness)); r = rgb[0]; g = rgb[1]; b = rgb[2]; a = 1; } /* console.log(this.penRGBA); console.log(this.penHue); console.log(this.penSaturation); console.log(this.penLightness); console.log(this.hsl2rgb(this.penHue, this.penSaturation, (this.penLightness > 100 ? 200 - this.penLightness : this.penLightness))); */ var circleRes = Math.max(Math.ceil(this.penSize * Math.max(this.stage.zoomX, this.stage.zoomY)), 3); // Redraw when array is full. if (this.stage.penCoordIndex + 24 * (circleRes + 1) > this.stage.penCoords.length) { this.stage.renderPen(this.stage.penContext, this.stage.penContext.penShaderInfo, this.stage.penContext.penBuffers); this.stage.penCoordIndex = 0; this.stage.penLineIndex = 0; this.stage.penColorIndex = 0; } // draw line { // first triangle // first coordinates this.stage.penCoords[this.stage.penCoordIndex] = ox; this.stage.penCoordIndex++; this.stage.penCoords[this.stage.penCoordIndex] = oy; this.stage.penCoordIndex++; // first coordinates supplement this.stage.penCoords[this.stage.penCoordIndex] = x; this.stage.penCoordIndex++; this.stage.penCoords[this.stage.penCoordIndex] = y; this.stage.penCoordIndex++; //first vertex description this.stage.penLines[this.stage.penLineIndex] = -Math.PI / 2; this.stage.penLineIndex++; this.stage.penLines[this.stage.penLineIndex] = this.penSize / 2; this.stage.penLineIndex++; // second coordinates this.stage.penCoords[this.stage.penCoordIndex] = x; this.stage.penCoordIndex++; this.stage.penCoords[this.stage.penCoordIndex] = y; this.stage.penCoordIndex++; // second coordinates supplement this.stage.penCoords[this.stage.penCoordIndex] = ox; this.stage.penCoordIndex++; this.stage.penCoords[this.stage.penCoordIndex] = oy; this.stage.penCoordIndex++; //second vertex description this.stage.penLines[this.stage.penLineIndex] = Math.PI / 2; this.stage.penLineIndex++; this.stage.penLines[this.stage.penLineIndex] = this.penSize / 2; this.stage.penLineIndex++; // third coordinates this.stage.penCoords[this.stage.penCoordIndex] = ox; this.stage.penCoordIndex++; this.stage.penCoords[this.stage.penCoordIndex] = oy; this.stage.penCoordIndex++; // third coordinates supplement this.stage.penCoords[this.stage.penCoordIndex] = x; this.stage.penCoordIndex++; this.stage.penCoords[this.stage.penCoordIndex] = y; this.stage.penCoordIndex++; //second vertex description this.stage.penLines[this.stage.penLineIndex] = Math.PI / 2; this.stage.penLineIndex++; this.stage.penLines[this.stage.penLineIndex] = this.penSize / 2; this.stage.penLineIndex++; // second triangle // first coordinates this.stage.penCoords[this.stage.penCoordIndex] = ox; this.stage.penCoordIndex++; this.stage.penCoords[this.stage.penCoordIndex] = oy; this.stage.penCoordIndex++; // first coordinates supplement this.stage.penCoords[this.stage.penCoordIndex] = x; this.stage.penCoordIndex++; this.stage.penCoords[this.stage.penCoordIndex] = y; this.stage.penCoordIndex++; //first vertex description this.stage.penLines[this.stage.penLineIndex] = Math.PI / 2; this.stage.penLineIndex++; this.stage.penLines[this.stage.penLineIndex] = this.penSize / 2; this.stage.penLineIndex++; // second coordinates this.stage.penCoords[this.stage.penCoordIndex] = x; this.stage.penCoordIndex++; this.stage.penCoords[this.stage.penCoordIndex] = y; this.stage.penCoordIndex++; // second coordinates supplement this.stage.penCoords[this.stage.penCoordIndex] = ox; this.stage.penCoordIndex++; this.stage.penCoords[this.stage.penCoordIndex] = oy; this.stage.penCoordIndex++; //second vertex description this.stage.penLines[this.stage.penLineIndex] = -Math.PI / 2; this.stage.penLineIndex++; this.stage.penLines[this.stage.penLineIndex] = this.penSize / 2; this.stage.penLineIndex++; // third coordinates this.stage.penCoords[this.stage.penCoordIndex] = x; this.stage.penCoordIndex++; this.stage.penCoords[this.stage.penCoordIndex] = y; this.stage.penCoordIndex++; // third coordinates supplement this.stage.penCoords[this.stage.penCoordIndex] = ox; this.stage.penCoordIndex++; this.stage.penCoords[this.stage.penCoordIndex] = oy; this.stage.penCoordIndex++; //second vertex description this.stage.penLines[this.stage.penLineIndex] = Math.PI / 2; this.stage.penLineIndex++; this.stage.penLines[this.stage.penLineIndex] = this.penSize / 2; this.stage.penLineIndex++; } for (var i = 0; i < circleRes; i++) { // first endcap // first coordinates this.stage.penCoords[this.stage.penCoordIndex] = x; this.stage.penCoordIndex++; this.stage.penCoords[this.stage.penCoordIndex] = y; this.stage.penCoordIndex++; // first coordinates supplement this.stage.penCoords[this.stage.penCoordIndex] = ox; this.stage.penCoordIndex++; this.stage.penCoords[this.stage.penCoordIndex] = oy; this.stage.penCoordIndex++; // first vertex description this.stage.penLines[this.stage.penLineIndex] = 0; this.stage.penLineIndex++; this.stage.penLines[this.stage.penLineIndex] = 0; this.stage.penLineIndex++; // second coordinates this.stage.penCoords[this.stage.penCoordIndex] = x; this.stage.penCoordIndex++; this.stage.penCoords[this.stage.penCoordIndex] = y; this.stage.penCoordIndex++; // second coordinates supplement this.stage.penCoords[this.stage.penCoordIndex] = ox; this.stage.penCoordIndex++; this.stage.penCoords[this.stage.penCoordIndex] = oy; this.stage.penCoordIndex++; // second vertex description this.stage.penLines[this.stage.penLineIndex] = Math.PI / 2 + i / circleRes * Math.PI; this.stage.penLineIndex++; this.stage.penLines[this.stage.penLineIndex] = this.penSize / 2; this.stage.penLineIndex++; // third coordinates this.stage.penCoords[this.stage.penCoordIndex] = x; this.stage.penCoordIndex++; this.stage.penCoords[this.stage.penCoordIndex] = y; this.stage.penCoordIndex++; // third coordinates supplement this.stage.penCoords[this.stage.penCoordIndex] = ox; this.stage.penCoordIndex++; this.stage.penCoords[this.stage.penCoordIndex] = oy; this.stage.penCoordIndex++; // third vertex description this.stage.penLines[this.stage.penLineIndex] = Math.PI / 2 + (i + 1) / circleRes * Math.PI; this.stage.penLineIndex++; this.stage.penLines[this.stage.penLineIndex] = this.penSize / 2; this.stage.penLineIndex++; // second endcap // first coordinates this.stage.penCoords[this.stage.penCoordIndex] = ox; this.stage.penCoordIndex++; this.stage.penCoords[this.stage.penCoordIndex] = oy; this.stage.penCoordIndex++; // first coordinates supplement this.stage.penCoords[this.stage.penCoordIndex] = x; this.stage.penCoordIndex++; this.stage.penCoords[this.stage.penCoordIndex] = y; this.stage.penCoordIndex++; // first vertex description this.stage.penLines[this.stage.penLineIndex] = 0; this.stage.penLineIndex++; this.stage.penLines[this.stage.penLineIndex] = 0; this.stage.penLineIndex++; // second coordinates this.stage.penCoords[this.stage.penCoordIndex] = ox; this.stage.penCoordIndex++; this.stage.penCoords[this.stage.penCoordIndex] = oy; this.stage.penCoordIndex++; // second coordinates supplement this.stage.penCoords[this.stage.penCoordIndex] = x; this.stage.penCoordIndex++; this.stage.penCoords[this.stage.penCoordIndex] = y; this.stage.penCoordIndex++; // second vertex description this.stage.penLines[this.stage.penLineIndex] = Math.PI / 2 + i / circleRes * Math.PI; this.stage.penLineIndex++; this.stage.penLines[this.stage.penLineIndex] = this.penSize / 2; this.stage.penLineIndex++; // third coordinates this.stage.penCoords[this.stage.penCoordIndex] = ox; this.stage.penCoordIndex++; this.stage.penCoords[this.stage.penCoordIndex] = oy; this.stage.penCoordIndex++; // third coordinates supplement this.stage.penCoords[this.stage.penCoordIndex] = x; this.stage.penCoordIndex++; this.stage.penCoords[this.stage.penCoordIndex] = y; this.stage.penCoordIndex++; // third vertex description this.stage.penLines[this.stage.penLineIndex] = Math.PI / 2 + (i + 1) / circleRes * Math.PI; this.stage.penLineIndex++; this.stage.penLines[this.stage.penLineIndex] = this.penSize / 2; this.stage.penLineIndex++; } // set color of vertices for (var i = 0; i < circleRes * 6 + 6; i++) { this.stage.penColors[this.stage.penColorIndex] = r; this.stage.penColorIndex++; this.stage.penColors[this.stage.penColorIndex] = g; this.stage.penColorIndex++; this.stage.penColors[this.stage.penColorIndex] = b; this.stage.penColorIndex++; this.stage.penColors[this.stage.penColorIndex] = a; this.stage.penColorIndex++; } this.penState = true; } if (this.saying) { this.updateBubble(); } }; Sprite.prototype.dotPen = function () { var context = this.stage.penContext; var x = this.scratchX; var y = this.scratchY; /* context.fillStyle = this.penRGBA || 'hsl(' + this.penHue + ',' + this.penSaturation + '%,' + (this.penLightness > 100 ? 200 - this.penLightness : this.penLightness) + '%)'; if(this.penSize <= 2 * 480 / this.stage.penCanvas.width){ context.fillRect(240 + x - this.penSize, 180 - y, this.penSize, this.penSize); } else{ context.beginPath(); context.arc(240 + x, 180 - y, Math.floor(this.penSize / 2), 0, 2 * Math.PI, false); context.fill(); } */ //if(this.penSize > 2 * 480 / this.stage.penCanvas.width){ //calculate color for vertices var r, g, b, a; if (this.penRGBA) { r = this.penRed; g = this.penGreen; b = this.penBlue; a = this.penAlpha; } else { var rgb = this.hsl2rgb(this.penHue, this.penSaturation, (this.penLightness > 100 ? 200 - this.penLightness : this.penLightness)); r = rgb[0]; g = rgb[1]; b = rgb[2]; a = 1; } var circleRes = Math.max(Math.ceil(this.penSize * Math.max(this.stage.zoomX, this.stage.zoomY)), 3); // Redraw when array is full. if (this.stage.penCoordIndex + 12 * circleRes > this.stage.penCoords.length) { this.stage.renderPen(this.stage.penContext, this.stage.penContext.penShaderInfo, this.stage.penContext.penBuffers); this.stage.penCoordIndex = 0; this.stage.penLineIndex = 0; this.stage.penColorIndex = 0; } for (var i = 0; i < circleRes; i++) { // first endcap // first coordinates this.stage.penCoords[this.stage.penCoordIndex] = x; this.stage.penCoordIndex++; this.stage.penCoords[this.stage.penCoordIndex] = y; this.stage.penCoordIndex++; // first coordinates supplement this.stage.penCoords[this.stage.penCoordIndex] = x; this.stage.penCoordIndex++; this.stage.penCoords[this.stage.penCoordIndex] = x; this.stage.penCoordIndex++; // first vertex description this.stage.penLines[this.stage.penLineIndex] = 0; this.stage.penLineIndex++; this.stage.penLines[this.stage.penLineIndex] = 0; this.stage.penLineIndex++; // second coordinates this.stage.penCoords[this.stage.penCoordIndex] = x; this.stage.penCoordIndex++; this.stage.penCoords[this.stage.penCoordIndex] = y; this.stage.penCoordIndex++; // second coordinates supplement this.stage.penCoords[this.stage.penCoordIndex] = x + 1; this.stage.penCoordIndex++; this.stage.penCoords[this.stage.penCoordIndex] = y + 1; this.stage.penCoordIndex++; // second vertex description this.stage.penLines[this.stage.penLineIndex] = Math.PI / 2 + i / circleRes * 2 * Math.PI; this.stage.penLineIndex++; this.stage.penLines[this.stage.penLineIndex] = this.penSize / 2; this.stage.penLineIndex++; // third coordinates this.stage.penCoords[this.stage.penCoordIndex] = x; this.stage.penCoordIndex++; this.stage.penCoords[this.stage.penCoordIndex] = y; this.stage.penCoordIndex++; // third coordinates supplement this.stage.penCoords[this.stage.penCoordIndex] = x + 1; this.stage.penCoordIndex++; this.stage.penCoords[this.stage.penCoordIndex] = y + 1; this.stage.penCoordIndex++; // third vertex description this.stage.penLines[this.stage.penLineIndex] = Math.PI / 2 + (i + 1) / circleRes * 2 * Math.PI; this.stage.penLineIndex++; this.stage.penLines[this.stage.penLineIndex] = this.penSize / 2; this.stage.penLineIndex++; } // set color of vertices for (var i = 0; i < circleRes * 3; i++) { this.stage.penColors[this.stage.penColorIndex] = r; this.stage.penColorIndex++; this.stage.penColors[this.stage.penColorIndex] = g; this.stage.penColorIndex++; this.stage.penColors[this.stage.penColorIndex] = b; this.stage.penColorIndex++; this.stage.penColors[this.stage.penColorIndex] = a; this.stage.penColorIndex++; } //} }; Sprite.prototype.hsl2rgb = function (h, s, l) { var r, g, b; h = (h % 360) / 360; s = s / 100; l = (l - 10) / 100; if (s == 0) { r = g = b = l; // achromatic } else { var hue2rgb = function hue2rgb(p, q, t) { if (t < 0) t += 1; if (t > 1) t -= 1; if (t < 1 / 6) return p + (q - p) * 6 * t; if (t < 1 / 2) return q; if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6; return p; } var q = l < 0.5 ? l * (1 + s) : l + s - l * s; var p = 2 * l - q; r = hue2rgb(p, q, h + 1 / 3); g = hue2rgb(p, q, h); b = hue2rgb(p, q, h - 1 / 3); } return [Math.min(Math.floor(r * 256), 255), Math.min(Math.floor(g * 256), 255), Math.min(Math.floor(b * 256), 255)]; } Sprite.prototype.draw = function (context, noEffects) { if (this.stage.penCoordIndex) { this.stage.renderPen(this.stage.penContext, this.stage.penContext.penShaderInfo, this.stage.penContext.penBuffers); this.stage.penCoordIndex = 0; this.stage.penLineIndex = 0; this.stage.penColorIndex = 0; } var costume = this.costumes[this.currentCostumeIndex]; if (this.isDragging) { this.moveTo(this.dragOffsetX + this.stage.mouseX, this.dragOffsetY + this.stage.mouseY); } if (costume && costume.image.imgInfo) { var z = Math.max(this.stage.zoomX, this.stage.zoomY); var tempTest if (costume.resScale < Math.min(this.scale * SCALE * z, 8) && costume.isSvg) { if (costume.image.imgInfo) { this.stage.context.deleteTexture(costume.image.imgInfo.texture); costume.image.imgInfo = null; } if (costume.image.penImgInfo) { this.stage.penContext.deleteTexture(costume.image.penImgInfo.texture); costume.image.penImgInfo = null; } if (costume.image.collisionImgInfo) { this.stage.glCollisionContext.deleteTexture(costume.image.collisionImgInfo.texture); costume.image.collisionImgInfo = null; } costume.resScale = Math.min(Math.ceil(this.scale * SCALE * z), 8); console.log('scaling: ' + costume.resScale); costume.render(); } var imgInfo; if (context.canvas.id === 'canvas') imgInfo = costume.image.imgInfo; else if (context.canvas.id === 'penCanvas') imgInfo = costume.image.penImgInfo; else imgInfo = costume.image.collisionImgInfo; var color = -this.filters.color / 100 * Math.PI; var fisheye = this.filters.fisheye < -100 ? 0 : -this.filters.fisheye / 100 - 1; var whirl = -this.filters.whirl / 100 * Math.PI; var pixelate = Math.pow(Math.abs(this.filters.pixelate * costume.scale * this.scale), 0.6) + 1; var mosaic = Math.floor(Math.abs((this.filters.mosaic + 5) / 10)) + 1; if (this.filters.brightness > 100) { this.filters.brightness = 100; } var brightness = this.filters.brightness / 100; var ghost = noEffects ? 1 : Math.max(0, Math.min(1, 1 - this.filters.ghost / 100)); glDrawImage( context, context.useTouchingShader ? context.touchingShaderInfo : context.imgShaderInfo, context.imgBuffers, imgInfo, this.scratchX + (imgInfo.width / costume.resScale / 2 - costume.rotationCenterX) * this.scale * costume.scale * (this.rotationStyle === 'leftRight' && this.direction < 0 ? -1 : 1), this.scratchY + (-imgInfo.height / costume.resScale / 2 + costume.rotationCenterY) * this.scale * costume.scale, imgInfo.width / costume.resScale * costume.scale * this.scale * (this.rotationStyle === 'leftRight' && this.direction < 0 ? -1 : 1), imgInfo.height / costume.resScale * costume.scale * this.scale, this.rotationStyle === 'normal' ? - this.direction + 90 : 0, (-imgInfo.width / costume.resScale / 2 + costume.rotationCenterX) * this.scale * costume.scale * (this.rotationStyle === 'leftRight' && this.direction < 0 ? -1 : 1), (imgInfo.height / costume.resScale / 2 - costume.rotationCenterY) * this.scale * costume.scale, [color, fisheye, whirl, pixelate, mosaic, brightness, ghost], this.stage.tColor); } }; function hsvToRgb(h, s, v) { var r, g, b; var i = Math.floor(h * 6); var f = h * 6 - i; var p = v * (1 - s); var q = v * (1 - f * s); var t = v * (1 - (1 - f) * s); switch (i % 6) { case 0: r = v, g = t, b = p; break; case 1: r = q, g = v, b = p; break; case 2: r = p, g = v, b = t; break; case 3: r = p, g = q, b = v; break; case 4: r = t, g = p, b = v; break; case 5: r = v, g = p, b = q; break; } return { r: r * 255, g: g * 255, b: b * 255 }; } function rgbToHsv(r, g, b) { r /= 255, g /= 255, b /= 255; var max = Math.max(r, g, b), min = Math.min(r, g, b); var h, s, v = max; var d = max - min; s = max == 0 ? 0 : d / max; if (max == min) { h = 0; // achromatic } else { switch (max) { case r: h = (g - b) / d + (g < b ? 6 : 0); break; case g: h = (b - r) / d + 2; break; case b: h = (r - g) / d + 4; break; } h /= 6; } return { h: h, s: s, v: v }; } Sprite.prototype.setDirection = function (degrees) { var d = degrees % 360; if (d > 180) d -= 360; if (d <= -180) d += 360; this.direction = d; if (this.saying) this.updateBubble(); }; //folgender code ist nur provisorisch hier Sprite.prototype.sayOLD = function (text, thinking) { text = '' + text; if (!text) { this.saying = false; if (!this.bubble) return; this.bubble.style.display = 'none'; return ++this.sayId; } this.saying = true; this.thinking = thinking; if (!this.bubble) { this.bubble = document.createElement('div'); this.bubble.style.zIndex = '1'; // pf say over lists fix this.bubble.style.maxWidth = '' + (127 / 14) + 'em'; this.bubble.style.minWidth = '' + (48 / 14) + 'em'; this.bubble.style.padding = '' + (8 / 14) + 'em ' + (10 / 14) + 'em'; this.bubble.style.border = '' + (3 / 14) + 'em solid rgb(160, 160, 160)'; this.bubble.style.borderRadius = '' + (10 / 14) + 'em'; this.bubble.style.background = '#fff'; this.bubble.style.position = 'absolute'; this.bubble.style.font = 'bold 14em sans-serif'; this.bubble.style.whiteSpace = 'pre-wrap'; this.bubble.style.wordWrap = 'break-word'; this.bubble.style.textAlign = 'center'; this.bubble.style.cursor = 'default'; this.bubble.appendChild(this.bubbleText = document.createTextNode('')); this.bubble.appendChild(this.bubblePointer = document.createElement('div')); this.bubblePointer.style.position = 'absolute'; this.bubblePointer.style.height = '' + (21 / 14) + 'em'; this.bubblePointer.style.width = '' + (44 / 14) + 'em'; this.bubblePointer.style.background = 'url(icons.svg) ' + (-195 / 14) + 'em ' + (-4 / 14) + 'em'; this.bubblePointer.style.backgroundSize = '' + (320 / 14) + 'em ' + (96 / 14) + 'em'; this.stage.root.appendChild(this.bubble); } else { // tjvr this.stage.root.removeChild(this.bubble); this.stage.root.appendChild(this.bubble); } this.bubblePointer.style.backgroundPositionX = ((thinking ? -259 : -195) / 14) + 'em'; this.bubble.style.display = 'block'; this.bubbleText.nodeValue = text; this.updateBubble(); return ++this.sayId; }; Base.prototype.say = function (text, thinking) { // moved to base 3117. text = '' + text; if (!text) { this.saying = false; if (!this.bubble) return; this.bubble.style.display = 'none'; return ++this.sayId; } this.saying = true; this.thinking = thinking; if (!this.bubble) { this.bubble = document.createElement('div'); this.bubble.style.zIndex = '1'; // pf say over lists fix this.bubble.style.maxWidth = '' + (127 / 14) + 'em'; this.bubble.style.minWidth = '' + (48 / 14) + 'em'; this.bubble.style.padding = '' + (8 / 14) + 'em ' + (10 / 14) + 'em'; this.bubble.style.border = '' + (3 / 14) + 'em solid rgb(160, 160, 160)'; this.bubble.style.borderRadius = '' + (10 / 14) + 'em'; this.bubble.style.background = '#fff'; this.bubble.style.position = 'absolute'; this.bubble.style.font = 'bold 14em sans-serif'; this.bubble.style.whiteSpace = 'pre-wrap'; this.bubble.style.wordWrap = 'break-word'; this.bubble.style.textAlign = 'center'; this.bubble.style.cursor = 'default'; this.bubble.appendChild(this.bubbleText = document.createTextNode('')); this.bubble.appendChild(this.bubblePointer = document.createElement('div')); this.bubblePointer.style.position = 'absolute'; this.bubblePointer.style.height = '' + (21 / 14) + 'em'; this.bubblePointer.style.width = '' + (44 / 14) + 'em'; this.bubblePointer.style.background = 'url(icons.svg) ' + (-195 / 14) + 'em ' + (-4 / 14) + 'em'; this.bubblePointer.style.backgroundSize = '' + (320 / 14) + 'em ' + (96 / 14) + 'em'; this.stage.root.appendChild(this.bubble); } else { // tjvr this.stage.root.removeChild(this.bubble); this.stage.root.appendChild(this.bubble); } this.bubblePointer.style.backgroundPositionX = ((thinking ? -259 : -195) / 14) + 'em'; this.bubble.style.display = 'block'; this.bubbleText.nodeValue = text; this.updateBubble(); return ++this.sayId; }; //Context for collision math var collisionCanvas = document.createElement('canvas'); var collisionContext = collisionCanvas.getContext('2d'); Sprite.prototype.touching = function (thing) { var costume = this.costumes[this.currentCostumeIndex]; if (thing === '_mouse_') { var bounds = this.rotatedBounds(); var x = this.stage.rawMouseX; var y = this.stage.rawMouseY; if (x < bounds.left || y < bounds.bottom || x > bounds.right || y > bounds.top) { return false; } var cx = (x - this.scratchX) / this.scale var cy = (this.scratchY - y) / this.scale if (this.rotationStyle === 'normal' && this.direction !== 90) { var d = (90 - this.direction) * Math.PI / 180 var ox = cx var s = Math.sin(d), c = Math.cos(d) cx = c * ox - s * cy cy = s * ox + c * cy } else if (this.rotationStyle === 'leftRight' && this.direction < 0) { cx = -cx } //var d = costume.context.getImageData(cx * costume.resScale * costume.bitmapResolution + costume.rotationCenterX * costume.resScale, cy * costume.resScale * costume.bitmapResolution + costume.rotationCenterY * costume.resScale, 1, 1).data; this.stage.glCollisionContext.scissor(this.stage.rawMouseX + 240, this.stage.rawMouseY + 179, 1, 1); this.stage.glCollisionContext.clear(this.stage.glCollisionContext.COLOR_BUFFER_BIT); this.stage.glCollisionContext.useTouchingShader = false; this.draw(this.stage.glCollisionContext, true); var d = new Uint8Array(4); this.stage.glCollisionContext.readPixels( this.stage.rawMouseX + 240, this.stage.rawMouseY + 179, 1, 1, this.stage.glCollisionContext.RGBA, this.stage.glCollisionContext.UNSIGNED_BYTE, d); this.stage.glCollisionContext.scissor(0, 0, 480, 360); return d[3] !== 0; } else if (thing === '_edge_') { var bounds = this.rotatedBounds(); return bounds.left <= -240 || bounds.right >= 240 || bounds.top >= 180 || bounds.bottom <= -180; } else { if (!this.visible) return false; var sprites = this.stage.getObjects(thing); for (var i = sprites.length; i--;) { var sprite = sprites[i]; if (!sprite.visible) continue; var mb = this.rotatedBounds(); var ob = sprite.rotatedBounds(); //console.log(sprite); if (mb.bottom >= ob.top || ob.bottom >= mb.top || mb.left >= ob.right || ob.left >= mb.right) { continue; } var left = Math.max(mb.left, ob.left); var top = Math.min(mb.top, ob.top); var right = Math.min(mb.right, ob.right); var bottom = Math.max(mb.bottom, ob.bottom); collisionCanvas.width = Math.max(right - left, 1); collisionCanvas.height = Math.max(top - bottom, 1); collisionContext.save(); collisionContext.translate(-(left + 240), -(180 - top)); //this.draw(collisionContext, true); //collisionContext.globalCompositeOperation = 'source-in'; //sprite.draw(collisionContext, true); this.stage.glCollisionContext.scissor(240 + left, 180 + bottom, Math.max(right - left, 1), Math.max(top - bottom, 1)); this.stage.glCollisionContext.clear(this.stage.glCollisionContext.COLOR_BUFFER_BIT); this.stage.glCollisionContext.useTouchingShader = false; this.draw(this.stage.glCollisionContext, true); this.stage.glCollisionContext.touchingShaderInfo.blendSource = this.stage.glCollisionContext.DST_ALPHA; this.stage.glCollisionContext.touchingShaderInfo.blendDest = this.stage.glCollisionContext.ZERO; this.stage.tColor = [0.0, 0.0, 0.0, 0.0] this.stage.glCollisionContext.useTouchingShader = true; sprite.draw(this.stage.glCollisionContext, true); //collisionContext.restore(); //var data = collisionContext.getImageData(0, 0, Math.max(right - left, 1), Math.max(top - bottom, 1)).data; costume = sprite.costumes[sprite.currentCostumeIndex]; var data = new Uint8Array(Math.max(right - left, 1) * Math.max(top - bottom, 1) * 4); this.stage.glCollisionContext.readPixels( 240 + left, 180 + bottom, Math.max(right - left, 1), Math.max(top - bottom, 1), this.stage.glCollisionContext.RGBA, this.stage.glCollisionContext.UNSIGNED_BYTE, data); this.stage.glCollisionContext.scissor(0, 0, 480, 360); var length = data.length; for (var j = 0; j < length; j += 4) { if (data[j + 3]) { return true; } } } return false; } }; Sprite.prototype.touchingColor = function (rgb) { var b = this.rotatedBounds(); //collisionCanvas.width = Math.ceil(b.right - b.left); //collisionCanvas.height = Math.ceil(b.top - b.bottom); //collisionContext.save(); //collisionContext.translate(-(240 + b.left), -(180 - b.top)); /* this.stage.drawAllOn(collisionContext, this); collisionContext.globalCompositeOperation = 'destination-in'; this.draw(collisionContext, true); */ //set context to size of sprite: //this.stage.glCollisionCanvas.width = Math.ceil(b.right - b.left); //this.stage.glCollisionCanvas.height = Math.ceil(b.top - b.bottom); //this.stage.glCollisionCanvas.collisionMode = b; this.stage.glCollisionContext.scissor(240 + b.left, 180 + b.bottom, Math.ceil(b.right) - Math.floor(b.left), Math.ceil(b.top) - Math.floor(b.bottom)); this.stage.glCollisionContext.clear(this.stage.glCollisionContext.COLOR_BUFFER_BIT); this.stage.glCollisionContext.useTouchingShader = false; this.stage.drawAllOn(this.stage.glCollisionContext, this); this.stage.glCollisionContext.touchingShaderInfo.blendSource = this.stage.glCollisionContext.ZERO; this.stage.glCollisionContext.touchingShaderInfo.blendDest = this.stage.glCollisionContext.SRC_COLOR; this.stage.tColor = [0.0, 0.0, 0.0, 0.0] this.stage.glCollisionContext.useTouchingShader = true; this.draw(this.stage.glCollisionContext, true); //collisionContext.restore(); /* var width = collisionCanvas.width; var height = collisionCanvas.height; if(width <= 0){ width=1; } if(height <= 0){ height=1; } */ //var data = collisionContext.getImageData(0, 0, width, height).data; //b.right = Math.min(b.right, 240); var tempTest = performance.now(); var data = new Uint8Array((Math.ceil(b.right) - Math.floor(b.left)) * (Math.ceil(b.top) - Math.floor(b.bottom)) * 4); this.stage.glCollisionContext.finish(); this.stage.glCollisionContext.readPixels( 240 + b.left, 180 + b.bottom, Math.ceil(b.right) - Math.floor(b.left), Math.ceil(b.top) - Math.floor(b.bottom), this.stage.glCollisionContext.RGBA, this.stage.glCollisionContext.UNSIGNED_BYTE, data); this.stage.glCollisionContext.scissor(0, 0, 480, 360); //console.log(performance.now() - tempTest); //rgb = rgb & 0xffffff; var length = data.length;//Math.ceil(b.right - b.left) * Math.ceil(b.top - b.bottom) * 4; for (var i = 0; i < length; i += 4) { if (((data[i] << 16 | data[i + 1] << 8 | data[i + 2]) & 0xf8f8f0) === (rgb & 0xf8f8f0) && (data[i + 3] === 0xff)) { return true; } } return false; }; Sprite.prototype.colorTouchingColor = function (rgb1, rgb2, first) { var b = this.rotatedBounds(); this.stage.glCollisionContext.scissor(240 + b.left, 180 + b.bottom, Math.ceil(b.right) - Math.floor(b.left), Math.ceil(b.top) - Math.floor(b.bottom)); this.stage.glCollisionContext.clear(this.stage.glCollisionContext.COLOR_BUFFER_BIT); this.stage.glCollisionContext.useTouchingShader = false; this.stage.drawAllOn(this.stage.glCollisionContext, this); this.stage.glCollisionContext.touchingShaderInfo.blendSource = this.stage.glCollisionContext.ZERO; this.stage.glCollisionContext.touchingShaderInfo.blendDest = this.stage.glCollisionContext.SRC_COLOR; this.stage.tColor = [((rgb1 & 0xff0000) >> 16) / 255, ((rgb1 & 0x00ff00) >> 8) / 255, (rgb1 & 0x0000ff) / 255, 1.0]; this.stage.glCollisionContext.useTouchingShader = true; this.draw(this.stage.glCollisionContext, true); b.right = Math.min(b.right, 240); var data = new Uint8Array(Math.ceil(b.right - b.left) * Math.ceil(b.top - b.bottom) * 4); this.stage.glCollisionContext.finish(); this.stage.glCollisionContext.readPixels( 240 + b.left, 180 + b.bottom, b.right - b.left, b.top - b.bottom, this.stage.glCollisionContext.RGBA, this.stage.glCollisionContext.UNSIGNED_BYTE, data); this.stage.glCollisionContext.scissor(0, 0, 480, 360); //rgb = rgb & 0xffffff; var length = Math.ceil(b.right - b.left) * Math.ceil(b.top - b.bottom) * 4; for (var i = 0; i < length; i += 4) { //if(Math.abs(data[i ] - data[i + 1]) <= 4 && // Math.abs(data[i ] - data[i + 2]) <= 4 && // Math.abs(data[i + 1] - data[i + 2]) <= 4){ // if(data[i + 2] === (rgb2 & 0x0000ff) && data[i + 3]){ // return true; // } //} //else{ if (((data[i] << 16 | data[i + 1] << 8 | data[i + 2]) & 0xf8f8f0) === (rgb2 & 0xf8f8f0) && data[i + 3]) { return true; } //} } return false; } Sprite.prototype.bounceOffEdge = function () { var b = this.rotatedBounds(); var dl = 240 + b.left; var dt = 180 - b.top; var dr = 240 - b.right; var db = 180 + b.bottom; var d = Math.min(dl, dt, dr, db); if (d > 0) return; var dir = this.direction * Math.PI / 180; var dx = Math.sin(dir); var dy = -Math.cos(dir); switch (d) { case dl: dx = Math.max(0.2, Math.abs(dx)); break; case dt: dy = Math.max(0.2, Math.abs(dy)); break; case dr: dx = -Math.max(0.2, Math.abs(dx)); break; case db: dy = -Math.max(0.2, Math.abs(dy)); break; } this.direction = Math.atan2(dy, dx) * 180 / Math.PI + 90; if (this.saying) this.updateBubble(); b = this.rotatedBounds(); var x = this.scratchX; var y = this.scratchY; if (b.left < -240) x += -240 - b.left; if (b.top > 180) y += 180 - b.top; if (b.right > 240) x += 240 - b.left; if (b.bottom < -180) y += -180 - b.top; }; Sprite.prototype.rotatedBounds = function () { var costume = this.costumes[this.currentCostumeIndex]; var s = costume.scale * this.scale; var left = -costume.rotationCenterX * s; var top = costume.rotationCenterY * s; var right = left + costume.image.width * s / costume.resScale; var bottom = top - costume.image.height * s / costume.resScale; if (this.rotationStyle !== 'normal') { if (this.rotationStyle === 'leftRight' && this.direction < 0) { right = -left; left = right - costume.image.width * costume.scale * this.scale / costume.resScale; } return { left: this.scratchX + left, right: this.scratchX + right, top: this.scratchY + top, bottom: this.scratchY + bottom }; } var mSin = Math.sin(this.direction * Math.PI / 180); var mCos = Math.cos(this.direction * Math.PI / 180); var tlX = mSin * left - mCos * top; var tlY = mCos * left + mSin * top; var trX = mSin * right - mCos * top; var trY = mCos * right + mSin * top; var blX = mSin * left - mCos * bottom; var blY = mCos * left + mSin * bottom; var brX = mSin * right - mCos * bottom; var brY = mCos * right + mSin * bottom; return { left: this.scratchX + Math.min(tlX, trX, blX, brX), right: this.scratchX + Math.max(tlX, trX, blX, brX), top: this.scratchY + Math.max(tlY, trY, blY, brY), bottom: this.scratchY + Math.min(tlY, trY, blY, brY) }; }; Sprite.prototype.showRotatedBounds = function () { var bounds = this.rotatedBounds(); var div = document.createElement('div'); div.style.outline = '1px solid red'; div.style.position = 'absolute'; div.style.left = (240 + bounds.left) + 'px'; div.style.top = (180 - bounds.top) + 'px'; div.style.width = (bounds.right - bounds.left) + 'px'; div.style.height = (bounds.top - bounds.bottom) + 'px'; this.stage.canvas.parentNode.appendChild(div); }; Sprite.prototype.distanceTo = function (thing) { if (thing === '_mouse_') { var x = this.stage.mouseX; var y = this.stage.mouseY; } else { var sprite = this.stage.getObject(thing); if (!sprite) return 0; x = sprite.scratchX; y = sprite.scratchY; } return Math.sqrt((this.scratchX - x) * (this.scratchX - x) + (this.scratchY - y) * (this.scratchY - y)); }; Sprite.prototype.gotoObject = function (thing) { if (thing === '_mouse_') { this.moveTo(this.stage.mouseX, this.stage.mouseY); } else if (thing === '_random_') { var x = Math.round(480 * Math.random() - 240); var y = Math.round(360 * Math.random() - 180); this.moveTo(x, y); } else { var sprite = this.stage.getObject(thing); if (!sprite) return 0; this.moveTo(sprite.scratchX, sprite.scratchY); } }; Sprite.prototype.pointTowards = function (thing) { if (thing === '_mouse_') { var x = this.stage.mouseX; var y = this.stage.mouseY; } else { var sprite = this.stage.getObject(thing); if (!sprite) return 0; x = sprite.scratchX; y = sprite.scratchY; } var dx = x - this.scratchX; var dy = y - this.scratchY; this.direction = dx === 0 && dy === 0 ? 90 : Math.atan2(dx, dy) * 180 / Math.PI; if (this.saying) this.updateBubble(); }; Sprite.prototype.say = function (text, thinking) { text = '' + text; if (!text) { this.saying = false; if (!this.bubble) return; this.bubble.style.display = 'none'; return ++this.sayId; } this.saying = true; this.thinking = thinking; if (!this.bubble) { this.bubble = document.createElement('div'); this.bubble.style.maxWidth = '' + (127 / 14) + 'em'; this.bubble.style.minWidth = '' + (48 / 14) + 'em'; this.bubble.style.padding = '' + (8 / 14) + 'em ' + (10 / 14) + 'em'; this.bubble.style.border = '' + (3 / 14) + 'em solid rgb(160, 160, 160)'; this.bubble.style.borderRadius = '' + (10 / 14) + 'em'; this.bubble.style.background = '#fff'; this.bubble.style.position = 'absolute'; this.bubble.style.font = 'bold 1.4em sans-serif'; this.bubble.style.whiteSpace = 'pre-wrap'; this.bubble.style.wordWrap = 'break-word'; this.bubble.style.textAlign = 'center'; this.bubble.style.cursor = 'default'; this.bubble.appendChild(this.bubbleText = document.createTextNode('')); this.bubble.appendChild(this.bubblePointer = document.createElement('div')); this.bubblePointer.style.position = 'absolute'; this.bubblePointer.style.height = '' + (21 / 14) + 'em'; this.bubblePointer.style.width = '' + (44 / 14) + 'em'; this.bubblePointer.style.background = 'url(/img/icons.svg) ' + (-195 / 14) + 'em ' + (-4 / 14) + 'em'; this.bubblePointer.style.backgroundSize = '' + (320 / 14) + 'em ' + (96 / 14) + 'em'; this.stage.root.appendChild(this.bubble); } this.bubblePointer.style.backgroundPositionX = ((thinking ? -259 : -195) / 14) + 'em'; this.bubble.style.display = 'block'; this.bubbleText.nodeValue = text; this.updateBubble(); return ++this.sayId; }; Sprite.prototype.updateBubble = function () { //var bWidth = this.bubble.offsetWidth; //var bHeight = Math.max(this.stage.zoomX, this.stage.zoomY * 0.75); if (!this.visible || !this.saying) { this.bubble.style.display = 'none'; return; } var b = this.rotatedBounds(); var z = Math.max(this.stage.zoomX, this.stage.zoomY); var width = this.bubble.offsetWidth / z; var height = this.bubble.offsetHeight / z; var stageTop; var stageRight; if (this.stage.zoomX <= this.stage.zoomY) { stageTop = 360; stageRight = 480 * this.stage.zoomX / this.stage.zoomY; } else { stageTop = 360 * this.stage.zoomY / this.stage.zoomX; stageRight = 480; } var left = 240 + b.right; var bottom = stageTop - 180 + b.top; this.bubblePointer.style.top = ((height - 6) / 14) + 'em'; if (left + width + 2 > stageRight) { this.bubble.style.right = ((stageRight - 240 - b.left) / 14) + 'em'; this.bubble.style.left = 'auto'; this.bubblePointer.style.right = (3 / 14) + 'em'; this.bubblePointer.style.left = 'auto'; this.bubblePointer.style.backgroundPositionY = (-36 / 14) + 'em'; } else { this.bubble.style.left = (left / 14) + 'em'; this.bubble.style.right = 'auto'; this.bubblePointer.style.left = (3 / 14) + 'em'; this.bubblePointer.style.right = 'auto'; this.bubblePointer.style.backgroundPositionY = (-4 / 14) + 'em'; } if (bottom + height + 2 > stageTop) { bottom = stageTop - height - 2; } if (bottom < 19) { bottom = 19; } this.bubble.style.bottom = (bottom / 14) + 'em'; }; Sprite.prototype.remove = function () { if (this.bubble) { this.stage.root.removeChild(this.bubble); this.bubble = null; } if (this.node) { this.node.disconnect(); this.node = null; } }; var Costume = function (data, index, base) { this.index = index; this.base = base; this.baseLayerID = data.baseLayerID; this.baseLayerMD5 = data.baseLayerMD5; this.baseLayer = data.$image ? data.$image : new Image(0, 0); this.bitmapResolution = data.bitmapResolution || 1; this.scale = 1 / this.bitmapResolution; this.costumeName = data.costumeName; this.rotationCenterX = data.rotationCenterX; this.rotationCenterY = data.rotationCenterY; this.textLayer = data.$text; //Increases dynamically as needed. this.resScale = 1; //Is this an svg, i.e. does it need to be rescaled for good resolution? this.isSvg = this.baseLayerMD5.split('.')[1] === 'svg'; //this.image = document.createElement('canvas'); //this.context = this.image.getContext('2d'); this.render(); this.baseLayer.onload = function () { this.render(); }.bind(this); if (this.textLayer) { this.textLayer.onload = this.baseLayer.onload; } }; addEvents(Costume, 'load'); Costume.prototype.render = function () { this.image = document.createElement('canvas'); this.context = this.image.getContext('2d'); if (!this.baseLayer.width || this.textLayer && !this.textLayer.width) { return; } this.image.width = this.baseLayer.width * this.resScale; this.image.height = this.baseLayer.height * this.resScale; this.context.imageSmoothingEnabled = false; this.context.msImageSmoothingEnabled = false; this.context.drawImage(this.baseLayer, 0, 0, this.image.width, this.image.height); if (this.textLayer) { this.context.drawImage(this.textLayer, 0, 0, this.image.width, this.image.height); } if (this.base.isStage && this.index == this.base.currentCostumeIndex) { setTimeout(function () { this.base.updateBackdrop(); }.bind(this)); } //console.log('making texture'); if (this.base.isStage) { this.image.imgInfo = glMakeTexture(this.base.stage.backdropContext, this.image); } else { this.image.imgInfo = glMakeTexture(this.base.stage.context, this.image); this.image.penImgInfo = glMakeTexture(this.base.stage.penContext, this.image); } this.image.collisionImgInfo = glMakeTexture(this.base.stage.glCollisionContext, this.image); //destroy context and canvas after rendering. this.context = null; this.image.remove(); }; var Sound = function (data) { this.name = data.soundName; this.buffer = data.$buffer; this.duration = this.buffer ? this.buffer.duration : 0; }; var Watcher = function (stage) { this.stage = stage; this.cmd = 'getVar:'; this.color = '#ee7d16'; this.isDiscrete = true; this.label = 'watcher'; this.mode = 1; this.param = 'var'; this.sliderMax = 100; this.sliderMin = 0; this.target = undefined; this.visible = true; this.x = 0; this.y = 0; }; Watcher.prototype.fromJSON = function (data) { this.cmd = data.cmd || 'getVar:'; if (data.color) { var c = (data.color < 0 ? data.color + 0x1000000 : data.color).toString(16); this.color = '#000000'.slice(0, -c.length) + c; } this.isDiscrete = data.isDiscrete == null ? true : data.isDiscrete; this.label = data.label || ''; this.mode = data.mode || 1; this.param = data.param; this.sliderMax = data.sliderMax == null ? 100 : data.sliderMax; this.sliderMin = data.sliderMin || 0; this.targetName = data.target; this.visible = data.visible == null ? true : data.visible; this.x = data.x || 0; this.y = data.y || 0; return this; }; Watcher.prototype.resolve = function () { this.target = this.stage.getObject(this.targetName); if (this.target && this.cmd === 'getVar:') { this.target.watchers[this.param] = this; } if (!this.label) { this.label = this.getLabel(); if (this.target.isSprite) this.label = this.target.objName + ': ' + this.label; } }; var WATCHER_LABELS = { 'costumeIndex': 'costume #', 'xpos': 'x position', 'ypos': 'y position', 'heading': 'direction', 'scale': 'size', 'backgroundIndex': 'background #', 'sceneName': 'background name', 'tempo': 'tempo', 'volume': 'volume', 'answer': 'answer', 'timer': 'timer', 'soundLevel': 'loudness', 'isLoud': 'loud?', 'xScroll': 'x scroll', 'yScroll': 'y scroll' }; Watcher.prototype.getLabel = function () { switch (this.cmd) { case 'getVar:': return this.param; case 'sensor:': return this.param + ' sensor value'; case 'sensorPressed': return 'sensor ' + this.param + '?'; case 'timeAndDate': return this.param; case 'senseVideoMotion': return 'video ' + this.param; } return WATCHER_LABELS[this.cmd] || ''; }; Watcher.prototype.draw = function (destContext) { var canvas = document.createElement('canvas'); var context = canvas.getContext('2d'); var z = Math.min(this.stage.zoomX, this.stage.zoomY); canvas.width = 480 * z; canvas.height = 360 * z; context.scale(z, z); context.imageSmoothingEnabled = false; context.msImageSmoothingEnabled = false; var value = 0; if (!this.target) return; switch (this.cmd) { case 'answer': value = this.stage.answer; break; case 'backgroundIndex': value = this.stage.currentCostumeIndex + 1; break; case 'costumeIndex': value = this.target.currentCostumeIndex + 1; break; case 'getVar:': if (this.param.includes("sulf.") && !this.param.includes(".c") && !this.param.includes(".p")) { value = readSulfVar(this.param) } else { value = this.target.vars[this.param]; } if (this.mode === 3 && this.stage.mousePressed) { var x = this.stage.mouseX + 240 - this.x - 5; var y = 180 - this.stage.mouseY - this.y - 20; if (x >= 0 && y >= 0 && x <= this.width - 5 - 5 && y <= 9) { value = this.sliderMin + Math.max(0, Math.min(1, (x - 2.5) / (this.width - 5 - 5 - 5))) * (this.sliderMax - this.sliderMin); value = this.isDiscrete ? Math.round(value) : Math.round(value * 100) / 100; this.target.vars[this.param] = value; } } break; case 'heading': value = this.target.direction; break; case 'scale': value = this.target.scale * 100; break; case 'sceneName': value = this.stage.getCostumeName(); break; case 'senseVideoMotion': // TODO break; case 'soundLevel': // TODO break; case 'tempo': value = this.stage.tempoBPM; break; case 'timeAndDate': value = this.timeAndDate(this.param); break; case 'timer': value = Math.round((this.stage.now() - this.stage.timerStart) / 100) / 10; break; case 'volume': value = this.target.volume * 100; break; case 'xpos': value = this.target.scratchX; break; case 'ypos': value = this.target.scratchY; break; } if (typeof value === 'number' && (value < 0.001 || value > 0.001)) { value = Math.round(value * 1000) / 1000; } value = '' + value; if (this.labelWidth == null) { context.font = 'bold 11px sans-serif'; this.labelWidth = context.measureText(this.label).width; } context.save(); context.translate(this.x, this.y); //drawing variables in here? if (this.mode === 1 || this.mode === 3) { context.font = 'bold 11px sans-serif'; var dw = Math.max(41, 5 + context.measureText(value).width + 5); var r = 5; var w = this.width = 5 + this.labelWidth + 5 + dw + 5; var h = this.mode === 1 ? 21 : 32; context.strokeStyle = 'rgb(148, 145, 145)'; context.fillStyle = 'rgb(193, 196, 199)'; context.lineWidth = 2; context.beginPath(); context.arc(r + 1, r + 1, r, Math.PI, Math.PI * 3 / 2, false); context.arc(w - r - 1, r + 1, r, Math.PI * 3 / 2, 0, false); context.arc(w - r - 1, h - r - 1, r, 0, Math.PI / 2, false); context.arc(r + 1, h - r - 1, r, Math.PI / 2, Math.PI, false); context.closePath(); context.stroke(); context.fill(); context.fillStyle = '#000'; context.fillText(this.label, 5, 14); var dh = 15; var dx = 5 + this.labelWidth + 5; var dy = 3; var dr = 4; context.save(); context.translate(dx, dy); context.strokeStyle = '#fff'; context.fillStyle = this.color; context.lineWidth = 2; context.beginPath(); context.arc(dr + 1, dr + 1, dr, Math.PI, Math.PI * 3 / 2, false); context.arc(dw - dr - 1, dr + 1, dr, Math.PI * 3 / 2, 0, false); context.arc(dw - dr - 1, dh - dr - 1, dr, 0, Math.PI / 2, false); context.arc(dr + 1, dh - dr - 1, dr, Math.PI / 2, Math.PI, false); context.closePath(); context.stroke(); context.fill(); context.fillStyle = '#fff'; context.textAlign = 'center'; context.fillText(value, dw / 2, dh - 4); context.restore(); if (this.mode === 3) { var sh = 5; var sw = w - 5 - 5; var sr = 1.5; var br = 4.5; context.save(); context.translate(5, 22); context.strokeStyle = 'rgb(148, 145, 145)'; context.fillStyle = 'rgb(213, 216, 219)'; context.lineWidth = 2; context.beginPath(); context.arc(sr + 1, sr + 1, sr, Math.PI, Math.PI * 3 / 2, false); context.arc(sw - sr - 1, sr + 1, sr, Math.PI * 3 / 2, 0, false); context.arc(sw - sr - 1, sh - sr - 1, sr, 0, Math.PI / 2, false); context.arc(sr + 1, sh - sr - 1, sr, Math.PI / 2, Math.PI, false); context.closePath(); context.stroke(); context.fill(); var x = (sw - sh) * Math.max(0, Math.min(1, ((+value || 0) - this.sliderMin) / (this.sliderMax - this.sliderMin))); context.strokeStyle = 'rgb(108, 105, 105)'; context.fillStyle = 'rgb(233, 236, 239)'; context.beginPath(); context.arc(x + sh / 2, sh / 2, br - 1, 0, Math.PI * 2, false); context.stroke(); context.fill(); context.restore(); } } else if (this.mode === 2) { context.font = 'bold 15px sans-serif'; dh = 21; dw = Math.max(41, 5 + context.measureText(value).width + 5); dr = 4; context.strokeStyle = '#fff'; context.fillStyle = this.color; context.lineWidth = 2; context.beginPath(); context.arc(dr + 1, dr + 1, dr, Math.PI, Math.PI * 3 / 2, false); context.arc(dw - dr - 1, dr + 1, dr, Math.PI * 3 / 2, 0, false); context.arc(dw - dr - 1, dh - dr - 1, dr, 0, Math.PI / 2, false); context.arc(dr + 1, dh - dr - 1, dr, Math.PI / 2, Math.PI, false); context.closePath(); context.stroke(); context.fill(); context.fillStyle = '#fff'; context.textAlign = 'center'; context.fillText(value, dw / 2, dh - 5); } context.restore(); var imgInfo = glMakeTexture(destContext, canvas); glDrawImage( destContext, destContext.imgShaderInfo, destContext.imgBuffers, imgInfo, 0, 0, 480, 360, 0, 0, 0); destContext.deleteTexture(imgInfo.texture); imgInfo = null; canvas.remove(); }; var AudioContext = window.AudioContext || window.webkitAudioContext; var audioContext = AudioContext && new AudioContext; audioContext.mInit = false; return { hasTouchEvents: hasTouchEvents, getKeyCode: getKeyCode, audioContext: audioContext, IO: IO, Base: Base, Stage: Stage, Sprite: Sprite, Watcher: Watcher }; }()); //var socket = io.connect(window.location.hostname + ':8082'); var sulfCloudVars = []; var sulfCloudVarsChanged = {}; var sulfVarsload; var firstRunSulfCloudVars = true; var cloudManager = function (vars, lists) { //console.log(sulfCloudVars) if (firstRunSulfCloudVars) { sulfVarsload = vars; sulfListsload = lists; firstRunSulfCloudVars = false; } else { return; } var j = 0; for (var i = 0; i < vars.length; i++) { if (sulfVarsload[i].name.substring(sulfVarsload[i].name.indexOf(".") + 1, sulfVarsload[i].name.indexOf(".") + 3) == 'c.' || sulfVarsload[i].name.charAt(0) == '☁') { sulfCloudVars[sulfVarsload[i].name] = sulfVarsload[sulfVarsload[i].name]; j++; } } var j = 0; for (var i = 0; i < lists.length; i++) { if (sulfListsload[i].listName.substring(sulfListsload[i].listName.indexOf(".") + 1, sulfListsload[i].listName.indexOf(".") + 3) == 'c.' || sulfListsload[i].listName.charAt(0) == '☁') { sulfCloudVars[sulfListsload[i].listName] = sulfListsload[i].contents; j++; } } if (Object.keys(sulfCloudVars).length != 0) { console.log("cloud Project") setInterval(function () { console.log({ "projectID": projectID, sulfCloudVars }) socket.emit('getReq', { "projectID": projectID, sulfCloudVars }); sulfCloudVarsChanged = {}; }, 1000); } socket.on('getRes', (function (data) { console.log("loadCloud data") console.log(data) sulfCloudVars = data; })); } var outputZip var sulfCookieVars = {}; var sulfUsername; var volumeNode; window.onbeforeunload = WindowCloseHanlder; function WindowCloseHanlder() { sulfVarsload = 'undefined'; stage.stopAll(); setCookie(sulfCookieVars); } P.compile = (function () { 'use strict'; var LOG_PRIMITIVES; var DEBUG; // LOG_PRIMITIVES = true; // DEBUG = true; var EVENT_SELECTORS = [ 'procDef', 'whenClicked', 'whenCloned', 'whenGreenFlag', 'whenIReceive', 'whenKeyPressed', 'whenSceneStarts', 'whenSensorGreaterThan' // TODO ]; var compileScripts = function (object) { for (var i = 0; i < object.scripts.length; i++) { compileListener(object, object.scripts[i][2]); } }; var warnings; var warn = function (message) { warnings[message] = (warnings[message] || 0) + 1; }; var compileListener = function (object, script) { if (!script[0] || EVENT_SELECTORS.indexOf(script[0][0]) === -1) return; var nextLabel = function () { return object.fns.length + fns.length; }; var label = function () { var id = nextLabel(); fns.push(source.length); return id; }; var delay = function () { source += 'return;\n'; label(); }; var queue = function (id) { source += 'queue(' + id + ');\n'; source += 'return;\n'; }; var forceQueue = function (id) { source += 'forceQueue(' + id + ');\n'; source += 'return;\n'; }; var seq = function (script) { if (!script) return; for (var i = 0; i < script.length; i++) { compile(script[i]); } }; var varRef = function (name) { if (typeof name !== 'string') { return 'getVars(' + val(name) + ')[' + val(name) + ']'; } var o = object.stage.vars[name] !== undefined ? 'self' : 'S'; return o + '.vars[' + val(name) + ']'; }; var listRef = function (name) { if (typeof name !== 'string') { return 'getLists(' + val(name) + ')[' + val(name) + ']'; } var o = object.stage.lists[name] !== undefined ? 'self' : 'S'; if (o === 'S' && !object.lists[name]) { object.lists[name] = []; } return o + '.lists[' + val(name) + ']'; }; var param = function (name, usenum, usebool) { if (typeof name !== 'string') { throw new Error('Dynamic parameters are not supported'); } if (!inputs) return '0'; var i = inputs.indexOf(name); if (i === -1) { return '0'; } var t = types[i]; var kind = t === '%n' || t === '%d' || t === '%c' ? 'num' : t === '%b' ? 'bool' : ''; if (kind === 'num' && usenum) { return 'C.numargs[' + i + ']'; } if (kind === 'bool' && usebool) { return 'C.boolargs[' + i + ']'; } if (usenum) return '(+C.args[' + i + '] || 0)'; if (usebool) return 'bool(C.args[' + i + '])'; return 'C.args[' + i + ']'; }; var val = function (e, usenum, usebool) { var v; if (typeof e === 'number' || typeof e === 'boolean') { return '' + e; } else if (typeof e === 'string') { return '"' + e .replace(/\\/g, '\\\\') .replace(/\n/g, '\\n') .replace(/\r/g, '\\r') .replace(/"/g, '\\"') .replace(/\{/g, '\\x7b') .replace(/\}/g, '\\x7d') + '"'; } else if (e[0] === 'getParam') { /* Data */ return param(e[1], usenum, usebool); } else if ((v = numval(e)) != null || (v = boolval(e)) != null) { return v; } else if (e[0] === 'costumeName') { return 'S.getCostumeName()'; } else if (e[0] === 'sceneName') { return 'self.getCostumeName()'; } else if (e[0] === 'readVariable') { if (e[1].substring(e[1].indexOf(".") + 1, e[1].indexOf(".") + 3) == 'c.' || e[1].charAt(0) == '☁') { return 'sulfCloudVars["' + e[1] + '"]'; } if (e[1].substring(e[1].indexOf(".") + 1, e[1].indexOf(".") + 3) == 'p.') { return 'sulfCookieVars["' + e[1] + '"]'; } if (e[1].includes("sulf.") && !e[1].includes(".c") && !e[1].includes(".p")) { return readSulfVarAsString(e[1]) } return varRef(e[1]); } else if (e[0] === 'contentsOfList:') { return 'contentsOfList(' + listRef(e[1]) + ')'; } else if (e[0] === 'getLine:ofList:') { return 'getLineOfList(' + listRef(e[2]) + ', ' + val(e[1]) + ')'; } else if (e[0] === 'concatenate:with:') { return '("" + ' + val(e[1]) + ' + ' + val(e[2]) + ')'; } else if (e[0] === 'letter:of:') { return '(("" + ' + val(e[2]) + ')[(' + num(e[1]) + ' | 0) - 1] || "")'; } else if (e[0] === 'answer') { /* Sensing */ return 'self.answer'; } else if (e[0] === 'getAttribute:of:') { return 'attribute(' + val(e[1]) + ', ' + val(e[2]) + ')'; } else if (e[0] === 'getUserId') { return '0'; } else if (e[0] === 'getUserName') { return 'sulfUsername'; } else { warn('Undefined val: ' + e[0]); } }; var numval = function (e) { if (e[0] === 'xpos') { /* Motion */ return 'S.scratchX'; } else if (e[0] === 'ypos') { return 'S.scratchY'; } else if (e[0] === 'heading') { return 'S.direction'; } else if (e[0] === 'costumeIndex') { /* Looks */ return '(S.currentCostumeIndex + 1)'; } else if (e[0] === 'backgroundIndex') { return '(self.currentCostumeIndex + 1)'; } else if (e[0] === 'scale') { return '(S.scale * 100)'; } else if (e[0] === 'volume') { /* Sound */ return '(S.volume * 100)'; } else if (e[0] === 'tempo') { return 'self.tempoBPM'; } else if (e[0] === 'lineCountOfList:') { /* Data */ return listRef(e[1]) + '.length'; } else if (e[0] === '+') { /* Operators */ return '(' + num(e[1]) + ' + ' + num(e[2]) + ' || 0)'; } else if (e[0] === '-') { return '(' + num(e[1]) + ' - ' + num(e[2]) + ' || 0)'; } else if (e[0] === '*') { return '(' + num(e[1]) + ' * ' + num(e[2]) + ' || 0)'; } else if (e[0] === '/') { return '(' + num(e[1]) + ' / ' + num(e[2]) + ' || 0)'; } else if (e[0] === 'randomFrom:to:') { return 'random(' + num(e[1]) + ', ' + num(e[2]) + ')'; } else if (e[0] === 'abs') { return 'Math.abs(' + num(e[1]) + ')'; } else if (e[0] === 'sqrt') { return 'Math.sqrt(' + num(e[1]) + ')'; } else if (e[0] === 'stringLength:') { return '("" + ' + val(e[1]) + ').length'; } else if (e[0] === '%' || e[0] === '\\\\') { return 'mod(' + num(e[1]) + ', ' + num(e[2]) + ')'; } else if (e[0] === 'rounded') { return 'Math.round(' + num(e[1]) + ')'; } else if (e[0] === 'computeFunction:of:') { return 'mathFunc(' + val(e[1]) + ', ' + num(e[2]) + ')'; } else if (e[0] === 'mouseX') { /* Sensing */ return 'self.mouseX'; } else if (e[0] === 'mouseY') { return 'self.mouseY'; } else if (e[0] === 'timer') { return '((self.now() - self.timerStart) / 1000)'; } else if (e[0] === 'distanceTo:') { return 'S.distanceTo(' + val(e[1]) + ')'; // } else if (e[0] === 'soundLevel') { } else if (e[0] === 'timestamp') { return '((Date.now() - epoch) / 86400000)'; } else if (e[0] === 'timeAndDate') { return 'timeAndDate(' + val(e[1]) + ')'; // } else if (e[0] === 'sensor:') { } }; var DIGIT = /\d/; var boolval = function (e) { if (e[0] === 'list:contains:') { /* Data */ return 'listContains(' + listRef(e[1]) + ', ' + val(e[2]) + ')'; } else if (e[0] === '<' || e[0] === '>') { /* Operators */ if (typeof e[1] === 'string' && DIGIT.test(e[1]) || typeof e[1] === 'number') { var less = e[0] === '<'; var x = e[1]; var y = e[2]; } else if (typeof e[2] === 'string' && DIGIT.test(e[2]) || typeof e[2] === 'number') { var less = e[0] === '>'; var x = e[2]; var y = e[1]; } var nx = +x; if (x == null || nx !== nx) { return '(compare(' + val(e[1]) + ', ' + val(e[2]) + ') === ' + (e[0] === '<' ? -1 : 1) + ')'; } return (less ? 'numLess' : 'numGreater') + '(' + nx + ', ' + val(y) + ')'; } else if (e[0] === '=') { if (typeof e[1] === 'string' && DIGIT.test(e[1]) || typeof e[1] === 'number') { var x = e[1]; var y = e[2]; } else if (typeof e[2] === 'string' && DIGIT.test(e[2]) || typeof e[2] === 'number') { var x = e[2]; var y = e[1]; } var nx = +x; if (x == null || nx !== nx) { return '(equal(' + val(e[1]) + ', ' + val(e[2]) + '))'; } return '(numEqual(' + nx + ', ' + val(y) + '))'; } else if (e[0] === '&') { return '(' + bool(e[1]) + ' && ' + bool(e[2]) + ')'; } else if (e[0] === '|') { return '(' + bool(e[1]) + ' || ' + bool(e[2]) + ')'; } else if (e[0] === 'not') { return '!' + bool(e[1]) + ''; } else if (e[0] === 'mousePressed') { /* Sensing */ return 'self.mousePressed'; } else if (e[0] === 'touching:') { return 'S.touching(' + val(e[1]) + ')'; } else if (e[0] === 'touchingColor:') { return 'S.touchingColor(' + val(e[1]) + ')'; } else if (e[0] === 'color:sees:') { return 'S.colorTouchingColor(' + val(e[1]) + ', ' + val(e[2]) + ')'; } else if (e[0] === 'keyPressed:') { return '!!self.keys[P.getKeyCode(' + val(e[1]) + ')]'; // } else if (e[0] === 'isLoud') { // } else if (e[0] === 'sensorPressed:') { } }; var bool = function (e) { if (typeof e === 'boolean') { return e; } if (typeof e === 'number' || typeof e === 'string') { return +e !== 0 && e !== '' && e !== 'false' && e !== false; } var v = boolval(e); return v != null ? v : 'bool(' + val(e, false, true) + ')'; }; var num = function (e) { if (typeof e === 'number') { return e || 0; } if (typeof e === 'boolean' || typeof e === 'string') { return +e || 0; } var v = numval(e); return v != null ? v : '(+' + val(e, true) + ' || 0)'; }; var beatHead = function (dur) { source += 'save();\n'; source += 'R.start = self.now();\n'; source += 'R.duration = ' + num(dur) + ' * 60 / self.tempoBPM;\n'; source += 'R.first = true;\n'; }; var beatTail = function (dur) { var id = label(); source += 'if (self.now() - R.start < R.duration * 1000 || R.first) {\n'; source += ' R.first = false;\n'; forceQueue(id); source += '}\n'; source += 'restore();\n'; }; var wait = function (dur) { source += 'save();\n'; source += 'R.start = self.now();\n'; source += 'R.duration = ' + dur + ';\n'; source += 'R.first = true;\n'; var id = label(); source += 'if (self.now() - R.start < R.duration * 1000 || R.first) {\n'; source += ' R.first = false;\n'; forceQueue(id); source += '}\n'; source += 'restore();\n'; }; var noRGB = ''; noRGB += 'if (S.penRGBA) {\n'; noRGB += ' var hsl = rgb2hsl(S.penColor & 0xffffff);\n'; noRGB += ' S.penHue = hsl[0];\n'; noRGB += ' S.penSaturation = hsl[1];\n'; noRGB += ' S.penLightness = hsl[2];\n'; noRGB += ' S.penRGBA = false;'; noRGB += '}\n'; var compile = function (block) { if (LOG_PRIMITIVES) { source += 'console.log(' + val(block[0]) + ');\n'; } if (['turnRight:', 'turnLeft:', 'heading:', 'pointTowards:', 'setRotationStyle', 'lookLike:', 'nextCostume', 'say:duration:elapsed:from:', 'say:', 'think:duration:elapsed:from:', 'think:', 'changeGraphicEffect:by:', 'setGraphicEffect:to:', 'filterReset', 'changeSizeBy:', 'setSizeTo:', 'comeToFront', 'goBackByLayers:'].indexOf(block[0]) !== -1) { source += 'if (S.visible) VISUAL = true;\n'; } else if (['forward:', 'gotoX:y:', 'gotoSpriteOrMouse:', 'changeXposBy:', 'xpos:', 'changeYposBy:', 'ypos:', 'bounceOffEdge', 'glideSecs:toX:y:elapsed:from:'].indexOf(block[0]) !== -1) { source += 'if (S.visible || S.isPenDown) VISUAL = true;\n'; } else if (['showBackground:', 'startScene', 'nextBackground', 'nextScene', 'startSceneAndWait', 'show', 'hide', 'putPenDown', 'stampCostume', 'showVariable:', 'hideVariable:', 'showList', 'hideList', 'doAsk', 'setVolumeTo:', 'changeVolumeBy:', 'setTempoTo:', 'changeTempoBy:'].indexOf(block[0]) !== -1) { source += 'VISUAL = true;\n'; } if (block[0] === 'forward:') { /* Motion */ source += 'S.forward(' + num(block[1]) + ');\n'; } else if (block[0] === 'turnRight:') { source += 'S.setDirection(S.direction + ' + num(block[1]) + ');\n'; } else if (block[0] === 'turnLeft:') { source += 'S.setDirection(S.direction - ' + num(block[1]) + ');\n'; } else if (block[0] === 'heading:') { source += 'S.setDirection(' + num(block[1]) + ');\n'; } else if (block[0] === 'pointTowards:') { source += 'S.pointTowards(' + val(block[1]) + ');\n'; } else if (block[0] === 'gotoX:y:') { source += 'S.moveTo(' + num(block[1]) + ', ' + num(block[2]) + ');\n'; } else if (block[0] === 'gotoSpriteOrMouse:') { source += 'S.gotoObject(' + val(block[1]) + ');\n'; } else if (block[0] === 'changeXposBy:') { source += 'S.moveTo(S.scratchX + ' + num(block[1]) + ', S.scratchY);\n'; } else if (block[0] === 'xpos:') { source += 'S.moveTo(' + num(block[1]) + ', S.scratchY);\n'; } else if (block[0] === 'changeYposBy:') { source += 'S.moveTo(S.scratchX, S.scratchY + ' + num(block[1]) + ');\n'; } else if (block[0] === 'ypos:') { source += 'S.moveTo(S.scratchX, ' + num(block[1]) + ');\n'; } else if (block[0] === 'bounceOffEdge') { source += 'S.bounceOffEdge();\n'; } else if (block[0] === 'setRotationStyle') { source += 'var style = ' + val(block[1]) + ';\n'; source += 'S.rotationStyle = style === "left-right" ? "leftRight" : style === "don\'t rotate" ? "none" : "normal";\n'; } else if (block[0] === 'lookLike:') { /* Looks */ source += 'S.setCostume(' + val(block[1]) + ');\n'; } else if (block[0] === 'nextCostume') { source += 'S.showNextCostume();\n'; } else if (block[0] === 'showBackground:' || block[0] === 'startScene') { source += 'var bgname = self.getCostumeName();\n'; source += 'self.setCostume(' + val(block[1]) + ');\n'; source += 'var threads = (self.getCostumeName()!= bgname)? sceneChange(): "";\n'; source += 'if (threads.indexOf(BASE) !== -1) return;\n'; } else if (block[0] === 'nextBackground' || block[0] === 'nextScene') { source += 'S.showNextCostume();\n'; source += 'var threads = sceneChange();\n'; source += 'if (threads.indexOf(BASE) !== -1) return;\n'; } else if (block[0] === 'startSceneAndWait') { source += 'save();\n'; source += 'self.setCostume(' + val(block[1]) + ');\n'; source += 'R.threads = sceneChange();\n'; source += 'if (R.threads.indexOf(BASE) !== -1) return;\n'; var id = label(); source += 'if (!running(R.threads)) {\n'; forceQueue(id); source += '}\n'; source += 'restore();\n'; } else if (block[0] === 'say:duration:elapsed:from:') { source += 'save();\n'; source += 'R.id = S.say(' + val(block[1]) + ', false);\n'; source += 'R.start = self.now();\n'; source += 'R.duration = ' + num(block[2]) + ';\n'; var id = label(); source += 'if (self.now() - R.start < R.duration * 1000) {\n'; forceQueue(id); source += '}\n'; source += 'if (S.sayId === R.id) {\n'; source += ' S.say("");\n'; source += '}\n'; source += 'restore();\n'; } else if (block[0] === 'say:') { source += 'S.say(' + val(block[1]) + ', false);\n'; } else if (block[0] === 'think:duration:elapsed:from:') { source += 'save();\n'; source += 'R.id = S.say(' + val(block[1]) + ', true);\n'; source += 'R.start = self.now();\n'; source += 'R.duration = ' + num(block[2]) + ';\n'; var id = label(); source += 'if (self.now() - R.start < R.duration * 1000) {\n'; forceQueue(id); source += '}\n'; source += 'if (S.sayId === R.id) {\n'; source += ' S.say("");\n'; source += '}\n'; source += 'restore();\n'; } else if (block[0] === 'think:') { source += 'S.say(' + val(block[1]) + ', true);\n'; } else if (block[0] === 'changeGraphicEffect:by:') { source += 'S.changeFilter(' + val(block[1]) + ', ' + num(block[2]) + ');\n'; } else if (block[0] === 'setGraphicEffect:to:') { source += 'S.setFilter(' + val(block[1]) + ', ' + num(block[2]) + ');\n'; } else if (block[0] === 'filterReset') { source += 'S.resetFilters();\n'; } else if (block[0] === 'changeSizeBy:') { source += 'S.scale += ' + num(block[1]) + ' / 100;\n'; source += 'if (S.scale < 0) S.scale = 0;\n'; } else if (block[0] === 'setSizeTo:') { source += 'S.scale = ' + num(block[1]) + ' / 100;\n'; source += 'if (S.scale < 0) S.scale = 0;\n'; } else if (block[0] === 'show') { source += 'S.visible = true;\n'; source += 'if (S.saying) S.updateBubble();\n'; } else if (block[0] === 'hide') { source += 'S.visible = false;\n'; source += 'if (S.saying) S.updateBubble();\n'; } else if (block[0] === 'comeToFront') { source += 'var i = self.children.indexOf(S);\n'; source += 'if (i !== -1) self.children.splice(i, 1);\n'; source += 'self.children.push(S);\n'; } else if (block[0] === 'goBackByLayers:') { source += 'var i = self.children.indexOf(S);\n'; source += 'if (i !== -1) {\n'; source += ' self.children.splice(i, 1);\n'; source += ' self.children.splice(Math.max(0, i - ' + num(block[1]) + '), 0, S);\n'; source += '}\n'; // } else if (block[0] === 'setVideoState') { // } else if (block[0] === 'setVideoTransparency') { } else if (block[0] === 'playSound:') { /* Sound */ if (P.audioContext) { source += 'var sound = S.getSound(' + val(block[1]) + ');\n'; source += 'if (sound) playSound(sound);\n'; } } else if (block[0] === 'doPlaySoundAndWait') { if (P.audioContext) { source += 'var sound = S.getSound(' + val(block[1]) + ');\n'; source += 'if (sound) {\n'; source += ' playSound(sound);\n'; wait('sound.duration'); source += '}\n'; } } else if (block[0] === 'stopAllSounds') { if (P.audioContext) { source += 'self.stopAllSounds();\n'; } // } else if (block[0] === 'drum:duration:elapsed:from:') { } else if (block[0] === 'playDrum') { beatHead(block[2]); if (P.audioContext) { source += 'playSpan(DRUMS[Math.round(' + num(block[1]) + ') - 1] || DRUMS[2], 60, 10);\n'; } beatTail(); } else if (block[0] === 'rest:elapsed:from:') { beatHead(block[1]); beatTail(); } else if (block[0] === 'noteOn:duration:elapsed:from:') { beatHead(block[2]); if (P.audioContext) { source += 'playNote(' + num(block[1]) + ', R.duration);\n'; } beatTail(); // } else if (block[0] === 'midiInstrument:') { } else if (block[0] === 'instrument:') { source += 'S.instrument = Math.max(0, Math.min(INSTRUMENTS.length - 1, ' + num(block[1]) + ' - 1)) | 0;'; } else if (block[0] === 'changeVolumeBy:' || block[0] === 'setVolumeTo:') { source += 'S.volume = Math.min(1, Math.max(0, ' + (block[0] === 'changeVolumeBy:' ? 'S.volume + ' : '') + num(block[1]) + ' / 100));\n'; source += 'if (S.node) S.node.gain.setValueAtTime(S.volume, audioContext.currentTime);\n'; source += 'for (var sounds = S.sounds, i = sounds.length; i--;) {\n'; source += ' var sound = sounds[i];\n'; source += ' if (sound.node && sound.target === S) {\n'; source += ' sound.node.gain.setValueAtTime(S.volume, audioContext.currentTime);\n'; source += ' }\n'; source += '}\n'; } else if (block[0] === 'changeTempoBy:') { source += 'self.tempoBPM += ' + num(block[1]) + ';\n'; } else if (block[0] === 'setTempoTo:') { source += 'self.tempoBPM = ' + num(block[1]) + ';\n'; } else if (block[0] === 'clearPenTrails') { /* Pen */ //source += 'self.penCanvas.width = 480 * self.maxZoomX;\n'; //source += 'self.penCanvas.height = 360 * self.maxZoomY;\n'; //source += 'self.penContext.scale(self.maxZoomX, self.maxZoomY);\n'; //source += 'self.penContext.lineCap = "butt";\n' source += 'self.penContext.clear(self.penContext.COLOR_BUFFER_BIT);\n'; } else if (block[0] === 'putPenDown') { source += 'S.isPenDown = true;\n'; //source += 'S.penState = false;\n'; source += 'S.dotPen();\n'; } else if (block[0] === 'putPenUp') { source += 'S.isPenDown = false;\n'; //source += 'if(!S.penState)\n'; //source += 'S.dotPen();\n'; //source += 'S.penState = null;\n'; } else if (block[0] === 'penColor:') { source += 'var c = ' + num(block[1]) + ';\n'; source += 'S.penColor = c;\n'; source += 'var a = (c >> 24 & 0xff) / 0xff;\n'; source += 'S.penRGBA = true;\n'; source += 'S.penRed = c >> 16 & 0xff;\n'; source += 'S.penGreen = c >> 8 & 0xff;\n'; source += 'S.penBlue = c & 0xff;\n'; source += 'S.penAlpha = a || 1;\n'; } else if (block[0] === 'setPenHueTo:') { source += noRGB; source += 'S.penHue = ' + num(block[1]) + ' * 360 / 200;\n'; source += 'S.penSaturation = 100;\n'; source += 'S.penRGBA = false;\n'; } else if (block[0] === 'changePenHueBy:') { source += noRGB; source += 'S.penHue += ' + num(block[1]) + ' * 360 / 200;\n'; source += 'S.penSaturation = 100;\n'; source += 'S.penRGBA = false;\n'; } else if (block[0] === 'setPenShadeTo:') { source += noRGB; source += 'S.penLightness = ' + num(block[1]) + ' % 200;\n'; source += 'if (S.penLightness < 0) S.penLightness += 200;\n'; source += 'S.penSaturation = 100;\n'; source += 'S.penRGBA = false;\n'; } else if (block[0] === 'changePenShadeBy:') { source += noRGB; source += 'S.penLightness = (S.penLightness + ' + num(block[1]) + ') % 200;\n'; source += 'if (S.penLightness < 0) S.penLightness += 200;\n'; source += 'S.penSaturation = 100;\n'; source += 'S.penRGBA = false;\n'; } else if (block[0] === 'penSize:') { source += 'var f = ' + num(block[1]) + ';\n'; source += 'S.penSize = f < 1 ? 1 : f;\n'; } else if (block[0] === 'changePenSizeBy:') { source += 'var f = S.penSize + ' + num(block[1]) + ';\n'; source += 'S.penSize = f < 1 ? 1 : f;\n'; } else if (block[0] === 'stampCostume') { source += 'S.draw(self.penContext);\n'; } else if (block[0] === 'setVar:to:') { /* Data */ if (block[1].substring(block[1].indexOf(".") + 1, block[1].indexOf(".") + 3) == 'c.' || block[1].charAt(0) == '☁') { console.log("cloud " + block[1]); //source += 'console.log(' + val(block[1]) + ");\n"; source += 'sulfCloudVars[' + val(block[1]) + ']=' + val(block[2]) + ';\n'; } else if (block[1].substring(block[1].indexOf(".") + 1, block[1].indexOf(".") + 3) == 'p.') { source += 'sulfCookieVars[' + val(block[1]) + ']=' + varRef(block[1]) + ';\n'; } //source += 'console.log(' + val(block[1]) + ");\n"; source += varRef(block[1]) + ' = ' + val(block[2]) + ';\n'; } else if (block[0] === 'changeVar:by:') { var ref = varRef(block[1]); //source += 'console.log('+varRef(block[1])+");\n"; source += ref + ' = (+' + ref + ' || 0) + ' + num(block[2]) + ';\n'; if (block[1].substring(block[1].indexOf(".") + 1, block[1].indexOf(".") + 3) == 'c.' || block[1].charAt(0) == '☁') { source += 'sulfCloudVars[' + val(block[1]) + ']=' + varRef(block[1]) + ';\n'; } else if (block[1].substring(block[1].indexOf(".") + 1, block[1].indexOf(".") + 3) == 'p.') { source += 'sulfCookieVars[' + val(block[1]) + ']=' + varRef(block[1]) + ';\n'; } } else if (block[0] === 'append:toList:') { source += 'appendToList(' + listRef(block[2]) + ', ' + val(block[1]) + ');\n'; if (block[2].includes(".c")) { //source += 'console.log( '+listRef(block[2])+')\n'; source += 'sulfCloudVars[' + val(block[2]) + '].push(' + val(block[1]) + ')\n'; //source += 'console.log( sulfCloudVars['+ val(block[2])+'])\n'; } source += 'self.updateList(' + val(block[2]) + ');\n'; } else if (block[0] === 'deleteLine:ofList:') { source += 'deleteLineOfList(' + listRef(block[2]) + ', ' + val(block[1]) + ');\n'; source += 'self.updateList(' + val(block[2]) + ');\n'; } else if (block[0] === 'insert:at:ofList:') { source += 'insertInList(' + listRef(block[3]) + ', ' + val(block[2]) + ', ' + val(block[1]) + ');\n'; source += 'self.updateList(' + val(block[2]) + ');\n'; } else if (block[0] === 'setLine:ofList:to:') { source += 'setLineOfList(' + listRef(block[2]) + ', ' + val(block[1]) + ', ' + val(block[3]) + ');\n'; source += 'self.updateList(' + val(block[2]) + ');\n'; } else if (block[0] === 'showVariable:' || block[0] === 'hideVariable:') { var isShow = block[0] === 'showVariable:'; if (typeof block[1] !== 'string') { throw new Error('Dynamic variables are not supported'); } var o = object.vars[block[1]] !== undefined ? 'S' : 'self'; source += o + '.showVariable(' + val(block[1]) + ', ' + isShow + ');\n'; } else if (block[0] === 'showList:') { source += 'self.showList(' + val(block[1]) + ');\n'; source += 'self.updateList(' + val(block[1]) + ');\n'; } else if (block[0] === 'hideList:') { source += 'self.hideList(' + val(block[1]) + ');\n'; } else if (block[0] === 'broadcast:') { /* Control */ source += 'var threads = broadcast(' + val(block[1]) + ');\n'; source += 'if (threads.indexOf(BASE) !== -1) return;\n'; } else if (block[0] === 'call') { if (DEBUG && block[1] === 'sulf.debug') { source += 'debugger;\n'; } else if (block[1] === 'sulf.script %s') { console.log('********** Found embedded JavaScript: **********'); console.log(String(block[2].replace(';', ';\n'))); console.log('********** End embedded JavaScript. **********'); source += block[2]; } else { source += 'call(' + val(block[1]) + ', ' + nextLabel() + ', ['; for (var i = 2; i < block.length; i++) { if (i > 2) { source += ', '; } source += val(block[i]); } source += ']);\n'; delay(); } } else if (block[0] === 'doBroadcastAndWait') { source += 'save();\n'; source += 'R.threads = broadcast(' + val(block[1]) + ');\n'; source += 'if (R.threads.indexOf(BASE) !== -1) return;\n'; var id = label(); source += 'if (running(R.threads)) {\n'; forceQueue(id); source += '}\n'; source += 'restore();\n'; } else if (block[0] === 'doForever') { var id = label(); seq(block[1]); forceQueue(id); } else if (block[0] === 'doForeverIf') { var id = label(); source += 'if (' + bool(block[1]) + ') {\n'; seq(block[2]); source += '}\n'; forceQueue(id); // } else if (block[0] === 'doForLoop') { } else if (block[0] === 'doIf') { source += 'if (' + bool(block[1]) + ') {\n'; seq(block[2]); source += '}\n'; } else if (block[0] === 'doIfElse') { source += 'if (' + bool(block[1]) + ') {\n'; seq(block[2]); source += '} else {\n'; seq(block[3]); source += '}\n'; } else if (block[0] === 'doRepeat') { source += 'save();\n'; source += 'R.count = ' + num(block[1]) + ';\n'; var id = label(); source += 'if (R.count >= 0.5) {\n'; source += ' R.count -= 1;\n'; seq(block[2]); queue(id); source += '} else {\n'; source += ' restore();\n'; source += '}\n'; } else if (block[0] === 'doReturn') { source += 'endCall();\n'; source += 'return;\n'; } else if (block[0] === 'doUntil') { var id = label(); source += 'if (!' + bool(block[1]) + ') {\n'; seq(block[2]); queue(id); source += '}\n'; } else if (block[0] === 'doWhile') { var id = label(); source += 'if (' + bool(block[1]) + ') {\n'; seq(block[2]); queue(id); source += '}\n'; } else if (block[0] === 'doWaitUntil') { var id = label(); source += 'if (!' + bool(block[1]) + ') {\n'; queue(id); source += '}\n'; } else if (block[0] === 'glideSecs:toX:y:elapsed:from:') { source += 'save();\n'; source += 'R.start = self.now();\n'; source += 'R.duration = ' + num(block[1]) + ';\n'; source += 'R.baseX = S.scratchX;\n'; source += 'R.baseY = S.scratchY;\n'; source += 'R.deltaX = ' + num(block[2]) + ' - S.scratchX;\n'; source += 'R.deltaY = ' + num(block[3]) + ' - S.scratchY;\n'; var id = label(); source += 'var f = (self.now() - R.start) / (R.duration * 1000);\n'; source += 'if (f > 1) f = 1;\n'; source += 'S.moveTo(R.baseX + f * R.deltaX, R.baseY + f * R.deltaY);\n'; source += 'if (f < 1) {\n'; forceQueue(id); source += '}\n'; source += 'restore();\n'; } else if (block[0] === 'stopAll') { source += 'self.stopAll();\n'; source += 'return;\n'; } else if (block[0] === 'stopScripts') { source += 'switch (' + val(block[1]) + ') {\n'; source += ' case "all":\n'; source += ' self.stopAll();\n'; source += ' return;\n'; source += ' case "this script":\n'; source += ' endCall();\n'; source += ' return;\n'; source += ' case "other scripts in sprite":\n'; source += ' case "other scripts in stage":\n'; source += ' for (var i = 0; i < self.queue.length; i++) {\n'; source += ' if (i !== THREAD && self.queue[i] && self.queue[i].sprite === S) {\n'; source += ' self.queue[i] = undefined;\n'; source += ' }\n'; source += ' }\n'; source += ' break;\n'; source += '}\n'; } else if (block[0] === 'wait:elapsed:from:') { wait(num(block[1])); } else if (block[0] === 'warpSpeed') { source += 'WARP++;\n'; seq(block[1]); source += 'WARP--;\n'; } else if (block[0] === 'createCloneOf') { source += 'clone(' + val(block[1]) + ');\n'; } else if (block[0] === 'deleteClone') { source += 'if (S.isClone) {\n'; source += ' S.remove();\n'; source += ' var i = self.children.indexOf(S);\n'; source += ' if (i !== -1) self.children.splice(i, 1);\n'; source += ' for (var i = 0; i < self.queue.length; i++) {\n'; source += ' if (self.queue[i] && self.queue[i].sprite === S) {\n'; source += ' self.queue[i] = undefined;\n'; source += ' }\n'; source += ' }\n'; source += ' return;\n'; source += '}\n'; } else if (block[0] === 'doAsk') { /* Sensing */ source += 'R.id = self.nextPromptId++;\n'; var id = label(); source += 'if (self.promptId < R.id) {\n'; forceQueue(id); source += '}\n'; source += 'S.ask(' + val(block[1]) + ');\n'; var id = label(); source += 'if (self.promptId === R.id) {\n'; forceQueue(id); source += '}\n'; } else if (block[0] === 'timerReset') { source += 'self.timerStart = self.now();\n'; } else { warn('Undefined command: ' + block[0]); } }; var source = ''; var startfn = object.fns.length; var fns = [0]; if (script[0][0] === 'procDef') { var inputs = script[0][2]; var types = script[0][1].match(/%[snmdcb]/g) || []; for (var i = types.length; i--;) { var t = types[i]; if (t === '%d' || t === '%n' || t === '%c') { source += 'C.numargs[' + i + '] = +C.args[' + i + '] || 0;\n'; } else if (t === '%b') { source += 'C.boolargs[' + i + '] = bool(C.args[' + i + ']);\n'; } } } for (var i = 1; i < script.length; i++) { compile(script[i]); } if (script[0][0] === 'procDef') { source += 'endCall();\n'; source += 'return;\n'; } var createContinuation = function (source) { var result = '(function() {\n'; var brackets = 0; var delBrackets = 0; var shouldDelete = false; var here = 0; var length = source.length; while (here < length) { var i = source.indexOf('{', here); var j = source.indexOf('}', here); if (i === -1 && j === -1) { if (!shouldDelete) { result += source.slice(here); } break; } if (i === -1) i = length; if (j === -1) j = length; if (shouldDelete) { if (i < j) { delBrackets++; here = i + 1; } else { delBrackets--; if (!delBrackets) { shouldDelete = false; } here = j + 1; } } else { if (i < j) { result += source.slice(here, i + 1); brackets++; here = i + 1; } else { result += source.slice(here, j); here = j + 1; if (source.substr(j, 8) === '} else {') { if (brackets > 0) { result += '} else {'; here = j + 8; } else { shouldDelete = true; delBrackets = 0; } } else { if (brackets > 0) { result += '}'; brackets--; } } } } } result += '})'; return P.runtime.scopedEval(result); }; for (var i = 0; i < fns.length; i++) { object.fns.push(createContinuation(source.slice(fns[i]))); } var f = object.fns[startfn]; if (script[0][0] === 'whenClicked') { object.listeners.whenClicked.push(f); } else if (script[0][0] === 'whenGreenFlag') { object.listeners.whenGreenFlag.push(f); } else if (script[0][0] === 'whenCloned') { object.listeners.whenCloned.push(f); } else if (script[0][0] === 'whenIReceive') { var key = script[0][1].toLowerCase(); (object.listeners.whenIReceive[key] || (object.listeners.whenIReceive[key] = [])).push(f); } else if (script[0][0] === 'whenKeyPressed') { if (script[0][1] === 'any') { for (var i = 128; i--;) { object.listeners.whenKeyPressed[i].push(f); } } else { object.listeners.whenKeyPressed[P.getKeyCode(script[0][1])].push(f); } } else if (script[0][0] === 'whenSceneStarts') { var key = script[0][1].toLowerCase(); (object.listeners.whenSceneStarts[key] || (object.listeners.whenSceneStarts[key] = [])).push(f); } else if (script[0][0] === 'procDef') { object.procedures[script[0][1]] = { inputs: inputs, warp: script[0][4], fn: f }; } else { warn('Undefined event: ' + script[0][0]); } }; return function (stage) { warnings = Object.create(null); compileScripts(stage); for (var i = 0; i < stage.children.length; i++) { if (!stage.children[i].cmd) { compileScripts(stage.children[i]); } } for (var key in warnings) { console.warn(key + (warnings[key] > 1 ? ' (repeated ' + warnings[key] + ' times)' : '')); } }; }()); P.runtime = (function () { 'use strict'; var self, S, R, STACK, C, WARP, CALLS, BASE, THREAD, IMMEDIATE, VISUAL; var bool = function (v) { return +v !== 0 && v !== '' && v !== 'false' && v !== false; }; var DIGIT = /\d/; var compare = function (x, y) { if ((typeof x === 'number' || DIGIT.test(x)) && (typeof y === 'number' || DIGIT.test(y))) { var nx = +x; var ny = +y; if (nx === nx && ny === ny) { return nx < ny ? -1 : nx === ny ? 0 : 1; } } var xs = ('' + x).toLowerCase(); var ys = ('' + y).toLowerCase(); return xs < ys ? -1 : xs === ys ? 0 : 1; }; var numLess = function (nx, y) { if (typeof y === 'number' || DIGIT.test(y)) { var ny = +y; if (ny === ny) { return nx < ny; } } var ys = ('' + y).toLowerCase(); return '' + nx < ys; }; var numGreater = function (nx, y) { if (typeof y === 'number' || DIGIT.test(y)) { var ny = +y; if (ny === ny) { return nx > ny; } } var ys = ('' + y).toLowerCase(); return '' + nx > ys; }; var equal = function (x, y) { if ((typeof x === 'number' || DIGIT.test(x)) && (typeof y === 'number' || DIGIT.test(y))) { var nx = +x; var ny = +y; if (nx === nx && ny === ny) { return nx === ny; } } var xs = ('' + x).toLowerCase(); var ys = ('' + y).toLowerCase(); return xs === ys; }; var numEqual = function (nx, y) { if (typeof y === 'number' || DIGIT.test(y)) { var ny = +y; return ny === ny && nx === ny; } return false; }; var mod = function (x, y) { var r = x % y; if (r / y < 0) { r += y; } return r; }; var random = function (x, y) { x = +x || 0; y = +y || 0; if (x > y) { var tmp = y; y = x; x = tmp; } if (x % 1 === 0 && y % 1 === 0) { return Math.floor(Math.random() * (y - x + 1)) + x; } return Math.random() * (y - x) + x; }; var rgb2hsl = function (rgb) { var r = (rgb >> 16 & 0xff) / 0xff; var g = (rgb >> 8 & 0xff) / 0xff; var b = (rgb & 0xff) / 0xff; var min = Math.min(r, g, b); var max = Math.max(r, g, b); if (min === max) { return [0, 0, r * 100]; } var c = max - min; var l = (min + max) / 2; var s = c / (1 - Math.abs(2 * l - 1)); var h; switch (max) { case r: h = ((g - b) / c + 6) % 6; break; case g: h = (b - r) / c + 2; break; case b: h = (r - g) / c + 4; break; } h *= 60; return [h, s * 100, l * 100]; }; var clone = function (name) { var parent = name === '_myself_' ? S : self.getObject(name); var c = parent.clone(); self.children.splice(self.children.indexOf(parent), 0, c); self.triggerFor(c, 'whenCloned'); }; var epoch = Date.UTC(2000, 0, 1); var timeAndDate = P.Watcher.prototype.timeAndDate = function (format) { switch (format) { case 'year': return new Date().getFullYear(); case 'month': return new Date().getMonth() + 1; case 'date': return new Date().getDate(); case 'day of week': return new Date().getDay() + 1; case 'hour': return new Date().getHours(); case 'minute': return new Date().getMinutes(); case 'second': return new Date().getSeconds(); } return 0; }; var getVars = function (name) { return self.vars[name] !== undefined ? self.vars : S.vars; }; var getLists = function (name) { if (self.lists[name] !== undefined) return self.lists; if (S.lists[name] === undefined) { S.lists[name] = []; } return S.lists; }; var listIndex = function (list, index, length) { var i = index | 0; if (i === index) return i > 0 && i <= length ? i - 1 : -1; if (index === 'random' || index === 'any') { return Math.random() * length | 0; } if (index === 'last') { return length - 1; } return i > 0 && i <= length ? i - 1 : -1; }; var contentsOfList = function (list) { var isSingle = true; for (var i = list.length; i--;) { if (list[i].length !== 1) { isSingle = false; break; } } return list.join(isSingle ? '' : ' '); }; var getLineOfList = function (list, index) { var i = listIndex(list, index, list.length); return i !== -1 ? list[i] : ''; }; var listContains = function (list, value) { for (var i = list.length; i--;) { if (equal(list[i], value)) return true; } return false; }; var appendToList = function (list, value) { list.push(value); }; var deleteLineOfList = function (list, index) { if (index === 'all') { list.length = 0; } else { var i = listIndex(list, index, list.length); if (i === list.length - 1) { list.pop(); } else if (i !== -1) { list.splice(i, 1); } } }; var insertInList = function (list, index, value) { var i = listIndex(list, index, list.length + 1); if (i === list.length) { list.push(value); } else if (i !== -1) { list.splice(i, 0, value); } }; var setLineOfList = function (list, index, value) { var i = listIndex(list, index, list.length); if (i !== -1) { list[i] = value; } }; var mathFunc = function (f, x) { switch (f) { case 'abs': return Math.abs(x); case 'floor': return Math.floor(x); case 'sqrt': return Math.sqrt(x); case 'ceiling': return Math.ceil(x); case 'cos': return Math.cos(x * Math.PI / 180); case 'sin': return Math.sin(x * Math.PI / 180); case 'tan': return Math.tan(x * Math.PI / 180); case 'asin': return Math.asin(x) * 180 / Math.PI; case 'acos': return Math.acos(x) * 180 / Math.PI; case 'atan': return Math.atan(x) * 180 / Math.PI; case 'ln': return Math.log(x); case 'log': return Math.log(x) / Math.LN10; case 'e ^': return Math.exp(x); case '10 ^': return Math.exp(x * Math.LN10); } return 0; }; var attribute = function (attr, objName) { var o = self.getObject(objName); if (!o) return 0; if (o.isSprite) { switch (attr) { case 'x position': return o.scratchX; case 'y position': return o.scratchY; case 'direction': return o.direction; case 'costume #': return o.currentCostumeIndex + 1; case 'costume name': return o.costumes[o.currentCostumeIndex].costumeName; case 'size': return o.scale * 100; case 'volume': return 0; // TODO } } else { switch (attr) { case 'background #': case 'backdrop #': return o.currentCostumeIndex + 1; case 'backdrop name': return o.costumes[o.currentCostumeIndex].costumeName; case 'volume': return 0; // TODO } } var value = o.vars[attr]; if (value !== undefined) { return value; } return 0; }; var VOLUME = 0.3; var audioContext = P.audioContext; if (audioContext) { var wavBuffers = P.IO.wavBuffers; volumeNode = audioContext.createGain(); volumeNode.gain.value = VOLUME; volumeNode.connect(audioContext.destination); var playNote = function (id, duration) { var spans = INSTRUMENTS[S.instrument]; for (var i = 0, l = spans.length; i < l; i++) { var span = spans[i]; if (span.top >= id || span.top === 128) break; } playSpan(span, Math.max(0, Math.min(127, id)), duration); }; var playSpan = function (span, id, duration) { if (!S.node) { S.node = audioContext.createGain(); S.node.gain.value = S.volume; S.node.connect(volumeNode); } var source = audioContext.createBufferSource(); var note = audioContext.createGain(); var buffer = wavBuffers[span.name]; if (!buffer) return; source.buffer = buffer; if (source.loop = span.loop) { source.loopStart = span.loopStart; source.loopEnd = span.loopEnd; } source.connect(note); note.connect(S.node); var time = audioContext.currentTime; source.playbackRate.value = Math.pow(2, (id - 69) / 12) / span.baseRatio; var gain = note.gain; gain.value = 0; gain.setValueAtTime(0, time); if (span.attackEnd < duration) { gain.linearRampToValueAtTime(1, time + span.attackEnd); if (span.decayTime > 0 && span.holdEnd < duration) { gain.linearRampToValueAtTime(1, time + span.holdEnd); if (span.decayEnd < duration) { gain.linearRampToValueAtTime(0, time + span.decayEnd); } else { gain.linearRampToValueAtTime(1 - (duration - holdEnd) / span.decayTime, time + duration); } } else { gain.linearRampToValueAtTime(1, time + duration); } } else { gain.linearRampToValueAtTime(1, time + duration); } gain.linearRampToValueAtTime(0, time + duration + 0.02267573696); source.start(time); source.stop(time + duration + 0.02267573696); }; var playSound = function (sound) { if (!sound.buffer) return; if (!sound.node) { sound.node = audioContext.createGain(); sound.node.gain.value = S.volume; sound.node.connect(volumeNode); } sound.target = S; sound.node.gain.setValueAtTime(S.volume, audioContext.currentTime); if (sound.source) { sound.source.disconnect(); } sound.source = audioContext.createBufferSource(); sound.source.buffer = sound.buffer; sound.source.connect(sound.node); sound.source.start(audioContext.currentTime); }; } //these are javascript internal functions... what are they doing here??? var save = function () { STACK.push(R); R = {}; }; var restore = function () { R = STACK.pop(); }; // var lastCalls = []; var call = function (spec, id, values) { // lastCalls.push(spec); // if (lastCalls.length > 10000) lastCalls.shift(); var procedure = S.procedures[spec]; if (procedure) { STACK.push(R); CALLS.push(C); C = { base: procedure.fn, fn: S.fns[id], args: values, numargs: [], boolargs: [], stack: STACK = [], warp: procedure.warp }; R = {}; if (C.warp || WARP) { WARP++; IMMEDIATE = procedure.fn; } else { for (var i = CALLS.length, j = 5; i-- && j--;) { if (CALLS[i].base === procedure.fn) { var recursive = true; break; } } if (recursive) { self.queue[THREAD] = { sprite: S, base: BASE, fn: procedure.fn, calls: CALLS }; } else { IMMEDIATE = procedure.fn; } } } else { IMMEDIATE = S.fns[id]; } }; var endCall = function () { if (CALLS.length) { if (WARP) WARP--; IMMEDIATE = C.fn; C = CALLS.pop(); STACK = C.stack; R = STACK.pop(); } }; var sceneChange = function () { return self.trigger('whenSceneStarts', self.costumes[self.currentCostumeIndex].costumeName); }; var broadcast = function (name) { return self.trigger('whenIReceive', name); }; var running = function (bases) { for (var j = 0; j < self.queue.length; j++) { if (self.queue[j] && bases.indexOf(self.queue[j].base) !== -1) return true; } return false; }; var queue = function (id) { if (WARP) { IMMEDIATE = S.fns[id]; } else { forceQueue(id); } }; var forceQueue = function (id) { self.queue[THREAD] = { sprite: S, base: BASE, fn: S.fns[id], calls: CALLS }; }; // Internal definition (function () { 'use strict'; P.Stage.prototype.framerate = 30; P.Stage.prototype.initRuntime = function () { this.queue = []; this.onError = this.onError.bind(this); }; P.Stage.prototype.startThread = function (sprite, base) { var thread = { sprite: sprite, base: base, fn: base, calls: [{ args: [], stack: [{}] }] }; for (var i = 0; i < this.queue.length; i++) { var q = this.queue[i]; if (q && q.sprite === sprite && q.base === base) { this.queue[i] = thread; return; } } this.queue.push(thread); }; P.Stage.prototype.triggerFor = function (sprite, event, arg) { var threads; if (event === 'whenClicked') { threads = sprite.listeners.whenClicked; } else if (event === 'whenCloned') { threads = sprite.listeners.whenCloned; } else if (event === 'whenGreenFlag') { threads = sprite.listeners.whenGreenFlag; } else if (event === 'whenIReceive') { threads = sprite.listeners.whenIReceive[('' + arg).toLowerCase()]; } else if (event === 'whenKeyPressed') { threads = sprite.listeners.whenKeyPressed[arg]; } else if (event === 'whenSceneStarts') { threads = sprite.listeners.whenSceneStarts[('' + arg).toLowerCase()]; } if (threads) { for (var i = 0; i < threads.length; i++) { this.startThread(sprite, threads[i]); } } return threads || []; }; P.Stage.prototype.trigger = function (event, arg) { var threads = []; for (var i = this.children.length; i--;) { if (this.children[i].isSprite) { threads = threads.concat(this.triggerFor(this.children[i], event, arg)); } } return threads.concat(this.triggerFor(this, event, arg)); }; P.Stage.prototype.triggerGreenFlag = function () { this.timerStart = this.now(); this.trigger('whenGreenFlag'); }; P.Stage.prototype.start = function () { this.isRunning = true; if (this.interval) return; addEventListener('error', this.onError); this.baseTime = Date.now(); this.interval = setInterval(this.step.bind(this), 1000 / this.framerate); if (typeof (elem) !== 'undefined') { setTimeout(function () { Object.keys(stage.lists).forEach(element => { stage.updateList(element) }); }, 2000) } }; P.Stage.prototype.pause = function () { if (this.interval) { this.baseNow = this.now(); clearInterval(this.interval); delete this.interval; removeEventListener('error', this.onError); } this.isRunning = false; }; P.Stage.prototype.stopAll = function () { this.hidePrompt = false; this.prompter.style.display = 'none'; this.promptId = this.nextPromptId = 0; this.queue.length = 0; this.resetFilters(); this.stopSounds(); for (var i = 0; i < this.children.length; i++) { var c = this.children[i]; if (c.isClone) { c.remove(); this.children.splice(i, 1); i -= 1; } else if (c.isSprite) { c.resetFilters(); if (c.saying) c.say(''); c.stopSounds(); } } console.log(self.vars) for (var i = 0; i < Object.keys(self.vars).length; i++) { if (Object.keys(self.vars)[i].substring(Object.keys(self.vars)[i].indexOf(".") + 1, Object.keys(self.vars)[i].indexOf(".") + 3) == 'p.') { sulfCookieVars[Object.keys(self.vars)[i]] = self.vars[Object.keys(self.vars)[i]]; } } }; P.Stage.prototype.now = function () { return this.baseNow + Date.now() - this.baseTime; }; P.Stage.prototype.step = function () { self = this; for (var i = 0; i < Object.keys(sulfCloudVars).length; i++) { this.vars[Object.keys(sulfCloudVars)[i]] = sulfCloudVars[Object.keys(sulfCloudVars)[i]]; } VISUAL = false; var start = Date.now(); do { var queue = this.queue; for (THREAD = 0; THREAD < queue.length; THREAD++) { if (queue[THREAD]) { S = queue[THREAD].sprite; IMMEDIATE = queue[THREAD].fn; BASE = queue[THREAD].base; CALLS = queue[THREAD].calls; C = CALLS.pop(); STACK = C.stack; R = STACK.pop(); queue[THREAD] = undefined; WARP = 0; while (IMMEDIATE) { var fn = IMMEDIATE; IMMEDIATE = null; fn(); } STACK.push(R); CALLS.push(C); } } for (var i = queue.length; i--;) { if (!queue[i]) queue.splice(i, 1); } } while ((self.isTurbo || !VISUAL) && Date.now() - start < 1000 / this.framerate && queue.length); this.draw(); S = null; }; P.Stage.prototype.onError = function (e) { this.handleError(e.error); clearInterval(this.interval); }; P.Stage.prototype.handleError = function (e) { console.error(e.stack); }; }()); /* copy(JSON.stringify(instruments.map(function(g) { return g.map(function(r) { var attackTime = r[5] ? r[5][0] * 0.001 : 0; var holdTime = r[5] ? r[5][1] * 0.001 : 0; var decayTime = r[5] ? r[5][2] : 0; var baseRatio = Math.pow(2, (r[2] - 69) / 12); if (r[3] !== -1) { var length = r[4] - r[3]; baseRatio = 22050 * Math.round(length * 440 * baseRatio / 22050) / length / 440; } return { top: r[0], name: r[1], baseRatio: baseRatio, loop: r[3] !== -1, loopStart: r[3] / 22050, loopEnd: r[4] / 22050, attackEnd: attackTime, holdEnd: attackTime + holdTime, decayEnd: attackTime + holdTime + decayTime } }) })).replace(/"(\w+)":/g,'$1:').replace(/"/g, '\'')); */ var INSTRUMENTS = [[{ top: 38, name: 'AcousticPiano_As3', baseRatio: 0.5316313272700484, loop: true, loopStart: 0.465578231292517, loopEnd: 0.7733786848072562, attackEnd: 0, holdEnd: 0.1, decayEnd: 22.1 }, { top: 44, name: 'AcousticPiano_C4', baseRatio: 0.5905141892259927, loop: true, loopStart: 0.6334693877551021, loopEnd: 0.8605442176870748, attackEnd: 0, holdEnd: 0.1, decayEnd: 20.1 }, { top: 51, name: 'AcousticPiano_G4', baseRatio: 0.8843582887700535, loop: true, loopStart: 0.5532879818594104, loopEnd: 0.5609977324263039, attackEnd: 0, holdEnd: 0.08, decayEnd: 18.08 }, { top: 62, name: 'AcousticPiano_C6', baseRatio: 2.3557692307692304, loop: true, loopStart: 0.5914739229024943, loopEnd: 0.6020861678004535, attackEnd: 0, holdEnd: 0.08, decayEnd: 16.08 }, { top: 70, name: 'AcousticPiano_F5', baseRatio: 1.5776515151515151, loop: true, loopStart: 0.5634920634920635, loopEnd: 0.5879818594104308, attackEnd: 0, holdEnd: 0.04, decayEnd: 14.04 }, { top: 77, name: 'AcousticPiano_Ds6', baseRatio: 2.800762112139358, loop: true, loopStart: 0.560907029478458, loopEnd: 0.5836281179138322, attackEnd: 0, holdEnd: 0.02, decayEnd: 10.02 }, { top: 85, name: 'AcousticPiano_Ds6', baseRatio: 2.800762112139358, loop: true, loopStart: 0.560907029478458, loopEnd: 0.5836281179138322, attackEnd: 0, holdEnd: 0, decayEnd: 8 }, { top: 90, name: 'AcousticPiano_Ds6', baseRatio: 2.800762112139358, loop: true, loopStart: 0.560907029478458, loopEnd: 0.5836281179138322, attackEnd: 0, holdEnd: 0, decayEnd: 6 }, { top: 96, name: 'AcousticPiano_D7', baseRatio: 5.275119617224881, loop: true, loopStart: 0.3380498866213152, loopEnd: 0.34494331065759637, attackEnd: 0, holdEnd: 0, decayEnd: 3 }, { top: 128, name: 'AcousticPiano_D7', baseRatio: 5.275119617224881, loop: true, loopStart: 0.3380498866213152, loopEnd: 0.34494331065759637, attackEnd: 0, holdEnd: 0, decayEnd: 2 }], [{ top: 48, name: 'ElectricPiano_C2', baseRatio: 0.14870515241435123, loop: true, loopStart: 0.6956009070294784, loopEnd: 0.7873015873015873, attackEnd: 0, holdEnd: 0.08, decayEnd: 10.08 }, { top: 74, name: 'ElectricPiano_C4', baseRatio: 0.5945685670261941, loop: true, loopStart: 0.5181859410430839, loopEnd: 0.5449433106575964, attackEnd: 0, holdEnd: 0.04, decayEnd: 8.04 }, { top: 128, name: 'ElectricPiano_C4', baseRatio: 0.5945685670261941, loop: true, loopStart: 0.5181859410430839, loopEnd: 0.5449433106575964, attackEnd: 0, holdEnd: 0, decayEnd: 6 }], [{ top: 128, name: 'Organ_G2', baseRatio: 0.22283731584620914, loop: true, loopStart: 0.05922902494331066, loopEnd: 0.1510204081632653, attackEnd: 0, holdEnd: 0, decayEnd: 0 }], [{ top: 40, name: 'AcousticGuitar_F3', baseRatio: 0.3977272727272727, loop: true, loopStart: 1.6628117913832199, loopEnd: 1.6685260770975057, attackEnd: 0, holdEnd: 0, decayEnd: 15 }, { top: 56, name: 'AcousticGuitar_F3', baseRatio: 0.3977272727272727, loop: true, loopStart: 1.6628117913832199, loopEnd: 1.6685260770975057, attackEnd: 0, holdEnd: 0, decayEnd: 13.5 }, { top: 60, name: 'AcousticGuitar_F3', baseRatio: 0.3977272727272727, loop: true, loopStart: 1.6628117913832199, loopEnd: 1.6685260770975057, attackEnd: 0, holdEnd: 0, decayEnd: 12 }, { top: 67, name: 'AcousticGuitar_F3', baseRatio: 0.3977272727272727, loop: true, loopStart: 1.6628117913832199, loopEnd: 1.6685260770975057, attackEnd: 0, holdEnd: 0, decayEnd: 8.5 }, { top: 72, name: 'AcousticGuitar_F3', baseRatio: 0.3977272727272727, loop: true, loopStart: 1.6628117913832199, loopEnd: 1.6685260770975057, attackEnd: 0, holdEnd: 0, decayEnd: 7 }, { top: 83, name: 'AcousticGuitar_F3', baseRatio: 0.3977272727272727, loop: true, loopStart: 1.6628117913832199, loopEnd: 1.6685260770975057, attackEnd: 0, holdEnd: 0, decayEnd: 5.5 }, { top: 128, name: 'AcousticGuitar_F3', baseRatio: 0.3977272727272727, loop: true, loopStart: 1.6628117913832199, loopEnd: 1.6685260770975057, attackEnd: 0, holdEnd: 0, decayEnd: 4.5 }], [{ top: 40, name: 'ElectricGuitar_F3', baseRatio: 0.39615522817103843, loop: true, loopStart: 1.5733333333333333, loopEnd: 1.5848072562358277, attackEnd: 0, holdEnd: 0, decayEnd: 15 }, { top: 56, name: 'ElectricGuitar_F3', baseRatio: 0.39615522817103843, loop: true, loopStart: 1.5733333333333333, loopEnd: 1.5848072562358277, attackEnd: 0, holdEnd: 0, decayEnd: 13.5 }, { top: 60, name: 'ElectricGuitar_F3', baseRatio: 0.39615522817103843, loop: true, loopStart: 1.5733333333333333, loopEnd: 1.5848072562358277, attackEnd: 0, holdEnd: 0, decayEnd: 12 }, { top: 67, name: 'ElectricGuitar_F3', baseRatio: 0.39615522817103843, loop: true, loopStart: 1.5733333333333333, loopEnd: 1.5848072562358277, attackEnd: 0, holdEnd: 0, decayEnd: 8.5 }, { top: 72, name: 'ElectricGuitar_F3', baseRatio: 0.39615522817103843, loop: true, loopStart: 1.5733333333333333, loopEnd: 1.5848072562358277, attackEnd: 0, holdEnd: 0, decayEnd: 7 }, { top: 83, name: 'ElectricGuitar_F3', baseRatio: 0.39615522817103843, loop: true, loopStart: 1.5733333333333333, loopEnd: 1.5848072562358277, attackEnd: 0, holdEnd: 0, decayEnd: 5.5 }, { top: 128, name: 'ElectricGuitar_F3', baseRatio: 0.39615522817103843, loop: true, loopStart: 1.5733333333333333, loopEnd: 1.5848072562358277, attackEnd: 0, holdEnd: 0, decayEnd: 4.5 }], [{ top: 34, name: 'ElectricBass_G1', baseRatio: 0.11111671034065712, loop: true, loopStart: 1.9007709750566892, loopEnd: 1.9212244897959183, attackEnd: 0, holdEnd: 0, decayEnd: 17 }, { top: 48, name: 'ElectricBass_G1', baseRatio: 0.11111671034065712, loop: true, loopStart: 1.9007709750566892, loopEnd: 1.9212244897959183, attackEnd: 0, holdEnd: 0, decayEnd: 14 }, { top: 64, name: 'ElectricBass_G1', baseRatio: 0.11111671034065712, loop: true, loopStart: 1.9007709750566892, loopEnd: 1.9212244897959183, attackEnd: 0, holdEnd: 0, decayEnd: 12 }, { top: 128, name: 'ElectricBass_G1', baseRatio: 0.11111671034065712, loop: true, loopStart: 1.9007709750566892, loopEnd: 1.9212244897959183, attackEnd: 0, holdEnd: 0, decayEnd: 10 }], [{ top: 38, name: 'Pizz_G2', baseRatio: 0.21979665071770335, loop: true, loopStart: 0.3879365079365079, loopEnd: 0.3982766439909297, attackEnd: 0, holdEnd: 0, decayEnd: 5 }, { top: 45, name: 'Pizz_G2', baseRatio: 0.21979665071770335, loop: true, loopStart: 0.3879365079365079, loopEnd: 0.3982766439909297, attackEnd: 0, holdEnd: 0.012, decayEnd: 4.012 }, { top: 56, name: 'Pizz_A3', baseRatio: 0.503654636820466, loop: true, loopStart: 0.5197278911564626, loopEnd: 0.5287528344671202, attackEnd: 0, holdEnd: 0, decayEnd: 4 }, { top: 64, name: 'Pizz_A3', baseRatio: 0.503654636820466, loop: true, loopStart: 0.5197278911564626, loopEnd: 0.5287528344671202, attackEnd: 0, holdEnd: 0, decayEnd: 3.2 }, { top: 72, name: 'Pizz_E4', baseRatio: 0.7479647218453188, loop: true, loopStart: 0.7947845804988662, loopEnd: 0.7978231292517007, attackEnd: 0, holdEnd: 0, decayEnd: 2.8 }, { top: 80, name: 'Pizz_E4', baseRatio: 0.7479647218453188, loop: true, loopStart: 0.7947845804988662, loopEnd: 0.7978231292517007, attackEnd: 0, holdEnd: 0, decayEnd: 2.2 }, { top: 128, name: 'Pizz_E4', baseRatio: 0.7479647218453188, loop: true, loopStart: 0.7947845804988662, loopEnd: 0.7978231292517007, attackEnd: 0, holdEnd: 0, decayEnd: 1.5 }], [{ top: 41, name: 'Cello_C2', baseRatio: 0.14870515241435123, loop: true, loopStart: 0.3876643990929705, loopEnd: 0.40294784580498866, attackEnd: 0, holdEnd: 0, decayEnd: 0 }, { top: 52, name: 'Cello_As2', baseRatio: 0.263755980861244, loop: true, loopStart: 0.3385487528344671, loopEnd: 0.35578231292517004, attackEnd: 0, holdEnd: 0, decayEnd: 0 }, { top: 62, name: 'Violin_D4', baseRatio: 0.6664047388781432, loop: true, loopStart: 0.48108843537414964, loopEnd: 0.5151927437641723, attackEnd: 0, holdEnd: 0, decayEnd: 0 }, { top: 75, name: 'Violin_A4', baseRatio: 0.987460815047022, loop: true, loopStart: 0.14108843537414967, loopEnd: 0.15029478458049886, attackEnd: 0.07, holdEnd: 0.07, decayEnd: 0.07 }, { top: 128, name: 'Violin_E5', baseRatio: 1.4885238523852387, loop: true, loopStart: 0.10807256235827664, loopEnd: 0.1126530612244898, attackEnd: 0, holdEnd: 0, decayEnd: 0 }], [{ top: 30, name: 'BassTrombone_A2_3', baseRatio: 0.24981872564125807, loop: true, loopStart: 0.061541950113378686, loopEnd: 0.10702947845804989, attackEnd: 0, holdEnd: 0, decayEnd: 0 }, { top: 40, name: 'BassTrombone_A2_2', baseRatio: 0.24981872564125807, loop: true, loopStart: 0.08585034013605441, loopEnd: 0.13133786848072562, attackEnd: 0, holdEnd: 0, decayEnd: 0 }, { top: 55, name: 'Trombone_B3', baseRatio: 0.5608240680183126, loop: true, loopStart: 0.12, loopEnd: 0.17673469387755103, attackEnd: 0, holdEnd: 0, decayEnd: 0 }, { top: 88, name: 'Trombone_B3', baseRatio: 0.5608240680183126, loop: true, loopStart: 0.12, loopEnd: 0.17673469387755103, attackEnd: 0.05, holdEnd: 0.05, decayEnd: 0.05 }, { top: 128, name: 'Trumpet_E5', baseRatio: 1.4959294436906376, loop: true, loopStart: 0.1307936507936508, loopEnd: 0.14294784580498865, attackEnd: 0, holdEnd: 0, decayEnd: 0 }], [{ top: 128, name: 'Clarinet_C4', baseRatio: 0.5940193965517241, loop: true, loopStart: 0.6594104308390023, loopEnd: 0.7014965986394558, attackEnd: 0, holdEnd: 0, decayEnd: 0 }], [{ top: 40, name: 'TenorSax_C3', baseRatio: 0.2971698113207547, loop: true, loopStart: 0.4053968253968254, loopEnd: 0.4895238095238095, attackEnd: 0, holdEnd: 0, decayEnd: 0 }, { top: 50, name: 'TenorSax_C3', baseRatio: 0.2971698113207547, loop: true, loopStart: 0.4053968253968254, loopEnd: 0.4895238095238095, attackEnd: 0.02, holdEnd: 0.02, decayEnd: 0.02 }, { top: 59, name: 'TenorSax_C3', baseRatio: 0.2971698113207547, loop: true, loopStart: 0.4053968253968254, loopEnd: 0.4895238095238095, attackEnd: 0.04, holdEnd: 0.04, decayEnd: 0.04 }, { top: 67, name: 'AltoSax_A3', baseRatio: 0.49814747876378096, loop: true, loopStart: 0.3875736961451247, loopEnd: 0.4103854875283447, attackEnd: 0, holdEnd: 0, decayEnd: 0 }, { top: 75, name: 'AltoSax_A3', baseRatio: 0.49814747876378096, loop: true, loopStart: 0.3875736961451247, loopEnd: 0.4103854875283447, attackEnd: 0.02, holdEnd: 0.02, decayEnd: 0.02 }, { top: 80, name: 'AltoSax_A3', baseRatio: 0.49814747876378096, loop: true, loopStart: 0.3875736961451247, loopEnd: 0.4103854875283447, attackEnd: 0.02, holdEnd: 0.02, decayEnd: 0.02 }, { top: 128, name: 'AltoSax_C6', baseRatio: 2.3782742681047764, loop: true, loopStart: 0.05705215419501134, loopEnd: 0.0838095238095238, attackEnd: 0, holdEnd: 0, decayEnd: 0 }], [{ top: 61, name: 'Flute_B5_2', baseRatio: 2.255113636363636, loop: true, loopStart: 0.08430839002267573, loopEnd: 0.10244897959183673, attackEnd: 0, holdEnd: 0, decayEnd: 0 }, { top: 128, name: 'Flute_B5_1', baseRatio: 2.255113636363636, loop: true, loopStart: 0.10965986394557824, loopEnd: 0.12780045351473923, attackEnd: 0, holdEnd: 0, decayEnd: 0 }], [{ top: 128, name: 'WoodenFlute_C5', baseRatio: 1.1892952324548416, loop: true, loopStart: 0.5181859410430839, loopEnd: 0.7131065759637188, attackEnd: 0, holdEnd: 0, decayEnd: 0 }], [{ top: 57, name: 'Bassoon_C3', baseRatio: 0.29700969827586204, loop: true, loopStart: 0.11011337868480725, loopEnd: 0.19428571428571428, attackEnd: 0, holdEnd: 0, decayEnd: 0 }, { top: 67, name: 'Bassoon_C3', baseRatio: 0.29700969827586204, loop: true, loopStart: 0.11011337868480725, loopEnd: 0.19428571428571428, attackEnd: 0.04, holdEnd: 0.04, decayEnd: 0.04 }, { top: 76, name: 'Bassoon_C3', baseRatio: 0.29700969827586204, loop: true, loopStart: 0.11011337868480725, loopEnd: 0.19428571428571428, attackEnd: 0.08, holdEnd: 0.08, decayEnd: 0.08 }, { top: 84, name: 'EnglishHorn_F3', baseRatio: 0.39601293103448276, loop: true, loopStart: 0.341859410430839, loopEnd: 0.4049886621315193, attackEnd: 0.04, holdEnd: 0.04, decayEnd: 0.04 }, { top: 128, name: 'EnglishHorn_D4', baseRatio: 0.6699684005833739, loop: true, loopStart: 0.22027210884353743, loopEnd: 0.23723356009070296, attackEnd: 0, holdEnd: 0, decayEnd: 0 }], [{ top: 39, name: 'Choir_F3', baseRatio: 0.3968814788643197, loop: true, loopStart: 0.6352380952380953, loopEnd: 1.8721541950113378, attackEnd: 0, holdEnd: 0, decayEnd: 0 }, { top: 50, name: 'Choir_F3', baseRatio: 0.3968814788643197, loop: true, loopStart: 0.6352380952380953, loopEnd: 1.8721541950113378, attackEnd: 0.04, holdEnd: 0.04, decayEnd: 0.04 }, { top: 61, name: 'Choir_F3', baseRatio: 0.3968814788643197, loop: true, loopStart: 0.6352380952380953, loopEnd: 1.8721541950113378, attackEnd: 0.06, holdEnd: 0.06, decayEnd: 0.06 }, { top: 72, name: 'Choir_F4', baseRatio: 0.7928898424161845, loop: true, loopStart: 0.7415419501133786, loopEnd: 2.1059410430839, attackEnd: 0, holdEnd: 0, decayEnd: 0 }, { top: 128, name: 'Choir_F5', baseRatio: 1.5879576065654504, loop: true, loopStart: 0.836281179138322, loopEnd: 2.0585487528344673, attackEnd: 0, holdEnd: 0, decayEnd: 0 }], [{ top: 38, name: 'Vibraphone_C3', baseRatio: 0.29829545454545453, loop: true, loopStart: 0.2812698412698413, loopEnd: 0.28888888888888886, attackEnd: 0, holdEnd: 0.1, decayEnd: 8.1 }, { top: 48, name: 'Vibraphone_C3', baseRatio: 0.29829545454545453, loop: true, loopStart: 0.2812698412698413, loopEnd: 0.28888888888888886, attackEnd: 0, holdEnd: 0.1, decayEnd: 7.6 }, { top: 59, name: 'Vibraphone_C3', baseRatio: 0.29829545454545453, loop: true, loopStart: 0.2812698412698413, loopEnd: 0.28888888888888886, attackEnd: 0, holdEnd: 0.06, decayEnd: 7.06 }, { top: 70, name: 'Vibraphone_C3', baseRatio: 0.29829545454545453, loop: true, loopStart: 0.2812698412698413, loopEnd: 0.28888888888888886, attackEnd: 0, holdEnd: 0.04, decayEnd: 6.04 }, { top: 78, name: 'Vibraphone_C3', baseRatio: 0.29829545454545453, loop: true, loopStart: 0.2812698412698413, loopEnd: 0.28888888888888886, attackEnd: 0, holdEnd: 0.02, decayEnd: 5.02 }, { top: 86, name: 'Vibraphone_C3', baseRatio: 0.29829545454545453, loop: true, loopStart: 0.2812698412698413, loopEnd: 0.28888888888888886, attackEnd: 0, holdEnd: 0, decayEnd: 4 }, { top: 128, name: 'Vibraphone_C3', baseRatio: 0.29829545454545453, loop: true, loopStart: 0.2812698412698413, loopEnd: 0.28888888888888886, attackEnd: 0, holdEnd: 0, decayEnd: 3 }], [{ top: 128, name: 'MusicBox_C4', baseRatio: 0.5937634640241276, loop: true, loopStart: 0.6475283446712018, loopEnd: 0.6666666666666666, attackEnd: 0, holdEnd: 0, decayEnd: 2 }], [{ top: 128, name: 'SteelDrum_D5', baseRatio: 1.3660402567543959, loop: false, loopStart: -0.000045351473922902495, loopEnd: -0.000045351473922902495, attackEnd: 0, holdEnd: 0, decayEnd: 2 }], [{ top: 128, name: 'Marimba_C4', baseRatio: 0.5946035575013605, loop: false, loopStart: -0.000045351473922902495, loopEnd: -0.000045351473922902495, attackEnd: 0, holdEnd: 0, decayEnd: 0 }], [{ top: 80, name: 'SynthLead_C4', baseRatio: 0.5942328422565577, loop: true, loopStart: 0.006122448979591836, loopEnd: 0.06349206349206349, attackEnd: 0, holdEnd: 0, decayEnd: 0 }, { top: 128, name: 'SynthLead_C6', baseRatio: 2.3760775862068964, loop: true, loopStart: 0.005623582766439909, loopEnd: 0.01614512471655329, attackEnd: 0, holdEnd: 0, decayEnd: 0 }], [{ top: 38, name: 'SynthPad_A3', baseRatio: 0.4999105065330231, loop: true, loopStart: 0.1910204081632653, loopEnd: 3.9917006802721087, attackEnd: 0.05, holdEnd: 0.05, decayEnd: 0.05 }, { top: 50, name: 'SynthPad_A3', baseRatio: 0.4999105065330231, loop: true, loopStart: 0.1910204081632653, loopEnd: 3.9917006802721087, attackEnd: 0.08, holdEnd: 0.08, decayEnd: 0.08 }, { top: 62, name: 'SynthPad_A3', baseRatio: 0.4999105065330231, loop: true, loopStart: 0.1910204081632653, loopEnd: 3.9917006802721087, attackEnd: 0.11, holdEnd: 0.11, decayEnd: 0.11 }, { top: 74, name: 'SynthPad_A3', baseRatio: 0.4999105065330231, loop: true, loopStart: 0.1910204081632653, loopEnd: 3.9917006802721087, attackEnd: 0.15, holdEnd: 0.15, decayEnd: 0.15 }, { top: 86, name: 'SynthPad_A3', baseRatio: 0.4999105065330231, loop: true, loopStart: 0.1910204081632653, loopEnd: 3.9917006802721087, attackEnd: 0.2, holdEnd: 0.2, decayEnd: 0.2 }, { top: 128, name: 'SynthPad_C6', baseRatio: 2.3820424708835755, loop: true, loopStart: 0.11678004535147392, loopEnd: 0.41732426303854875, attackEnd: 0, holdEnd: 0, decayEnd: 0 }]]; /* copy(JSON.stringify(drums.map(function(d) { var decayTime = d[4] || 0; var baseRatio = Math.pow(2, (60 - d[1] - 69) / 12); if (d[2]) { var length = d[3] - d[2]; baseRatio = 22050 * Math.round(length * 440 * baseRatio / 22050) / length / 440; } return { name: d[0], baseRatio: baseRatio, loop: !!d[2], loopStart: d[2] / 22050, loopEnd: d[3] / 22050, attackEnd: 0, holdEnd: 0, decayEnd: decayTime } })).replace(/"(\w+)":/g,'$1:').replace(/"/g, '\'')); */ var DRUMS = [{ name: 'SnareDrum', baseRatio: 0.5946035575013605, loop: false, loopStart: null, loopEnd: null, attackEnd: 0, holdEnd: 0, decayEnd: 0 }, { name: 'Tom', baseRatio: 0.5946035575013605, loop: false, loopStart: null, loopEnd: null, attackEnd: 0, holdEnd: 0, decayEnd: 0 }, { name: 'SideStick', baseRatio: 0.5946035575013605, loop: false, loopStart: null, loopEnd: null, attackEnd: 0, holdEnd: 0, decayEnd: 0 }, { name: 'Crash', baseRatio: 0.8908987181403393, loop: false, loopStart: null, loopEnd: null, attackEnd: 0, holdEnd: 0, decayEnd: 0 }, { name: 'HiHatOpen', baseRatio: 0.9438743126816935, loop: false, loopStart: null, loopEnd: null, attackEnd: 0, holdEnd: 0, decayEnd: 0 }, { name: 'HiHatClosed', baseRatio: 0.5946035575013605, loop: false, loopStart: null, loopEnd: null, attackEnd: 0, holdEnd: 0, decayEnd: 0 }, { name: 'Tambourine', baseRatio: 0.5946035575013605, loop: false, loopStart: null, loopEnd: null, attackEnd: 0, holdEnd: 0, decayEnd: 0 }, { name: 'Clap', baseRatio: 0.5946035575013605, loop: false, loopStart: null, loopEnd: null, attackEnd: 0, holdEnd: 0, decayEnd: 0 }, { name: 'Claves', baseRatio: 0.5946035575013605, loop: false, loopStart: null, loopEnd: null, attackEnd: 0, holdEnd: 0, decayEnd: 0 }, { name: 'WoodBlock', baseRatio: 0.7491535384383408, loop: false, loopStart: null, loopEnd: null, attackEnd: 0, holdEnd: 0, decayEnd: 0 }, { name: 'Cowbell', baseRatio: 0.5946035575013605, loop: false, loopStart: null, loopEnd: null, attackEnd: 0, holdEnd: 0, decayEnd: 0 }, { name: 'Triangle', baseRatio: 0.8514452780229479, loop: true, loopStart: 0.7638548752834468, loopEnd: 0.7825396825396825, attackEnd: 0, holdEnd: 0, decayEnd: 2 }, { name: 'Bongo', baseRatio: 0.5297315471796477, loop: false, loopStart: null, loopEnd: null, attackEnd: 0, holdEnd: 0, decayEnd: 0 }, { name: 'Conga', baseRatio: 0.7954545454545454, loop: true, loopStart: 0.1926077097505669, loopEnd: 0.20403628117913833, attackEnd: 0, holdEnd: 0, decayEnd: 2 }, { name: 'Cabasa', baseRatio: 0.5946035575013605, loop: false, loopStart: null, loopEnd: null, attackEnd: 0, holdEnd: 0, decayEnd: 0 }, { name: 'GuiroLong', baseRatio: 0.5946035575013605, loop: false, loopStart: null, loopEnd: null, attackEnd: 0, holdEnd: 0, decayEnd: 0 }, { name: 'Vibraslap', baseRatio: 0.8408964152537145, loop: false, loopStart: null, loopEnd: null, attackEnd: 0, holdEnd: 0, decayEnd: 0 }, { name: 'Cuica', baseRatio: 0.7937005259840998, loop: false, loopStart: null, loopEnd: null, attackEnd: 0, holdEnd: 0, decayEnd: 0 }]; return { scopedEval: function (source) { return eval(source); } }; }()); function readSulfVar(name) { console.log(name) switch (name) { case "sulf.time": return Date.now(); case "sulf.hasTouchEvents": return P.hasTouchEvents; case "sulf.resolutionY": return self.canvas.height; case "sulf.resolutionX": return self.canvas.width; case "sulf.version": return sulfVersion } } function readSulfVarAsString(name) { switch (name) { case 'sulf.time': return 'Date.now()'; case 'sulf.version': return sulfVersion; case 'sulf.resolutionX': return 'self.canvas.width'; case 'sulf.resolutionY': return 'self.canvas.height'; case 'sulf.hasTouchEvents': return 'P.hasTouchEvents'; } } function loadCookie() { console.log("loadCookie"); var name = projectID + "="; var decodedCookie = decodeURIComponent(document.cookie); var ca = decodedCookie.split(';'); for (var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) == ' ') { c = c.substring(1); } if (c.indexOf(name) == 0) { sulfCookieVars = JSON.parse(lzw_decode(c.substring(name.length, c.length))); } } console.log(sulfCookieVars) if (typeof sulfCookieVars["sulf.p.username"] == 'undefined') { sulfUsername = "Player" + Math.floor((Math.random() * 999999) + 1); sulfCookieVars["sulf.p.username"] = sulfUsername; console.log(sulfUsername); } else { sulfUsername = sulfCookieVars["sulf.p.username"]; console.log("username:" + sulfUsername); } } function setCookie(data) { console.log(data); if (data == true) { console.log('no Sulfurous Variables used'); return; } else if (data == null) { console.log('sulfCookieVars undefined'); return; } cvalue = lzw_encode(JSON.stringify(data)); var d = new Date(); d.setTime(d.getTime() + (10000 * 24 * 60 * 60 * 1000)); var expires = "expires=" + d.toUTCString(); document.cookie = projectID + "=" + cvalue + ";" + expires + ";path=/"; } function lzw_encode(s) { var dict = {}; var data = (s + "").split(""); var out = []; var currChar; var phrase = data[0]; var code = 256; for (var i = 1; i < data.length; i++) { currChar = data[i]; if (dict[phrase + currChar] != null) { phrase += currChar; } else { out.push(phrase.length > 1 ? dict[phrase] : phrase.charCodeAt(0)); dict[phrase + currChar] = code; code++; phrase = currChar; } } out.push(phrase.length > 1 ? dict[phrase] : phrase.charCodeAt(0)); for (var i = 0; i < out.length; i++) { out[i] = String.fromCharCode(out[i]); } return out.join(""); } // Decompress an LZW-encoded string function lzw_decode(s) { var dict = {}; var data = (s + "").split(""); var currChar = data[0]; var oldPhrase = currChar; var out = [currChar]; var code = 256; var phrase; for (var i = 1; i < data.length; i++) { var currCode = data[i].charCodeAt(0); if (currCode < 256) { phrase = data[i]; } else { phrase = dict[currCode] ? dict[currCode] : (oldPhrase + currChar); } out.push(phrase); currChar = phrase.charAt(0); dict[code] = oldPhrase + currChar; code++; oldPhrase = phrase; } return out.join(""); } setInterval(function () { console.log("saved Cookie") setCookie(sulfCookieVars) } , 10000)
/* global d3 */ define(function (require) { 'use strict'; var modules = require('modules'); var _ = require('lodash'); modules.get('a4c-topology-editor').factory('connectorDragFactoryService', [ 'relationshipMatchingService', function(relationshipMatchingService) { return { create: function(topologySvg) { var selectedTarget; var mouseCoordinate; var connectorDrag = d3.behavior.drag() .on('dragstart', function(element) { relationshipMatchingService.getTargets(element.node.id, element.template, element.id, topologySvg.topology.topology.nodeTemplates, topologySvg.topology.nodeTypes, topologySvg.topology.relationshipTypes, topologySvg.topology.capabilityTypes, topologySvg.topology.topology.dependencies).then(function(result) { var connectTargets = []; // TODO if drag & drop is still active _.each(result.targets, function(target) { var targetNode = topologySvg.layout.nodeMap[target.template.name]; _.each(target.capabilities, function(targetCapabilityInfo){ var targetCapability = targetNode.capabilitiesMap[targetCapabilityInfo.id]; if(_.defined(targetCapability)) { // add a drop target connectTargets.push({ id: targetNode.id + '.' + targetCapability.id, target: targetCapability, relationship: result.relationshipType }); } }); }); var targetSelection = topologySvg.svg.selectAll('.connectorTarget').data(connectTargets); targetSelection.enter().append('circle') .attr('cx', function(d){ return d.target.coordinate.x; }) .attr('cy', function(d){ return d.target.coordinate.y; }) .attr('r', 10) .attr('class', 'connectorTarget') .attr('pointer-events', 'mouseover') .on('mouseover', function(node) { selectedTarget = node; }) .on('mouseout', function() { selectedTarget = null; }); targetSelection.exit().remove(); }); mouseCoordinate = { x: element.coordinate.x, y: element.coordinate.y }; // find relationship valid targets d3.event.sourceEvent.stopPropagation(); }).on('drag', function(element) { var data = []; mouseCoordinate.x += d3.event.dx; mouseCoordinate.y += d3.event.dy; data = [{ source: { x: element.coordinate.x, y: element.coordinate.y }, target: mouseCoordinate }]; var link = topologySvg.svg.selectAll('.connectorlink').data(data); link.enter().append('path') .attr('class', 'connectorlink') .attr('d', d3.svg.diagonal()) .attr('pointer-events', 'none'); link.attr('d', d3.svg.diagonal()); link.exit().remove(); }).on('dragend', function(element) { // remove all drag line and drag targets topologySvg.svg.selectAll('.connectorTarget').data([]).exit().remove(); topologySvg.svg.selectAll('.connectorlink').data([]).exit().remove(); if(_.defined(selectedTarget)) { var target = selectedTarget.target; topologySvg.addRelationship({ sourceId: element.node.id, requirementName: element.id, requirementType: element.template.type, targetId: target.node.id, capabilityName: target.id, relationship: selectedTarget.relationship }); } }); return connectorDrag; } // create }; // return } // function ]); // factory }); // define
var a02525 = [ [ "Color", "a02525.html#adef5b1eaa33d1e25481314372fe7a213", null ], [ "Normal", "a02525.html#aea2975a936d5c8f0cec3d389c8f15696", null ], [ "Point", "a02525.html#a01003afa1d44248483bdd563df2138f7", null ], [ "Scalar", "a02525.html#a6a76bcf8df187de33f12ccd9ad2b2487", null ], [ "TexCoord", "a02525.html#a9bf514a1a1bfe8d949ccb74623d7ba77", null ] ];
"use strict";Shuang.resource.scheme.sougou={id:"sougou",name:"\u641C\u72D7\u53CC\u62FC",tips:["iOS (>= 11.3) \u81EA\u5E26\u65B9\u6848"],detail:{sheng:{b:"b",c:"c",d:"d",f:"f",g:"g",h:"h",j:"j",k:"k",l:"l",m:"m",n:"n",p:"p",q:"q",r:"r",s:"s",t:"t",w:"w",x:"x",y:"y",z:"z",ch:"i",sh:"u",zh:"v"},yun:{a:"a",ai:"l",an:"j",ang:"h",ao:"k",e:"e",ei:"z",en:"f",eng:"g",i:"i",ia:"w",ian:"m",iang:"d",iao:"c",ie:"x",iong:"s",in:"n",ing:";",iu:"q",o:"o",ong:"s",ou:"b",u:"u",ua:"w",uai:"y",uan:"r",uang:"d",ue:"t",ui:"v",un:"p",uo:"o",v:"y",ve:"t"},other:{a:"oa",ai:"ol",an:"oj",ang:"oh",ao:"ok",e:"oe",ei:"oz",en:"of",eng:"og",er:"or",o:"oo",ou:"ob"}}};
/*jshint curly:true, eqeqeq:true, laxbreak:true, noempty:false */ /* The MIT License (MIT) Copyright (c) 2007-2013 Einar Lielmanis and contributors. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. CSS Beautifier --------------- Written by Harutyun Amirjanyan, (amirjanyan@gmail.com) Based on code initially developed by: Einar Lielmanis, <einar@jsbeautifier.org> http://jsbeautifier.org/ Usage: css_beautify(source_text); css_beautify(source_text, options); The options are (default in brackets): indent_size (4) — indentation size, indent_char (space) — character to indent with, selector_separator_newline (true) - separate selectors with newline or not (e.g. "a,\nbr" or "a, br") end_with_newline (false) - end with a newline e.g css_beautify(css_source_text, { 'indent_size': 1, 'indent_char': '\t', 'selector_separator': ' ', 'end_with_newline': false, }); */ // http://www.w3.org/TR/CSS21/syndata.html#tokenization // http://www.w3.org/TR/css3-syntax/ (function () { function css_beautify(source_text, options) { options = options || {}; var indentSize = options.indent_size || 4; var indentCharacter = options.indent_char || ' '; var selectorSeparatorNewline = true; if (options.selector_separator_newline !== undefined) { selectorSeparatorNewline = options.selector_separator_newline; } var endWithNewline = options.end_with_newline || false; // compatibility if (typeof indentSize === "string") { indentSize = parseInt(indentSize, 10); } // tokenizer var whiteRe = /^\s+$/; var wordRe = /[\w$\-_]/; var pos = -1, ch; function next() { ch = source_text.charAt(++pos); return ch; } function peek() { return source_text.charAt(pos + 1); } function eatString(endChar) { var start = pos; while (next()) { if (ch === "\\") { next(); next(); } else if (ch === endChar) { break; } else if (ch === "\n") { break; } } return source_text.substring(start, pos + 1); } function eatWhitespace() { var start = pos; while (whiteRe.test(peek())) { pos++; } return pos !== start; } function skipWhitespace() { var start = pos; do {} while (whiteRe.test(next())); return pos !== start + 1; } function eatComment(singleLine) { var start = pos; next(); while (next()) { if (ch === "*" && peek() === "/") { pos++; break; } else if (singleLine && ch === "\n") { break; } } return source_text.substring(start, pos + 1); } function lookBack(str) { return source_text.substring(pos - str.length, pos).toLowerCase() === str; } function isCommentOnLine() { var endOfLine = source_text.indexOf('\n', pos); if (endOfLine === -1) { return false; } var restOfLine = source_text.substring(pos, endOfLine); return restOfLine.indexOf('//') !== -1; } // printer var indentString = source_text.match(/^[\r\n]*[\t ]*/)[0]; var singleIndent = new Array(indentSize + 1).join(indentCharacter); var indentLevel = 0; var nestedLevel = 0; function indent() { indentLevel++; indentString += singleIndent; } function outdent() { indentLevel--; indentString = indentString.slice(0, -indentSize); } var print = {}; print["{"] = function (ch) { print.singleSpace(); output.push(ch); print.newLine(); }; print["}"] = function (ch) { print.newLine(); output.push(ch); print.newLine(); }; print._lastCharWhitespace = function () { return whiteRe.test(output[output.length - 1]); }; print.newLine = function (keepWhitespace) { if (!keepWhitespace) { while (print._lastCharWhitespace()) { output.pop(); } } if (output.length) { output.push('\n'); } if (indentString) { output.push(indentString); } }; print.singleSpace = function () { if (output.length && !print._lastCharWhitespace()) { output.push(' '); } }; var output = []; if (indentString) { output.push(indentString); } /*_____________________--------------------_____________________*/ var insideRule = false; var enteringConditionalGroup = false; while (true) { var isAfterSpace = skipWhitespace(); if (!ch) { break; } else if (ch === '/' && peek() === '*') { /* css comment */ print.newLine(); output.push(eatComment(), "\n", indentString); var header = lookBack(""); if (header) { print.newLine(); } } else if (ch === '/' && peek() === '/') { // single line comment output.push(eatComment(true), indentString); } else if (ch === '@') { // strip trailing space, if present, for hash property checks var atRule = eatString(" ").replace(/ $/, ''); // pass along the space we found as a separate item output.push(atRule, ch); // might be a nesting at-rule if (atRule in css_beautify.NESTED_AT_RULE) { nestedLevel += 1; if (atRule in css_beautify.CONDITIONAL_GROUP_RULE) { enteringConditionalGroup = true; } } } else if (ch === '{') { eatWhitespace(); if (peek() === '}') { next(); output.push(" {}"); } else { indent(); print["{"](ch); // when entering conditional groups, only rulesets are allowed if (enteringConditionalGroup) { enteringConditionalGroup = false; insideRule = (indentLevel > nestedLevel); } else { // otherwise, declarations are also allowed insideRule = (indentLevel >= nestedLevel); } } } else if (ch === '}') { outdent(); print["}"](ch); insideRule = false; if (nestedLevel) { nestedLevel--; } } else if (ch === ":") { eatWhitespace(); if (insideRule || enteringConditionalGroup) { // 'property: value' delimiter // which could be in a conditional group query output.push(ch, " "); } else { if (peek() === ":") { // pseudo-element next(); output.push("::"); } else { // pseudo-class output.push(ch); } } } else if (ch === '"' || ch === '\'') { output.push(eatString(ch)); } else if (ch === ';') { if (isCommentOnLine()) { var beforeComment = eatString('/'); var comment = eatComment(true); output.push(beforeComment, comment.substring(1, comment.length - 1), '\n', indentString); } else { output.push(ch, '\n', indentString); } } else if (ch === '(') { // may be a url if (lookBack("url")) { output.push(ch); eatWhitespace(); if (next()) { if (ch !== ')' && ch !== '"' && ch !== '\'') { output.push(eatString(')')); } else { pos--; } } } else { if (isAfterSpace) { print.singleSpace(); } output.push(ch); eatWhitespace(); } } else if (ch === ')') { output.push(ch); } else if (ch === ',') { eatWhitespace(); output.push(ch); if (!insideRule && selectorSeparatorNewline) { print.newLine(); } else { print.singleSpace(); } } else if (ch === ']') { output.push(ch); } else if (ch === '[' || ch === '=') { // no whitespace before or after eatWhitespace(); output.push(ch); } else { if (isAfterSpace) { print.singleSpace(); } output.push(ch); } } var sweetCode = output.join('').replace(/[\n ]+$/, ''); // establish end_with_newline var should = endWithNewline; var actually = /\n$/.test(sweetCode); if (should && !actually) { sweetCode += "\n"; } else if (!should && actually) { sweetCode = sweetCode.slice(0, -1); } return sweetCode; } // https://developer.mozilla.org/en-US/docs/Web/CSS/At-rule css_beautify.NESTED_AT_RULE = { "@page": true, "@font-face": true, "@keyframes": true, // also in CONDITIONAL_GROUP_RULE below "@media": true, "@supports": true, "@document": true }; css_beautify.CONDITIONAL_GROUP_RULE = { "@media": true, "@supports": true, "@document": true }; /*global define */ if (typeof define === "function" && define.amd) { // Add support for require.js define([], function () { return css_beautify; }); } else if (typeof exports !== "undefined") { // Add support for CommonJS. Just put this file somewhere on your require.paths // and you will be able to `var html_beautify = require("beautify").html_beautify`. exports.css_beautify = css_beautify; } else if (typeof window !== "undefined") { // If we're running a web page and don't have either of the above, add our one global window.css_beautify = css_beautify; } else if (typeof global !== "undefined") { // If we don't even have window, try global. global.css_beautify = css_beautify; } }());
import Utils from '../utils/utils'; import Mixins from '../utils/mixins'; import __vueComponentProps from '../runtime-helpers/vue-component-props.js'; export default { name: 'f7-label', props: Object.assign({ id: [String, Number], floating: Boolean, inline: Boolean }, Mixins.colorProps), render() { const _h = this.$createElement; const self = this; const props = self.props; const { inline, id, style, className, floating } = props; const classes = Utils.classNames(className, 'item-title', { 'item-label-inline': inline, 'item-label': !floating, 'item-floating-label': floating }, Mixins.colorClasses(props)); return _h('div', { style: style, class: classes, attrs: { id: id } }, [this.$slots['default']]); }, computed: { props() { return __vueComponentProps(this); } } };
/** * BaseOverview-test.js * Created by Jonathan Hill 06/18/20 */ import { formatMoney } from 'helpers/moneyFormatter'; import BaseOverview from 'models/v2/covid19/BaseOverview'; import { overviewAPIResponse } from './mockData'; const overview = Object.create(BaseOverview); overview.populate(overviewAPIResponse); const _otherObligations = overviewAPIResponse.spending.total_obligations - overviewAPIResponse.spending.award_obligations; const _awardObligationsNotOutlayed = overviewAPIResponse.spending.award_obligations - overviewAPIResponse.spending.award_outlays; const _remainingBalance = overviewAPIResponse.total_budget_authority - overviewAPIResponse.spending.total_obligations; const nonAwardOutLays = overviewAPIResponse.spending.total_outlays - overviewAPIResponse.spending.award_outlays; const _nonAwardNotOutlayed = (overviewAPIResponse.spending.total_obligations - overviewAPIResponse.spending.award_obligations) - (overviewAPIResponse.spending.total_outlays - overviewAPIResponse.spending.award_outlays); describe(' COVID-19 overview Model', () => { describe('Private Variables', () => { it('should calculate otherObligations', () => { expect(overview._otherObligations).toEqual(_otherObligations); }); it('should calculate awardObligationsNotOutlayed', () => { expect(overview._awardObligationsNotOutlayed).toEqual(_awardObligationsNotOutlayed); }); it('should calculate remainingBalance', () => { expect(overview._remainingBalance).toEqual(_remainingBalance); }); it('should calculate nonAwardOutLays', () => { expect(overview._nonAwardOutLays).toEqual(nonAwardOutLays); }); it('should calculate nonAwardNotOutlayed', () => { expect(overview._nonAwardNotOutlayed).toEqual(_nonAwardNotOutlayed); }); }); describe('Public Variables', () => { it('should format totalBudgetAuthority', () => { expect(overview.totalBudgetAuthority).toEqual(formatMoney(overview._totalBudgetAuthority)); }); it('should format awardObligations', () => { expect(overview.awardObligations).toEqual(formatMoney(overview._awardObligations)); }); it('should format awardOutlays', () => { expect(overview.awardOutlays).toEqual(formatMoney(overview._awardOutlays)); }); it('should format totalObligations', () => { expect(overview.totalObligations).toEqual(formatMoney(overview._totalObligations)); }); it('should format totalOutlays', () => { expect(overview.totalOutlays).toEqual(formatMoney(overview._totalOutlays)); }); it('should format otherObligations', () => { expect(overview.otherObligations).toEqual(formatMoney(overview._otherObligations)); }); it('should format awardObligationsNotOutlayed', () => { expect(overview.awardObligationsNotOutlayed).toEqual(formatMoney(overview._awardObligationsNotOutlayed)); }); it('should format remainingBalance', () => { expect(overview.remainingBalance).toEqual(formatMoney(overview._remainingBalance)); }); it('should format nonAwardOutLays', () => { expect(overview.nonAwardOutLays).toEqual(formatMoney(overview._nonAwardOutLays)); }); it('should format nonAwardNotOutlayed', () => { expect(overview.nonAwardNotOutlayed).toEqual(formatMoney(overview._nonAwardNotOutlayed)); }); }); });
'use strict'; function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } var Icon = require('../Icon-deabd942.js'); var React = _interopDefault(require('react')); require('@carbon/icon-helpers'); require('prop-types'); var VolumeUpFilled24 = /*#__PURE__*/ React.forwardRef(function VolumeUpFilled24(props, ref) { return React.createElement(Icon.Icon, Icon._extends({ width: 24, height: 24, viewBox: "0 0 32 32", ref: ref }, props), React.createElement("path", { d: "M27.16,8.08,25.63,9.37a10,10,0,0,1-.29,13.23L26.81,24a12,12,0,0,0,.35-15.88Z" }), React.createElement("path", { d: "M21.58,12a6,6,0,0,1-.18,7.94l1.47,1.36a8,8,0,0,0,.23-10.59Z" }), React.createElement("path", { d: "M18,30a1,1,0,0,1-.71-.3L9.67,22H3a1,1,0,0,1-1-1H2V11a1,1,0,0,1,1-1H9.67l7.62-7.7a1,1,0,0,1,1.41,0A1,1,0,0,1,19,3V29A1,1,0,0,1,18,30Z" }), props.children); }); module.exports = VolumeUpFilled24;
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _reactIconBase = require('react-icon-base'); var _reactIconBase2 = _interopRequireDefault(_reactIconBase); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var FaThLarge = function FaThLarge(props) { return _react2.default.createElement( _reactIconBase2.default, _extends({ viewBox: '0 0 40 40' }, props), _react2.default.createElement( 'g', null, _react2.default.createElement('path', { d: 'm18.6 22.9v8.5q0 1.2-0.8 2t-2 0.9h-11.4q-1.2 0-2.1-0.9t-0.8-2v-8.5q0-1.2 0.8-2.1t2.1-0.8h11.4q1.1 0 2 0.8t0.8 2.1z m0-17.2v8.6q0 1.1-0.8 2t-2 0.8h-11.4q-1.2 0-2.1-0.8t-0.8-2v-8.6q0-1.1 0.8-2t2.1-0.8h11.4q1.1 0 2 0.8t0.8 2z m20 17.2v8.5q0 1.2-0.8 2t-2 0.9h-11.4q-1.2 0-2.1-0.9t-0.8-2v-8.5q0-1.2 0.8-2.1t2.1-0.8h11.4q1.1 0 2 0.8t0.8 2.1z m0-17.2v8.6q0 1.1-0.8 2t-2 0.8h-11.4q-1.2 0-2.1-0.8t-0.8-2v-8.6q0-1.1 0.8-2t2.1-0.8h11.4q1.1 0 2 0.8t0.8 2z' }) ) ); }; exports.default = FaThLarge; module.exports = exports['default'];
/*generated by a tool*/ CreateryuSpriteData = function() { spriteLookup_.load("images/misc/ryu/r-fb-projectile-1.png","images/misc/ryu/projectiles.png", "0px", "-23px", "116px", "80px"); spriteLookup_.load("images/misc/ryu/r-fb-projectile-2.png","images/misc/ryu/projectiles.png", "-116px", "-18px", "148px", "85px"); spriteLookup_.load("images/misc/ryu/r-fb-projectile-2a.png","images/misc/ryu/projectiles.png", "-264px", "-18px", "148px", "85px"); spriteLookup_.load("images/misc/ryu/r-fb-projectile-3.png","images/misc/ryu/projectiles.png", "-412px", "-39px", "100px", "64px"); spriteLookup_.load("images/misc/ryu/r-fb-projectile-3a.png","images/misc/ryu/projectiles.png", "-512px", "-39px", "100px", "64px"); spriteLookup_.load("images/misc/ryu/r-fb-projectile-4.png","images/misc/ryu/projectiles.png", "-612px", "-15px", "148px", "88px"); spriteLookup_.load("images/misc/ryu/r-fb-projectile-5.png","images/misc/ryu/projectiles.png", "-760px", "-25px", "120px", "78px"); spriteLookup_.load("images/misc/ryu/r-fb-projectile-6.png","images/misc/ryu/projectiles.png", "-880px", "-18px", "152px", "85px"); spriteLookup_.load("images/misc/ryu/r-fb-projectile-7.png","images/misc/ryu/projectiles.png", "-1032px", "-41px", "104px", "62px"); spriteLookup_.load("images/misc/ryu/r-fb-projectile-8.png","images/misc/ryu/projectiles.png", "-1136px", "-8px", "148px", "95px"); spriteLookup_.load("images/misc/ryu/r-fb-projectile-hit-0.png","images/misc/ryu/projectiles.png", "-1284px", "-41px", "88px", "62px"); spriteLookup_.load("images/misc/ryu/r-fb-projectile-hit-1.png","images/misc/ryu/projectiles.png", "-1372px", "0px", "76px", "103px"); spriteLookup_.load("images/misc/ryu/r-fb-projectile-hit-2.png","images/misc/ryu/projectiles.png", "0px", "-144px", "100px", "121px"); spriteLookup_.load("images/misc/ryu/r-fb-projectile-hit-3.png","images/misc/ryu/projectiles.png", "-100px", "-134px", "114px", "131px"); spriteLookup_.load("images/misc/ryu/r-fb-projectile-hit-4.png","images/misc/ryu/projectiles.png", "-214px", "-118px", "118px", "147px"); spriteLookup_.load("images/misc/ryu/r-fb-projectile-hit-5.png","images/misc/ryu/projectiles.png", "-332px", "-103px", "120px", "162px"); spriteLookup_.load("images/misc/ryu/r-fb-projectiles-super-1.png","images/misc/ryu/projectiles.png", "-452px", "-183px", "150px", "82px"); spriteLookup_.load("images/misc/ryu/r-fb-projectiles-super-2.png","images/misc/ryu/projectiles.png", "-602px", "-137px", "174px", "128px"); spriteLookup_.load("images/misc/ryu/r-fb-projectiles-super-3.png","images/misc/ryu/projectiles.png", "-776px", "-183px", "144px", "82px"); spriteLookup_.load("images/misc/ryu/r-fb-projectiles-super-4.png","images/misc/ryu/projectiles.png", "-920px", "-137px", "180px", "128px"); spriteLookup_.load("images/misc/ryu/r-fb-projectiles-super-5.png","images/misc/ryu/projectiles.png", "-1100px", "-183px", "124px", "82px"); spriteLookup_.load("images/misc/ryu/r-fb-projectiles-super-6.png","images/misc/ryu/projectiles.png", "-1224px", "-129px", "220px", "136px"); spriteLookup_.load("images/misc/ryu/r-fb-projectiles-super-7.png","images/misc/ryu/projectiles.png", "-1444px", "-199px", "142px", "66px"); spriteLookup_.load("images/misc/ryu/r-fb-projectiles-super-8.png","images/misc/ryu/projectiles.png", "-1586px", "-129px", "184px", "136px"); spriteLookup_.load("images/misc/ryu/hr-bfire-01.png","images/misc/ryu/sprites.png", "0px", "-129px", "160px", "198px"); spriteLookup_.load("images/misc/ryu/hr-bfire-02.png","images/misc/ryu/sprites.png", "-160px", "-129px", "160px", "198px"); spriteLookup_.load("images/misc/ryu/hr-rfire-01.png","images/misc/ryu/sprites.png", "-960px", "-129px", "160px", "198px"); spriteLookup_.load("images/misc/ryu/hr-rfire-02.png","images/misc/ryu/sprites.png", "-320px", "-129px", "160px", "198px"); spriteLookup_.load("images/misc/ryu/hr-rfire-03.png","images/misc/ryu/sprites.png", "-480px", "-208px", "240px", "119px"); spriteLookup_.load("images/misc/ryu/hr-rfire-04.png","images/misc/ryu/sprites.png", "-720px", "-209px", "240px", "118px"); spriteLookup_.load("images/misc/ryu/r-air-block-0.png","images/misc/ryu/sprites.png", "-1120px", "-152px", "110px", "175px"); spriteLookup_.load("images/misc/ryu/r-block-0.png","images/misc/ryu/sprites.png", "-1230px", "-90px", "130px", "237px"); spriteLookup_.load("images/misc/ryu/r-block-1.png","images/misc/ryu/sprites.png", "-1360px", "-93px", "136px", "234px"); spriteLookup_.load("images/misc/ryu/r-b-walk-1.png","images/misc/ryu/sprites.png", "-1496px", "-98px", "126px", "229px"); spriteLookup_.load("images/misc/ryu/r-b-walk-2.png","images/misc/ryu/sprites.png", "-1622px", "-88px", "122px", "239px"); spriteLookup_.load("images/misc/ryu/r-b-walk-3.png","images/misc/ryu/sprites.png", "-1744px", "-86px", "108px", "241px"); spriteLookup_.load("images/misc/ryu/r-b-walk-4.png","images/misc/ryu/sprites.png", "-1852px", "-83px", "108px", "244px"); spriteLookup_.load("images/misc/ryu/r-b-walk-5.png","images/misc/ryu/sprites.png", "-1960px", "-83px", "122px", "244px"); spriteLookup_.load("images/misc/ryu/r-b-walk-6.png","images/misc/ryu/sprites.png", "-2082px", "-88px", "126px", "239px"); spriteLookup_.load("images/misc/ryu/r-crouch-0.png","images/misc/ryu/sprites.png", "-2208px", "-98px", "126px", "229px"); spriteLookup_.load("images/misc/ryu/r-crouch-1.png","images/misc/ryu/sprites.png", "-2334px", "-142px", "124px", "185px"); spriteLookup_.load("images/misc/ryu/r-crouch-2.png","images/misc/ryu/sprites.png", "-2458px", "-160px", "124px", "167px"); spriteLookup_.load("images/misc/ryu/r-crouch-block-0.png","images/misc/ryu/sprites.png", "-2582px", "-160px", "128px", "167px"); spriteLookup_.load("images/misc/ryu/r-crouch-block-1.png","images/misc/ryu/sprites.png", "-2710px", "-165px", "130px", "162px"); spriteLookup_.load("images/misc/ryu/r-crouch-k1-1.png","images/misc/ryu/sprites.png", "-2840px", "-160px", "152px", "167px"); spriteLookup_.load("images/misc/ryu/r-crouch-k1-2.png","images/misc/ryu/sprites.png", "-2992px", "-160px", "218px", "167px"); spriteLookup_.load("images/misc/ryu/r-crouch-k2-2.png","images/misc/ryu/sprites.png", "-3210px", "-175px", "186px", "152px"); spriteLookup_.load("images/misc/ryu/r-crouch-k2-3.png","images/misc/ryu/sprites.png", "-3396px", "-191px", "270px", "136px"); spriteLookup_.load("images/misc/ryu/r-crouch-k3-1.png","images/misc/ryu/sprites.png", "-3666px", "-167px", "108px", "160px"); spriteLookup_.load("images/misc/ryu/r-crouch-k3-2.png","images/misc/ryu/sprites.png", "-3774px", "-173px", "238px", "154px"); spriteLookup_.load("images/misc/ryu/r-crouch-k3-3.png","images/misc/ryu/sprites.png", "-4012px", "-178px", "128px", "149px"); spriteLookup_.load("images/misc/ryu/r-crouch-k3-4.png","images/misc/ryu/sprites.png", "-4140px", "-168px", "130px", "159px"); spriteLookup_.load("images/misc/ryu/r-crouch-k3-5.png","images/misc/ryu/sprites.png", "-4270px", "-162px", "120px", "165px"); spriteLookup_.load("images/misc/ryu/r-crouch-p1-1.png","images/misc/ryu/sprites.png", "-4390px", "-157px", "144px", "170px"); spriteLookup_.load("images/misc/ryu/r-crouch-p1-2.png","images/misc/ryu/sprites.png", "-4534px", "-157px", "198px", "170px"); spriteLookup_.load("images/misc/ryu/r-crouch-p2-1.png","images/misc/ryu/sprites.png", "-4732px", "-160px", "124px", "167px"); spriteLookup_.load("images/misc/ryu/r-crouch-p2-2.png","images/misc/ryu/sprites.png", "-4856px", "-160px", "128px", "167px"); spriteLookup_.load("images/misc/ryu/r-crouch-p2-3.png","images/misc/ryu/sprites.png", "-4984px", "-157px", "204px", "170px"); spriteLookup_.load("images/misc/ryu/r-crouch-p3-1.png","images/misc/ryu/sprites.png", "-5188px", "-137px", "134px", "190px"); spriteLookup_.load("images/misc/ryu/r-crouch-p3-2.png","images/misc/ryu/sprites.png", "-5322px", "-93px", "166px", "234px"); spriteLookup_.load("images/misc/ryu/r-crouch-p3-3.png","images/misc/ryu/sprites.png", "-5488px", "0px", "120px", "327px"); spriteLookup_.load("images/misc/ryu/r-crouch-turn-0.png","images/misc/ryu/sprites.png", "-5608px", "-163px", "120px", "164px"); spriteLookup_.load("images/misc/ryu/r-crouch-turn-1.png","images/misc/ryu/sprites.png", "-5728px", "-162px", "120px", "165px"); spriteLookup_.load("images/misc/ryu/r-crouch-turn-2.png","images/misc/ryu/sprites.png", "-5848px", "-160px", "122px", "167px"); spriteLookup_.load("images/misc/ryu/r-dizzy-0.png","images/misc/ryu/sprites.png", "-5970px", "-91px", "136px", "236px"); spriteLookup_.load("images/misc/ryu/r-dizzy-1.png","images/misc/ryu/sprites.png", "-6106px", "-86px", "140px", "241px"); spriteLookup_.load("images/misc/ryu/r-dizzy-2.png","images/misc/ryu/sprites.png", "-6246px", "-88px", "148px", "239px"); spriteLookup_.load("images/misc/ryu/r-down.png","images/misc/ryu/sprites.png", "-6394px", "-240px", "266px", "87px"); spriteLookup_.load("images/misc/ryu/r-fb-0.png","images/misc/ryu/sprites.png", "-6660px", "-96px", "148px", "231px"); spriteLookup_.load("images/misc/ryu/r-fb-1.png","images/misc/ryu/sprites.png", "-6808px", "-108px", "182px", "219px"); spriteLookup_.load("images/misc/ryu/r-fb-2.png","images/misc/ryu/sprites.png", "-6990px", "-121px", "192px", "206px"); spriteLookup_.load("images/misc/ryu/r-fb-3.png","images/misc/ryu/sprites.png", "-7182px", "-129px", "228px", "198px"); spriteLookup_.load("images/misc/ryu/r-f-jump-2.png","images/misc/ryu/sprites.png", "-7410px", "-54px", "122px", "273px"); spriteLookup_.load("images/misc/ryu/r-f-jump-3.png","images/misc/ryu/sprites.png", "-7532px", "-208px", "186px", "119px"); spriteLookup_.load("images/misc/ryu/r-f-jump-4.png","images/misc/ryu/sprites.png", "-7718px", "-129px", "110px", "198px"); spriteLookup_.load("images/misc/ryu/r-f-jump-5.png","images/misc/ryu/sprites.png", "-7828px", "-193px", "230px", "134px"); spriteLookup_.load("images/misc/ryu/r-f-jump-6.png","images/misc/ryu/sprites.png", "-8058px", "-85px", "140px", "242px"); spriteLookup_.load("images/misc/ryu/r-f-jump-k1-1.png","images/misc/ryu/sprites.png", "-8198px", "-142px", "116px", "185px"); spriteLookup_.load("images/misc/ryu/r-f-jump-k1-2.png","images/misc/ryu/sprites.png", "-8314px", "-152px", "118px", "175px"); spriteLookup_.load("images/misc/ryu/r-f-jump-k1-3.png","images/misc/ryu/sprites.png", "-8432px", "-168px", "144px", "159px"); spriteLookup_.load("images/misc/ryu/r-f-jump-k3-1.png","images/misc/ryu/sprites.png", "-8576px", "-121px", "122px", "206px"); spriteLookup_.load("images/misc/ryu/r-f-jump-k3-2.png","images/misc/ryu/sprites.png", "-8698px", "-152px", "234px", "175px"); spriteLookup_.load("images/misc/ryu/r-f-jump-p2-1.png","images/misc/ryu/sprites.png", "-8932px", "-114px", "140px", "213px"); spriteLookup_.load("images/misc/ryu/r-f-jump-p2-2.png","images/misc/ryu/sprites.png", "-9072px", "-121px", "116px", "206px"); spriteLookup_.load("images/misc/ryu/r-f-jump-p2-3.png","images/misc/ryu/sprites.png", "-9188px", "-129px", "130px", "198px"); spriteLookup_.load("images/misc/ryu/r-f-jump-p2-4.png","images/misc/ryu/sprites.png", "-9318px", "-123px", "180px", "204px"); spriteLookup_.load("images/misc/ryu/r-f-jump-p2-5.png","images/misc/ryu/sprites.png", "-9498px", "-90px", "160px", "237px"); spriteLookup_.load("images/misc/ryu/r-f-p2-0.png","images/misc/ryu/sprites.png", "-9658px", "-88px", "166px", "239px"); spriteLookup_.load("images/misc/ryu/r-f-p2-1.png","images/misc/ryu/sprites.png", "-9824px", "-88px", "166px", "239px"); spriteLookup_.load("images/misc/ryu/r-f-p2-2.png","images/misc/ryu/sprites.png", "-9990px", "-88px", "166px", "239px"); spriteLookup_.load("images/misc/ryu/r-f-p2-3.png","images/misc/ryu/sprites.png", "-10156px", "-72px", "186px", "255px"); spriteLookup_.load("images/misc/ryu/r-f-p2-4.png","images/misc/ryu/sprites.png", "-10342px", "-96px", "192px", "231px"); spriteLookup_.load("images/misc/ryu/r-f-p2-5.png","images/misc/ryu/sprites.png", "-10534px", "-96px", "206px", "231px"); spriteLookup_.load("images/misc/ryu/r-f-p2-6.png","images/misc/ryu/sprites.png", "-10740px", "-108px", "206px", "219px"); spriteLookup_.load("images/misc/ryu/r-f-p2-7.png","images/misc/ryu/sprites.png", "-10946px", "-108px", "206px", "219px"); spriteLookup_.load("images/misc/ryu/r-f-p2-8.png","images/misc/ryu/sprites.png", "-11152px", "-108px", "206px", "219px"); spriteLookup_.load("images/misc/ryu/r-f-p2-9.png","images/misc/ryu/sprites.png", "-11358px", "-108px", "206px", "219px"); spriteLookup_.load("images/misc/ryu/r-f-walk-1.png","images/misc/ryu/sprites.png", "-11564px", "-88px", "140px", "239px"); spriteLookup_.load("images/misc/ryu/r-f-walk-3.png","images/misc/ryu/sprites.png", "-11704px", "-83px", "118px", "244px"); spriteLookup_.load("images/misc/ryu/r-f-walk-4.png","images/misc/ryu/sprites.png", "-11822px", "-86px", "108px", "241px"); spriteLookup_.load("images/misc/ryu/r-f-walk-5.png","images/misc/ryu/sprites.png", "-11930px", "-88px", "112px", "239px"); spriteLookup_.load("images/misc/ryu/r-getup-0.png","images/misc/ryu/sprites.png", "-12042px", "-232px", "188px", "95px"); spriteLookup_.load("images/misc/ryu/r-getup-1.png","images/misc/ryu/sprites.png", "-12230px", "-137px", "118px", "190px"); spriteLookup_.load("images/misc/ryu/r-getup-2.png","images/misc/ryu/sprites.png", "-12348px", "-72px", "88px", "255px"); spriteLookup_.load("images/misc/ryu/r-getup-3.png","images/misc/ryu/sprites.png", "-12436px", "-144px", "150px", "183px"); spriteLookup_.load("images/misc/ryu/r-hit-air-0.png","images/misc/ryu/sprites.png", "-12586px", "-129px", "160px", "198px"); spriteLookup_.load("images/misc/ryu/r-hit-air-1.png","images/misc/ryu/sprites.png", "-12746px", "-209px", "240px", "118px"); spriteLookup_.load("images/misc/ryu/r-hit-air-1a.png","images/misc/ryu/sprites.png", "-12986px", "-209px", "240px", "118px"); spriteLookup_.load("images/misc/ryu/r-hit-air-2.png","images/misc/ryu/sprites.png", "-13226px", "-221px", "250px", "106px"); spriteLookup_.load("images/misc/ryu/r-hit-air-2a.png","images/misc/ryu/sprites.png", "-13476px", "-221px", "246px", "106px"); spriteLookup_.load("images/misc/ryu/r-hit-air-3.png","images/misc/ryu/sprites.png", "-13722px", "-191px", "248px", "136px"); spriteLookup_.load("images/misc/ryu/r-hit-air-4.png","images/misc/ryu/sprites.png", "-13970px", "-129px", "160px", "198px"); spriteLookup_.load("images/misc/ryu/r-hit-air-5.png","images/misc/ryu/sprites.png", "-14130px", "-214px", "210px", "113px"); spriteLookup_.load("images/misc/ryu/r-hit-air-6.png","images/misc/ryu/sprites.png", "-14340px", "-163px", "146px", "164px"); spriteLookup_.load("images/misc/ryu/r-hit-chn-0.png","images/misc/ryu/sprites.png", "-14486px", "-165px", "156px", "162px"); spriteLookup_.load("images/misc/ryu/r-hit-chn-1.png","images/misc/ryu/sprites.png", "-14642px", "-173px", "162px", "154px"); spriteLookup_.load("images/misc/ryu/r-hit-cln-0.png","images/misc/ryu/sprites.png", "-14804px", "-160px", "146px", "167px"); spriteLookup_.load("images/misc/ryu/r-hit-shf-0.png","images/misc/ryu/sprites.png", "-14950px", "-93px", "148px", "234px"); spriteLookup_.load("images/misc/ryu/r-hit-shf-1.png","images/misc/ryu/sprites.png", "0px", "-434px", "164px", "228px"); spriteLookup_.load("images/misc/ryu/r-hit-shf-1a.png","images/misc/ryu/sprites.png", "-164px", "-433px", "164px", "229px"); spriteLookup_.load("images/misc/ryu/r-hit-shn-1.png","images/misc/ryu/sprites.png", "-328px", "-464px", "172px", "198px"); spriteLookup_.load("images/misc/ryu/r-hit-shn-1a.png","images/misc/ryu/sprites.png", "-500px", "-464px", "172px", "198px"); spriteLookup_.load("images/misc/ryu/r-hit-slf-0.png","images/misc/ryu/sprites.png", "-672px", "-425px", "142px", "237px"); spriteLookup_.load("images/misc/ryu/r-hit-sln-0.png","images/misc/ryu/sprites.png", "-814px", "-438px", "130px", "224px"); spriteLookup_.load("images/misc/ryu/r-hit-sln-0a.png","images/misc/ryu/sprites.png", "-944px", "-438px", "130px", "224px"); spriteLookup_.load("images/misc/ryu/r-hit-smf-0.png","images/misc/ryu/sprites.png", "-1074px", "-425px", "146px", "237px"); spriteLookup_.load("images/misc/ryu/r-hit-smn-0.png","images/misc/ryu/sprites.png", "-1220px", "-451px", "136px", "211px"); spriteLookup_.load("images/misc/ryu/r-hit-smn-0a.png","images/misc/ryu/sprites.png", "-1356px", "-451px", "136px", "211px"); spriteLookup_.load("images/misc/ryu/r-hit-smn-1.png","images/misc/ryu/sprites.png", "-1492px", "-459px", "136px", "203px"); spriteLookup_.load("images/misc/ryu/r-hk-0.png","images/misc/ryu/sprites.png", "-1628px", "-379px", "142px", "283px"); spriteLookup_.load("images/misc/ryu/r-hk-1.png","images/misc/ryu/sprites.png", "-1770px", "-487px", "108px", "175px"); spriteLookup_.load("images/misc/ryu/r-hk-2.png","images/misc/ryu/sprites.png", "-1878px", "-438px", "122px", "224px"); spriteLookup_.load("images/misc/ryu/r-hk-3.png","images/misc/ryu/sprites.png", "-2000px", "-395px", "190px", "267px"); spriteLookup_.load("images/misc/ryu/r-hk-4.png","images/misc/ryu/sprites.png", "-2190px", "-395px", "116px", "267px"); spriteLookup_.load("images/misc/ryu/r-hk-5.png","images/misc/ryu/sprites.png", "-2306px", "-410px", "192px", "252px"); spriteLookup_.load("images/misc/ryu/r-hk-6.png","images/misc/ryu/sprites.png", "-2498px", "-410px", "122px", "252px"); spriteLookup_.load("images/misc/ryu/r-hk-7.png","images/misc/ryu/sprites.png", "-2620px", "-395px", "106px", "267px"); spriteLookup_.load("images/misc/ryu/r-hk-8.png","images/misc/ryu/sprites.png", "-2726px", "-395px", "106px", "267px"); spriteLookup_.load("images/misc/ryu/r-hk-9.png","images/misc/ryu/sprites.png", "-2832px", "-410px", "108px", "252px"); spriteLookup_.load("images/misc/ryu/r-hk-10.png","images/misc/ryu/sprites.png", "-2940px", "-410px", "106px", "252px"); spriteLookup_.load("images/misc/ryu/r-jump-1.png","images/misc/ryu/sprites.png", "-3046px", "-384px", "124px", "278px"); spriteLookup_.load("images/misc/ryu/r-jump-1a.png","images/misc/ryu/sprites.png", "-3170px", "-364px", "124px", "298px"); spriteLookup_.load("images/misc/ryu/r-jump-2.png","images/misc/ryu/sprites.png", "-3294px", "-435px", "128px", "227px"); spriteLookup_.load("images/misc/ryu/r-jump-3.png","images/misc/ryu/sprites.png", "-3422px", "-482px", "122px", "180px"); spriteLookup_.load("images/misc/ryu/r-jump-4.png","images/misc/ryu/sprites.png", "-3544px", "-495px", "122px", "167px"); spriteLookup_.load("images/misc/ryu/r-jump-5.png","images/misc/ryu/sprites.png", "-3666px", "-441px", "128px", "221px"); spriteLookup_.load("images/misc/ryu/r-jump-6.png","images/misc/ryu/sprites.png", "-3794px", "-364px", "124px", "298px"); spriteLookup_.load("images/misc/ryu/r-jump-k1-1.png","images/misc/ryu/sprites.png", "-3918px", "-431px", "126px", "231px"); spriteLookup_.load("images/misc/ryu/r-jump-k1-2.png","images/misc/ryu/sprites.png", "-4044px", "-407px", "150px", "255px"); spriteLookup_.load("images/misc/ryu/r-jump-k1-3.png","images/misc/ryu/sprites.png", "-4194px", "-425px", "124px", "237px"); spriteLookup_.load("images/misc/ryu/r-jump-k3-1.png","images/misc/ryu/sprites.png", "-4318px", "-379px", "142px", "283px"); spriteLookup_.load("images/misc/ryu/r-jump-k3-2.png","images/misc/ryu/sprites.png", "-4460px", "-464px", "116px", "198px"); spriteLookup_.load("images/misc/ryu/r-jump-k3-3.png","images/misc/ryu/sprites.png", "-4576px", "-410px", "118px", "252px"); spriteLookup_.load("images/misc/ryu/r-jump-k3-4.png","images/misc/ryu/sprites.png", "-4694px", "-387px", "186px", "275px"); spriteLookup_.load("images/misc/ryu/r-jump-k3-5.png","images/misc/ryu/sprites.png", "-4880px", "-400px", "122px", "262px"); spriteLookup_.load("images/misc/ryu/r-jump-k3-6.png","images/misc/ryu/sprites.png", "-5002px", "-410px", "118px", "252px"); spriteLookup_.load("images/misc/ryu/r-jump-p1-1.png","images/misc/ryu/sprites.png", "-5120px", "-474px", "110px", "188px"); spriteLookup_.load("images/misc/ryu/r-jump-p1-2.png","images/misc/ryu/sprites.png", "-5230px", "-472px", "174px", "190px"); spriteLookup_.load("images/misc/ryu/r-jump-p2-1.png","images/misc/ryu/sprites.png", "-5404px", "-459px", "148px", "203px"); spriteLookup_.load("images/misc/ryu/r-jump-p2-2.png","images/misc/ryu/sprites.png", "-5552px", "-477px", "196px", "185px"); spriteLookup_.load("images/misc/ryu/r-k1-0.png","images/misc/ryu/sprites.png", "-5748px", "-402px", "166px", "260px"); spriteLookup_.load("images/misc/ryu/r-k1-1.png","images/misc/ryu/sprites.png", "-5914px", "-425px", "108px", "237px"); spriteLookup_.load("images/misc/ryu/r-k1-2.png","images/misc/ryu/sprites.png", "-6022px", "-420px", "182px", "242px"); spriteLookup_.load("images/misc/ryu/r-k1-4.png","images/misc/ryu/sprites.png", "-6204px", "-420px", "136px", "242px"); spriteLookup_.load("images/misc/ryu/r-k2-1.png","images/misc/ryu/sprites.png", "-6340px", "-418px", "136px", "244px"); spriteLookup_.load("images/misc/ryu/r-k2-2.png","images/misc/ryu/sprites.png", "-6476px", "-361px", "112px", "301px"); spriteLookup_.load("images/misc/ryu/r-k2-3.png","images/misc/ryu/sprites.png", "-6588px", "-418px", "186px", "244px"); spriteLookup_.load("images/misc/ryu/r-k3-1.png","images/misc/ryu/sprites.png", "-6774px", "-433px", "122px", "229px"); spriteLookup_.load("images/misc/ryu/r-k3-2.png","images/misc/ryu/sprites.png", "-6896px", "-421px", "172px", "241px"); spriteLookup_.load("images/misc/ryu/r-k3-3.png","images/misc/ryu/sprites.png", "-7068px", "-421px", "210px", "241px"); spriteLookup_.load("images/misc/ryu/r-k3-4.png","images/misc/ryu/sprites.png", "-7278px", "-456px", "202px", "206px"); spriteLookup_.load("images/misc/ryu/r-k3-5.png","images/misc/ryu/sprites.png", "-7480px", "-454px", "148px", "208px"); spriteLookup_.load("images/misc/ryu/r-p1-0.png","images/misc/ryu/sprites.png", "-7628px", "-420px", "148px", "242px"); spriteLookup_.load("images/misc/ryu/r-p1-1.png","images/misc/ryu/sprites.png", "-7776px", "-418px", "204px", "244px"); spriteLookup_.load("images/misc/ryu/r-p2-0.png","images/misc/ryu/sprites.png", "-7980px", "-420px", "136px", "242px"); spriteLookup_.load("images/misc/ryu/r-p2-1.png","images/misc/ryu/sprites.png", "-8116px", "-420px", "180px", "242px"); spriteLookup_.load("images/misc/ryu/r-p2-2.png","images/misc/ryu/sprites.png", "-8296px", "-374px", "160px", "288px"); spriteLookup_.load("images/misc/ryu/r-p2-3.png","images/misc/ryu/sprites.png", "-8456px", "-420px", "136px", "242px"); spriteLookup_.load("images/misc/ryu/r-p3-1.png","images/misc/ryu/sprites.png", "-8592px", "-428px", "154px", "234px"); spriteLookup_.load("images/misc/ryu/r-p3-2.png","images/misc/ryu/sprites.png", "-8746px", "-428px", "224px", "234px"); spriteLookup_.load("images/misc/ryu/r-stance-0.png","images/misc/ryu/sprites.png", "-8970px", "-423px", "132px", "239px"); spriteLookup_.load("images/misc/ryu/r-stance-1.png","images/misc/ryu/sprites.png", "-9102px", "-420px", "132px", "242px"); spriteLookup_.load("images/misc/ryu/r-stance-2.png","images/misc/ryu/sprites.png", "-9234px", "-415px", "132px", "247px"); spriteLookup_.load("images/misc/ryu/r-stance-3.png","images/misc/ryu/sprites.png", "-9366px", "-410px", "129px", "252px"); spriteLookup_.load("images/misc/ryu/r-throw-0-0.png","images/misc/ryu/sprites.png", "-9495px", "-436px", "168px", "226px"); spriteLookup_.load("images/misc/ryu/r-throw-0-1.png","images/misc/ryu/sprites.png", "-9663px", "-418px", "170px", "244px"); spriteLookup_.load("images/misc/ryu/r-throw-0-2.png","images/misc/ryu/sprites.png", "-9833px", "-428px", "152px", "234px"); spriteLookup_.load("images/misc/ryu/r-throw-0-3.png","images/misc/ryu/sprites.png", "-9985px", "-456px", "176px", "206px"); spriteLookup_.load("images/misc/ryu/r-throw-0-4.png","images/misc/ryu/sprites.png", "-10161px", "-508px", "144px", "154px"); spriteLookup_.load("images/misc/ryu/r-throw-1-0.png","images/misc/ryu/sprites.png", "-10305px", "-454px", "150px", "208px"); spriteLookup_.load("images/misc/ryu/r-throw-1-1.png","images/misc/ryu/sprites.png", "-10455px", "-508px", "164px", "154px"); spriteLookup_.load("images/misc/ryu/r-throw-1-2.png","images/misc/ryu/sprites.png", "-10619px", "-515px", "248px", "147px"); spriteLookup_.load("images/misc/ryu/r-throw-1-3.png","images/misc/ryu/sprites.png", "-10867px", "-536px", "188px", "126px"); spriteLookup_.load("images/misc/ryu/r-throw-1-4.png","images/misc/ryu/sprites.png", "-11055px", "-495px", "140px", "167px"); spriteLookup_.load("images/misc/ryu/r-turn-0.png","images/misc/ryu/sprites.png", "-11195px", "-417px", "134px", "245px"); spriteLookup_.load("images/misc/ryu/r-turn-1.png","images/misc/ryu/sprites.png", "-11329px", "-418px", "128px", "244px"); spriteLookup_.load("images/misc/ryu/r-turn-2.png","images/misc/ryu/sprites.png", "-11457px", "-421px", "134px", "241px"); spriteLookup_.load("images/misc/ryu/r-uppercut-p1-1.png","images/misc/ryu/sprites.png", "-11591px", "-441px", "132px", "221px"); spriteLookup_.load("images/misc/ryu/r-uppercut-p1-2.png","images/misc/ryu/sprites.png", "-11723px", "-431px", "156px", "231px"); spriteLookup_.load("images/misc/ryu/r-uppercut-p1-3.png","images/misc/ryu/sprites.png", "-11879px", "-327px", "124px", "335px"); spriteLookup_.load("images/misc/ryu/r-uppercut-p1-4.png","images/misc/ryu/sprites.png", "-12003px", "-351px", "110px", "311px"); spriteLookup_.load("images/misc/ryu/r-uppercut-p1-5.png","images/misc/ryu/sprites.png", "-12113px", "-361px", "122px", "301px"); spriteLookup_.load("images/misc/ryu/r-uppercut-p1-6.png","images/misc/ryu/sprites.png", "-12235px", "-405px", "124px", "257px"); spriteLookup_.load("images/misc/ryu/r-win-1-0.png","images/misc/ryu/sprites.png", "-12359px", "-418px", "134px", "244px"); spriteLookup_.load("images/misc/ryu/r-win-1-1.png","images/misc/ryu/sprites.png", "-12493px", "-420px", "134px", "242px"); spriteLookup_.load("images/misc/ryu/r-win-1-2.png","images/misc/ryu/sprites.png", "-12627px", "-420px", "134px", "242px"); spriteLookup_.load("images/misc/ryu/r-win-1-3.png","images/misc/ryu/sprites.png", "-12761px", "-420px", "134px", "242px"); spriteLookup_.load("images/misc/ryu/r-win-1-4.png","images/misc/ryu/sprites.png", "-12895px", "-420px", "134px", "242px"); spriteLookup_.load("images/misc/ryu/r-win-1-5.png","images/misc/ryu/sprites.png", "-13029px", "-420px", "134px", "242px"); spriteLookup_.load("images/misc/ryu/r-win-1-6.png","images/misc/ryu/sprites.png", "-13163px", "-420px", "134px", "242px"); spriteLookup_.load("images/misc/ryu/r-win-2-0.png","images/misc/ryu/sprites.png", "-13297px", "-425px", "120px", "237px"); spriteLookup_.load("images/misc/ryu/r-win-2-1.png","images/misc/ryu/sprites.png", "-13417px", "-407px", "124px", "255px"); spriteLookup_.load("images/misc/ryu/r-win-2-2.png","images/misc/ryu/sprites.png", "-13541px", "-359px", "124px", "303px"); /*super move - trail*/ spriteLookup_.load("images/misc/ryu/r-fb-0-shadow-1.png","images/misc/ryu/trail-sprites.png", "0px", "0px", "148px", "231px"); spriteLookup_.load("images/misc/ryu/r-fb-0-shadow-2.png","images/misc/ryu/trail-sprites.png", "-148px", "0px", "148px", "231px"); spriteLookup_.load("images/misc/ryu/r-fb-1-shadow-1.png","images/misc/ryu/trail-sprites.png", "-296px", "-12px", "182px", "219px"); spriteLookup_.load("images/misc/ryu/r-fb-1-shadow-2.png","images/misc/ryu/trail-sprites.png", "-478px", "-12px", "182px", "219px"); spriteLookup_.load("images/misc/ryu/r-fb-2-shadow-1.png","images/misc/ryu/trail-sprites.png", "0px", "-231px", "192px", "206px"); spriteLookup_.load("images/misc/ryu/r-fb-2-shadow-2.png","images/misc/ryu/trail-sprites.png", "-192px", "-231px", "188px", "206px"); spriteLookup_.load("images/misc/ryu/r-fb-3-shadow-1.png","images/misc/ryu/trail-sprites.png", "-380px", "-239px", "228px", "198px"); spriteLookup_.load("images/misc/ryu/r-fb-3-shadow-2.png","images/misc/ryu/trail-sprites.png", "-608px", "-239px", "228px", "198px"); /*misc*/ spriteLookup_.load("images/misc/ryu/r-super-fireball-spark-0.png","images/misc/ryu/misc-sprites.png", "0px", "-85px", "36px", "46px"); spriteLookup_.load("images/misc/ryu/r-super-fireball-spark-1.png","images/misc/ryu/misc-sprites.png", "-36px", "-8px", "94px", "123px"); spriteLookup_.load("images/misc/ryu/r-super-fireball-spark-2.png","images/misc/ryu/misc-sprites.png", "-130px", "-15px", "108px", "116px"); spriteLookup_.load("images/misc/ryu/r-super-fireball-spark-3.png","images/misc/ryu/misc-sprites.png", "-238px", "0px", "124px", "131px"); spriteLookup_.load("images/misc/ryu/r-super-fireball-spark-4.png","images/misc/ryu/misc-sprites.png", "0px", "-159px", "80px", "95px"); spriteLookup_.load("images/misc/ryu/r-super-fireball-spark-5.png","images/misc/ryu/misc-sprites.png", "-80px", "-131px", "144px", "123px"); spriteLookup_.load("images/misc/ryu/r-super-fireball-spark-6.png","images/misc/ryu/misc-sprites.png", "-224px", "-139px", "124px", "115px"); spriteLookup_.load("images/misc/ryu/r-super-fireball-spark-7.png","images/misc/ryu/misc-sprites.png", "-348px", "-131px", "106px", "123px"); }
import React from "react" function Footer() { return ( <div> <p>hello from footer</p> </div> ) } export default Footer
// import { assert } from 'chai'; // import { testOptional } from '../extensions/index.js'; // import getDNSStats from '../src/st-dns-stats.js'; // it.optional = testOptional; // Object.freeze(assert); // describe('st-dns-stats', () => { // it.optional('should return domains stats', () => { // assert.deepEqual(getDNSStats(['epam.com']), { '.com': 1, '.com.epam': 1 }); // assert.deepEqual(getDNSStats(['epam.com', 'info.epam.com']), { '.com': 2, '.com.epam': 2, '.com.epam.info': 1 }); // assert.deepEqual(getDNSStats([]), {}); // }); // });
const path = require('path') const express = require('express') const morgan = require('morgan') const rateLimit = require('express-rate-limit') const helmet = require('helmet') const mongoSanitize = require('express-mongo-sanitize') const xss = require('xss-clean') const hpp = require('hpp') const cookieParser = require('cookie-parser') const compression = require('compression') const AppError = require('./utils/appError') const globalErrorHandler = require('./controllers/errorController') const reviewRouter = require('./routes/reviewRoutes') const tourRouter = require('./routes/tourRoutes') const userRouter = require('./routes/userRoutes') const bookingRouter = require('./routes/bookingRoutes') const viewRouter = require('./routes/viewRoutes') const app = express() app.enable('trust proxy') app.set('view engine', 'pug') app.set('views', path.join(__dirname, 'views')) //GLOBAL MIDDLEWARE //Serving static files app.use(express.static(path.join(__dirname, 'public'))) // Secure HTTP headers // content-security-policy app.use(helmet()) //Development loggin if (process.env.NODE_ENV === 'development') { app.use(morgan('dev')) } //Limit requests from same API const limiter = rateLimit({ max: 100, windowMs: 60 * 60 * 1000, message: 'Too many requests from this IP, please try again in an hour', }) app.use('/api', limiter) //Body parser, reading data from req.body app.use(express.json({ limit: '10kb' })) app.use(cookieParser()) //Data sanitization against NOSQL query injection app.use(mongoSanitize()) //Data sanitization against XSS app.use(xss()) //Prevent data pollution app.use( hpp({ whitelist: [ 'duration', 'ratingsQuantity', 'ratingsAverage', 'maxGroupSize', 'difficulty', 'price', ], }) ) app.use(compression()) //Test middleware app.use((req, res, next) => { req.requestTime = new Date().toISOString() // console.log(req.cookies) next() }) // ROUTE HANDLERS // app.get('/api/v1/tours', getAllTours); // app.post('/api/v1/tours', createTour); // app.get('/api/v1/tours/:id', getTour); // app.patch('/api/v1/tours/:id', updateTour); // app.delete('/api/v1/tours/:id', deleteTour); // ROUTES app.use('/', viewRouter) app.use('/api/v1/users/', userRouter) app.use('/api/v1/tours/', tourRouter) app.use('/api/v1/reviews/', reviewRouter) app.use('/api/v1/bookings/', bookingRouter) app.all('*', (req, res, next) => { next(new AppError(`Can't find ${req.originalUrl} on this server`, 404)) }) app.use(globalErrorHandler) module.exports = app
/** * MIT License * * Copyright (c) 2018-present, Walmart Inc., * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ var Logger = require('testarmada-midway-logger'); var Promise = require('bluebird'); var Path = require('path'); var Clone = require('./clone'); var Constants = require('../constants'); var multiRepoDirectory; module.exports = { getMultiRepoDirectory: function () { Logger.debug('Getting multiRepoDirectory. ' + multiRepoDirectory); return multiRepoDirectory; }, setMultiRepoDirectory: function (multiRepoDir) { Logger.debug('Setting multiRepoDirectory to ' + multiRepoDir); multiRepoDirectory = multiRepoDir; }, validateRepoInfo: function (repos) { var requiredFields = ['git', 'mocks', 'data']; repos.forEach(function (repo) { requiredFields.forEach(function (field) { if (repo[field] === undefined) { throw new Error('Missing field ' + field + ' in ' + JSON.stringify(repo, null, 3)); } }); }); }, requireEndpoints: function (repos) { var self = this; if (repos && repos instanceof Array) { repos.forEach(function (repo) { Logger.debug('Setting multiRepoDirectory to ' + repo.data); self.setMultiRepoDirectory(repo.data); Logger.debug('Requiring now ..repos' + repo.mocks); try { var endPointLocation = Path.join(process.cwd(), Constants.MULTI_REPOS_PATH, repo.mocks); Logger.debug('Requiring end point ::' + endPointLocation); require(endPointLocation); } catch (e) { self.setMultiRepoDirectory(undefined); Logger.error(e); throw new Error(e); } }); } this.setMultiRepoDirectory(undefined); }, handleMultipleRepos: function (midwayOptions) { var self = this; if (midwayOptions.multipleGitRepos) { this.validateRepoInfo(midwayOptions.multipleGitRepos); return Clone(midwayOptions.multipleGitRepos).then(function (repos) { Logger.debug(repos); self.requireEndpoints(repos); Logger.debug('Loaded all external routes'); return Promise.resolve(); }).catch(function (err) { return Promise.reject(err); }); } else { return Promise.resolve(); } } };
mycallback( {"CONTRIBUTOR OCCUPATION": "HOME EDUCATOR", "CONTRIBUTION AMOUNT (F3L Bundled)": "25.00", "ELECTION CODE": "G2010", "MEMO CODE": "", "CONTRIBUTOR EMPLOYER": "NONE", "DONOR CANDIDATE STATE": "", "CONTRIBUTOR STREET 1": "5708 GLENWOOD CT.", "CONTRIBUTOR MIDDLE NAME": "R.", "DONOR CANDIDATE FEC ID": "", "DONOR CANDIDATE MIDDLE NAME": "", "CONTRIBUTOR STATE": "VA", "DONOR CANDIDATE FIRST NAME": "", "CONTRIBUTOR FIRST NAME": "TAMI", "BACK REFERENCE SCHED NAME": "", "DONOR CANDIDATE DISTRICT": "", "CONTRIBUTION DATE": "20100712", "DONOR COMMITTEE NAME": "", "MEMO TEXT/DESCRIPTION": "", "Reference to SI or SL system code that identifies the Account": "", "FILER COMMITTEE ID NUMBER": "C00472050", "DONOR CANDIDATE LAST NAME": "", "CONTRIBUTOR LAST NAME": "GRAHAM", "_record_type": "fec.version.v7_0.SA", "CONDUIT STREET2": "", "CONDUIT STREET1": "", "DONOR COMMITTEE FEC ID": "", "CONTRIBUTION PURPOSE DESCRIP": "CONTRIBUTION", "CONTRIBUTOR ZIP": "223101335", "CONTRIBUTOR STREET 2": "", "CONDUIT CITY": "", "ENTITY TYPE": "IND", "CONTRIBUTOR CITY": "ALEXANDRIA", "CONTRIBUTOR SUFFIX": "", "TRANSACTION ID": "SA11.534", "DONOR CANDIDATE SUFFIX": "", "DONOR CANDIDATE OFFICE": "", "CONTRIBUTION PURPOSE CODE": "15", "ELECTION OTHER DESCRIPTION": "", "_src_file": "2011/20110504/727361.fec_1.yml", "CONDUIT STATE": "", "CONTRIBUTOR ORGANIZATION NAME": "", "BACK REFERENCE TRAN ID NUMBER": "", "DONOR CANDIDATE PREFIX": "", "CONTRIBUTOR PREFIX": "", "CONDUIT ZIP": "", "CONDUIT NAME": "", "CONTRIBUTION AGGREGATE F3L Semi-annual Bundled": "225.00", "FORM TYPE": "SA11AI"}); mycallback( {"CONTRIBUTOR OCCUPATION": "HOME EDUCATOR", "CONTRIBUTION AMOUNT (F3L Bundled)": "25.00", "ELECTION CODE": "G2010", "MEMO CODE": "", "CONTRIBUTOR EMPLOYER": "NONE", "DONOR CANDIDATE STATE": "", "CONTRIBUTOR STREET 1": "5708 GLENWOOD CT.", "CONTRIBUTOR MIDDLE NAME": "R.", "DONOR CANDIDATE FEC ID": "", "DONOR CANDIDATE MIDDLE NAME": "", "CONTRIBUTOR STATE": "VA", "DONOR CANDIDATE FIRST NAME": "", "CONTRIBUTOR FIRST NAME": "TAMI", "BACK REFERENCE SCHED NAME": "", "DONOR CANDIDATE DISTRICT": "", "CONTRIBUTION DATE": "20100712", "DONOR COMMITTEE NAME": "", "MEMO TEXT/DESCRIPTION": "", "Reference to SI or SL system code that identifies the Account": "", "FILER COMMITTEE ID NUMBER": "C00472050", "DONOR CANDIDATE LAST NAME": "", "CONTRIBUTOR LAST NAME": "GRAHAM", "_record_type": "fec.version.v7_0.SA", "CONDUIT STREET2": "", "CONDUIT STREET1": "", "DONOR COMMITTEE FEC ID": "", "CONTRIBUTION PURPOSE DESCRIP": "CONTRIBUTION", "CONTRIBUTOR ZIP": "223101335", "CONTRIBUTOR STREET 2": "", "CONDUIT CITY": "", "ENTITY TYPE": "IND", "CONTRIBUTOR CITY": "ALEXANDRIA", "CONTRIBUTOR SUFFIX": "", "TRANSACTION ID": "SA11.534", "DONOR CANDIDATE SUFFIX": "", "DONOR CANDIDATE OFFICE": "", "CONTRIBUTION PURPOSE CODE": "15", "ELECTION OTHER DESCRIPTION": "", "_src_file": "2011/20110504/727361.fec_1.yml", "CONDUIT STATE": "", "CONTRIBUTOR ORGANIZATION NAME": "", "BACK REFERENCE TRAN ID NUMBER": "", "DONOR CANDIDATE PREFIX": "", "CONTRIBUTOR PREFIX": "", "CONDUIT ZIP": "", "CONDUIT NAME": "", "CONTRIBUTION AGGREGATE F3L Semi-annual Bundled": "225.00", "FORM TYPE": "SA11AI"});
const merge = require('webpack-merge') const webpackBaseConfig = require('./webpack.base.config.js') module.exports = merge(webpackBaseConfig, {})
'use strict'; describe('Directive: sameAs', function () { // load the directive's module beforeEach(module('client')); var element, scope; beforeEach(inject(function ($rootScope) { scope = $rootScope.$new(); })); it('should make hidden element visible', inject(function ($compile) { element = angular.element('<same-as></same-as>'); element = $compile(element)(scope); expect(element.text()).toBe('this is the sameAs directive'); })); });
/* * MIT License * * Copyright (c) 2021 John Nahlen * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ function UserTimeZoneRepository() { this.userTimeZoneMap = {}; } /** * * @param {number} userId * @param {?string} timeZone */ UserTimeZoneRepository.prototype.setUserTimeZone = function(userId,timeZone) { this.userTimeZoneMap[userId] = timeZone; }; /** * * @param {number} userId * @return {?string} */ UserTimeZoneRepository.prototype.getUserTimeZone = function(userId) { return this.userTimeZoneMap[userId]; }; /** * * @param {number} userId */ UserTimeZoneRepository.prototype.deleteUserTimeZone = function(userId) { delete this.userTimeZoneMap[userId]; }; UserTimeZoneRepository.prototype.clearUserTimeZones = function() { this.userTimeZoneMap = {}; }; const userTimeZoneRepository = new UserTimeZoneRepository(); module.exports = userTimeZoneRepository;
(function(){ 'use strict'; angular .module('app') .directive('menuLeft',menuLeft); function menuLeft () { return { templateUrl: 'layout/menu-left/menu-left.tpl.html', restrict: 'E', replace: true, controller: MenuLeftCtrl, controllerAs: 'menuLeft' }; } MenuLeftCtrl.$inject = ['$rootScope','$state','ceAuthentication']; function MenuLeftCtrl($rootScope,$state,ceAuthentication){ var vm = this; vm.goToCreateGame = goToCreateGame; vm.goToCreateRecipe = goToCreateRecipe; vm.goToProfile = goToProfile; vm.goToSearchGame = goToSearchGame; vm.opened = false; vm.toggleDisplay = toggleDisplay; function goToCreateGame(){ if(userConnected()){ toggleDisplay(); $state.go('gameCreateQuiz'); } } function goToCreateRecipe(){ if(userConnected()){ toggleDisplay(); $state.go('recipeCreate'); } } function goToProfile(){ var user = userConnected(); if(user){ toggleDisplay(); $state.go('profileView',{username: user.username}); } } function goToSearchGame(){ toggleDisplay(); $state.go('gameSearch'); } function toggleDisplay(){ vm.opened = !vm.opened; $rootScope.bodyPush = vm.opened; } function userConnected(){ var user = ceAuthentication.getUser(); if(!user){ toggleDisplay(); $state.go('login'); return false; } return user; } } })();
// © 2016-2020 Resurface Labs Inc. /** * Parsed rule for HTTP logger. */ class HttpRule { constructor(verb, scope = null, param1 = null, param2 = null) { this._verb = verb; this._scope = scope; this._param1 = param1; this._param2 = param2; // mark immutable properties Object.defineProperty(this, '_verb', {configurable: false, writable: false}); Object.defineProperty(this, '_scope', {configurable: false, writable: false}); Object.defineProperty(this, '_param1', {configurable: false, writable: false}); Object.defineProperty(this, '_param2', {configurable: false, writable: false}); } get verb() { return this._verb; } get scope() { return this._scope; } get param1() { return this._param1; } get param2() { return this._param2; } } module.exports = HttpRule;
const isBrowser = typeof window !== 'undefined'; const isNode = (typeof module !== 'undefined' && module.exports); (function() { var Cherry = {}; var Scanner = require('./lib/Scanner').default, Parser = require('./lib/Parser').default, Source = require('./lib/Source').default, Tokenize = require('./lib/Token').default, Stream = require('./lib/Stream').default, Location = require('./lib/Location').default, Range = require('./lib/Location').Range, Collections = require('./lib/Collections').default, Utils = require('./lib/Utils').default; Cherry = { Scanner, Parser, Source, Tokenize, Collections, Utils, Stream, Location, Range }; /************************************ Exposing Cherry ************************************/ // CommonJS module is defined if(isNode) module.exports = Cherry; if(isBrowser) window.cherry = window.Cherry = Cherry; /*global define:false */ if (typeof define === 'function' && define.amd) { define([], function() { return Cherry; }); } }).call(this);
(function (_, Kotlin) { 'use strict'; var Kind_CLASS = Kotlin.Kind.CLASS; var Pair = Kotlin.kotlin.Pair; var Kind_INTERFACE = Kotlin.Kind.INTERFACE; var Exception = Kotlin.kotlin.Exception; function DateTime() { } DateTime.prototype.formatDate = function () { return (new Date()).toString(); }; DateTime.$metadata$ = { kind: Kind_CLASS, simpleName: 'DateTime', interfaces: [] }; function WordOfTheDay(day, word, description) { this.day = day; this.word = word; this.description = description; } WordOfTheDay.$metadata$ = { kind: Kind_CLASS, simpleName: 'WordOfTheDay', interfaces: [] }; WordOfTheDay.prototype.component1 = function () { return this.day; }; WordOfTheDay.prototype.component2 = function () { return this.word; }; WordOfTheDay.prototype.component3 = function () { return this.description; }; WordOfTheDay.prototype.copy_6hosri$ = function (day, word, description) { return new WordOfTheDay(day === void 0 ? this.day : day, word === void 0 ? this.word : word, description === void 0 ? this.description : description); }; WordOfTheDay.prototype.toString = function () { return 'WordOfTheDay(day=' + Kotlin.toString(this.day) + (', word=' + Kotlin.toString(this.word)) + (', description=' + Kotlin.toString(this.description)) + ')'; }; WordOfTheDay.prototype.hashCode = function () { var result = 0; result = result * 31 + Kotlin.hashCode(this.day) | 0; result = result * 31 + Kotlin.hashCode(this.word) | 0; result = result * 31 + Kotlin.hashCode(this.description) | 0; return result; }; WordOfTheDay.prototype.equals = function (other) { return this === other || (other !== null && (typeof other === 'object' && (Object.getPrototypeOf(this) === Object.getPrototypeOf(other) && (Kotlin.equals(this.day, other.day) && Kotlin.equals(this.word, other.word) && Kotlin.equals(this.description, other.description))))); }; function WordOfTheDayInMemoryRepository() { } WordOfTheDayInMemoryRepository.prototype.wordOfTheDay = function () { return new Pair('Maladroit', 'Lacking skill, cleverness, or resourcefulness in handling situations'); }; WordOfTheDayInMemoryRepository.$metadata$ = { kind: Kind_CLASS, simpleName: 'WordOfTheDayInMemoryRepository', interfaces: [WordRepository] }; function WordRepository() { } WordRepository.$metadata$ = { kind: Kind_INTERFACE, simpleName: 'WordRepository', interfaces: [] }; function WordUseCase(dateTime) { this.dateTime = dateTime; this.repository_0 = new WordOfTheDayInMemoryRepository(); } WordUseCase.prototype.wordOfTheDay_bcuqm1$ = function (success, error) { try { var word = this.repository_0.wordOfTheDay(); success(new WordOfTheDay(this.dateTime.formatDate(), word.first, word.second)); } catch (ex) { if (Kotlin.isType(ex, Exception)) { error(); } else throw ex; } }; WordUseCase.$metadata$ = { kind: Kind_CLASS, simpleName: 'WordUseCase', interfaces: [] }; function WordOfTheDayViewModel(useCase) { this.useCase = useCase; } WordOfTheDayViewModel.prototype.retrieveWord_bcuqm1$ = function (success, error) { this.useCase.wordOfTheDay_bcuqm1$(success, error); }; WordOfTheDayViewModel.$metadata$ = { kind: Kind_CLASS, simpleName: 'WordOfTheDayViewModel', interfaces: [] }; var package$com = _.com || (_.com = {}); var package$gilson = package$com.gilson || (package$com.gilson = {}); var package$chapter = package$gilson.chapter || (package$gilson.chapter = {}); package$chapter.DateTime = DateTime; var package$model = package$chapter.model || (package$chapter.model = {}); package$model.WordOfTheDay = WordOfTheDay; var package$repository = package$chapter.repository || (package$chapter.repository = {}); package$repository.WordOfTheDayInMemoryRepository = WordOfTheDayInMemoryRepository; package$repository.WordRepository = WordRepository; var package$usecase = package$chapter.usecase || (package$chapter.usecase = {}); package$usecase.WordUseCase = WordUseCase; var package$viewmodel = package$chapter.viewmodel || (package$chapter.viewmodel = {}); package$viewmodel.WordOfTheDayViewModel = WordOfTheDayViewModel; Kotlin.defineModule('common-js', _); return _; }(module.exports, require('kotlin'))); //# sourceMappingURL=common-js.js.map
// @remove-on-eject-begin /** * Copyright (c) 2015-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ // @remove-on-eject-end 'use strict'; const fs = require('fs'); const isWsl = require('is-wsl'); const path = require('path'); const webpack = require('webpack'); const resolve = require('resolve'); const PnpWebpackPlugin = require('pnp-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const WriteFilePlugin = require('write-file-webpack-plugin'); const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin'); const TerserPlugin = require('terser-webpack-plugin'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin'); const safePostCssParser = require('postcss-safe-parser'); const ManifestPlugin = require('webpack-manifest-plugin'); const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin'); const WorkboxWebpackPlugin = require('workbox-webpack-plugin'); const WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeModulesPlugin'); const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin'); const getCSSModuleLocalIdent = require('react-dev-utils/getCSSModuleLocalIdent'); const paths = require('./paths'); const modules = require('./modules'); const getClientEnvironment = require('./env'); const ModuleNotFoundPlugin = require('react-dev-utils/ModuleNotFoundPlugin'); const ForkTsCheckerWebpackPlugin = require('react-dev-utils/ForkTsCheckerWebpackPlugin'); const typescriptFormatter = require('react-dev-utils/typescriptFormatter'); const eslint = require('eslint'); // @cermakjiri - start const ExtensionReloader = require('webpack-extension-reloader'); // @cermakjiri - end // @remove-on-eject-begin const getCacheIdentifier = require('react-dev-utils/getCacheIdentifier'); // @remove-on-eject-end const postcssNormalize = require('postcss-normalize'); const appPackageJson = require(paths.appPackageJson); // Source maps are resource heavy and can cause out of memory issue for large source files. const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false'; const imageInlineSizeLimit = parseInt( process.env.IMAGE_INLINE_SIZE_LIMIT || '10000' ); // Check if TypeScript is setup const useTypeScript = fs.existsSync(paths.appTsConfig); // style files regexes const cssRegex = /\.css$/; const cssModuleRegex = /\.module\.css$/; const sassRegex = /\.(scss|sass)$/; const sassModuleRegex = /\.module\.(scss|sass)$/; // This is the production and development configuration. // It is focused on developer experience, fast rebuilds, and a minimal bundle. module.exports = function(webpackEnv) { const isEnvDevelopment = webpackEnv === 'development'; const isEnvProduction = webpackEnv === 'production'; // Webpack uses `publicPath` to determine where the app is being served from. // It requires a trailing slash, or the file assets will get an incorrect path. // In development, we always serve from the root. This makes config easier. const publicPath = isEnvProduction ? paths.servedPath : isEnvDevelopment && '/'; // Some apps do not use client-side routing with pushState. // For these, "homepage" can be set to "." to enable relative asset paths. const shouldUseRelativeAssetPaths = publicPath === './'; // `publicUrl` is just like `publicPath`, but we will provide it to our app // as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript. // Omit trailing slash as %PUBLIC_URL%/xyz looks better than %PUBLIC_URL%xyz. const publicUrl = isEnvProduction ? publicPath.slice(0, -1) : isEnvDevelopment && ''; // Get environment variables to inject into our app. const env = getClientEnvironment(publicUrl); // common function to get style loaders const getStyleLoaders = (cssOptions, preProcessor) => { const loaders = [ isEnvDevelopment && require.resolve('style-loader'), isEnvProduction && { loader: MiniCssExtractPlugin.loader, options: shouldUseRelativeAssetPaths ? { publicPath: '../../' } : {}, }, { loader: require.resolve('css-loader'), options: cssOptions, }, { // Options for PostCSS as we reference these options twice // Adds vendor prefixing based on your specified browser support in // package.json loader: require.resolve('postcss-loader'), options: { // Necessary for external CSS imports to work // https://github.com/facebook/create-react-app/issues/2677 ident: 'postcss', plugins: () => [ require('postcss-flexbugs-fixes'), require('postcss-preset-env')({ autoprefixer: { flexbox: 'no-2009', }, stage: 3, }), // Adds PostCSS Normalize as the reset css with default options, // so that it honors browserslist config in package.json // which in turn let's users customize the target behavior as per their needs. postcssNormalize(), ], sourceMap: isEnvProduction && shouldUseSourceMap, }, }, ].filter(Boolean); if (preProcessor) { loaders.push( { loader: require.resolve('resolve-url-loader'), options: { sourceMap: isEnvProduction && shouldUseSourceMap, }, }, { loader: require.resolve(preProcessor), options: { sourceMap: true, }, } ); } return loaders; }; return { mode: isEnvProduction ? 'production' : isEnvDevelopment && 'development', // Stop compilation early in production bail: isEnvProduction, devtool: isEnvProduction ? shouldUseSourceMap ? 'source-map' : false : isEnvDevelopment && 'cheap-module-source-map', // These are the "entry points" to our application. // This means they will be the "root" imports that are included in JS bundle. entry: { app: [ isEnvDevelopment && require.resolve('webpack-dev-server/client') + '?http://localhost:4000', paths.appIndexJs, ].filter(Boolean), background: [ isEnvDevelopment && require.resolve('webpack-dev-server/client') + '?http://localhost:4000', paths.appBackgroundJs, ].filter(Boolean), contentScript: paths.appContentScriptJs, }, output: { // The build folder. path: isEnvProduction ? paths.appBuild : paths.devAppBuild, // Add /* filename */ comments to generated require()s in the output. pathinfo: isEnvDevelopment, // There will be one main bundle, and one file per asynchronous chunk. // No need to hash because extension updates are managed by the browser distributer filename: '[name].bundle.js', // TODO: remove this when upgrading to webpack 5 futureEmitAssets: false, publicPath: '', // Point sourcemap entries to original disk location (format as URL on Windows) devtoolModuleFilenameTemplate: isEnvProduction ? info => path .relative(paths.appSrc, info.absoluteResourcePath) .replace(/\\/g, '/') : isEnvDevelopment && (info => path.resolve(info.absoluteResourcePath).replace(/\\/g, '/')), // Prevents conflicts when multiple Webpack runtimes (from different apps) // are used on the same page. jsonpFunction: `webpackJsonp${appPackageJson.name}`, }, optimization: { minimize: isEnvProduction, minimizer: [ // This is only used in production mode new TerserPlugin({ terserOptions: { parse: { // We want terser to parse ecma 8 code. However, we don't want it // to apply any minification steps that turns valid ecma 5 code // into invalid ecma 5 code. This is why the 'compress' and 'output' // sections only apply transformations that are ecma 5 safe // https://github.com/facebook/create-react-app/pull/4234 ecma: 8, }, compress: { ecma: 5, warnings: false, // Disabled because of an issue with Uglify breaking seemingly valid code: // https://github.com/facebook/create-react-app/issues/2376 // Pending further investigation: // https://github.com/mishoo/UglifyJS2/issues/2011 comparisons: false, // Disabled because of an issue with Terser breaking valid code: // https://github.com/facebook/create-react-app/issues/5250 // Pending further investigation: // https://github.com/terser-js/terser/issues/120 inline: 2, }, mangle: { safari10: true, }, output: { ecma: 5, comments: false, // Turned on because emoji and regex is not minified properly using default // https://github.com/facebook/create-react-app/issues/2488 ascii_only: true, }, }, // Use multi-process parallel running to improve the build speed // Default number of concurrent runs: os.cpus().length - 1 // Disabled on WSL (Windows Subsystem for Linux) due to an issue with Terser // https://github.com/webpack-contrib/terser-webpack-plugin/issues/21 parallel: !isWsl, // Enable file caching cache: true, sourceMap: shouldUseSourceMap, }), // This is only used in production mode new OptimizeCSSAssetsPlugin({ cssProcessorOptions: { parser: safePostCssParser, map: shouldUseSourceMap ? { // `inline: false` forces the sourcemap to be output into a // separate file inline: false, // `annotation: true` appends the sourceMappingURL to the end of // the css file, helping the browser find the sourcemap annotation: true, } : false, }, }), ], }, resolve: { // This allows you to set a fallback for where Webpack should look for modules. // We placed these paths second because we want `node_modules` to "win" // if there are any conflicts. This matches Node resolution mechanism. // https://github.com/facebook/create-react-app/issues/253 modules: ['node_modules', paths.appNodeModules].concat( modules.additionalModulePaths || [] ), // These are the reasonable defaults supported by the Node ecosystem. // We also include JSX as a common component filename extension to support // some tools, although we do not recommend using it, see: // https://github.com/facebook/create-react-app/issues/290 // `web` extension prefixes have been added for better support // for React Native Web. extensions: paths.moduleFileExtensions .map(ext => `.${ext}`) .filter(ext => useTypeScript || !ext.includes('ts')), alias: { // Support React Native Web // https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/ 'react-native': 'react-native-web', }, plugins: [ // Adds support for installing with Plug'n'Play, leading to faster installs and adding // guards against forgotten dependencies and such. PnpWebpackPlugin, // Prevents users from importing files from outside of src/ (or node_modules/). // This often causes confusion because we only process files within src/ with babel. // To fix this, we prevent you from importing files out of src/ -- if you'd like to, // please link the files into your node_modules/ and let module-resolution kick in. // Make sure your source files are compiled, as they will not be processed in any way. new ModuleScopePlugin(paths.appSrc, [paths.appPackageJson]), ], }, resolveLoader: { plugins: [ // Also related to Plug'n'Play, but this time it tells Webpack to load its loaders // from the current package. PnpWebpackPlugin.moduleLoader(module), ], }, module: { strictExportPresence: true, rules: [ // Disable require.ensure as it's not a standard language feature. { parser: { requireEnsure: false } }, // First, run the linter. // It's important to do this before Babel processes the JS. { test: /\.(js|mjs|jsx|ts|tsx)$/, enforce: 'pre', use: [ { options: { formatter: require.resolve('react-dev-utils/eslintFormatter'), eslintPath: require.resolve('eslint'), resolvePluginsRelativeTo: __dirname, // @remove-on-eject-begin baseConfig: (() => { const eslintCli = new eslint.CLIEngine(); let eslintConfig; try { eslintConfig = eslintCli.getConfigForFile(paths.appIndexJs); } catch (e) { // A config couldn't be found. } // We allow overriding the config only if the env variable is set if (process.env.EXTEND_ESLINT === 'true' && eslintConfig) { return eslintConfig; } else { return { extends: [require.resolve('eslint-config-react-app')], }; } })(), ignore: false, useEslintrc: false, // @remove-on-eject-end }, loader: require.resolve('eslint-loader'), }, ], include: paths.appSrc, }, { // "oneOf" will traverse all following loaders until one will // match the requirements. When no loader matches it will fall // back to the "file" loader at the end of the loader list. oneOf: [ // "url" loader works like "file" loader except that it embeds assets // smaller than specified limit in bytes as data URLs to avoid requests. // A missing `test` is equivalent to a match. { test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/], loader: require.resolve('url-loader'), options: { limit: imageInlineSizeLimit, name: 'static/media/[name].[ext]', }, }, // Process application JS with Babel. // The preset includes JSX, Flow, TypeScript, and some ESnext features. { test: /\.(js|mjs|jsx|ts|tsx)$/, include: paths.appSrc, loader: require.resolve('babel-loader'), options: { customize: require.resolve( 'babel-preset-react-app/webpack-overrides' ), // @remove-on-eject-begin babelrc: false, configFile: false, presets: [require.resolve('babel-preset-react-app')], // Make sure we have a unique cache identifier, erring on the // side of caution. // We remove this when the user ejects because the default // is sane and uses Babel options. Instead of options, we use // the react-scripts and babel-preset-react-app versions. cacheIdentifier: getCacheIdentifier( isEnvProduction ? 'production' : isEnvDevelopment && 'development', [ 'babel-plugin-named-asset-import', 'babel-preset-react-app', 'react-dev-utils', 'react-scripts', ] ), // @remove-on-eject-end plugins: [ [ require.resolve('babel-plugin-named-asset-import'), { loaderMap: { svg: { ReactComponent: '@svgr/webpack?-svgo,+titleProp,+ref![path]', }, }, }, ], ], // This is a feature of `babel-loader` for webpack (not Babel itself). // It enables caching results in ./node_modules/.cache/babel-loader/ // directory for faster rebuilds. cacheDirectory: true, // See #6846 for context on why cacheCompression is disabled cacheCompression: false, compact: isEnvProduction, }, }, // Process any JS outside of the app with Babel. // Unlike the application JS, we only compile the standard ES features. { test: /\.(js|mjs)$/, exclude: /@babel(?:\/|\\{1,2})runtime/, loader: require.resolve('babel-loader'), options: { babelrc: false, configFile: false, compact: false, presets: [ [ require.resolve('babel-preset-react-app/dependencies'), { helpers: true }, ], ], cacheDirectory: true, // See #6846 for context on why cacheCompression is disabled cacheCompression: false, // @remove-on-eject-begin cacheIdentifier: getCacheIdentifier( isEnvProduction ? 'production' : isEnvDevelopment && 'development', [ 'babel-plugin-named-asset-import', 'babel-preset-react-app', 'react-dev-utils', 'react-scripts', ] ), // @remove-on-eject-end // If an error happens in a package, it's possible to be // because it was compiled. Thus, we don't want the browser // debugger to show the original code. Instead, the code // being evaluated would be much more helpful. sourceMaps: false, }, }, // "postcss" loader applies autoprefixer to our CSS. // "css" loader resolves paths in CSS and adds assets as dependencies. // "style" loader turns CSS into JS modules that inject <style> tags. // In production, we use MiniCSSExtractPlugin to extract that CSS // to a file, but in development "style" loader enables hot editing // of CSS. // By default we support CSS Modules with the extension .module.css { test: cssRegex, exclude: cssModuleRegex, use: getStyleLoaders({ importLoaders: 1, sourceMap: isEnvProduction && shouldUseSourceMap, }), // Don't consider CSS imports dead code even if the // containing package claims to have no side effects. // Remove this when webpack adds a warning or an error for this. // See https://github.com/webpack/webpack/issues/6571 sideEffects: true, }, // Adds support for CSS Modules (https://github.com/css-modules/css-modules) // using the extension .module.css { test: cssModuleRegex, use: getStyleLoaders({ importLoaders: 1, sourceMap: isEnvProduction && shouldUseSourceMap, modules: true, getLocalIdent: getCSSModuleLocalIdent, }), }, // Opt-in support for SASS (using .scss or .sass extensions). // By default we support SASS Modules with the // extensions .module.scss or .module.sass { test: sassRegex, exclude: sassModuleRegex, use: getStyleLoaders( { importLoaders: 2, sourceMap: isEnvProduction && shouldUseSourceMap, }, 'sass-loader' ), // Don't consider CSS imports dead code even if the // containing package claims to have no side effects. // Remove this when webpack adds a warning or an error for this. // See https://github.com/webpack/webpack/issues/6571 sideEffects: true, }, // Adds support for CSS Modules, but using SASS // using the extension .module.scss or .module.sass { test: sassModuleRegex, use: getStyleLoaders( { importLoaders: 2, sourceMap: isEnvProduction && shouldUseSourceMap, modules: true, getLocalIdent: getCSSModuleLocalIdent, }, 'sass-loader' ), }, // "file" loader makes sure those assets get served by WebpackDevServer. // When you `import` an asset, you get its (virtual) filename. // In production, they would get copied to the `build` folder. // This loader doesn't use a "test" so it will catch all modules // that fall through the other loaders. { loader: require.resolve('file-loader'), // Exclude `js` files to keep "css" loader working as it injects // its runtime that would otherwise be processed through "file" loader. // Also exclude `html` and `json` extensions so they get processed // by webpacks internal loaders. exclude: [/\.(js|mjs|jsx|ts|tsx)$/, /\.html$/, /\.json$/], options: { name: 'static/media/[name].[hash:8].[ext]', }, }, // ** STOP ** Are you adding a new loader? // Make sure to add the new loader(s) before the "file" loader. ], }, ], }, plugins: [ // @cermakjiri - start isEnvDevelopment && new ExtensionReloader({ manifest: paths.manifestJson, port: process.env.PORT, }), // @cermakjiri - end // Generates an `index.html` file with the <script> injected. new HtmlWebpackPlugin( Object.assign( {}, { inject: true, template: paths.appPopupHtml, chunks: ['app'], filename: 'popup.html', }, isEnvProduction ? { minify: { removeComments: true, collapseWhitespace: true, removeRedundantAttributes: true, useShortDoctype: true, removeEmptyAttributes: true, removeStyleLinkTypeAttributes: true, keepClosingSlash: true, minifyJS: true, minifyCSS: true, minifyURLs: true, }, } : undefined ) ), // Makes some environment variables available in index.html. // The public URL is available as %PUBLIC_URL% in index.html, e.g.: // <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico"> // In production, it will be an empty string unless you specify "homepage" // in `package.json`, in which case it will be the pathname of that URL. // In development, this will be an empty string. new InterpolateHtmlPlugin(HtmlWebpackPlugin, env.raw), // This gives some necessary context to module not found errors, such as // the requesting resource. new ModuleNotFoundPlugin(paths.appPath), // Makes some environment variables available to the JS code, for example: // if (process.env.NODE_ENV === 'production') { ... }. See `./env.js`. // It is absolutely essential that NODE_ENV is set to production // during a production build. // Otherwise React will be compiled in the very slow development mode. new webpack.DefinePlugin(env.stringified), // Watcher doesn't work well if you mistype casing in a path so we use // a plugin that prints an error when you attempt to do this. // See https://github.com/facebook/create-react-app/issues/240 isEnvDevelopment && new CaseSensitivePathsPlugin(), // If you require a missing module and then `npm install` it, you still have // to restart the development server for Webpack to discover it. This plugin // makes the discovery automatic so you don't have to restart. // See https://github.com/facebook/create-react-app/issues/186 isEnvDevelopment && new WatchMissingNodeModulesPlugin(paths.appNodeModules), isEnvProduction && new MiniCssExtractPlugin({ // Options similar to the same options in webpackOptions.output // both options are optional filename: 'static/css/[name].[contenthash:8].css', chunkFilename: 'static/css/[name].[contenthash:8].chunk.css', }), // Generate a manifest file which contains a mapping of all asset filenames // to their corresponding output file so that tools can pick it up without // having to parse `index.html`. new ManifestPlugin({ fileName: 'asset-manifest.json', publicPath: publicPath, generate: (seed, files) => { const manifestFiles = files.reduce(function(manifest, file) { manifest[file.name] = file.path; return manifest; }, seed); return { files: manifestFiles, }; }, }), // Moment.js is an extremely popular library that bundles large locale files // by default due to how Webpack interprets its code. This is a practical // solution that requires the user to opt into importing specific locales. // https://github.com/jmblog/how-to-optimize-momentjs-with-webpack // You can remove this if you don't use Moment.js: new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/), // Generate a service worker script that will precache, and keep up to date, // the HTML & assets that are part of the Webpack build. isEnvProduction && new WorkboxWebpackPlugin.GenerateSW({ clientsClaim: true, exclude: [/\.map$/, /asset-manifest\.json$/], importWorkboxFrom: 'cdn', navigateFallback: publicUrl + '/index.html', navigateFallbackBlacklist: [ // Exclude URLs starting with /_, as they're likely an API call new RegExp('^/_'), // Exclude any URLs whose last part seems to be a file extension // as they're likely a resource and not a SPA route. // URLs containing a "?" character won't be blacklisted as they're likely // a route with query params (e.g. auth callbacks). new RegExp('/[^/?]+\\.[^/]+$'), ], }), // TypeScript type checking useTypeScript && new ForkTsCheckerWebpackPlugin({ typescript: resolve.sync('typescript', { basedir: paths.appNodeModules, }), async: isEnvDevelopment, useTypescriptIncrementalApi: true, checkSyntacticErrors: true, resolveModuleNameModule: process.versions.pnp ? `${__dirname}/pnpTs.js` : undefined, resolveTypeReferenceDirectiveModule: process.versions.pnp ? `${__dirname}/pnpTs.js` : undefined, tsconfig: paths.appTsConfig, reportFiles: [ '**', '!**/__tests__/**', '!**/?(*.)(spec|test).*', '!**/src/setupProxy.*', '!**/src/setupTests.*', ], watch: paths.appSrc, silent: true, // The formatter is invoked directly in WebpackDevServerUtils during development formatter: isEnvProduction ? typescriptFormatter : undefined, }), // Forces webpack dev server to write to the file system so we can serve it for hot reloading // the extension. This plugin is only in effect with "webpack-dev-server", otherwise it lets webpack do the writing new WriteFilePlugin(), ].filter(Boolean), // Some libraries import Node modules but don't use them in the browser. // Tell Webpack to provide empty mocks for them so importing them works. node: { module: 'empty', dgram: 'empty', dns: 'mock', fs: 'empty', http2: 'empty', net: 'empty', tls: 'empty', child_process: 'empty', }, // Turn off performance processing because we utilize // our own hints via the FileSizeReporter performance: false, }; };
/** * Copyright 2004-present Facebook. All Rights Reserved. * * @emails oncall+jsinfra * @format */ jest.autoMockOff(); test('TestUtil:', () => { let TestUtil; beforeEach(() => { TestUtil = require('../TestUtil'); }); describe('generateFormattedCodeFromAST:', () => { it('can generate formatted JS code from a Babel AST object', () => { expect( TestUtil.generateFormattedCodeFromAST( TestUtil.__parse__FOR_UNIT_TESTS( `function hello(){/* Comments should remain */alert('world!')}`, ), ), ).toMatchInlineSnapshot(` "function hello() { /* Comments should remain */ alert('world!'); }" `); }); }); });
import React, { useEffect, useState } from 'react'; import Card from '@material-ui/core/Card'; import CardActions from '@material-ui/core/CardActions'; import CardContent from '@material-ui/core/CardContent'; import Button from '@material-ui/core/Button'; import TextField from '@material-ui/core/TextField'; import Typography from '@material-ui/core/Typography'; import Icon from '@material-ui/core/Icon'; import Avatar from '@material-ui/core/Avatar'; import auth from '../auth/auth-helper'; import FileUpload from '@material-ui/icons/AddPhotoAlternate'; import { makeStyles } from '@material-ui/core/styles'; import { read, update } from './api-auction.js'; import { Redirect } from 'react-router-dom'; const useStyles = makeStyles(theme => ({ root: { flexGrow: 1, margin: 30, }, card: { textAlign: 'center', paddingBottom: theme.spacing(2) }, title: { margin: theme.spacing(2), color: theme.palette.protectedTitle, fontSize: '1.2em' }, subheading: { marginTop: theme.spacing(2), color: theme.palette.openTitle }, error: { verticalAlign: 'middle' }, textField: { marginLeft: theme.spacing(1), marginRight: theme.spacing(1), width: 400 }, submit: { margin: 'auto', marginBottom: theme.spacing(2) }, bigAvatar: { width: 60, height: 60, margin: 'auto' }, input: { display: 'none' }, filename: { marginLeft: '10px' } })) export default function EditShop({ match }) { const classes = useStyles() const [auction, setAuction] = useState({ itemName: '', description: '', image: '', bidStart: '', bidEnd: '', startingBid: 0, }) const [redirect, setRedirect] = useState(false) const [error, setError] = useState('') const getDateString = (date) => { let year = date.getFullYear() let day = date.getDate().toString().length == 1 ? '0' + date.getDate() : date.getDate() let month = date.getMonth().toString().length == 1 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1 let hours = date.getHours().toString().length == 1 ? '0' + date.getHours() : date.getHours() let minutes = date.getMinutes().toString().length == 1 ? '0' + date.getMinutes() : date.getMinutes() let dateString = `${year}-${month}-${day}T${hours}:${minutes}` return dateString } const jwt = auth.isAuthenticated() useEffect(() => { const abortController = new AbortController() const signal = abortController.signal read({ auctionId: match.params.auctionId }, signal).then((data) => { if (data.error) { setError(data.error) } else { data.bidEnd = getDateString(new Date(data.bidEnd)) data.bidStart = getDateString(new Date(data.bidStart)) setAuction(data) } }) return function cleanup() { abortController.abort() } }, []) const clickSubmit = () => { if (auction.bidEnd < auction.bidStart) { setError("Aukcja nie może zakończyć się przed rozpoczęciem") } else { let auctionData = new FormData() auction.itemName && auctionData.append('itemName', auction.itemName) auction.description && auctionData.append('description', auction.description) auction.image && auctionData.append('image', auction.image) auction.startingBid && auctionData.append('startingBid', auction.startingBid) auction.bidStart && auctionData.append('bidStart', auction.bidStart) auction.bidEnd && auctionData.append('bidEnd', auction.bidEnd) update({ auctionId: match.params.auctionId }, { t: jwt.token }, auctionData).then((data) => { if (data.error) { setError(data.error) } else { setRedirect(true) } }) } } const handleChange = name => event => { const value = name === 'image' ? event.target.files[0] : event.target.value setAuction({ ...auction, [name]: value }) } const logoUrl = auction._id ? `/api/auctions/image/${auction._id}?${new Date().getTime()}` : '/api/auctions/defaultphoto' if (redirect) { return (<Redirect to={'/myauctions'} />) } return (<div className={classes.root}> <Card className={classes.card}> <CardContent> <Typography type="headline" component="h2" className={classes.title}> Edytuj Aukcje </Typography> <br /> <Avatar src={logoUrl} className={classes.bigAvatar} /><br /> <input accept="image/*" onChange={handleChange('image')} className={classes.input} id="icon-button-file" type="file" /> <label htmlFor="icon-button-file"> <Button variant="contained" color="default" component="span"> Zmień obraz <FileUpload /> </Button> </label> <span className={classes.filename}>{auction.image ? auction.image.name : ''}</span><br /> <TextField id="name" label="Name" className={classes.textField} value={auction.itemName} onChange={handleChange('itemName')} margin="normal" /><br /> <TextField id="multiline-flexible" label="Opis" multiline rows="3" value={auction.description} onChange={handleChange('description')} className={classes.textField} margin="normal" /><br /> <TextField id="startingBid" label="Początkowa cena (zł)" className={classes.textField} value={auction.startingBid} onChange={handleChange('startingBid')} margin="normal" /><br /> <br /> <TextField id="datetime-local" label="Czas rozpoczęcia aukcji" type="datetime-local" value={auction.bidStart} className={classes.textField} onChange={handleChange('bidStart')} InputLabelProps={{ shrink: true, }} /><br /> <br /> <TextField id="datetime-local" label="Czas zakończenia aukcji" type="datetime-local" value={auction.bidEnd} className={classes.textField} onChange={handleChange('bidEnd')} InputLabelProps={{ shrink: true, }} /><br /> <br /> { error && (<Typography component="p" color="error"> <Icon color="error" className={classes.error}>error</Icon> {error} </Typography>) } </CardContent> <CardActions> <Button color="primary" variant="contained" onClick={clickSubmit} className={classes.submit}>Zaktualizuj</Button> </CardActions> </Card> </div>) }
'use strict'; const Path = require('path'); const Webpack = require('webpack'); module.exports = { entry: { serpentity: './lib/serpentity.js', "serpentity.min": './lib/serpentity.js', }, output: { path: Path.resolve(__dirname, '../dist'), filename: '[name].js', library: 'Serpentity', libraryTarget: 'umd' }, module: { loaders: [ { test: /\.js$/, exclude: /(node_modules|doc)/, loader: 'babel-loader', query: { presets: ['es2015'] } } ] }, resolve: { modules: [ 'node_modules', Path.resolve(__dirname, '../lib') ], extensions: ['.js'], }, context: Path.resolve(__dirname, '..'), plugins : [ new Webpack.optimize.UglifyJsPlugin({ include: /\.min\.js$/, minimize: true }) ] };
var searchData= [ ['nagagog_32547',['Nagagog',['../namespace_brawl_lib_1_1_s_s_b_b_1_1_resource_nodes.html#a8ee16394b7d4914ccae85a71954c0fe9ab27bdd40981e2fa6f56dd60a8f006363',1,'BrawlLib::SSBB::ResourceNodes']]], ['name_32548',['Name',['../class_brawl_lib_1_1_modeling_1_1_collada_1_1_collada.html#a3cb1e359a1066f4dd73d437e2419d181a49ee3087348e8d44e1feda1917443987',1,'BrawlLib::Modeling::Collada::Collada']]], ['nbt_32549',['NBT',['../class_brawl_lib_1_1_s_s_b_b_1_1_resource_nodes_1_1_m_d_l0_normal_node.html#afe23950ffc20e820ec958d7ae1c5596aaeba879e90e48586dc246a1aa3c6bc98d',1,'BrawlLib.SSBB.ResourceNodes.MDL0NormalNode.NBT()'],['../namespace_brawl_lib_1_1_wii_1_1_graphics.html#a312aa6cad349670693a273f2ca53cf42aeba879e90e48586dc246a1aa3c6bc98d',1,'BrawlLib.Wii.Graphics.NBT()'],['../namespace_brawl_lib_1_1_wii_1_1_graphics.html#a9e8d15413edd7e808cdce256f53d24c3aeba879e90e48586dc246a1aa3c6bc98d',1,'BrawlLib.Wii.Graphics.NBT()']]], ['nbt3_32550',['NBT3',['../class_brawl_lib_1_1_s_s_b_b_1_1_resource_nodes_1_1_m_d_l0_normal_node.html#afe23950ffc20e820ec958d7ae1c5596aafa5c8e251179981dc9395fd30cf0ba8b',1,'BrawlLib::SSBB::ResourceNodes::MDL0NormalNode']]], ['nearconstant_32551',['NearConstant',['../namespace_brawl_lib_1_1_s_s_b_b_1_1_types.html#ae77e17c9e21f77e4a29cbee2be4e406cad8a12443eb9d978206526ef2a4ec6c93',1,'BrawlLib::SSBB::Types']]], ['nearest_32552',['Nearest',['../namespace_brawl_lib_1_1_s_s_b_b_1_1_resource_nodes.html#a555214f10de806b0ed5be99ad89a12e8a60494f02d440f316319dd0fad40ad007',1,'BrawlLib.SSBB.ResourceNodes.Nearest()'],['../namespace_brawl_lib_1_1_s_s_b_b_1_1_resource_nodes.html#a1036195b4e97203c50fdfb60d9eefdc3a60494f02d440f316319dd0fad40ad007',1,'BrawlLib.SSBB.ResourceNodes.Nearest()']]], ['nearest_5fmipmap_5flinear_32553',['Nearest_Mipmap_Linear',['../namespace_brawl_lib_1_1_s_s_b_b_1_1_resource_nodes.html#a1036195b4e97203c50fdfb60d9eefdc3a4385be674d727059f6328a98745248d3',1,'BrawlLib::SSBB::ResourceNodes']]], ['nearest_5fmipmap_5fnearest_32554',['Nearest_Mipmap_Nearest',['../namespace_brawl_lib_1_1_s_s_b_b_1_1_resource_nodes.html#a1036195b4e97203c50fdfb60d9eefdc3acf2ce1d8a7724df31781d260a2971b2a',1,'BrawlLib::SSBB::ResourceNodes']]], ['nearz_32555',['NearZ',['../namespace_brawl_lib_1_1_s_s_b_b_1_1_resource_nodes.html#a2d5fa73e676c294357b7a2bdd6446569afefc9363814c340d2a751d6ee1189f55',1,'BrawlLib::SSBB::ResourceNodes']]], ['ness_32556',['Ness',['../class_brawl_lib_1_1_s_s_b_b_1_1_resource_nodes_1_1_ty_seal_node.html#ab0bcc625f96933a277f84ff891da74b9ae526291a06e0f6fcae3948be033c6596',1,'BrawlLib::SSBB::ResourceNodes::TySealNode']]], ['never_32557',['Never',['../namespace_brawl_lib_1_1_wii_1_1_graphics.html#a2e385e0f8ac242b5d179c1ee0effee5ca6e7b34fa59e1bd229b207892956dc41c',1,'BrawlLib.Wii.Graphics.Never()'],['../namespace_brawl_lib_1_1_wii_1_1_graphics.html#afadec15fb0526a987decd19f294dce6ea6e7b34fa59e1bd229b207892956dc41c',1,'BrawlLib.Wii.Graphics.Never()']]], ['newton_32558',['Newton',['../namespace_brawl_lib_1_1_s_s_b_b_1_1_types.html#a6e4e11c291643530dccd9b582e1faa82a1c8b97c83b0726216cd5dbc88a64b0ed',1,'BrawlLib::SSBB::Types']]], ['no_32559',['No',['../class_brawl_crate_1_1_discord_1_1_discord_rpc.html#aeaa805de06569dc0034609d9f8097fc8abafd7322c6e97d25b6299b5d6fe8920b',1,'BrawlCrate::Discord::DiscordRpc']]], ['nocache_32560',['NoCache',['../class_brawl_lib_1_1_platform_1_1_win32.html#aa21f4be2e992fe11edbb601ce8ce792ea9c2a36ed94b288fe8f5ce5b6b16d3fdd',1,'BrawlLib::Platform::Win32']]], ['node_32561',['Node',['../class_brawl_lib_1_1_modeling_1_1_collada_1_1_collada.html#a9e243f1f6be413b7a6f015e530e8516ba6c3a6944a808a7c0bbb6788dbec54a9f',1,'BrawlLib.Modeling.Collada.Collada.Node()'],['../class_brawl_lib_1_1_modeling_1_1_collada_1_1_collada.html#ab4079943a0aebe343e1acc03c31d3760a0cc25b606fe928a0c9a58f7f209c4495',1,'BrawlLib.Modeling.Collada.Collada.NODE()']]], ['nodesign_32562',['NoDesign',['../namespace_brawl_lib_1_1_s_s_b_b_1_1_types.html#acb8923d932490252ed7b4e087f37749ba640a027182fae363f8947a011ac49b74',1,'BrawlLib::SSBB::Types']]], ['nodesignyaxis_32563',['NoDesignYAxis',['../namespace_brawl_lib_1_1_s_s_b_b_1_1_types.html#acb8923d932490252ed7b4e087f37749ba3cfe0c39fae186f4de6c90144b7dc256',1,'BrawlLib::SSBB::Types']]], ['noedit_32564',['NoEdit',['../namespace_brawl_lib_1_1_s_s_b_b_1_1_resource_nodes.html#a57416f79e39a4c4dd86a4334e94ee180a3df6a2120849c3699e235131ffe10447',1,'BrawlLib::SSBB::ResourceNodes']]], ['noeditentry_32565',['NoEditEntry',['../namespace_brawl_lib_1_1_s_s_b_b_1_1_resource_nodes.html#a57416f79e39a4c4dd86a4334e94ee180ae22cad2369ae1cc8a1218aa89b719812',1,'BrawlLib::SSBB::ResourceNodes']]], ['noeditfolder_32566',['NoEditFolder',['../namespace_brawl_lib_1_1_s_s_b_b_1_1_resource_nodes.html#a57416f79e39a4c4dd86a4334e94ee180ad704715f61ceff33d5b06873db6f2653',1,'BrawlLib::SSBB::ResourceNodes']]], ['nomatrix_32567',['NoMatrix',['../namespace_brawl_lib_1_1_wii_1_1_graphics.html#afc897bd2b403902b8822bb85249c5dc7a3e3e96b754085325096bb3dab9c4a704',1,'BrawlLib::Wii::Graphics']]], ['none_32568',['None',['../class_brawl_lib_1_1_internal_1_1_audio_1_1_audio_provider.html#a3ab3496203ad68fb90fe0f58ea1e6251a6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.Internal.Audio.AudioProvider.None()'],['../class_brawl_lib_1_1_modeling_1_1_collada_1_1_collada.html#af6b11e1957eaaba2430ee53d0bdef964a6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.Modeling.Collada.Collada.None()'],['../class_brawl_lib_1_1_platform_1_1_win32_1_1_direct_sound.html#aed39126f34ab0b1108cb2201dd123650a6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.Platform.Win32.DirectSound.None()'],['../class_brawl_lib_1_1_platform_1_1_linux.html#a81c9dc6c0c570683e154c6cd2a3dbf24a6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.Platform.Linux.None()'],['../class_brawl_lib_1_1_platform_1_1_o_s_x.html#a09363ea20b65697a0f86915f326e3c8ea6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.Platform.OSX.None()'],['../class_brawl_lib_1_1_modeling_1_1_collada_1_1_collada.html#a12b713e6a5791e4ec305bcba7c7e5e5ea6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.Modeling.Collada.Collada.None()'],['../class_brawl_lib_1_1_platform_1_1_win32_1_1_direct_sound.html#a01e9dc8965e2d12ecf83985241d94f17a6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.Platform.Win32.DirectSound.None()'],['../class_brawl_lib_1_1_s_s_b_b_1_1_resource_nodes_1_1_f_c_f_g_node.html#a6b77aecd0b346062572d4fa67b579aa9a6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.SSBB.ResourceNodes.FCFGNode.None()'],['../class_brawl_lib_1_1_modeling_1_1_collada_1_1_collada.html#a3cb1e359a1066f4dd73d437e2419d181a6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.Modeling.Collada.Collada.None()'],['../class_brawl_lib_1_1_modeling_1_1_collada_1_1_collada.html#ab4079943a0aebe343e1acc03c31d3760ab50339a10e1de285ac99d4c3990b8693',1,'BrawlLib.Modeling.Collada.Collada.NONE()'],['../class_brawl_lib_1_1_s_s_b_b_1_1_resource_nodes_1_1_b_r_e_s_group_node.html#a883a106f4795baf12cd9fcefe6159f97a6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.SSBB.ResourceNodes.BRESGroupNode.None()'],['../class_brawl_lib_1_1_s_s_b_b_1_1_resource_nodes_1_1_project_plus_1_1_s_t_e_x_node.html#adf751eb676e80c333ad725bfe51780a3a6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.SSBB.ResourceNodes.ProjectPlus.STEXNode.None()'],['../struct_brawl_lib_1_1_s_s_b_b_1_1_types_1_1hk_array.html#a494602b83e4544da2e569da6753a5ecba6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.SSBB.Types.hkArray.None()'],['../struct_brawl_lib_1_1_s_s_b_b_1_1_types_1_1_post_field_info.html#a84dd88eb611f27e40ad8c9955b27bb59a6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.SSBB.Types.PostFieldInfo.None()'],['../class_brawl_lib_1_1_s_s_b_b_1_1_resource_nodes_1_1_project_plus_1_1_s_t_e_x_node.html#ab8fe59a579245e5c71e0fb0997a7115fa6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.SSBB.ResourceNodes.ProjectPlus.STEXNode.None()'],['../class_brawl_lib_1_1_s_s_b_b_1_1_resource_nodes_1_1_f_c_f_g_node.html#abfa6c21fc16fbbd6063afbeebb82b75aa6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.SSBB.ResourceNodes.FCFGNode.None()'],['../class_brawl_lib_1_1_s_s_b_b_1_1_resource_nodes_1_1_f_c_f_g_node.html#a61e195d82096092bc49f682eaa28a216a6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.SSBB.ResourceNodes.FCFGNode.None()'],['../struct_brawl_lib_1_1_s_s_b_b_1_1_types_1_1_lighting.html#a6c67615b4c4aa2b5ff3ff95414137b53a6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.SSBB.Types.Lighting.None()'],['../class_brawl_lib_1_1_s_s_b_b_1_1_resource_nodes_1_1_i_s_o_partition_node.html#a158553297727ed48f439f7b23f6a07e2a6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.SSBB.ResourceNodes.ISOPartitionNode.None()'],['../class_brawl_lib_1_1_s_s_b_b_1_1_resource_nodes_1_1_collision_object.html#a9d8bde16e409cdfacd73c50dff8e7204a6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.SSBB.ResourceNodes.CollisionObject.None()'],['../struct_brawl_lib_1_1_s_s_b_b_1_1_types_1_1_post_field_info.html#a45ef19b90e423680ee100b39e2cfa3a7a6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.SSBB.Types.PostFieldInfo.None()'],['../class_brawl_lib_1_1_platform_1_1_win32_1_1_direct_sound.html#ac0a91877723d646687e0a57d4a3eff86a6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.Platform.Win32.DirectSound.None()'],['../class_brawl_lib_1_1_modeling_1_1_collada_1_1_collada.html#aff0205d9f45e236c3fe2a153e8a0541aa6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.Modeling.Collada.Collada.None()'],['../class_brawl_lib_1_1_s_s_b_b_1_1_resource_nodes_1_1_r_s_a_r_sound_node.html#aba7abf470ef80a4a65f818f51b86d6b9a6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.SSBB.ResourceNodes.RSARSoundNode.None()'],['../class_brawl_lib_1_1_modeling_1_1_collada_1_1_collada.html#afe74d4fd6bac502bd9305c099771e12ba6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.Modeling.Collada.Collada.None()'],['../class_brawl_lib_1_1_s_s_b_b_1_1_resource_nodes_1_1_f_c_f_g_node.html#a5b3f67051f77c38629188da6ff91f19ea6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.SSBB.ResourceNodes.FCFGNode.None()'],['../class_brawl_lib_1_1_s_s_b_b_1_1_resource_nodes_1_1_f_c_f_g_node.html#a500db1364f2c0f69ca00a4c1eda86779a6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.SSBB.ResourceNodes.FCFGNode.None()'],['../class_brawl_lib_1_1_s_s_b_b_1_1_resource_nodes_1_1_f_c_f_g_node.html#a127f5843fa29dd8489b38de6745df8a3a6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.SSBB.ResourceNodes.FCFGNode.None()'],['../namespace_brawl_lib_1_1_s_s_b_b_1_1_types.html#a861939016d40ba3b04eec3b50af258cea6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.SSBB.Types.None()'],['../namespace_brawl_lib_1_1_s_s_b_b_1_1_types.html#a94b0e94b99343f56b3a2b16f58d6626ba6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.SSBB.Types.None()'],['../namespace_brawl_lib_1_1_internal_1_1_windows_1_1_controls_1_1_model_viewer_1_1_main_window_base.html#aa3cb14495590d3bfc26097c7d36ca3e4a6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.Internal.Windows.Controls.ModelViewer.MainWindowBase.None()'],['../namespace_brawl_lib_1_1_s_s_b_b_1_1_types_1_1_animations.html#a27c04f6f0b86076b80659db9dbeac138a6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.SSBB.Types.Animations.None()'],['../namespace_brawl_lib_1_1_wii_1_1_compression.html#a650883f83462880bfa587832ba342815a6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.Wii.Compression.None()'],['../namespace_brawl_lib_1_1_internal.html#aad47dc5d3712e8ed8eab131cedff7ccca6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.Internal.None()'],['../namespace_brawl_lib_1_1_s_s_b_b_1_1_types.html#a57606938d06f854a5a4a568f5d455e8da6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.SSBB.Types.None()'],['../namespace_brawl_lib_1_1_s_s_b_b_1_1_types.html#aeae291ea16f477d0772fae9eda06580aa6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.SSBB.Types.None()'],['../namespace_brawl_lib_1_1_s_s_b_b_1_1_resource_nodes.html#a54c4cebad8472f65094fc04fe22d0150a6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.SSBB.ResourceNodes.None()'],['../namespace_brawl_lib_1_1_s_s_b_b_1_1_types.html#a6b4c6b3ba61214bd24201b497faf490da6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.SSBB.Types.None()'],['../namespace_brawl_lib_1_1_s_s_b_b_1_1_types.html#ad67c779aff65645c06c1f3f964da1ebea6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.SSBB.Types.None()'],['../namespace_brawl_lib_1_1_internal_1_1_drawing_1_1_imaging.html#a1d8a53aa2a8c2b44a748fbb264d60a70a6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.Internal.Drawing.Imaging.None()'],['../namespace_brawl_lib_1_1_s_s_b_b_1_1_types.html#a250ca3408d30336c5103a7fd279be296a6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.SSBB.Types.None()'],['../namespace_brawl_lib_1_1_wii_1_1_graphics.html#ac6f9cc63c8a0a85a916ff1dbab085b1ea6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.Wii.Graphics.None()'],['../namespace_brawl_lib_1_1_s_s_b_b_1_1_types.html#aee48afce3162f75d9f96bd4acb5bd0f5a6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.SSBB.Types.None()'],['../namespace_brawl_lib_1_1_wii_1_1_models.html#a5b7df835f9135fb4052993d18c9ccaaca6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.Wii.Models.None()'],['../namespace_brawl_lib_1_1_s_s_b_b_1_1_types.html#a3739f396eb02106909e68eddaa34fdc6a6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.SSBB.Types.None()'],['../namespace_brawl_lib_1_1_s_s_b_b_1_1_resource_nodes.html#ab5f5e2cf756212b1902ffe32f383bbeba6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.SSBB.ResourceNodes.None()'],['../namespace_brawl_lib_1_1_wii_1_1_graphics.html#a312aa6cad349670693a273f2ca53cf42a6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.Wii.Graphics.None()'],['../namespace_brawl_lib_1_1_internal_1_1_windows_1_1_controls_1_1_model_viewer_1_1_main_window_base.html#a3e5999d6e42155c1b4b2d7324fcb7170a6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.Internal.Windows.Controls.ModelViewer.MainWindowBase.None()'],['../namespace_brawl_lib_1_1_internal_1_1_windows_1_1_controls_1_1_model_viewer_1_1_panels.html#a6d5b7585874e984d83c5cd31fb3c8ab8a6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.Internal.Windows.Controls.ModelViewer.Panels.None()'],['../namespace_brawl_lib_1_1_s_s_b_b_1_1_resource_nodes.html#a97716354bebe4ecb24b337f3693a0270a6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.SSBB.ResourceNodes.None()'],['../namespace_brawl_lib_1_1_wii_1_1_models.html#ad60abe1fb6bc18fceeeed8f7b1567e75a6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.Wii.Models.None()'],['../namespace_brawl_lib_1_1_s_s_b_b_1_1_types.html#a8ef3098b2d78b40c06ecc372fca00ba0a6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.SSBB.Types.None()'],['../namespace_brawl_lib_1_1_wii_1_1_graphics.html#a96537ab6e16fc4e3f9286d7e2f07b652a6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.Wii.Graphics.None()'],['../namespace_brawl_lib_1_1_imaging.html#a2bc45223fae4eb191d42b9b0b47d7b6ba6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.Imaging.None()'],['../namespace_brawl_lib_1_1_internal_1_1_windows_1_1_controls_1_1_model_viewer_1_1_main_window_base.html#ac7cbf8caf9f94017699671b5e23d74eea6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.Internal.Windows.Controls.ModelViewer.MainWindowBase.None()'],['../namespace_brawl_lib_1_1_internal.html#ac2516ff5ea868140730c54036525888aa6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.Internal.None()'],['../namespace_brawl_lib_1_1_s_s_b_b_1_1_types.html#aa1704689002f0063ef50530b295d7f76a6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.SSBB.Types.None()'],['../namespace_brawl_lib_1_1_s_s_b_b_1_1_types.html#a614615e1eda07c39af881834c54e9c40a6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.SSBB.Types.None()'],['../namespace_brawl_lib_1_1_wii_1_1_graphics.html#a035d42370d6d3d1b47a255b9297a535aa6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.Wii.Graphics.None()'],['../namespace_brawl_lib_1_1_wii_1_1_graphics.html#a3af845e6adb2464a52b7588fad75e879a6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.Wii.Graphics.None()'],['../namespace_brawl_lib_1_1_s_s_b_b_1_1_types.html#af1e007dacde9d6ff43dcbeb6e85133cba6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.SSBB.Types.None()'],['../namespace_brawl_lib_1_1_s_s_b_b_1_1_types.html#af5a1b4c3c89bdc68715acc694194a838a6adf97f83acf6453d4a6a4b1070f3754',1,'BrawlLib.SSBB.Types.None()']]], ['noninterlaced_32569',['NonInterlaced',['../struct_brawl_lib_1_1_s_s_b_b_1_1_types_1_1_t_h_p_video_info.html#acb98ee0eb380751af8747726d0c424d9a379c1d082a0888f90eef16a8add53810',1,'BrawlLib::SSBB::Types::THPVideoInfo']]], ['nooperation_32570',['NoOperation',['../namespace_brawl_lib_1_1_wii_1_1_graphics.html#ac1e90eb61ce98e140d55c32504332494a621666d91ebf4ce8af89ffdfdbdc7f44',1,'BrawlLib::Wii::Graphics']]], ['noouttransition_32571',['NoOutTransition',['../namespace_brawl_lib_1_1_s_s_b_b_1_1_types.html#af1e007dacde9d6ff43dcbeb6e85133cbaa1bda776e8cdff1c035f9ecb1388f23f',1,'BrawlLib::SSBB::Types']]], ['nop_32572',['NOP',['../namespace_brawl_lib_1_1_wii_1_1_graphics.html#afda46c1fd4a6aa155ca3e1f5bfc4f8fca1a004f5abe2b334db21328be1ea6b593',1,'BrawlLib.Wii.Graphics.NOP()'],['../namespace_brawl_lib_1_1_s_s_b_b_1_1_types.html#abbe5ca57eaa693da2aa4d75fd78fe2b9ab7e7f2b46723f5b08d763041108f8fed',1,'BrawlLib.SSBB.Types.Nop()'],['../namespace_brawl_lib_1_1_s_s_b_b_1_1_resource_nodes.html#a5034d410bfd57401bd5b555b7c9b2a8dab7e7f2b46723f5b08d763041108f8fed',1,'BrawlLib.SSBB.ResourceNodes.Nop()']]], ['noprocessing_32573',['NoProcessing',['../namespace_brawl_lib_1_1_s_s_b_b_1_1_types.html#a2cec183def8371318e642a0d56aabffcafeb185a61ab8e46ea145ee6bd3217d06',1,'BrawlLib::SSBB::Types']]], ['normal_32574',['Normal',['../class_brawl_lib_1_1_s_s_b_b_1_1_resource_nodes_1_1_event_match_fighter_node.html#ac13fccf817b4839df45ca2d5a8e8fc31a960b44c579bc2f6818d2daaf9e4c16f0',1,'BrawlLib.SSBB.ResourceNodes.EventMatchFighterNode.Normal()'],['../class_brawl_lib_1_1_s_s_b_b_1_1_resource_nodes_1_1_classic_fighter_node.html#aade6c2ed380e28724bb4331531443914a960b44c579bc2f6818d2daaf9e4c16f0',1,'BrawlLib.SSBB.ResourceNodes.ClassicFighterNode.Normal()'],['../class_brawl_lib_1_1_s_s_b_b_1_1_resource_nodes_1_1_project_plus_1_1_s_t_e_x_node.html#adf751eb676e80c333ad725bfe51780a3a960b44c579bc2f6818d2daaf9e4c16f0',1,'BrawlLib.SSBB.ResourceNodes.ProjectPlus.STEXNode.Normal()'],['../class_brawl_lib_1_1_modeling_1_1_collada_1_1_collada.html#aff0205d9f45e236c3fe2a153e8a0541aa1e23852820b9154316c7c06e2b7ba051',1,'BrawlLib.Modeling.Collada.Collada.NORMAL()'],['../class_brawl_lib_1_1_platform_1_1_win32_1_1_direct_sound.html#a7586af691e8d4049738940397ea33753a960b44c579bc2f6818d2daaf9e4c16f0',1,'BrawlLib.Platform.Win32.DirectSound.Normal()'],['../namespace_brawl_lib_1_1_s_s_b_b_1_1_types.html#a3a1585cb0b55e48ba8cd168818710df8a960b44c579bc2f6818d2daaf9e4c16f0',1,'BrawlLib.SSBB.Types.Normal()'],['../namespace_brawl_lib_1_1_internal.html#aad47dc5d3712e8ed8eab131cedff7ccca960b44c579bc2f6818d2daaf9e4c16f0',1,'BrawlLib.Internal.Normal()'],['../namespace_brawl_lib_1_1_s_s_b_b_1_1_types.html#ae26875bce89a02d25d4f594bcaf11a67a960b44c579bc2f6818d2daaf9e4c16f0',1,'BrawlLib.SSBB.Types.Normal()'],['../namespace_brawl_lib_1_1_wii_1_1_models.html#ad60abe1fb6bc18fceeeed8f7b1567e75a960b44c579bc2f6818d2daaf9e4c16f0',1,'BrawlLib.Wii.Models.Normal()'],['../namespace_brawl_lib_1_1_s_s_b_b_1_1_types.html#affd97e4da2c003abbad6685119902e47a960b44c579bc2f6818d2daaf9e4c16f0',1,'BrawlLib.SSBB.Types.Normal()'],['../namespace_brawl_lib_1_1_wii_1_1_graphics.html#a9e8d15413edd7e808cdce256f53d24c3a960b44c579bc2f6818d2daaf9e4c16f0',1,'BrawlLib.Wii.Graphics.Normal()'],['../namespace_brawl_lib_1_1_s_s_b_b_1_1_types.html#a9d6933987232359e6ee0628a7d45dd41a960b44c579bc2f6818d2daaf9e4c16f0',1,'BrawlLib.SSBB.Types.Normal()']]], ['normalairjump_32575',['NormalAirJump',['../class_brawl_lib_1_1_s_s_b_b_1_1_resource_nodes_1_1_f_c_f_g_node.html#a6b77aecd0b346062572d4fa67b579aa9a5f486d683ee29a6e0393337d4f9a94ff',1,'BrawlLib::SSBB::ResourceNodes::FCFGNode']]], ['normalizedbumpalpha_32576',['NormalizedBumpAlpha',['../namespace_brawl_lib_1_1_wii_1_1_graphics.html#a24b937c050766d054f07778602365f04a4d68f4e35972f7ba67b3155d9fa1c5e7',1,'BrawlLib::Wii::Graphics']]], ['normalmap_32577',['NormalMap',['../class_brawl_lib_1_1_s_s_b_b_1_1_resource_nodes_1_1_m_d_l0_material_node.html#a72c6d1b22d181b91e16a367d91adf3b7a6b9d0d690dd35849b77d2c234ce90d90',1,'BrawlLib::SSBB::ResourceNodes::MDL0MaterialNode']]], ['normalmapspecular_32578',['NormalMapSpecular',['../class_brawl_lib_1_1_s_s_b_b_1_1_resource_nodes_1_1_m_d_l0_material_node.html#a72c6d1b22d181b91e16a367d91adf3b7a4765d38ea48cebb0b8fee8a68ae5b72b',1,'BrawlLib::SSBB::ResourceNodes::MDL0MaterialNode']]], ['normalnoroll_32579',['NormalNoRoll',['../namespace_brawl_lib_1_1_s_s_b_b_1_1_types.html#affd97e4da2c003abbad6685119902e47adfed5ebe247475d5bba35ff20c8a9cc5',1,'BrawlLib::SSBB::Types']]], ['normals_32580',['Normals',['../namespace_brawl_lib_1_1_wii_1_1_models.html#a0a6bfaac1bc782504be7d79af8fa6d0ba4ab971a51f0335cbf8d9c2c65d379e99',1,'BrawlLib.Wii.Models.Normals()'],['../namespace_brawl_lib_1_1_wii_1_1_graphics.html#abc11fd2a159d97e58a0e34564e51a553a4ab971a51f0335cbf8d9c2c65d379e99',1,'BrawlLib.Wii.Graphics.Normals()']]], ['normtx_32581',['NorMtx',['../namespace_brawl_lib_1_1_wii_1_1_models.html#ab175ebe1c9a8c2871641e5f706bacbedae101ff73f29b7cb8762eb71c019f3ceb',1,'BrawlLib::Wii::Models']]], ['not_5fowned_32582',['NOT_OWNED',['../struct_brawl_lib_1_1_s_s_b_b_1_1_types_1_1hk_class_member.html#a431cec4e3245fcf62b886e2ed08222eeaeac8dab356093f6ef126de559f11da79',1,'BrawlLib::SSBB::Types::hkClassMember']]], ['notand_32583',['NotAnd',['../namespace_brawl_lib_1_1_wii_1_1_graphics.html#ac1e90eb61ce98e140d55c32504332494a6d48c9b6392d76562f288772a4338eb2',1,'BrawlLib::Wii::Graphics']]], ['notequal_32584',['NotEqual',['../namespace_brawl_lib_1_1_wii_1_1_graphics.html#a2e385e0f8ac242b5d179c1ee0effee5ca19bb0af2c3c530538cb41aff7f235b96',1,'BrawlLib.Wii.Graphics.NotEqual()'],['../namespace_brawl_lib_1_1_wii_1_1_graphics.html#afadec15fb0526a987decd19f294dce6ea19bb0af2c3c530538cb41aff7f235b96',1,'BrawlLib.Wii.Graphics.NotEqual()']]], ['notor_32585',['NotOr',['../namespace_brawl_lib_1_1_wii_1_1_graphics.html#ac1e90eb61ce98e140d55c32504332494a7c06c8aa73b2be287aafb805e88a98cd',1,'BrawlLib::Wii::Graphics']]], ['notpan_32586',['NotPan',['../class_brawl_lib_1_1_s_s_b_b_1_1_resource_nodes_1_1_r_s_a_r_sound_node.html#ad4113a62a6241c081637ce3de96e6b9ba90877437d74f35d61fcf2fa5085dcf29',1,'BrawlLib::SSBB::ResourceNodes::RSARSoundNode']]], ['notpriority_32587',['NotPriority',['../class_brawl_lib_1_1_s_s_b_b_1_1_resource_nodes_1_1_r_s_a_r_sound_node.html#ad4113a62a6241c081637ce3de96e6b9ba8769012a126bfebf082c988bfd95ae2d',1,'BrawlLib::SSBB::ResourceNodes::RSARSoundNode']]], ['notransform_32588',['NoTransform',['../namespace_brawl_lib_1_1_s_s_b_b_1_1_types.html#a250ca3408d30336c5103a7fd279be296ac8c9fe0abed7ae3bab93a24ac8ac1e97',1,'BrawlLib::SSBB::Types']]], ['notsurroundpan_32589',['NotSurroundPan',['../class_brawl_lib_1_1_s_s_b_b_1_1_resource_nodes_1_1_r_s_a_r_sound_node.html#ad4113a62a6241c081637ce3de96e6b9ba9161908657001dd0c9dd21e7bfd36759',1,'BrawlLib::SSBB::ResourceNodes::RSARSoundNode']]], ['notvolume_32590',['NotVolume',['../class_brawl_lib_1_1_s_s_b_b_1_1_resource_nodes_1_1_r_s_a_r_sound_node.html#ad4113a62a6241c081637ce3de96e6b9ba273d447a8f50b1632797622e49be27ee',1,'BrawlLib::SSBB::ResourceNodes::RSARSoundNode']]], ['nowalljump_32591',['NoWalljump',['../namespace_brawl_lib_1_1_s_s_b_b_1_1_types.html#a8ef3098b2d78b40c06ecc372fca00ba0a708da212d3e91728d3f39ac3e0b719b3',1,'BrawlLib::SSBB::Types']]], ['nowrap_32592',['NoWrap',['../namespace_brawl_lib_1_1_wii_1_1_graphics.html#a94babd8bae22049c4fbf8558f709f287a93ac740a98eb4cc45b853c780ed16c44',1,'BrawlLib::Wii::Graphics']]], ['nrmmtxarray_32593',['NrmMtxArray',['../namespace_brawl_lib_1_1_wii_1_1_graphics.html#a9e8d15413edd7e808cdce256f53d24c3a2a07ba3a9b493233fd49e04f8f57ff83',1,'BrawlLib::Wii::Graphics']]], ['nrmnbt_32594',['NrmNBT',['../namespace_brawl_lib_1_1_wii_1_1_graphics.html#a3c79c410422ef03a6509d3b7e23d2062a6bb8a09d103ef5dfeaeed6f8b0699a56',1,'BrawlLib::Wii::Graphics']]], ['nrmnbt3_32595',['NrmNBT3',['../namespace_brawl_lib_1_1_wii_1_1_graphics.html#a3c79c410422ef03a6509d3b7e23d2062abd5f23f361c9fb579bb4a463f831b405',1,'BrawlLib::Wii::Graphics']]], ['nrmxyz_32596',['NrmXYZ',['../namespace_brawl_lib_1_1_wii_1_1_graphics.html#a3c79c410422ef03a6509d3b7e23d2062a7a5f7dbc6439321e24934befbcddc476',1,'BrawlLib::Wii::Graphics']]], ['null_32597',['Null',['../struct_brawl_lib_1_1_s_s_b_b_1_1_types_1_1_color_input.html#a9dd27dfecee717aacce79b875cd60621abbb93ef26e3c101ff11cdd21cab08a94',1,'BrawlLib.SSBB.Types.ColorInput.Null()'],['../struct_brawl_lib_1_1_s_s_b_b_1_1_types_1_1_color_input.html#af541af917b3d0bb5aceb3190688223e6abbb93ef26e3c101ff11cdd21cab08a94',1,'BrawlLib.SSBB.Types.ColorInput.Null()'],['../namespace_brawl_lib_1_1_s_s_b_b_1_1_resource_nodes.html#a1ea6574d2fe9d2789519b485b064b732abbb93ef26e3c101ff11cdd21cab08a94',1,'BrawlLib.SSBB.ResourceNodes.Null()'],['../namespace_brawl_lib_1_1_wii_1_1_graphics.html#a9e8d15413edd7e808cdce256f53d24c3abbb93ef26e3c101ff11cdd21cab08a94',1,'BrawlLib.Wii.Graphics.Null()'],['../namespace_brawl_lib_1_1_s_s_b_b_1_1_resource_nodes.html#a8c18b53425c4a4bec5191cd32b3db5d9abbb93ef26e3c101ff11cdd21cab08a94',1,'BrawlLib.SSBB.ResourceNodes.Null()']]], ['numberoflinesdef_32598',['NumberOfLinesDef',['../namespace_brawl_lib_1_1_s_s_b_b_1_1_resource_nodes.html#add592c198a54493ad0659bc44f0de0cba20ec96aa3d5bb43b1e1f5081ad408b7f',1,'BrawlLib::SSBB::ResourceNodes']]] ];
define([ 'underscore', 'utils', 'settings', 'eventMgr', 'fileMgr', 'editor', 'diff_match_patch_uncompressed', 'jsondiffpatch' ], function(_, utils, settings, eventMgr, fileMgr, editor, diff_match_patch, jsondiffpatch) { function Provider(providerId, providerName) { this.providerId = providerId; this.providerName = providerName; this.isPublishEnabled = true; } // Parse and check a JSON discussion list Provider.prototype.parseDiscussionList = function(discussionListJSON) { try { var discussionList = JSON.parse(discussionListJSON); _.each(discussionList, function(discussion, discussionIndex) { if( (discussion.discussionIndex != discussionIndex) || (!_.isNumber(discussion.selectionStart)) || (!_.isNumber(discussion.selectionEnd)) ) { throw 'invalid'; } discussion.commentList && discussion.commentList.forEach(function(comment) { if( (!(!comment.author || _.isString(comment.author))) || (!_.isString(comment.content)) ) { throw 'invalid'; } }); }); return discussionList; } catch(e) { } }; Provider.prototype.serializeContent = function(content, discussionList) { if(discussionList.length > 2) { // Serialized JSON return content + '<!--se_discussion_list:' + discussionList + '-->'; } return content; }; Provider.prototype.parseContent = function(content) { var discussionList; var discussionListJSON = '{}'; var discussionExtractor = /<!--se_discussion_list:([\s\S]+)-->$/.exec(content); if(discussionExtractor && (discussionList = this.parseDiscussionList(discussionExtractor[1]))) { content = content.substring(0, discussionExtractor.index); discussionListJSON = discussionExtractor[1]; } return { content: content, discussionList: discussionList || {}, discussionListJSON: discussionListJSON }; }; var diffMatchPatch = new diff_match_patch(); diffMatchPatch.Match_Threshold = 0; diffMatchPatch.Patch_DeleteThreshold = 0; var jsonDiffPatch = jsondiffpatch.create({ objectHash: function(obj) { return JSON.stringify(obj); }, textDiff: { minLength: 9999999 } }); var merge = settings.conflictMode == 'merge'; Provider.prototype.syncMerge = function(fileDesc, syncAttributes, remoteContent, remoteTitle, remoteDiscussionList, remoteDiscussionListJSON) { function cleanupDiffs(diffs) { var result = []; var removeDiff = [-1, '']; var addDiff = [1, '']; var distance = 20; function pushDiff() { if(!removeDiff[1] && !addDiff[1]) { return; } if(!removeDiff[1] || !addDiff[1]) { result.push([0, removeDiff[1] + addDiff[1]]); } else { removeDiff[1] = '⧸⧸' + removeDiff[1] + '⧸⧸'; addDiff[1] += '⧸⧸'; result.push(removeDiff); result.push(addDiff); } removeDiff = [-1, '']; addDiff = [1, '']; } diffs.forEach(function(diff, index) { function firstOrLast() { return index === 0 || index === diffs.length - 1; } var diffType = diff[0]; var diffText = diff[1]; if(diffType === 0) { if(firstOrLast() || diffText.length > distance) { if(removeDiff[1] || addDiff[1]) { var match = /\s/.exec(diffText); if(match) { var prefixOffset = match.index; var prefix = diffText.substring(0, prefixOffset); diffText = diffText.substring(prefixOffset); removeDiff[1] += prefix; addDiff[1] += prefix; } } if(diffText) { var suffixOffset = diffText.length; while(suffixOffset && /\S/.test(diffText[suffixOffset - 1])) { suffixOffset--; } var suffix = diffText.substring(suffixOffset); diffText = diffText.substring(0, suffixOffset); if(firstOrLast() || diffText.length > distance) { pushDiff(); result.push([0, diffText]); } else { removeDiff[1] += diffText; addDiff[1] += diffText; } removeDiff[1] += suffix; addDiff[1] += suffix; } } else { removeDiff[1] += diffText; addDiff[1] += diffText; } } else if(diffType === -1) { removeDiff[1] += diffText; } else if(diffType === 1) { addDiff[1] += diffText; } }); if(removeDiff[1] == addDiff[1]) { result.push([0, addDiff[1]]); } else { pushDiff(); } return result; } var localContent = fileDesc.content; var localTitle = fileDesc.title; var localDiscussionListJSON = fileDesc.discussionListJSON; var localDiscussionList = fileDesc.discussionList; // Local/Remote CRCs var localContentCRC = utils.crc32(localContent); var localTitleCRC = utils.crc32(localTitle); var localDiscussionListCRC = utils.crc32(localDiscussionListJSON); var remoteContentCRC = utils.crc32(remoteContent); var remoteTitleCRC = utils.crc32(remoteTitle); var remoteDiscussionListCRC = utils.crc32(remoteDiscussionListJSON); // Check content var localContentChanged = syncAttributes.contentCRC != localContentCRC; var remoteContentChanged = syncAttributes.contentCRC != remoteContentCRC; var contentChanged = localContent != remoteContent && remoteContentChanged; var contentConflict = contentChanged && localContentChanged; // Check title syncAttributes.titleCRC = syncAttributes.titleCRC || localTitleCRC; // Not synchronized with Dropbox var localTitleChanged = syncAttributes.titleCRC != localTitleCRC; var remoteTitleChanged = syncAttributes.titleCRC != remoteTitleCRC; var titleChanged = localTitle != remoteTitle && remoteTitleChanged; var titleConflict = titleChanged && localTitleChanged; // Check discussionList var localDiscussionListChanged = syncAttributes.discussionListCRC != localDiscussionListCRC; var remoteDiscussionListChanged = syncAttributes.discussionListCRC != remoteDiscussionListCRC; var discussionListChanged = localDiscussionListJSON != remoteDiscussionListJSON && remoteDiscussionListChanged; var discussionListConflict = discussionListChanged && localDiscussionListChanged; var conflictList = []; var newContent = remoteContent; var newTitle = remoteTitle; var newDiscussionList = remoteDiscussionList; var adjustLocalDiscussionList = false; var adjustRemoteDiscussionList = false; var mergeDiscussionList = false; var diffs, patch; if( (!merge && (contentConflict || titleConflict || discussionListConflict)) || (contentConflict && syncAttributes.content === undefined) || (titleConflict && syncAttributes.title === undefined) || (discussionListConflict && syncAttributes.discussionList === undefined) ) { fileMgr.createFile(localTitle + " (backup)", localContent, localDiscussionListJSON); eventMgr.onMessage('Conflict detected on "' + localTitle + '". A backup has been created locally.'); } else { if(contentConflict) { // Patch content var oldContent = syncAttributes.content; diffs = diffMatchPatch.diff_main(oldContent, localContent); diffMatchPatch.diff_cleanupSemantic(diffs); patch = diffMatchPatch.patch_make(oldContent, diffs); var patchResult = diffMatchPatch.patch_apply(patch, remoteContent); newContent = patchResult[0]; if(!patchResult[1].every(_.identity)) { // Remaining conflicts diffs = diffMatchPatch.diff_main(localContent, newContent); diffs = cleanupDiffs(diffs); newContent = ''; var conflict; diffs.forEach(function(diff) { var diffType = diff[0]; var diffText = diff[1]; if(diffType !== 0 && !conflict) { conflict = { selectionStart: newContent.length, type: 'conflict' }; } else if(diffType === 0 && conflict) { conflict.selectionEnd = newContent.length; conflictList.push(conflict); conflict = undefined; } newContent += diffText; }); if(conflict) { conflict.selectionEnd = newContent.length; conflictList.push(conflict); } } } if(contentChanged) { if(localDiscussionListChanged) { adjustLocalDiscussionList = true; } if(remoteDiscussionListChanged) { adjustRemoteDiscussionList = true; } else { adjustLocalDiscussionList = true; newDiscussionList = localDiscussionList; } } if(discussionListConflict) { mergeDiscussionList = true; } if(titleConflict) { // Patch title patch = diffMatchPatch.patch_make(syncAttributes.title, localTitle); newTitle = diffMatchPatch.patch_apply(patch, remoteTitle)[0]; } } // Adjust local discussions offsets var editorSelection; if(contentChanged) { var localDiscussionArray = []; // Adjust editor's cursor position and local discussions at the same time if(fileMgr.currentFile === fileDesc) { editorSelection = { selectionStart: editor.selectionMgr.selectionStart, selectionEnd: editor.selectionMgr.selectionEnd }; localDiscussionArray.push(editorSelection); fileDesc.newDiscussion && localDiscussionArray.push(fileDesc.newDiscussion); } if(adjustLocalDiscussionList) { localDiscussionArray = localDiscussionArray.concat(_.values(localDiscussionList)); } discussionListChanged |= editor.adjustCommentOffsets(localContent, newContent, localDiscussionArray); } // Adjust remote discussions offsets if(adjustRemoteDiscussionList) { var remoteDiscussionArray = _.values(remoteDiscussionList); editor.adjustCommentOffsets(remoteContent, newContent, remoteDiscussionArray); } // Patch remote discussionList with local modifications if(mergeDiscussionList) { var oldDiscussionList = JSON.parse(syncAttributes.discussionList); diffs = jsonDiffPatch.diff(oldDiscussionList, localDiscussionList); jsonDiffPatch.patch(remoteDiscussionList, diffs); _.each(remoteDiscussionList, function(discussion, discussionIndex) { if(!discussion) { delete remoteDiscussionList[discussionIndex]; } }); } if(conflictList.length) { discussionListChanged = true; // Add conflicts to discussionList conflictList.forEach(function(conflict) { // Create discussion index var discussionIndex; do { discussionIndex = utils.randomString() + utils.randomString(); // Increased size to prevent collision } while(_.has(newDiscussionList, discussionIndex)); conflict.discussionIndex = discussionIndex; newDiscussionList[discussionIndex] = conflict; }); } if(titleChanged) { fileDesc.title = newTitle; eventMgr.onTitleChanged(fileDesc); eventMgr.onMessage('"' + localTitle + '" has been renamed to "' + newTitle + '" on ' + this.providerName + '.'); } if(contentChanged || discussionListChanged) { editor.watcher.noWatch(_.bind(function() { if(contentChanged) { if(fileMgr.currentFile === fileDesc) { editor.setValueNoWatch(newContent); editorSelection && editor.selectionMgr.setSelectionStartEnd( editorSelection.selectionStart, editorSelection.selectionEnd ); } fileDesc.content = newContent; eventMgr.onContentChanged(fileDesc, newContent); } if(discussionListChanged) { fileDesc.discussionList = newDiscussionList; var diff = jsonDiffPatch.diff(localDiscussionList, newDiscussionList); var commentsChanged = false; _.each(diff, function(discussionDiff, discussionIndex) { if(!_.isArray(discussionDiff)) { commentsChanged = true; } else if(discussionDiff.length === 1) { eventMgr.onDiscussionCreated(fileDesc, newDiscussionList[discussionIndex]); } else { eventMgr.onDiscussionRemoved(fileDesc, localDiscussionList[discussionIndex]); } }); commentsChanged && eventMgr.onCommentsChanged(fileDesc); } editor.undoMgr.currentMode = 'sync'; editor.undoMgr.saveState(); eventMgr.onMessage('"' + remoteTitle + '" has been updated from ' + this.providerName + '.'); if(conflictList.length) { eventMgr.onMessage('"' + remoteTitle + '" has conflicts that you have to review.'); } }, this)); } // Return remote CRCs return { contentCRC: remoteContentCRC, titleCRC: remoteTitleCRC, discussionListCRC: remoteDiscussionListCRC }; }; return Provider; });
// This is a manifest file that'll be compiled into application.js, which will include all the files // listed below. // // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, or any plugin's // vendor/assets/javascripts directory can be referenced here using a relative path. // // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the // compiled file. JavaScript code in this file should be added after the last require_* statement. // // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details // about supported directives. // //= require rails-ujs //= require turbolinks //= require_tree . document.addEventListener('turbolinks:load', function () { const mobileMenuButton = document.querySelector('.mobile-menu-button'); const menu = document.querySelector('.mobile-menu'); if (mobileMenuButton) { [...menu.querySelectorAll('a')].forEach(function(link) { link.addEventListener('click', function() { menu.classList.remove('mobile-menu--active'); }); }); mobileMenuButton.addEventListener('click', function() { menu.classList.toggle('mobile-menu--active'); }); } });
webpackHotUpdate(0,{ /***/ "./src/components/user.js": /*!********************************!*\ !*** ./src/components/user.js ***! \********************************/ /*! exports provided: default */ /*! exports used: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_react___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_react__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_jquery__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_jquery___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_jquery__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_react_bootstrap__ = __webpack_require__(/*! react-bootstrap */ "./node_modules/react-bootstrap/es/index.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__img_registerpage_png__ = __webpack_require__(/*! ../img/registerpage.png */ "./src/img/registerpage.png"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__img_registerpage_png___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3__img_registerpage_png__); var _jsxFileName = 'C:\\sandbox\\repos\\personalprojectYP\\personalproject\\personal_projectsYP.Web\\App\\src\\components\\user.js'; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var User = function (_Component) { _inherits(User, _Component); function User(props, context) { _classCallCheck(this, User); var _this = _possibleConstructorReturn(this, (User.__proto__ || Object.getPrototypeOf(User)).call(this, props, context)); _this.state = { accountId: '', meal: '', quantity: '', editMode: false, resultMode: false, mealId: '', user: [], userMeal: [], singleMeal: [] }; _this.handleChange = _this.handleChange.bind(_this); _this.submit = _this.submit.bind(_this); _this.edit = _this.edit.bind(_this); _this.delete = _this.delete.bind(_this); _this.submitChange = _this.submitChange.bind(_this); _this.getCalculate = _this.getCalculate.bind(_this); return _this; } _createClass(User, [{ key: 'componentDidMount', value: function componentDidMount() { var _this2 = this; var cookie = document.cookie; if (cookie === null) { window.location.href = "http://localhost:57432/login"; } else { var accountId = cookie.split("=")[1]; this.setState({ accountId: accountId }, function () { return _this2.getByAccountId(); }); } } }, { key: 'getByAccountId', value: function getByAccountId() { var accountId = this.state.accountId; fetch("/api/user/" + accountId, { method: 'GET', headers: { 'Content-Type': 'application/json' }, credentials: 'include' }).then(function (resp) { return resp.json(); }).then(function (data) { var _this3 = this; var item = [data.Item]; this.setState({ user: item }, function () { return _this3.getUserMeal(); }); }.bind(this)); } }, { key: 'getUserMeal', value: function getUserMeal() { var accountId = this.state.accountId; fetch("/api/user/todaymeal/" + accountId, { method: 'GET', headers: { 'Content-Type': 'application/json' }, credentials: 'include' }).then(function (resp) { return resp.json(); }).then(function (data) { var item = data.Items; for (var i = 0; i < item.length; i++) { item[i].CreatedDateOnly = item[i].CreatedDate.split("T")[0]; } this.setState({ userMeal: item }); }.bind(this)); } }, { key: 'handleChange', value: function handleChange(event) { var target = event.target; var value = target.value; var name = target.name; this.setState(_defineProperty({}, name, value)); } }, { key: 'edit', value: function edit(id) { fetch("/api/user/singlemeal/" + id, { method: 'GET', headers: { 'Content-Type': 'application/json' }, credentials: 'include' }).then(function (resp) { return resp.json(); }).then(function (data) { var item = data.Item; this.setState({ accountId: item.AccountId, meal: item.Meal, mealId: item.Id, quantity: item.Quantity, editMode: true }); }.bind(this)); } }, { key: 'submitChange', value: function submitChange() { var Id = this.state.mealId; fetch("/api/user/update/" + Id, { method: 'PUT', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ Id: Id, AccountId: this.state.accountId, Meal: this.state.meal, Quantity: this.state.quantity }), credentials: 'include' }).then(function (response) { var _this4 = this; this.setState({ meal: '', quantity: '', editMode: false }, function () { return _this4.getUserMeal(); }); }.bind(this)); } }, { key: 'delete', value: function _delete(id) { fetch("/api/user/delete/" + id, { method: 'delete' }).then(function (response) { var _this5 = this; this.setState({ editModel: false }, function () { return _this5.getUserMeal(); }); }.bind(this)); } }, { key: 'submit', value: function submit(event) { event.preventDefault(); fetch("/api/user/meal", { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ AccountId: this.state.accountId, Meal: this.state.meal, Quantity: this.state.quantity }), credentials: 'include' }).then(function (response) { var _this6 = this; this.setState({ meal: '', quantity: '' }, function () { return _this6.getUserMeal(); }); }.bind(this)); } }, { key: 'getCalculate', value: function getCalculate() { var userMeal = this.state.userMeal; for (var i = 0; i < userMeal.length; i++) { fetch("https://api.nal.usda.gov/ndb/search/?format=json&q=" + userMeal[i].Meal + "&sort=n&max=25&offset=0&api_key=iePhBf4DTI9UStixHQvpqeNZnlICZEKRITy2HpQV", { method: 'GET', headers: { 'Content-Type': 'application/json' } }).then(function (resp) { return resp.json(); }).then(function (data) { if (data.errors == undefined) { console.log(data.list); } }); } } }, { key: 'render', value: function render() { var _this7 = this; return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( 'div', { __source: { fileName: _jsxFileName, lineNumber: 170 }, __self: this }, __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( 'div', { className: 'row', __source: { fileName: _jsxFileName, lineNumber: 171 }, __self: this }, __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( 'div', { className: 'col-md-4 m-t-sm m-l-md', __source: { fileName: _jsxFileName, lineNumber: 172 }, __self: this }, __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( 'div', { className: 'card askForm', __source: { fileName: _jsxFileName, lineNumber: 173 }, __self: this }, __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('img', { className: 'card-img-top img-responsive m-b-sm', src: __WEBPACK_IMPORTED_MODULE_3__img_registerpage_png___default.a, __source: { fileName: _jsxFileName, lineNumber: 174 }, __self: this }), __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( 'div', { className: 'card-body', __source: { fileName: _jsxFileName, lineNumber: 175 }, __self: this }, __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( 'form', { className: 'form-group', onSubmit: this.submit, __source: { fileName: _jsxFileName, lineNumber: 176 }, __self: this }, __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( 'label', { __source: { fileName: _jsxFileName, lineNumber: 177 }, __self: this }, 'What have you eat today?' ), __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('input', { type: 'text', onChange: this.handleChange, className: 'form-control m-b-sm', name: 'meal', value: this.state.meal, __source: { fileName: _jsxFileName, lineNumber: 178 }, __self: this }), __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( 'label', { __source: { fileName: _jsxFileName, lineNumber: 179 }, __self: this }, 'Quantity' ), __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('input', { type: 'number', onChange: this.handleChange, className: 'form-control m-b-sm', name: 'quantity', value: this.state.quantity, __source: { fileName: _jsxFileName, lineNumber: 180 }, __self: this }), this.state.editMode === true ? __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( 'div', { __source: { fileName: _jsxFileName, lineNumber: 182 }, __self: this }, __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( 'button', { type: 'button', onClick: this.submitChange, className: 'btn btn-secondary btn-lg btn-block m-t-md', __source: { fileName: _jsxFileName, lineNumber: 183 }, __self: this }, 'Edit' ) ) : __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( 'button', { type: 'submit', className: 'btn btn-primary btn-lg btn-block m-t-md', __source: { fileName: _jsxFileName, lineNumber: 186 }, __self: this }, 'Submit' ) ) ) ) ), this.state.user.map(function (user) { return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( 'div', { className: 'col-md-4 m-t-sm', key: user.Id, __source: { fileName: _jsxFileName, lineNumber: 193 }, __self: _this7 }, __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( 'div', { className: 'card mealList', __source: { fileName: _jsxFileName, lineNumber: 194 }, __self: _this7 }, __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( 'div', { className: 'card-header bg-dark text-white', __source: { fileName: _jsxFileName, lineNumber: 195 }, __self: _this7 }, 'Today, ', user.FirstName, ' ', user.LastName, ' Ate ...' ), __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( 'div', { className: 'card-body', __source: { fileName: _jsxFileName, lineNumber: 198 }, __self: _this7 }, _this7.state.userMeal.map(function (userMeal) { return __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( 'div', { key: userMeal.Id, __source: { fileName: _jsxFileName, lineNumber: 200 }, __self: _this7 }, __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( 'div', { className: 'row', __source: { fileName: _jsxFileName, lineNumber: 201 }, __self: _this7 }, __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( 'button', { type: 'button', onClick: function onClick() { return _this7.edit(userMeal.Id); }, className: 'btn btn-outline-secondary m-l-sm m-b-xs', __source: { fileName: _jsxFileName, lineNumber: 202 }, __self: _this7 }, userMeal.Meal, ' x ', userMeal.Quantity ), __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('i', { className: 'fa fa-close m-l-xs', onClick: function onClick() { return _this7.delete(userMeal.Id); }, __source: { fileName: _jsxFileName, lineNumber: 207 }, __self: _this7 }) ) ); }), __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( 'button', { type: 'button', className: 'btn btn-primary m-t-md', onClick: _this7.getCalculate, __source: { fileName: _jsxFileName, lineNumber: 211 }, __self: _this7 }, 'Calculate' ) ) ), _this7.state.resultMode === true ? __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( 'div', { className: 'result m-t-sm', __source: { fileName: _jsxFileName, lineNumber: 215 }, __self: _this7 }, __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( 'div', { className: 'card', __source: { fileName: _jsxFileName, lineNumber: 216 }, __self: _this7 }, __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( 'div', { className: 'card-header bg-dark text-white', __source: { fileName: _jsxFileName, lineNumber: 217 }, __self: _this7 }, 'You Ate ...' ), __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement( 'div', { className: 'card-body', __source: { fileName: _jsxFileName, lineNumber: 220 }, __self: _this7 }, 'Energy: ', __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('br', { __source: { fileName: _jsxFileName, lineNumber: 221 }, __self: _this7 }), 'Protein: ', __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('br', { __source: { fileName: _jsxFileName, lineNumber: 222 }, __self: _this7 }), 'Fat: ', __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('br', { __source: { fileName: _jsxFileName, lineNumber: 223 }, __self: _this7 }), 'Carbohydrates: ', __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('br', { __source: { fileName: _jsxFileName, lineNumber: 224 }, __self: _this7 }), 'Sugars: ', __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('br', { __source: { fileName: _jsxFileName, lineNumber: 225 }, __self: _this7 }), 'Sodium: ', __WEBPACK_IMPORTED_MODULE_0_react___default.a.createElement('br', { __source: { fileName: _jsxFileName, lineNumber: 226 }, __self: _this7 }) ) ) ) : null ); }) ) ); } }]); return User; }(__WEBPACK_IMPORTED_MODULE_0_react__["Component"]); /* harmony default export */ __webpack_exports__["a"] = (User); // fetch("https://api.nal.usda.gov/ndb/reports/?ndbno="+ndbono+"&type=b&format=json&api_key=iePhBf4DTI9UStixHQvpqeNZnlICZEKRITy2HpQV",{ // method: 'GET', // headers:{'Content-Type':'application/json'} // }).then((resp)=>resp.json() // .then(function(data){ // let nutrientData = data.report.food; // console.log(nutrientData); // })) /***/ }) }) //# sourceMappingURL=0.4b2f53441af72a7a5091.hot-update.js.map
// this is the main file of the platform, including read the // default/uploaded data, call other functions to visualize and analyze the // data, also including sending request to the server for implementing BBAC_I // settings that are used globally, including layout and color var globalSettings = {} globalSettings.xpadding = 10 globalSettings.ypadding = 10 globalSettings.margin = { top: 30, right: 30, bottom: 30, left: 30 } globalSettings.colorScheme = d3.interpolateRdYlBu var mapjson // read NL yearly temperature as attribute data in default d3.csv('data/temp_yr.csv', function (data) { // parse attribute data as needed formats parseData(data) initGraphs() updateTimeLine() updateHeatMap() // read NL Thiessen polygon geojson file as default to visualize geomap d3.json('data/NL_wgs84.geojson', function (json) { mapjson = json updateMap() }) }) // read user uploaded csv file as inputdata for co-clustering analysis var inputData = [] var csvFileInput = document.getElementById('csvFileInput') var mapFileInput = document.getElementById('mapFileInput') // read uploaded csv file function readCSVFile (file) { var reader = new FileReader() reader.onload = function () { inputData = d3.csvParse(reader.result) parseData(inputData) updateTimeLine() updateHeatMap() } // start reading the file. When it is done, calls the onload event defined above. reader.readAsText(file) } // read uploaded geojson file function readGeojsonFile (file) { var reader = new FileReader() reader.onload = function () { mapjson = JSON.parse(reader.result) updateMap() } // start reading the file. When it is done, calls the onload event defined above. reader.readAsText(file) } // add change event to file upload to check if the user has uploaded the attribute data csvFileInput.addEventListener('change', function () { var csvFile = csvFileInput.files[0] if (!(csvFile.name.split('.').pop() === 'csv')) { window.alert('Please upload the CSV file for the attribute data') csvFileInput.value = '' } }) mapFileInput.addEventListener('change', function () { // one geojson polygon file for geographical map with the coordinated // referenced sysetm as wgs84 var geojsonFile = mapFileInput.files[0] if (mapFileInput.files.length === 1) { let geojsonFile = mapFileInput.files[0] if (!(geojsonFile.name.split('.').pop() === 'geojson')) { window.alert('Please upload the geojson file for the map') mapFileInput.value = '' } else { readCSVFile(csvFileInput.files[0]) readGeojsonFile(mapFileInput.files[0]) } } }) // initialize the setting of visualizations function initGraphs () { initTimeLine() initMap() initHeatMap() initSmallMultiples() } // implementation of co-clustering algorithm in the server written in R, connected // using jug. The parameters (k:num. of row-cluster l: num. of col-cluster // niters: num. of iterations for reducing the information loss nruns: num. of // iterations for random initialization) are defined by user in the interface. function coClustering () { // this variable is used to save parameters chosen by users, e.g. k,l var parameters = {} var p = [] var url = '' // get values of all parameters parameters['k'] = document.querySelector('#numRC').value parameters['l'] = document.querySelector('#numCC').value parameters['niters'] = document.querySelector('#innerIter').value parameters['nruns'] = document.querySelector('#outerIter').value // join them together for (var k in parameters) { if (parameters[k].length > 0) { var x = k + '=' + parameters[k] p.push(x) } } // set up url with all parameters selected by users: this url contain the // parameters selected by the user and serve as req.params using d3.json() url = 'http://' + window.location.hostname + ':8888/?' + p.join('&') d3 .json(url) // put data needed into req.body using d3.json() in the client side // to send it to the server side // the data in function(err,data) means the data in the res.body and is // the processed result of the server side .post(JSON.stringify({ data: parsedData.valRserver }), function (err, data) { // processed result (data) contains: rlabelInfo, clabelInfo, valueSM, Z_order // rlabelInfo includes: ix: the re-ordered row indices from row-cluster 1 to k // based on co-clustering results num: accumulated num. of row-clusters // rlabel: which row-cluster each row (from 1 to m) belongs to. // clabelInfo includes: ix: the re-ordered column indices from year-cluster 1 to l // based on co-clustering results num: accumulated num. of col-clusters // clabel: which col-cluster each column (from 1 to n) belongs to. // valueSM: values for small multiples using RCavg' (size: lxm) // Z_CoC: the co-clustered data matrix according to the co-clustering results // with size (mxn) x1 as a vector var clabel = [].concat.apply([], data.clabelInfo.clabel) var rlabel = [].concat.apply([], data.rlabelInfo.rlabel) // visualize the clustering results in the heatmap addHeatmap(data.Z_CoC, rlabel, clabel) // visualize the col-clusters in the timeline addTimeline(clabel) // rlabelMerge used for merging row-clusters for thick lines in small multiples smallMultiples.rlabelMerge = [] for (var i = 1; i <= +document.querySelector('#numRC').value; i++) { var tempLabel = [] for (var j = 0; j < rlabel.length; j++) { if (rlabel[j] === i) { tempLabel.push(parsedData.keysRow[j]) } } smallMultiples.rlabelMerge.push({ rc: i, rlabel: tempLabel }) } // visualize the clustering results (co-clusters) in the small multiples updateSmallmultiple(data.valueSM) updateMapCo() }) }
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.WizardNavItem = void 0; const tslib_1 = require("tslib"); const React = tslib_1.__importStar(require("react")); const react_styles_1 = require("@patternfly/react-styles"); const wizard_1 = tslib_1.__importDefault(require("@patternfly/react-styles/css/components/Wizard/wizard")); const angle_right_icon_1 = tslib_1.__importDefault(require('@patternfly/react-icons/dist/js/icons/angle-right-icon')); const WizardNavItem = (_a) => { var { children = null, content = '', isCurrent = false, isDisabled = false, step, onNavItemClick = () => undefined, navItemComponent = 'button', href = null, isExpandable = false } = _a, rest = tslib_1.__rest(_a, ["children", "content", "isCurrent", "isDisabled", "step", "onNavItemClick", "navItemComponent", "href", "isExpandable"]); const NavItemComponent = navItemComponent; const [isExpanded, setIsExpanded] = React.useState(false); React.useEffect(() => { setIsExpanded(isCurrent); }, [isCurrent]); if (navItemComponent === 'a' && !href && process.env.NODE_ENV !== 'production') { // eslint-disable-next-line no-console console.error('WizardNavItem: When using an anchor, please provide an href'); } const btnProps = { disabled: isDisabled }; const linkProps = { tabIndex: isDisabled ? -1 : undefined, href }; return (React.createElement("li", { className: react_styles_1.css(wizard_1.default.wizardNavItem, isExpandable && wizard_1.default.modifiers.expandable, isExpandable && isExpanded && wizard_1.default.modifiers.expanded) }, React.createElement(NavItemComponent, Object.assign({}, rest, (navItemComponent === 'a' ? Object.assign({}, linkProps) : Object.assign({}, btnProps)), { onClick: () => (isExpandable ? setIsExpanded(!isExpanded || isCurrent) : onNavItemClick(step)), className: react_styles_1.css(wizard_1.default.wizardNavLink, isCurrent && wizard_1.default.modifiers.current, isDisabled && wizard_1.default.modifiers.disabled), "aria-disabled": isDisabled ? true : null, "aria-current": isCurrent && !children ? 'step' : false }, (isExpandable && { 'aria-expanded': isExpanded })), isExpandable ? (React.createElement(React.Fragment, null, React.createElement("span", { className: react_styles_1.css(wizard_1.default.wizardNavLinkText) }, content), React.createElement("span", { className: react_styles_1.css(wizard_1.default.wizardNavLinkToggle) }, React.createElement("span", { className: react_styles_1.css(wizard_1.default.wizardNavLinkToggleIcon) }, React.createElement(angle_right_icon_1.default, null))))) : (content)), children)); }; exports.WizardNavItem = WizardNavItem; exports.WizardNavItem.displayName = 'WizardNavItem'; //# sourceMappingURL=WizardNavItem.js.map
import { createStore } from 'redux' const initialState = { sidebarShow: 'responsive', simView : 1, datadetensi:{}, trigger:0, forma:{}, formb:{}, initial:{}, } const changeState = (state = initialState, { type, ...rest }) => { switch (type) { case 'set': return {...state, ...rest } default: return state } } const store = createStore(changeState) export default store
import React from "react" import Layout from "../../components/layout" import arrow from "../../img/arrow-icon.png" import { Helmet } from "react-helmet" import HeaderBanner from "../../components/headerbanner.js" import { Link } from "gatsby" const PlumHQ = () => { return ( <div> <Helmet> <title>Plum - Partner Perks of GoFloaters</title> </Helmet> <Layout> <HeaderBanner> <h1>Plum</h1> <div className="col-md-12 breadcrumb-container text-center"> <p> <Link to="/our-community-perks">Community Benefits</Link> / Plum </p> </div> </HeaderBanner> <div className="container"> <div className="row"> <div className="col-md-3 text-center"> <img src="https://assets.gofloaters.com/partner/plumhq.png" alt="Plum" ></img> </div> <div className="col-md-9"> <p> Plum is a comprehensive employee benefits platform for startups. Plum provides premium health insurance including complete medical, dental, vision, physical &amp; mental wellness benefits to your team. Additionally, Plum makes managing health benefits and administering claims hassle-free through a real-time, simplified dashboard experience. </p> <p> <strong>Offer brief:</strong>{" "} </p> <p> 1. Plum is waiving platform fees for the first year for all companies with less than 500 employees at GoFloaters. These benefits total up to ₹50,000 annually. <br /> 2. Free OPD consultations accessible to all GoFloaters companies taking up their group medical cover through Plum. <br /> 3. Enroll a team as lean as 5 employees with the flexibility of paying per month through Plum One. </p> <p> <strong>Benefits:</strong> </p> <p> <strong>COVID-19 Treatment Coverage</strong> <br />A must-have in the present times, with Plum health insurance plans, your employees get coverage of treatment costs for Coronavirus. This includes hospitalization bills, pre, and post-hospitalization costs, quarantine costs, and even a free doctor consultation. </p> <p> <strong>Pre-Existing Disease Coverage</strong> <br /> Most insurance providers keep a window of 2-4 years for Pre-Existing Diseases(PED) like Diabetes, Cataract, Epilepsy, Cancer, Sleep Apnea, etc. With Plum, your employees get PED coverage from Day 1. </p> <p> <strong>Maternity and Newborn Cover</strong> <br /> Younger members of your workforce are often worried about the financial strain that comes with the birth of a child. We take this away by covering all maternity and newborn care costs from the day the policy is issued. </p> <p> <strong>Cover For Dependents</strong> <br /> We offer plans to include the spouse, children, and even parents of your employees depending on your budget. Every member of the family added to the cover enjoys the same benefits as the employee. </p> <p> <strong>Zero Waiting Periods</strong> <br /> Plum Health Insurance Cover begins as soon as you buy the policy, making claim benefits possible from the very first day. </p> <p> <strong>No Hidden Terms and Conditions</strong> <br /> No hidden room rents or ICU caps. Plum is transparent about what&rsquo;s covered and what&rsquo;s not through a simplified user dashboard. </p> <p> <strong>Priority Claims</strong> <br /> Your employees can log into their dashboard or email Plum and initiate claims in less than 5 mins. Our Customer Success experts then help your employees from end-to-end, coordinate with insurance partners or network hospitals, and take the worry away from your employees. </p> <p> <br /> If you are part of our community and wish to avail this benefit <br /> <br /> <a href="https://gofloatersscdd.typeform.com/to/vwAJwR" target="_blank" rel="noopener noreferrer" className="" style={{ fontSize: "0.9rem", color: "#fff", background: "#4f9fc8", borderRadius: "5px", padding: "7px 15px", marginTop: "10px", }} > Claim Now{" "} <img src="https://assets.gofloaters.com/arrow-icon.png" alt="arrow" style={{ width: "20px", paddingBottom: "3px" }} /> </a> <br /> <br /> </p> </div> </div> </div> </Layout> </div> ) } export default PlumHQ
/* jshint esversion: 6 */ /* jslint node: true */ 'use strict'; /** * Middleware to add Content-Security-Policy header http://www.w3.org/TR/CSP/ * * @option report-only, The Content-Security-Policy-Report-Only header field * lets servers experiment with policies by monitoring (rather than * enforcing) a policy. * @option report-uri, Instructs the browser to POST a reports of policy * failures to this URI. You can also append -Report-Only to the HTTP * header name to instruct the browser to only send reports (does not * block anything). * @option sandbox, Enables a sandbox for the requested resource similar to the * iframe sandbox attribute. * * @option default-src, The default-src is the default policy for loading * content such as JavaScript, Images, CSS, Font's, AJAX requests, * Frames, HTML5 Media * @option script-src, Defines valid sources of JavaScript. * @option object-src, Defines valid sources of plugins, eg <object>, <embed> * or <applet>. * @option style-src, Defines valid sources of stylesheets. * @option img-src, Defines valid sources of images. * @option media-src, Defines valid sources of audio and video, eg HTML5 <audio>, <video> elements. * @option frame-src, Defines valid sources for loading frames. * @option font-src, Defines valid sources of fonts. * @option connect-src, Applies to XMLHttpRequest (AJAX), WebSocket or EventSource. If not allowed the browser emulates a 400 HTTP status code. * @option child-src, Defines valid sources for web workers and nested browsing contexts loaded using elements such as <frame> and <iframe> (CSP2). * @option worker-src, Defines valid sources that can be loaded within a Worker, SharedWorker, or ServiceWorker (CSP3). * @option form-action, Defines valid sources that can be used as a HTML <form> action (CSP2). * @option frame-ancestors, Defines valid sources for embedding the resource using <frame> <iframe> <object> <embed> <applet>. Setting this directive to 'none' should be roughly equivalent to X-Frame-Options: DENY (CSP2). * @option plugin-types, Defines valid MIME types for plugins invoked via <object> and <embed>. To load an <applet> you must specify application/x-java-applet (CSP2). * */ module.exports.getCSP = function (options) { const header = options['report-only'] ? 'Content-Security-Policy-Report-Only' : 'Content-Security-Policy'; const srcs = ['report-uri', 'sandbox', 'default-src', 'script-src', 'object-src', 'style-src', 'img-src', 'media-src', 'frame-src', 'font-src', 'connect-src', 'child-src', 'worker-src', 'form-action', 'frame-ancestors', 'plugin-types']; let compiled = ''; srcs.forEach(src => { const directive = getDirective(options, src); if (directive) { compiled += directive + ';'; } }); return function (req, res, next) { res.removeHeader('Content-Security-Policy-Report-Only'); res.removeHeader('Content-Security-Policy'); res.setHeader(header, compiled); next(); }; }; /** */ module.exports.SANDBOX_ALLOW_FORMS = 'allow-forms'; /** */ module.exports.SANDBOX_ALLOW_SCRIPTS = 'allow-scripts'; /** */ module.exports.SANDBOX_ALLOW_SAME = 'allow-same-origin'; /** */ module.exports.SANDBOX_ALLOW_TOP_NAVIGATION = 'allow-top-navigation'; /** Allows loading resources from the same origin (same scheme, host and port). */ module.exports.SRC_SELF = '\'self\''; /** Prevents loading resources from any source. */ module.exports.SRC_NONE = '\'none\''; /** Allows use of inline source elements such as style attribute and onclick */ module.exports.SRC_USAFE_INLINE = '\'unsafe-inline\''; /** Allows unsafe dynamic code evaluation such as JavaScript eval() */ module.exports.SRC_UNSAFE_EVAL = '\'unsafe-eval\''; /** Allows loading resources via the data scheme (e.g. Base64 encoded images). */ module.exports.SRC_DATA = 'data:'; /** Allows loading resources via a blob. */ module.exports.SRC_BLOB = 'blob:'; /** Wildcard, allows anything. */ module.exports.SRC_ANY = '*'; /** Allows loading resources only over HTTPS on any domain. */ module.exports.SRC_HTTPS = 'https:'; /** * This policy allows images, scripts, AJAX, and CSS from the same origin, and * does not allow any other resources to load (eg object, frame, media, etc). It * is a good starting point for many sites. */ module.exports.STARTER_OPTIONS = { 'default-src': module.exports.SRC_NONE, 'script-src': module.exports.SRC_SELF, 'connect-src': module.exports.SRC_SELF, 'img-src': module.exports.SRC_SELF, 'style-src': module.exports.SRC_SELF, 'font-src': module.exports.SRC_SELF, 'child-src': module.exports.SRC_SELF, 'form-action': module.exports.SRC_SELF, 'frame-ancestors': module.exports.SRC_SELF, 'plugin-types': module.exports.SRC_NONE }; /** * Helper function to compile one directive. handles strings and arrays. * * @param options * all options * @param name * name of the one to compile * @returns compilation of named option */ function getDirective (options, name) { if (!options[name]) { return null; } if (typeof options[name] === 'string') { return name + ' ' + options[name]; } if (Array.isArray(options[name])) { let result = name + ' '; options[name].forEach(value => { result += value + ' '; }); return result; } return null; }
// Copyright (c) 2020, Frappe Technologies and contributors // For license information, please see license.txt frappe.ui.form.on("Onboarding Step", { refresh: function(frm) { frappe.boot.developer_mode && frm.set_intro( __( "To export this step as JSON, link it in a Onboarding document and save the document." ), true ); if (frm.doc.reference_document && frm.doc.action == "Update Settings") { setup_fields(frm); } if (!frappe.boot.developer_mode) { frm.trigger("disable_form"); } }, reference_document: function(frm) { if (frm.doc.reference_document && frm.doc.action == "Update Settings") { setup_fields(frm); } }, action: function(frm) { if (frm.doc.action == "Show Form Tour") { frm.fields_dict.reference_document.set_description(`You need to add the steps in the contoller JS file. For example: <code>note.js</code> <pre class="small text-muted"><code> frappe.tour['Note'] = [ { fieldname: "title", title: "Title of the Note", description: "...", } ]; </code></pre> `); } else { frm.fields_dict.reference_document.set_description(null); } }, disable_form: function(frm) { frm.set_read_only(); frm.fields .filter((field) => field.has_input) .forEach((field) => { frm.set_df_property(field.df.fieldname, "read_only", "1"); }); frm.disable_save(); }, }); function setup_fields(frm) { if (frm.doc.reference_document && frm.doc.action == "Update Settings") { frappe.model.with_doctype(frm.doc.reference_document, () => { let fields = frappe .get_meta(frm.doc.reference_document) .fields.filter((df) => { return ["Data", "Check", "Int", "Link", "Select"].includes( df.fieldtype ); }) .map((df) => { return { label: `${__(df.label)} (${df.fieldname})`, value: df.fieldname, }; }); frm.set_df_property("field", "options", fields); }); } }
import React from 'react' import PropTypes from 'prop-types' import Grid from '@material-ui/core/Grid' import Bracket from '../Bracket' const Tournament = ({ brackets }) => ( <Grid container direction="row" justify="space-between"> {brackets.map(bracket => ( <Grid key={bracket.id} item md={3} sm={6} xs={12}> <Bracket name={bracket.name} teams={bracket.teams} /> </Grid> ))} </Grid> ) Tournament.propTypes = { brackets: PropTypes.array.isRequired } export default Tournament
import { USER_DELETE_FAIL, USER_DELETE_REQUEST, USER_DELETE_SUCCESS, USER_DETAILS_FAIL, USER_DETAILS_REQUEST, USER_DETAILS_RESET, USER_DETAILS_SUCCESS, USER_LIST_FAIL, USER_LIST_REQUEST, USER_LIST_RESET, USER_LIST_SUCCESS, USER_LOGIN_FAIL, USER_LOGIN_REQUEST, USER_LOGIN_SUCCESS, USER_LOGOUT, USER_REGISTER_FAIL, USER_REGISTER_REQUEST, USER_REGISTER_SUCCESS, USER_UPDATE_FAIL, USER_UPDATE_PROFILE_FAIL, USER_UPDATE_PROFILE_REQUEST, USER_UPDATE_PROFILE_RESET, USER_UPDATE_PROFILE_SUCCESS, USER_UPDATE_REQUEST, USER_UPDATE_RESET, USER_UPDATE_SUCCESS } from '../constants/userConstants' export const userLoginReducer = (state = {}, action) => { switch (action.type) { case USER_LOGIN_REQUEST: return {loading: true} case USER_LOGIN_SUCCESS: return { loading: false, userInfo: action.payload, } case USER_LOGIN_FAIL: return { loading: false, error: action.payload, } case USER_LOGOUT: return {} default: return state } } export const userRegisterReducer = (state = {}, action) => { switch (action.type) { case USER_REGISTER_REQUEST: return {loading: true} case USER_REGISTER_SUCCESS: return { loading: false, userInfo: action.payload, } case USER_REGISTER_FAIL: return { loading: false, error: action.payload, } default: return state } } export const userDetailsReducer = (state = {user: {}}, action) => { switch (action.type) { case USER_DETAILS_REQUEST: return {loading: true, ...state} case USER_DETAILS_SUCCESS: return { loading: false, user: action.payload, } case USER_DETAILS_FAIL: return { loading: false, error: action.payload, } case USER_DETAILS_RESET: return {user: {}} default: return state } } export const userUpdateProfileReducer = (state = {}, action) => { switch (action.type) { case USER_UPDATE_PROFILE_REQUEST: return {loading: true,} case USER_UPDATE_PROFILE_SUCCESS: return { loading: false, success: true, user: action.payload, } case USER_UPDATE_PROFILE_FAIL: return { loading: false, error: action.payload, } case USER_UPDATE_PROFILE_RESET: return {} default: return state } } export const userListReducer = (state = {users: []}, action) => { switch (action.type) { case USER_LIST_REQUEST: return {loading: true,} case USER_LIST_SUCCESS: return { loading: false, success: true, users: action.payload, } case USER_LIST_FAIL: return { loading: false, error: action.payload, } case USER_LIST_RESET: return {} default: return state } } export const userDeleteReducer = (state = {}, action) => { switch (action.type) { case USER_DELETE_REQUEST: return { loading: true } case USER_DELETE_SUCCESS: return { loading: false, success: true } case USER_DELETE_FAIL: return { loading: false, error: action.payload } default: return state } } export const userUpdateReducer = (state = { user: {} }, action) => { switch (action.type) { case USER_UPDATE_REQUEST: return { loading: true } case USER_UPDATE_SUCCESS: return { loading: false, success: true } case USER_UPDATE_FAIL: return { loading: false, error: action.payload } case USER_UPDATE_RESET: return { user: {} } default: return state } }
/*! * MZUI: standard - v1.0.1 - 2018-01-09 * Copyright (c) 2018 cnezsoft.com; Licensed MIT */ window.CoreLib=window.jQuery||window.Zepto,!function(t){"use strict";t.callEvent=function(e,a,n,r,s){var o,i=t.Event(e);return r&&(t(r).trigger(i,s),o=i.result),t.isFunction(a)&&(o=a.apply(n,t.isArray(s)?s:[s])),o},t.fn.callEvent=function(e,a,n){return t.callEvent(a,e.options?e.options[a]:null,e,this,n)},t.bindFn=function(e,a,n){var r=t.fn[e],s=a.NAME||"mzui."+e;t.fn[e]=function(e,r){return this.each(function(){var o=t(this),i=o.data(s),l="object"==typeof e&&e;n&&(l=t.extend(l,n)),i||o.data(s,i=new a(o,l)),"string"==typeof e&&i[e].apply(i,t.isArray(r)?r:[r])})},t.fn[e].Constructor=a,t.fn[e].noConflict=function(){return t.fn[e]=r,this}},t.formatDate=function(t,e){t instanceof Date||(t=new Date(t));var a={"M+":t.getMonth()+1,"d+":t.getDate(),"h+":t.getHours(),"m+":t.getMinutes(),"s+":t.getSeconds(),"S+":t.getMilliseconds()};/(y+)/i.test(e)&&(e=e.replace(RegExp.$1,(t.getFullYear()+"").substr(4-RegExp.$1.length)));for(var n in a)new RegExp("("+n+")").test(e)&&(e=e.replace(RegExp.$1,1==RegExp.$1.length?a[n]:("00"+a[n]).substr((""+a[n]).length)));return e},t.format=function(e,a){if(e instanceof Date)return t.formatDate(e,a);if(arguments.length>1){var n;if(2==arguments.length&&"object"==typeof a)for(var r in a)void 0!==a[r]&&(n=new RegExp("({"+r+"})","g"),e=e.replace(n,a[r]));else for(var s=1;s<arguments.length;s++)void 0!==arguments[s]&&(n=new RegExp("({["+(s-1)+"]})","g"),e=e.replace(n,arguments[s]))}return e},t.calValue=function(e,a,n){return t.isFunction(e)?e.apply(a,t.isArray(n)?n:[n]):e},t.is$=function(e){return window.jQuery===t?e instanceof jQuery:t.zepto.isZ(e)},t.isStr=function(t){return"string"==typeof t},t.isNum=function(t){return"number"==typeof t},t.TapName="ontouchstart"in document.documentElement?"touchstart":"click",t.uuid||(t.uuid=0)}(CoreLib),!function(t,e,a,n){"use strict";var r=1200,s=t.TapName,o="display",i="orginalClass",l="hidden",c="loading",u="body",d="."+o+".oneTarget",p="mzui."+o,f={left:"right",bottom:"top",top:"bottom",right:"left"},g=function(a,n){var s=this;t.isPlainObject(a)&&(n=a,a=null),n=t.extend({element:a},g.DEFAULT,a?a.data():null,n);var i=n.display;i&&g.plugs["_"+i]&&(n=t.calValue(g.plugs["_"+i],s,n));var l=n.selector;a||(n.trigger=null),n.name||(n.name=o+r++);var c=function(e){n.stopPropagation&&e.stopPropagation();var a=t(this),r=a.data()||{};if(r.element=this,a.is("a")){var o=a.data("url")||a.attr("href");o&&"#"!==o&&o.indexOf("##")<0&&(!n.target&&/^#[a-z]/i.test(o)?r.target=o:r.remote||(r.remote=o)),e&&n.preventDefault!==!1&&e.preventDefault()}s[n.triggerMethod](r)};if(n.trigger&&(l?a.on(n.trigger,l,c):a.on(n.trigger,c)),s.$=a,s.options=n,n.displayAuto!==e&&n.displayAuto!==!1)l&&a?a.find(l).each(c):s.show();else if(l&&a){var u=n.activeClass;a.find(l).filter("[data-display-auto]"+(u?",."+u:"")).each(c)}};g.prototype._getTarget=function(e){var a=this,n=t.calValue(e.target,a,e);if("!new"===n||n==="#"+o+"Target"){var r=o+"Target-"+e.name,s=o+"Layer-"+e.name;t("#"+r).remove(),n=t('<div class="'+o+" "+l+'"/>').attr({id:r});var c=t("#"+s);c.length||(c=t('<div class="'+o+'-layer"/>').attr({id:s}).appendTo(u)),e.layer=e.container=c.append(n)}else"!self"===n&&(n=e.element||a.$);return n=t(n).addClass(o).attr("data-"+o+"-name",e.name),n.parent().length||n.appendTo(e.container),n.data(i)||n.data(i,n.attr("class")),n},g.prototype.update=function(e,a,r,s){var i=this,l=function(n){var r=a.template;t.isFunction(r)?n=r(n,a):t.isStr(r)&&(n=t.format(r,n)),n!==!1&&(t.is$(n)?e.empty().append(n):e["text"===a.contentType?"text":"html"](n))},d=t.calValue(a.remote,i,a);if(d){var p=t.uuid++,f=a.loadingClass;e.removeClass(a.showInClass).addClass(f),t(u).addClass("has-"+o+"-"+c),a.$backdrop&&a.$backdrop.addClass(f);var g=t.isStr(d)?{url:d}:d;i.xhr&&i.xhr.abort(),i.remoteCall=p,i.xhr=t.ajax(t.extend({dataType:a.remoteType||"html",error:a.remoteError},g,{success:function(t,e,a){l(t),g.success&&g.success(t,e,a)},complete:function(r,l){i.xhr=0,i.remoteCall===p&&(i.lastRemote!==d&&(t(a.container).scrollTop(0),i.lastRemote=d),e.removeClass(f).addClass(a.showInClass),t(u).removeClass("has-"+o+"-"+c),a.$backdrop&&a.$backdrop.removeClass(f),t.callEvent("loaded",a.loaded,i,i.$,a),t(n).triggerHandler(o+".loaded",[i,i.$,a]),g.complete&&g.complete(r,l),s&&s())}}))}else{var h=t.calValue(a.content,i,a),m=a.source;m&&(m=t(t.calValue(m,i,a)),m=m.parent().length?m.clone():m,h=h?m.html(h):m),l(h),s&&s()}r&&r(d)},g.prototype._getOptions=function(e){var a=this,n=t.extend({},a.options,e),r=n.display;return r&&g.plugs[r]&&(n=t.calValue(g.plugs[r],a,n)),n.$target||(n.$target=a._getTarget(n)),n},g.prototype.show=function(e,c){t.isFunction(e)&&(c=e,e=null);var p=this,h=p._getOptions(e);p.last=h;var m=h.$target,v=h.activeClass,C=h.animate,y=h.element,b=h.placement,w=h.layer,x="",S="",k=h.name,$=h.arrow,T=h.backdrop,E=t(y);if(m.attr("class","invisible "+m.data(i)+" "+(h.targetClass||"")).removeClass(l),t.callEvent("show",h.show,p,p.$,h)===!1)return m.attr("class",i),h.layer&&h.layer.remove(),c&&c();if(h.showSingle&&(h.showSingle===!0?m.parent().children():t(h.showSingle)).not(m).removeClass(h.showInClass).addClass(l),w&&w.removeClass(l),T){var D="backdrop-"+k;t("#"+D).remove();var A=h.$backdrop=t('<div class="display-backdrop"/>').attr({id:D,type:h.display,"data-display-name":k}).appendTo(u).css("zIndex",r++);T===!0&&(T="fade"),t.isStr(T)&&A.addClass(T),t(u).addClass("display-show-"+h.name),setTimeout(function(){A.addClass("in")},10),h.backdropDismiss&&A.attr("data-dismiss",o)}"none"!==h.targetZIndex&&(w||m).css("zIndex",h.targetZIndex||r++),v&&y&&(h.activeSingle&&E.parent().children().removeClass(v),E.addClass(v)),p.update(m,h,function(e){if(h.scrollTop&&t(h.container).scrollTop(0),b=t.calValue(b,p,h)){t.isStr(b)&&"{"==b[0]&&(b=t.parseJSON(b));t("body");if(t.isPlainObject(b))m.css(b);else if("overlay"===b){var r=E[0].getBoundingClientRect();m.css({position:"absolute",left:r.left,top:r.top,width:r.width,height:r.height})}else if(0===b.indexOf("beside")){m.css({position:"fixed"}),b=b.split("-");var i,l,u=t(a),g=b[1]||"auto",v=b[2]||"center",r=(E.offset(),E[0].getBoundingClientRect()),y=m.width(),k=m.height(),T=u.width(),D=u.height(),A="start"===v,L="end"===v,j=r.top,F=r.left,I=r.width,O=r.height;"auto"===g&&(g=j+O+k<=D?"bottom":k<=j?"top":F+I+y<=T?"right":y<=F?"left":"bottom");var H=A?F:L?F+I:F+I/2-y/2,M=A?j:L?j+O:j+O/2-k/2;"bottom"===g?(i=j+O,l=H):"top"===g?(i=j-k,l=H):"right"===g?(i=M,l=F+I):(i=M,l=F-y),m.css({top:Math.max(0,Math.min(i,D-k)),left:Math.max(0,Math.min(l,T-y))}),S=f[g],x="fade scale-from-"+S}else{b=b.split("-");var N=b[0],_=b[1],R={};"top"!=N&&"bottom"!=N&&"left"!=N&&"right"!=N||(R.justifyContent="flex-"+("top"===N||"left"==N?"start":"end"),R.flexDirection="top"==N||"bottom"==N?"column":"row",R.alignItems=_?"center"==_?"center":"left"==_?"flex-start":"flex-end":"stretch"),w&&w.css(R),x=N,S=f[x],x="from-"+x}}if($){var z="display-arrow arrow-"+S;t.isStr($)&&(z+=" "+$),m.addClass(z)}var V=function(){m.removeClass("invisible"),e||m.addClass(h.showInClass),c&&c();var a=h.autoHide;a&&(p.animateCall=setTimeout(function(){p.hide()},t.isNum(a)?a:5e3)),p.animateCall=setTimeout(function(){t.callEvent("shown",h.shown,p,p.$,h),t(n).triggerHandler(o+".shown",[p,p.$,h])},h.duration+50),h.targetDismiss&&m.one((h.targetDismiss===!0?s:h.targetDismiss)+d,function(){p.hide()})};C?(C===!0?m.addClass(x?"enter-"+x:"fade"):t.isStr(C)?m.addClass(C.replace("suggest",x)):t.isNum(C)&&(h.duration=C),clearTimeout(p.animateCall),p.animateCall=setTimeout(V,10)):V()},function(){t.callEvent("displayed",h.displayed,p,p.$,h),t(n).triggerHandler(o+".displayed",[p,p.$,h]),h.plugSkin&&m.find("[data-skin]").skin(),h.plugDisplay&&m.find("[data-"+o+"]").display(),t.fn.listenScroll&&m.find(".listen-scroll").listenScroll()}),g.last=k,g.all[k]=p},g.prototype.hide=function(e,a){t.isFunction(e)&&(a=e,e=null);var r=this,s=r.last||r._getOptions(e);if(t.callEvent("hide",s.hide,r,r.$,s)===!1)return a&&a();r.last=!1;var i=s.$target.off(d),c=t("#backdrop-"+s.name),p=function(){s.layer&&s.layer.addClass(l),t.callEvent(l,s[l],r,r.$,s),t(n).triggerHandler(o+"."+l,[r,r.$,s]),i.addClass(l),c.remove(),t(u).removeClass(o+"-show-"+s.name),s.layer&&s.layer.remove()};s.activeClass&&s.element&&t(s.element).removeClass(s.activeClass),i.removeClass(s.showInClass),c.removeClass("in"),s.animate?(clearTimeout(r.animateCall),r.animateCall=setTimeout(p,s.duration+50)):p()},g.prototype.isShow=function(e){return e=this._getOptions(e),e.checkShow?t.calValue(e.checkShow,this,e):e.$target?e.$target.hasClass(e.showInClass):e.last},g.prototype.toggle=function(e,a){var n;e===!0||e===!1?(n=e,e=t.isPlainObject(a)?a:null,e&&(a=null)):n=this.isShow(e),this[n?"hide":"show"](e,a)},g.NAME=p,g.DEFAULT={trigger:s,triggerMethod:"show",container:u,plugSkin:!0,plugDisplay:!0,content:!1,loadingClass:c,showInClass:"in",animate:!0,duration:300,keyboard:!0,backdropDismiss:!0,activeSingle:!0},g.plugs=function(e,a,n){if(t.isPlainObject(e))t.each(e,g.plugs);else{if(!a)return g.plugs[e];g.plugs[e]=a,e=0===e.indexOf("_")?e.substr(1):e,t.fn[e]||n===!1||t.bindFn(n||e,g,{display:e})}},g.all={},g.dismiss=function(e,a){t.isFunction(e)&&(a=e,e=""),e=e||g.last;var n=g.all[e];n&&n.hide(a)},t.bindFn(o,g),t.Display=g,t(function(){t("[data-"+o+"]").display(),t(n).on(s,'[data-dismiss="'+o+'"]',function(){var e=t(this),a="data-"+o+"-name";name=e.attr(a),name&&"null"!=name&&"undefined"!=name||(name=e.closest("."+o).attr(a)),g.dismiss(name)})})}(CoreLib,void 0,window,document),!function(t,e){"use strict";if(!t.Display)return void console.error("display.plugs.js requires display.js");var a=function(e,a,n,r,s){var o=t(a).next("."+e);return o.length||(o=n),o||'<div class="'+(s||e)+" "+(r||"")+'"/>'},n=function(t,a){return t===e?a:t};t.Display.plugs({dropdown:function(e){var r=e.source;return t.extend(e,{backdrop:n(e.backdrop,"clean"),source:e.target?null:function(){return a("dropdown-menu",e.element,r)},target:n(e.target,"!new"),placement:n(e.placement,"beside"),activeClass:n(e.activeClass,"open"),targetDismiss:n(e.targetDismiss,!0)})},popover:function(e){var r=e.source;return t.extend(e,{arrow:n(e.arrow,!0),backdrop:n(e.backdrop,"clean"),source:e.target?null:function(){return a("popover",e.element,r,"canvas with-padding")},target:n(e.target,"!new"),placement:n(e.placement,"beside"),activeClass:n(e.activeClass,"open")})},messager:function(a){return t.extend(a,{autoHide:n(a.autoHide,!0),animate:a.animate===e||a.animate===!0?"scale-suggest fade":a.animate,closeButton:n(a.closeButton,!0),template:function(e,a){var n=t(a.source||'<div class="messager list-item"/>');return a.icon&&n.append('<div class="avatar"><i class="icon icon-'+a.icon+'"/></div>'),n.append('<div class="title">'+e+"</div>"),a.closeButton&&n.append('<button class="btn muted" type="button" data-dismiss="display"><i class="icon icon-remove"></i></button>'),n.addClass(a.type||"gray")},target:"!new",placement:n(a.placement,"bottom-center"),activeClass:n(a.activeClass,"open")})},modal:function(e){var r=e.source;return t.extend(e,{backdrop:n(e.backdrop,"modal-backdrop fade"),source:e.target?null:function(){return a("modal",e.element,r,"","content")},target:n(e.target,"!new"),targetClass:"modal "+(e.targetClass||""),placement:n(e.placement,"tap"===t.TapName?"bottom":"center"),activeClass:n(e.activeClass,"open")})},_collapse:function(e){return t.extend(e,{triggerMethod:"toggle",animate:!1,showInClass:"in",activeClass:"collapse-open",showSingle:n(e.group||e.showSingle,!!e.selector&&"collapse-group-"+ ++t.uuid)})}}),t.Display.plugs("_self",function(e){return t.extend(e,{trigger:!1,target:"!self",targetZIndex:"none",displayAuto:n(e.displayAuto,!0)})},"displaySelf");var r=new t.Display({display:"messager"});r._show=r.show,r.show=function(e,a){r._show(t.extend({content:e},a))},t.each({primary:0,success:"ok-sign",info:"info-sign",warning:"warning-sign",danger:"exclamation-sign",important:0,special:0},function(e,a){r[e]=function(n,s){r._show(t.extend({content:n,icon:a||null,type:e},s))}}),t.messager=r}(CoreLib,void 0),!function(t){"use strict";var e="mzui.scrollListener",a=function(n,r){var s=this;s.options=r=t.extend({},a.DEFAULT,n.data(),r),s.$=n,s.$container=r.container?"parent"==r.container?s.$.parent():t(r.container):s.$,s.lastScrollTop=0,s.lastCallTime=0;var o=0;if(n.on("scroll."+e,function(){clearTimeout(o);var t=(new Date).getTime();o=setTimeout(function(){s.onScroll(),s.lastCallTime=t},t-s.lastCallTime>r.handleInterval?0:r.handleInterval)}),r.canScrollClass){var i=(s.$[0]===window?t("body"):s.$)[0].scrollHeight;s.$container.toggleClass(r.canScrollClass,i>s.$.height())}};a.prototype.onScroll=function(){var t=this,e=t.options,a=t.$.scrollTop(),n=a>0,r=a>t.lastScrollTop?"down":"up",s=e.directionClass;t.$container.toggleClass(e.inScrollClass,n).toggleClass(s+"-down","down"===r).toggleClass(s+"-up","up"===r).toggleClass(s+"-over",a+t.$.height()>=t.$[0].scrollHeight),t.$container.callEvent(t,"listenScroll",[n,r,a]),t.isInScroll=n,t.scrollDirection=r,t.lastScrollTop=a},a.NAME=e,a.DEFAULT={minDelta:20,handleInterval:100,inScrollClass:"in-scroll",directionClass:"scroll",canScrollClass:"can-scroll"},t.bindFn("listenScroll",a),t(function(){t(window).listenScroll({container:"body"}),t(".listen-scroll").listenScroll()})}(CoreLib),!function(t,e,a){"use strict";function n(t){if(t=t.toLowerCase(),t&&c.test(t)){var e;if(4===t.length){var a="#";for(e=1;e<4;e+=1)a+=t.slice(e,e+1).concat(t.slice(e,e+1));t=a}var n=[];for(e=1;e<7;e+=2)n.push(v("0x"+t.slice(e,e+2)));return{r:n[0],g:n[1],b:n[2],a:1}}throw new Error("Wrong hex string! (hex: "+t+")")}function r(e){return typeof e===f&&("transparent"===e.toLowerCase()||c.test(t.trim(e.toLowerCase())))}function s(t){function e(t){return t=t<0?t+1:t>1?t-1:t,6*t<1?i+(o-i)*t*6:2*t<1?o:3*t<2?i+(o-i)*(2/3-t)*6:i}var a=t.h,n=t.s,r=t.l,s=t.a;a=l(a)%d/d,n=C(n),r=C(r),s=C(s);var o=r<=.5?r*(n+1):r+n-r*n,i=2*r-o,c={r:e(a+1/3)*u,g:e(a)*u,b:e(a-1/3)*u,a:s};return c}function o(t,a,n){return h(n)&&(n=0),h(a)&&(a=u),e.min(e.max(t,n),a)}function i(t,e){return o(t,e)}function l(t){return"number"==typeof t?t:parseFloat(t)}var c=/^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/,u=255,d=360,p=100,f="string",g="object",h=function(t){return t===a},m=function(t){return!h(t)},v=function(t){return parseInt(t)},C=function(t,e){return i(l(t),e)},y=function(t){return v(C(t,u))},b=function(t,e,a,r){var o=this;if(o.r=o.g=o.b=0,o.a=1,m(r)&&(o.a=C(r,1)),m(t)&&m(e)&&m(a))o.r=y(t),o.g=y(e),o.b=y(a);else if(m(t)){var i=typeof t;if(i==f)t=t.toLowerCase(),"transparent"===t?o.a=0:o.rgb(n(t));else if("number"==i&&h(e))o.r=o.g=o.b=y(t);else if(i==g&&m(t.r))o.r=y(t.r),m(t.g)&&(o.g=y(t.g)),m(t.b)&&(o.b=y(t.b)),m(t.a)&&(o.a=C(t.a,1));else if(i==g&&m(t.h)){var l={h:C(t.h,d),s:1,l:1,a:1};m(t.s)&&(l.s=C(t.s,1)),m(t.l)&&(l.l=C(t.l,1)),m(t.a)&&(l.a=C(t.a,1)),o.rgb(s(l))}}};b.prototype.rgb=function(t){var e=this;if(m(t)){if(typeof t==g)m(t.r)&&(e.r=y(t.r)),m(t.g)&&(e.g=y(t.g)),m(t.b)&&(e.b=y(t.b)),m(t.a)&&(e.a=C(t.a,1));else{var a=v(l(t));e.r=a,e.g=a,e.b=a}return e}return{r:e.r,g:e.g,b:e.b,a:e.a}},b.prototype.hue=function(t){var e=this,a=e.toHsl();return h(t)?a.h:(a.h=C(t,d),e.rgb(s(a)),e)},b.prototype.darken=function(t){var e=this,a=e.toHsl();return a.l-=t/p,a.l=i(a.l,1),e.rgb(s(a)),e},b.prototype.clone=function(){var t=this;return new b(t.r,t.g,t.b,t.a)},b.prototype.lighten=function(t){return this.darken(-t)},b.prototype.fade=function(t){return this.a=i(t/p,1),this},b.prototype.toHsl=function(){var t,a,n=this,r=n.r/u,s=n.g/u,o=n.b/u,i=n.a,l=e.max(r,s,o),c=e.min(r,s,o),p=(l+c)/2,f=l-c;if(l===c)t=a=0;else{switch(a=p>.5?f/(2-l-c):f/(l+c),l){case r:t=(s-o)/f+(s<o?6:0);break;case s:t=(o-r)/f+2;break;case o:t=(r-s)/f+4}t/=6}return{h:t*d,s:a,l:p,a:i}},b.prototype.luma=function(){var t=this.r/u,a=this.g/u,n=this.b/u;return t=t<=.03928?t/12.92:e.pow((t+.055)/1.055,2.4),a=a<=.03928?a/12.92:e.pow((a+.055)/1.055,2.4),n=n<=.03928?n/12.92:e.pow((n+.055)/1.055,2.4),.2126*t+.7152*a+.0722*n},b.prototype.saturate=function(t){var e=this.toHsl();return e.s+=t/p,e.s=i(e.s),this.rgb(s(e))},b.prototype.contrast=function(t,e,a){if(e=h(e)?new b(u,u,u,1):new b(e),t=h(t)?new b(0,0,0,1):new b(t),t.luma()>e.luma()){var n=e;e=t,t=n}return this.a<.5?t:(a=h(a)?.43:l(a),this.luma()<a?e:t)},b.prototype.hexStr=function(){var t=function(t){return t=t.toString(16),1==t.length?"0"+t:t};return"#"+t(this.r)+t(this.g)+t(this.b)},b.prototype.toCssStr=function(){var t=this;return t.a>0?t.a<1?"rgba("+t.r+","+t.g+","+t.b+","+t.a+")":t.hexStr():"transparent"},b.isColor=r,t.Color=b}(CoreLib,Math,void 0),function(t,e,a){"use strict";var n="mzui.skin",r={},s=function(e,a){var n=this;n.options=a=t.extend({},s.DEFAULT,e.data(),a),n.$=e,n.paint()};s.prototype.paint=function(n){var s,o,i=this,l=i.options,c=i.$,u=i.$.hasClass("pale")||l.pale,d=l.outline||c.hasClass("outline"),p=l.tint||c.hasClass("text-tint");if(n=n===e?l.skin:n,u===e&&(i.$.hasClass("dark")||l.dark)&&(u=!1),t.isStr(n)&&n.indexOf(":")>0){n=n.split(":"),o=n[0],n=n[1];var f=parseInt(n);NaN!==f&&(n=f)}if(""===n||n===e||"random"===n)n=a.round(360*a.random());else if(r[n])n=r[n];else if(t.isStr(n)&&0===n.indexOf("random"))r[n]=n=a.round(360*a.random());else if(t.isStr(n)&&0===n.indexOf("@")){for(var g=0,h=n.length-1;h>0;--h)g+=a.pow(3,h-1)*n.charCodeAt(h);n=g}o&&(r[o]=n),s="number"==typeof n?new t.Color({h:n*l.hueSpace%360,s:l.saturation,l:l.lightness}):new t.Color(n),i.color=s,s.luma()<l.threshold?u&&(i.darkColor=s,i.color=new t.Color(t.extend(s.toHsl(),{l:l.paleLight}))):u===!1?(i.paleColor=s,i.color=new t.Color(t.extend(s.toHsl(),{l:l.darkLight}))):(u=!0,p&&(i.darkColor=new t.Color(t.extend(s.toHsl(),{l:l.darkLight}))));var m=i.color.toCssStr(),v={backgroundColor:d?"transparent":m,borderColor:m,color:d?m:u?p?i.darkColor.toCssStr():"":"#fff"};i.$.callEvent(i,"paint",v)!==!1&&c.css(v)},s.NAME=n,s.DEFAULT={skin:"random",hueSpace:47,saturation:.7,lightness:.6,threshold:.5,darkLight:.4,paleLight:.92},s.all=r,s.set=function(e,a){t.isPlainObject(e)?t.extend(s.all,e,a):s.all[e]=a,t("[data-skin]").skin("paint")},t.bindFn("skin",s),t.Skin=s,t(function(){t("[data-skin]").skin()})}(CoreLib,void 0,Math),!function(t,e,a){"use strict";var n="mzui.ajaxform",r=function(r,s){if(r.length&&!r.data(n)){r.data(n,1);var o=function(e,a){var n,o=t.Event(e);return t.isArray(a)||(a=[a]),r.trigger(o,a),n=o.result,s&&t.isFunction(s[e])&&(n=s[e].apply(r,a)),n},i=function(e){var a=r.find(".form-message");if(a.length){var n=a.find(".content");(n.length?n:a).html(e),a.show()}else t.messager.warning(e,{time:1e4})};r.on("submit",function(n){n.preventDefault();var l=r[0],c={};t.each(r.serializeArray(),function(e,n){var r=n.name,s=n.value,o=c[r];if(s instanceof FileList){for(var i=[],l=s.length-1;l>=0;--l)i.push(s[l]);s=i}t.isArray(s)?o===a?o=s:t.isArray(o)?o.push.apply(o,s):(s.push(o),o=s):r.lastIndexOf("]")===r.length-1?o===a?o=[s]:o.push(s):o=s,c[r]=o});var u=o("onSubmit",c);if(u!==!1){u!==a&&(c=u),s.dataConverter&&(c=s.dataConverter(c));var d=new FormData;for(var p in c){var f=c[p];if(t.isArray(f))for(var g=f.length-1;g>=0;--g)d.append(p,f[g]);else d.append(p,f)}var h=r.find('[type="submit"]').attr("disabled","disabled").addClass("disabled loading");t.ajax({url:s.url||l.action,type:s.type||l.method,processData:!1,contentType:!1,dataType:s.dataType||r.data("type")||"json",data:d,success:function(e,n){var s=o("onResponse",[e,n]);if(s!==!1){s!==a&&(e=s);try{if("string"==typeof e&&(e=t.parseJSON(e)),o("onSuccess",e)!==!1)if("success"===e.result)e.message?(t.messager.success(e.message),e.locate&&setTimeout(function(){location.href=e.locate},1200)):e.locate&&(location.href=e.locate);else{var l=e.message||e.reason||e.error;l&&(t.isPlainObject(l)?t.each(l,function(e,a){t.isArray(a)&&a.length&&(a=a.length>1?"<ul><li>"+a.join("</li><li>")+"</li></ul>":a[0]);var n=r.find("#"+e+', [name="'+e+'"]').closest(".control");if(n.length){var s=n.find(".help-text");s.length?s.html(a):n.append('<div class="help-text">'+a+"</div>"),n.addClass("has-error")}else i(a)}):i(l))}}catch(c){o("onError",["Error response."])!==!1&&i(e||"No response.")}o("onResult",e)}},error:function(a,n,r){o("onError",[r,n,a])!==!1&&(i("error: "+r),e.v&&e.v.lang.timeout&&t.messager.danger(e.v.lang.timeout))},complete:function(t,e){h.attr("disabled",null).removeClass("disabled loading"),o("onComplete",{xhr:t,status:e})}})}}).on("change",function(e){r.find(".form-message").hide(),t(e.target).closest(".control").removeClass("has-error")}),o("init")}};t.ajaxForm=r,t.fn.ajaxform=function(e){return t(this).each(function(){var a=t(this);r(a,t.extend(a.data(),e))})},t(function(){t(".ajaxform").ajaxform()})}(CoreLib,window,void 0);
// make creates our URL fragments and rules for rewriting URLs for auth export function make(token, server = "github.com", prefix = "") { prefix = prefix.replace(/^\/+/, "") return { https_url: `https://${server}/${prefix}`, ssh_url: `git@${server}:${prefix}`, auth_url: `https://${token}:x-oauth-basic@${server}/${prefix}`, section: `url.https://${token}:x-oauth-basic@${server}/${prefix}`, auth_rule: `url.https://${token}:x-oauth-basic@${server}/${prefix}.insteadof`, } }
// Schemas const CommunicationRequestSchema = require('../../schemas/communicationrequest.schema'); const BundleSchema = require('../../schemas/bundle.schema'); // Arguments const CommunicationRequestArgs = require('../../parameters/communicationrequest.parameters'); const CommonArgs = require('../../parameters/common.parameters'); // Resolvers const { communicationrequestResolver, communicationrequestListResolver, communicationrequestInstanceResolver } = require('./resolver'); // Scope Utilities const { scopeInvariant } = require('../../../../utils/scope.utils'); let scopeOptions = { name: 'CommunicationRequest', action: 'read', version: '1_0_2' }; /** * @name exports.CommunicationRequestQuery * @summary CommunicationRequest Query. */ module.exports.CommunicationRequestQuery = { args: Object.assign({}, CommonArgs, CommunicationRequestArgs), description: 'Query for a single CommunicationRequest', resolve: scopeInvariant(scopeOptions, communicationrequestResolver), type: CommunicationRequestSchema }; /** * @name exports.CommunicationRequestListQuery * @summary CommunicationRequestList Query. */ module.exports.CommunicationRequestListQuery = { args: Object.assign({}, CommonArgs, CommunicationRequestArgs), description: 'Query for multiple CommunicationRequests', resolve: scopeInvariant(scopeOptions, communicationrequestListResolver), type: BundleSchema }; /** * @name exports.CommunicationRequestInstanceQuery * @summary CommunicationRequestInstance Query. */ module.exports.CommunicationRequestInstanceQuery = { description: 'Get information about a single CommunicationRequest', resolve: scopeInvariant(scopeOptions, communicationrequestInstanceResolver), type: CommunicationRequestSchema };
const { validatePermissions } = require('./../utils'); const { Role } = require('../models'); module.exports = { list: async (req, res) => { const roles = await Role.find({}); return res.json({ roles }); }, get: (req, res) => { return res.json({ role: req.context.role }); }, create: async (req, res) => { const { name, permissions } = req.body; if (name && permissions) { const { isValid, invalids } = validatePermissions(permissions); if (isValid) { const role = await Role.create({ ...req.body, }); return res.json({ role, message: 'Role created successfully.' }); } return res .status(400) .json({ message: 'You entered invalid permissions.', invalids }); } return res .status(400) .json({ message: 'name and permissions are required.' }); }, update: async (req, res) => { const { name, permissions } = req.body; if (name && permissions) { const { isValid, invalids } = validatePermissions(permissions); if (isValid) { const { role } = req.context; role.name = name; role.permissions = permissions; await role.save(); return res.json({ role, message: 'Role updated successfully.' }); } return res .status(400) .json({ message: 'You entered invalid permissions.', invalids }); } return res .status(400) .json({ message: 'name and permissions are required.' }); }, delete: async (req, res) => { if (await req.context.role.users) { return res.status(400).json({ message: 'The role cannot be deleted because there are users that belong to it.', }); } await req.context.role.delete(); return res.json({ message: 'Role deleted successfully.' }); }, };
import Image from '../classes/Image' import TileSet from '../classes/TileSet' class TiledSet extends TileSet { constructor( image /*A single image file to extrapolate from */, data /*Tiled format JSON data */ ) { super(image, data) this.image = typeof image == 'string' ? new Image(image) : image this.data = data this.length = data.tilecount } nthImage(n) { if (n < 0) throw new Error('N must be greater than or equal to 0') if (n >= this.data.tilecount) throw new Error('Invalid Tile Number, exceeds max for tileset') const { tilewidth, tileheight, imagewidth, columns, spacing = 0 } = this.data let x = (n % columns) * (tilewidth + spacing) let y = Math.floor(n / columns) * (tileheight + spacing) return Image.fromSpriteSheet(this.image, x, y, tilewidth, tileheight) } } export default TiledSet
var startRide = document.getElementById('start'); var endRide = document.getElementById('end'); var form = document.getElementById('form'); var otp = document.getElementById('otp'); var tracker; var socket; //start emitting location coor. startRide.addEventListener('click', sendLocation); //end emitting location coor. endRide.addEventListener('click',stop); //functions function sendLocation(){ socket = io.connect('https://ambulancetrackerapk.herokuapp.com/'); tracker = setInterval(getLocation, 10000); startRide.classList.add('d-none'); // endRide.classList.remove('d-none'); form.classList.remove('d-none'); alert("Ride Initiated\nPlease fill the form!!!") } function test(){ console.log('h'); } function getLocation(){ if (navigator.geolocation){ navigator.geolocation.getCurrentPosition(showPosition); }else{ console.log("Geolocation is not supported by this browser."); } } function showPosition(position) { socket.emit('liveLocation',{lat:position.coords.latitude, lon:position.coords.longitude}); console.log(position.coords.latitude); console.log(position.coords.longitude); } function stop(){ clearInterval(tracker); socket.emit('nowAvailable'); socket.close(); location.reload(); startRide.classList.remove('d-none'); endRide.classList.add('d-none'); form.classList.add('d-none'); } function submitdata(event){ event.preventDefault(); // console.log(document.getElementById('roll_no').val()) var formdata = { patient: document.getElementById('roll_no').value, acmp1: document.getElementById('acmp1').value, acmp2: document.getElementById('acmp2').value } // console.log(56) // alert(formdata); $.ajax({ url: "/driver/otp/", type: "POST", data: formdata, success: function (data) { document.getElementById('cotp').value = data; alert(data) } }); form.classList.add('d-none'); otp.classList.remove('d-none'); } function otpdata(event){ event.preventDefault(); var otpdata = { cotp: document.getElementById('cotp').value, otp: document.getElementById('otpip').value } $.ajax({ url: "/driver/confirmotp/", type: "POST", data: otpdata, success: function (data) { if(data === true){ otp.classList.add('d-none'); endRide.classList.remove('d-none'); }else{ alert('Enter Valid OTP!!!') document.getElementById('otpip').value = ""; } } }); } $("#submitbtn").click(submitdata); $("#otpbtn").click(otpdata);
/** * Izdevumu JavaScript funkcionalitāte * * @type _L4.Anonym$0|Function */ var BlockPublish = function() { /** * Norāda, cik ieraksti jāizlaiž pieprasot ielādēt nākamo izdevumu porciju, spiežot pogu "Ielādēt vairāk" * * @type Number */ var skip = 0; /** * Norāda, pēc kāda gada tika veikta meklēšana * Nepieciešams, lai padotu AJAX pieprasījumam nākamo izdevumu pielādēšanai * * @type Number */ var filt_year = 0; /** * Norāda, pēc kāda mēneša tika veikta meklēšana * Nepieciešams, lai padotu AJAX pieprasījumam nākamo izdevumu pielādēšanai * * @type Number */ var filt_month = 0; /** * Pazīme, vai tika jau pievienota pārzīmēšanas apstrāde * * @returns {undefined} */ var is_resize_handler_added = 0; /** * Atgriež masīvu ar cubeportfolio komponentes objekta iestatījumiem * * @returns {_L6.getCubeOptions.Anonym$0} */ var getCubeOptions = function() { return { filters: '#js-filters-juicy-projects', layoutMode: 'grid', loadMoreAction: 'click', defaultFilter: '*', animationType: 'quicksand', gapHorizontal: 35, gapVertical: 30, gridAdjustment: 'responsive', mediaQueries: [{ width: 1500, cols: 5 }, { width: 1100, cols: 4 }, { width: 800, cols: 3 }, { width: 480, cols: 2 }, { width: 320, cols: 1 }], caption: 'overlayBottomReveal', displayType: 'sequentially', displayTypeSpeed: 80 }; }; /** * Uzzīmē galeriju objektu ar cubeportfolio komponenti * * @returns {undefined} */ var drawCubeGalery = function() { if ($("#js-grid-juicy-projects").hasClass("dx_init_ok")) { $("#js-grid-juicy-projects").removeClass("dx_init_ok"); jQuery("#js-grid-juicy-projects").off('initComplete.cbp'); $("#js-grid-juicy-projects").cubeportfolio('destroy'); } jQuery("#js-grid-juicy-projects").on('initComplete.cbp', function() { $("#js-grid-juicy-projects").addClass("dx_init_ok"); if (is_resize_handler_added ==0) { is_resize_handler_added = 1; PageMain.addResizeCallback(drawCubeGalery); } }); $("#js-grid-juicy-projects").cubeportfolio('init', getCubeOptions()); }; /** * Izpilda AJAX pieprasījumu un pieladē papildus galerijas * * @returns {undefined} */ var addGaleryItems = function() { /* var formData = new FormData(); formData.append("param", "OBJ=PUBLISH"); formData.append("skip", skip); formData.append("nr", filt_month); formData.append("year", filt_year); */ var formData = "param=" + encodeURIComponent("OBJ=PUBLISH") + "&skip=" + skip + "&nr=" + filt_month + "&year=" + filt_year; var ajax_url = 'block_ajax'; $("#load_more_link").text("IELĀDĒ..."); var request = new FormAjaxRequestIE9 (ajax_url, "", "", formData); request.progress_info = "Ielādē datus. Lūdzu, uzgaidiet..."; request.callback = function(data) { skip = data.data.skip; var scroll_down = function(){ var d = $("body"); d.scrollTop(d.prop("scrollHeight")); }; $("#js-grid-juicy-projects").cubeportfolio('appendItems', data['html'], scroll_down); if (data.data.is_last) { $("#load_more_link").hide(); } else { $("#load_more_link").text("VAIRĀK"); } }; // izpildam AJAX pieprasījumu request.doRequest(); }; /** * Meklēšanas pogas nospiešana - uzstāda progresa paziņojumu lapai * Progresa paziņojuma funkcija no dx_core.js * * @returns {undefined} */ var handleBtnSearch = function() { $("#search_galeries_btn").click(function() { show_page_splash(); }); }; /** * Ielādēt vairāk pogas nospiešana - izpilda AJAX pieprasījumu un ielādē papildus izdevumus * * @returns {undefined} */ var handleLoadMoreLink = function() { $("#load_more_link").click(function(e){ e.preventDefault(); addGaleryItems(); }); }; /** * Uzstāda izdevumu bloka parametrus * * @param {object} block Izdevumu bloka elements * @returns {undefined} */ var setParameters = function(block) { skip = block.attr('dx_skip'); filt_month = block.attr('dx_filt_month'); filt_year = block.attr('dx_filt_year'); }; /** * Apstrādā un inicializē vēl neinicializēto izdevumu bloku * * @returns {undefined} */ var initPublish = function() { var page_elem = $(".dx-block-container-publish[dx_block_init='0']"); if (page_elem.length == 0) { return; // nav vairs ko inicializēt } setParameters(page_elem); handleBtnSearch(); handleLoadMoreLink(); drawCubeGalery(); page_elem.attr('dx_block_init', 1); // uzstādam pazīmi, ka bloks ir inicializēts }; return { init: function() { initPublish(); } }; }(); $(document).ready(function() { BlockPublish.init(); });
import parseTemplate from '../../javascripts/utils/parse-template.util'; describe('parseTemplate utility', () => { let template; describe('Given a template contains a placeholder', () => { beforeEach(() => { template = 'A quick brown {placeholder} jumps over the lazy dog'; }); describe('When parseTemplate is called with placeholder="fox"', () => { beforeEach(() => { template = parseTemplate(template, { placeholder: 'fox' }); }); it('Then template should equal to "A quick brown fox jumps over the lazy dog"', () => { expect(template).toEqual('A quick brown fox jumps over the lazy dog'); }); }); describe('When parseTemplate is called without providing a substitute for the placeholder', () => { beforeEach(() => { template = parseTemplate(template, {}); }); it('Then template should equal to "A quick brown {placeholder} jumps over the lazy dog"', () => { expect(template).toEqual('A quick brown {placeholder} jumps over the lazy dog'); }); }); }); describe('Given a template contains multiple placeholders', () => { beforeEach(() => { template = 'A quick brown {placeholder} jumps over the lazy {placeholder2}'; }); describe('When parseTemplate is called with placeholder="fox" and placeholder2="dog"', () => { beforeEach(() => { template = parseTemplate(template, { placeholder: 'fox', placeholder2: 'dog' }); }); it('Then template should equal to "A quick brown fox jumps over the lazy dog"', () => { expect(template).toEqual('A quick brown fox jumps over the lazy dog'); }); }); }); describe('Given a template contains multiple instances of a placeholder', () => { beforeEach(() => { template = '{placeholder}, {placeholder}, {placeholder} your boat'; }); describe('When parseTemplate is called with placeholder="row"', () => { beforeEach(() => { template = parseTemplate(template, { placeholder: 'row' }); }); it('Then template should equal to "row, row, row your boat"', () => { expect(template).toEqual('row, row, row your boat'); }); }); }); });
const { ConseilDataClient, ConseilOperator, ConseilSortDirection, registerFetch, registerLogger, TezosConseilClient, TezosLanguageUtil, TezosMessageUtils, TezosNodeReader, TezosNodeWriter, TezosParameterFormat, TezosConstants, } = require("conseiljs"); const { KeyStoreUtils, SoftSigner } = require("conseiljs-softsigner"); const { JSONPath } = require("jsonpath-plus"); const log = require("loglevel"); const fetch = require("node-fetch"); module.exports = class Tezos { constructor(privateKey, priceContract, chainID, rpc, conseilServer, mutex) { this.account = ""; // tezos wallet address this.privateKey = privateKey; // tezos private key this.rpc = rpc; // rpc server address for network interaction this.conseilServer = conseilServer; // conseil server setting this.priceContract = priceContract; // tezos harbinger oracle contract details {address:string, mapID:nat} this.chainID = chainID; // chain id being used this.mutex = mutex; } /** * Initiate conseil keystore and signer */ async initConseil() { const logger = log.getLogger("conseiljs"); logger.setLevel("error", false); registerLogger(logger); registerFetch(fetch); this.keyStore = await KeyStoreUtils.restoreIdentityFromSecretKey( this.privateKey ); this.account = this.keyStore.publicKeyHash; this.signer = await SoftSigner.createSigner( TezosMessageUtils.writeKeyWithHint(this.keyStore.secretKey, "edsk") ); } /** * Get the tezos balance for an account * * @param address tezos address for the account */ async balance(address) { return await TezosNodeReader.getSpendableBalanceForAccount( this.rpc, address ); } /** * Get the tezos fa1.2 token balance for an account * * @param tokenContract tezos fa1.2 token contract details {address:string, mapID:nat} * @param address tezos address for the account */ async tokenBalance(tokenContract, address) { const key = TezosMessageUtils.encodeBigMapKey( Buffer.from(TezosMessageUtils.writePackedData(address, "address"), "hex") ); let tokenData = undefined; try { tokenData = await TezosNodeReader.getValueForBigMapKey( this.rpc, tokenContract.mapID, key ); } catch (err) { if (!(Object.prototype.hasOwnProperty.call(err, "httpStatus") && err.httpStatus === 404)) throw err; } let balance = tokenData === undefined ? "0" : JSONPath({ path: "$.args[0].int", json: tokenData })[0]; return balance; } /** * Get the tezos fa1.2 token allowance for swap contract by an account * * @param tokenContract tezos fa1.2 token contract details {address:string, mapID:nat} * @param swapContract tezos swap contract details {address:string, mapID:nat} * @param address tezos address for the account */ async tokenAllowance(tokenContract, swapContract, address) { const key = TezosMessageUtils.encodeBigMapKey( Buffer.from(TezosMessageUtils.writePackedData(address, "address"), "hex") ); let tokenData = undefined; try { tokenData = await TezosNodeReader.getValueForBigMapKey( this.rpc, tokenContract.mapID, key ); } catch (err) { if (!(Object.prototype.hasOwnProperty.call(err, "httpStatus") && err.httpStatus === 404)) throw err; } let allowances = tokenData === undefined ? undefined : JSONPath({ path: "$.args[1]", json: tokenData })[0]; const allowance = allowances === undefined ? [] : allowances.filter( (allow) => allow.args[0].string === swapContract.address ); return allowance.length === 0 ? "0" : allowance[0].args[1].int; } /** * Approve tokens for the swap contract * * @param tokenContract tezos fa1.2 token contract details {address:string, mapID:nat} * @param swapContract tezos swap contract details {address:string, mapID:nat} * @param amount the quantity of fa1.2 tokens to be approved */ async approveToken(tokenContract, swapContract, amount) { const allow = await this.tokenAllowance( tokenContract, swapContract, this.account ); let ops = []; if (parseInt(allow) > 0) { ops.push({ amtInMuTez: 0, entrypoint: "approve", parameters: `(Pair "${swapContract.address}" 0)`, to: tokenContract.address, }); } ops.push({ amtInMuTez: 0, entrypoint: "approve", parameters: `(Pair "${swapContract.address}" ${amount})`, to: tokenContract.address, }); const res = await this.interact(ops); if (res.status !== "applied") { throw new Error("TEZOS TX FAILED"); } return res; } /** * Initiate a swap offer on the tezos chain * * @param swapContract tezos swap contract details {address:string, mapID:nat} * @param hashedSecret hash of the swap * @param pair swap pair used * @param asset asset in the pair being traded * @param refundTimestamp time after which the swap exires * @param amount value of the swap in fa1.2 tokens or mutez * @param expectedValue value expected in return in coiunter asset units * @param mutez amount in mutez being sent (default=0) */ async offer( swapContract, hashedSecret, pair, asset, refundTimestamp, amount, expectedValue, mutez = 0 ) { const res = await this.interact([ { to: swapContract.address, amtInMuTez: mutez, entrypoint: "offer", parameters: `(Pair (Pair "${asset}" (Pair ${expectedValue} "${pair}")) (Pair "${refundTimestamp}" (Pair ${hashedSecret} ${amount})))`, }, ]); if (res.status !== "applied") { throw new Error("TEZOS TX FAILED"); } return res; } /** * Accept an existing swap offer on the tezos chain * * @param swapContract tezos swap contract details {address:string, mapID:nat} * @param hashedSecret hash of the swap * @param pair swap pair used * @param asset asset in the pair being traded * @param amount value of the swap in fa1.2 tokens or mutez * @param mutez amount in mutez being sent (default=0) */ async take(swapContract, hashedSecret, pair, asset, amount, mutez = 0) { const res = await this.interact([ { to: swapContract.address, amtInMuTez: mutez, entrypoint: "take", parameters: `(Pair (Pair "${asset}" "${pair}") (Pair ${hashedSecret} ${amount}))`, }, ]); if (res.status !== "applied") { throw new Error("TEZOS TX FAILED"); } return res; } /** * Refund the swap if possible * * @param swapContract tezos swap contract details {address:string, mapID:nat} * @param hashedSecret hash of the swap being refunded */ async refund(swapContract, hashedSecret) { const res = await this.interact([ { to: swapContract.address, amtInMuTez: 0, entrypoint: "refund", parameters: `${hashedSecret}`, }, ]); if (res.status !== "applied") { throw new Error("TEZOS TX FAILED"); } return res; } /** * Get reward basis points for responding to swaps * * @param swapContract tezos swap contract details {address:string, mapID:nat} */ async getReward(swapContract) { const storage = await TezosNodeReader.getContractStorage( this.rpc, swapContract.address ); return { commission: parseInt( JSONPath({ path: "$.args[3].int", json: storage, })[0] ), reward: parseInt( JSONPath({ path: "$.args[1].args[1].int", json: storage, })[0] ), }; } /** * Get the current asset pair price from the harbinger oracle * * @param asset asset pair eg. ETH-USD as supported by harbinger */ async getPrice(asset) { const packedKey = TezosMessageUtils.encodeBigMapKey( Buffer.from(TezosMessageUtils.writePackedData(asset, "string"), "hex") ); let jsonData = undefined; try { jsonData = await TezosNodeReader.getValueForBigMapKey( this.rpc, this.priceContract.mapID, packedKey ); } catch (err) { if (!(Object.prototype.hasOwnProperty.call(err, "httpStatus") && err.httpStatus === 404)) throw err; } return parseInt( JSONPath({ path: "$.args[0].args[0].int", json: jsonData, })[0] ); } parseSwapValue(michelsonData) { const michelineData = TezosLanguageUtil.translateMichelsonToMicheline(michelsonData); const jsonData = JSON.parse(michelineData); return { hashedSecret: "0x" + JSONPath({ path: "$.bytes", json: jsonData[2], })[0], initiator: TezosMessageUtils.readAddress(JSONPath({ path: "$.args[1].args[1].bytes", json: jsonData[0], })[0]), pair: JSONPath({ path: "$.args[0].string", json: jsonData[1], })[0], asset: JSONPath({ path: "$.args[0].args[0].string", json: jsonData[0], })[0], commission: JSONPath({ path: "$.args[0].args[1].int", json: jsonData[0], })[0], refundTimestamp: Number( JSONPath({ path: "$.args[1].int", json: jsonData[1], })[0] ), value: JSONPath({ path: "$.int", json: jsonData[3] })[0], expectedValue: JSONPath({ path: "$.args[1].args[0].int", json: jsonData[0], })[0], }; } /** * Get details of a particular swap * * @param swapContract tezos swap contract details {address:string, mapID:nat} * @param hashedSecret hash of the swap requested * @param key_hash key hash for the bigmap to query * * @return the swap details if available */ async getSwap(swapContract, hashedSecret, key_hash = undefined) { let packedKey = ""; if (key_hash === undefined) { hashedSecret = hashedSecret.substring(2); packedKey = TezosMessageUtils.encodeBigMapKey( Buffer.from(TezosMessageUtils.writePackedData(hashedSecret, "bytes"), "hex") ); } else { packedKey = key_hash; } let jsonData = undefined; try { jsonData = await TezosNodeReader.getValueForBigMapKey( this.rpc, swapContract.mapID, packedKey ); } catch (err) { if (!(Object.prototype.hasOwnProperty.call(err, "httpStatus") && err.httpStatus === 404)) throw err; } if (jsonData === undefined) return jsonData; return { hashedSecret: "0x" + JSONPath({ path: "$.args[2].bytes", json: jsonData, })[0], initiator: JSONPath({ path: "$.args[0].args[2].string", json: jsonData, })[0], pair: JSONPath({ path: "$.args[1].args[0].string", json: jsonData, })[0], asset: JSONPath({ path: "$.args[0].args[0].args[0].string", json: jsonData, })[0], commission: JSONPath({ path: "$.args[0].args[0].args[1].int", json: jsonData, })[0], refundTimestamp: Number( Math.floor( new Date( JSONPath({ path: "$.args[1].args[1].string", json: jsonData, })[0] ).getTime() / 1000 ) ), value: JSONPath({ path: "$.args[3].int", json: jsonData })[0], expectedValue: JSONPath({ path: "$.args[0].args[1].int", json: jsonData, })[0], }; } /** * Get the list of all active swaps * * @param swapContract tezos swap contract details {address:string, mapID:nat} * @return a list of all active swaps with their details */ async getAllSwaps(swapContract) { const data = await ConseilDataClient.executeEntityQuery( this.conseilServer, "tezos", this.conseilServer.network, "big_map_contents", { fields: [ "key", "value", ], predicates: [ { field: "big_map_id", operation: ConseilOperator.EQ, set: [swapContract.mapID.toString()], inverse: false, }, { field: "value", operation: ConseilOperator.ISNULL, set: [""], inverse: true, }, ], orderBy: [{ field: "key", direction: ConseilSortDirection.DESC }], aggregation: [], limit: 1000, } ); let swaps = []; data.forEach((e) => { if (e.value !== null) swaps.push(this.parseSwapValue(e.value)); }); return swaps; } /** * Get the list of all active swaps initiated by a specific user * * @param swapContract tezos swap contract details {address:string, mapID:nat} * @param account tezos address of the user whose swaps are to be retrieved * * @return a list of all active swaps initiated by a specific user */ async getUserSwaps(swapContract, account) { const swaps = await this.getAllSwaps(swapContract); return swaps.filter((swp) => swp.initiator === account); } /** * Get all swaps waiting for a response matching the min expire time requested * * @param swapContract tezos swap contract details {address:string, mapID:nat} * @param minTimeToExpire minimum time left for swap to expire in seconds * * @return a list of waiting swaps with details */ async getWaitingSwaps(swapContract, minTimeToExpire) { const swaps = await this.getAllSwaps(swapContract); return swaps.filter( (swp) => swp.initiator !== this.account && Math.trunc(Date.now() / 1000) < swp.refundTimestamp - minTimeToExpire ); } /** * Add Swap Pairs (only admin) * * @param swapContract tezos swap contract details {address:string, mapID:nat} * @param assets asset dict from config */ async addPairs(swapContract, assets) { const res = await this.interact([ { to: swapContract.address, amtInMuTez: 0, entrypoint: "addSwapPair", parameters: `{ Elt "ethtz/usdtz" { Elt "ethtz" (Pair "${assets["ethtz"].tokenContract.address}" (Pair "usdtz" 18)); Elt "usdtz" (Pair "${assets["usdtz"].tokenContract.address}" (Pair "ethtz" 6))}; Elt "xtz/ethtz" {Elt "ethtz" (Pair "${assets["ethtz"].tokenContract.address}" (Pair "xtz" 18)); Elt "xtz" (Pair "${swapContract.address}" (Pair "ethtz" 6))}; Elt "xtz/usdtz" {Elt "usdtz" (Pair "${assets["usdtz"].tokenContract.address}" (Pair "xtz" 6)); Elt "xtz" (Pair "${swapContract.address}" (Pair "usdtz" 6))}}`, }, ]); if (res.status !== "applied") { throw new Error("TEZOS TX FAILED"); } return res; } /** * Send a tx to the blockchain * * @param operations List of operations needed to be sent to the chain * @param extraGas extra gas to add for the tx (user choice) * @param extraStorage extra storage to add for the tx (user choice) * * @return operation result */ async interact(operations, extraGas = 500, extraStorage = 50) { await this.mutex.acquire(); try { for (let i = 0; i < operations.length; i++) { const fee = 105000, storageLimit = 6000, gasLimit = 1000000; const result = await TezosNodeWriter.sendContractInvocationOperation( this.rpc, this.signer, this.keyStore, operations[i].to, operations[i].amtInMuTez, fee, storageLimit + extraStorage, gasLimit + extraGas, operations[i].entrypoint, operations[i].parameters, TezosParameterFormat.Michelson, TezosConstants.HeadBranchOffset, true ); const groupid = result["operationGroupID"] .replace(/"/g, "") .replace(/\n/, ""); // clean up RPC output console.log("TEZOS TX HASH: ", groupid); const opRes = await TezosConseilClient.awaitOperationConfirmation( this.conseilServer, this.conseilServer.network, groupid, 2 ); if (opRes.status != "applied") { return opRes; } } return { status: "applied" }; } catch (err) { console.error("TEZOS TX ERROR : ", err); throw err; } finally { this.mutex.release(); } } };
//Provides: bigInt const var bigInt = (function (undefined) { "use strict"; var BASE = 1e7, LOG_BASE = 7, MAX_INT = 9007199254740992, MAX_INT_ARR = smallToArray(MAX_INT), DEFAULT_ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyz"; var supportsNativeBigInt = typeof BigInt === "function"; function Integer(v, radix, alphabet, caseSensitive) { if (typeof v === "undefined") return Integer[0]; if (typeof radix !== "undefined") return +radix === 10 && !alphabet ? parseValue(v) : parseBase(v, radix, alphabet, caseSensitive); return parseValue(v); } function BigInteger(value, sign) { this.value = value; this.sign = sign; this.isSmall = false; } BigInteger.prototype = Object.create(Integer.prototype); function SmallInteger(value) { this.value = value; this.sign = value < 0; this.isSmall = true; } SmallInteger.prototype = Object.create(Integer.prototype); function NativeBigInt(value) { this.value = value; } NativeBigInt.prototype = Object.create(Integer.prototype); function isPrecise(n) { return -MAX_INT < n && n < MAX_INT; } function smallToArray(n) { // For performance reasons doesn't reference BASE, need to change this function if BASE changes if (n < 1e7) return [n]; if (n < 1e14) return [n % 1e7, Math.floor(n / 1e7)]; return [n % 1e7, Math.floor(n / 1e7) % 1e7, Math.floor(n / 1e14)]; } function arrayToSmall(arr) { // If BASE changes this function may need to change trim(arr); var length = arr.length; if (length < 4 && compareAbs(arr, MAX_INT_ARR) < 0) { switch (length) { case 0: return 0; case 1: return arr[0]; case 2: return arr[0] + arr[1] * BASE; default: return arr[0] + (arr[1] + arr[2] * BASE) * BASE; } } return arr; } function trim(v) { var i = v.length; while (v[--i] === 0); v.length = i + 1; } function createArray(length) { // function shamelessly stolen from Yaffle's library https://github.com/Yaffle/BigInteger var x = new Array(length); var i = -1; while (++i < length) { x[i] = 0; } return x; } function truncate(n) { if (n > 0) return Math.floor(n); return Math.ceil(n); } function add(a, b) { // assumes a and b are arrays with a.length >= b.length var l_a = a.length, l_b = b.length, r = new Array(l_a), carry = 0, base = BASE, sum, i; for (i = 0; i < l_b; i++) { sum = a[i] + b[i] + carry; carry = sum >= base ? 1 : 0; r[i] = sum - carry * base; } while (i < l_a) { sum = a[i] + carry; carry = sum === base ? 1 : 0; r[i++] = sum - carry * base; } if (carry > 0) r.push(carry); return r; } function addAny(a, b) { if (a.length >= b.length) return add(a, b); return add(b, a); } function addSmall(a, carry) { // assumes a is array, carry is number with 0 <= carry < MAX_INT var l = a.length, r = new Array(l), base = BASE, sum, i; for (i = 0; i < l; i++) { sum = a[i] - base + carry; carry = Math.floor(sum / base); r[i] = sum - carry * base; carry += 1; } while (carry > 0) { r[i++] = carry % base; carry = Math.floor(carry / base); } return r; } BigInteger.prototype.add = function (v) { var n = parseValue(v); if (this.sign !== n.sign) { return this.subtract(n.negate()); } var a = this.value, b = n.value; if (n.isSmall) { return new BigInteger(addSmall(a, Math.abs(b)), this.sign); } return new BigInteger(addAny(a, b), this.sign); }; BigInteger.prototype.plus = BigInteger.prototype.add; SmallInteger.prototype.add = function (v) { var n = parseValue(v); var a = this.value; if (a < 0 !== n.sign) { return this.subtract(n.negate()); } var b = n.value; if (n.isSmall) { if (isPrecise(a + b)) return new SmallInteger(a + b); b = smallToArray(Math.abs(b)); } return new BigInteger(addSmall(b, Math.abs(a)), a < 0); }; SmallInteger.prototype.plus = SmallInteger.prototype.add; NativeBigInt.prototype.add = function (v) { return new NativeBigInt(this.value + parseValue(v).value); } NativeBigInt.prototype.plus = NativeBigInt.prototype.add; function subtract(a, b) { // assumes a and b are arrays with a >= b var a_l = a.length, b_l = b.length, r = new Array(a_l), borrow = 0, base = BASE, i, difference; for (i = 0; i < b_l; i++) { difference = a[i] - borrow - b[i]; if (difference < 0) { difference += base; borrow = 1; } else borrow = 0; r[i] = difference; } for (i = b_l; i < a_l; i++) { difference = a[i] - borrow; if (difference < 0) difference += base; else { r[i++] = difference; break; } r[i] = difference; } for (; i < a_l; i++) { r[i] = a[i]; } trim(r); return r; } function subtractAny(a, b, sign) { var value; if (compareAbs(a, b) >= 0) { value = subtract(a, b); } else { value = subtract(b, a); sign = !sign; } value = arrayToSmall(value); if (typeof value === "number") { if (sign) value = -value; return new SmallInteger(value); } return new BigInteger(value, sign); } function subtractSmall(a, b, sign) { // assumes a is array, b is number with 0 <= b < MAX_INT var l = a.length, r = new Array(l), carry = -b, base = BASE, i, difference; for (i = 0; i < l; i++) { difference = a[i] + carry; carry = Math.floor(difference / base); difference %= base; r[i] = difference < 0 ? difference + base : difference; } r = arrayToSmall(r); if (typeof r === "number") { if (sign) r = -r; return new SmallInteger(r); } return new BigInteger(r, sign); } BigInteger.prototype.subtract = function (v) { var n = parseValue(v); if (this.sign !== n.sign) { return this.add(n.negate()); } var a = this.value, b = n.value; if (n.isSmall) return subtractSmall(a, Math.abs(b), this.sign); return subtractAny(a, b, this.sign); }; BigInteger.prototype.minus = BigInteger.prototype.subtract; SmallInteger.prototype.subtract = function (v) { var n = parseValue(v); var a = this.value; if (a < 0 !== n.sign) { return this.add(n.negate()); } var b = n.value; if (n.isSmall) { return new SmallInteger(a - b); } return subtractSmall(b, Math.abs(a), a >= 0); }; SmallInteger.prototype.minus = SmallInteger.prototype.subtract; NativeBigInt.prototype.subtract = function (v) { return new NativeBigInt(this.value - parseValue(v).value); } NativeBigInt.prototype.minus = NativeBigInt.prototype.subtract; BigInteger.prototype.negate = function () { return new BigInteger(this.value, !this.sign); }; SmallInteger.prototype.negate = function () { var sign = this.sign; var small = new SmallInteger(-this.value); small.sign = !sign; return small; }; NativeBigInt.prototype.negate = function () { return new NativeBigInt(-this.value); } BigInteger.prototype.abs = function () { return new BigInteger(this.value, false); }; SmallInteger.prototype.abs = function () { return new SmallInteger(Math.abs(this.value)); }; NativeBigInt.prototype.abs = function () { return new NativeBigInt(this.value >= 0 ? this.value : -this.value); } function multiplyLong(a, b) { var a_l = a.length, b_l = b.length, l = a_l + b_l, r = createArray(l), base = BASE, product, carry, i, a_i, b_j; for (i = 0; i < a_l; ++i) { a_i = a[i]; for (var j = 0; j < b_l; ++j) { b_j = b[j]; product = a_i * b_j + r[i + j]; carry = Math.floor(product / base); r[i + j] = product - carry * base; r[i + j + 1] += carry; } } trim(r); return r; } function multiplySmall(a, b) { // assumes a is array, b is number with |b| < BASE var l = a.length, r = new Array(l), base = BASE, carry = 0, product, i; for (i = 0; i < l; i++) { product = a[i] * b + carry; carry = Math.floor(product / base); r[i] = product - carry * base; } while (carry > 0) { r[i++] = carry % base; carry = Math.floor(carry / base); } return r; } function shiftLeft(x, n) { var r = []; while (n-- > 0) r.push(0); return r.concat(x); } function multiplyKaratsuba(x, y) { var n = Math.max(x.length, y.length); if (n <= 30) return multiplyLong(x, y); n = Math.ceil(n / 2); var b = x.slice(n), a = x.slice(0, n), d = y.slice(n), c = y.slice(0, n); var ac = multiplyKaratsuba(a, c), bd = multiplyKaratsuba(b, d), abcd = multiplyKaratsuba(addAny(a, b), addAny(c, d)); var product = addAny(addAny(ac, shiftLeft(subtract(subtract(abcd, ac), bd), n)), shiftLeft(bd, 2 * n)); trim(product); return product; } // The following function is derived from a surface fit of a graph plotting the performance difference // between long multiplication and karatsuba multiplication versus the lengths of the two arrays. function useKaratsuba(l1, l2) { return -0.012 * l1 - 0.012 * l2 + 0.000015 * l1 * l2 > 0; } BigInteger.prototype.multiply = function (v) { var n = parseValue(v), a = this.value, b = n.value, sign = this.sign !== n.sign, abs; if (n.isSmall) { if (b === 0) return Integer[0]; if (b === 1) return this; if (b === -1) return this.negate(); abs = Math.abs(b); if (abs < BASE) { return new BigInteger(multiplySmall(a, abs), sign); } b = smallToArray(abs); } if (useKaratsuba(a.length, b.length)) // Karatsuba is only faster for certain array sizes return new BigInteger(multiplyKaratsuba(a, b), sign); return new BigInteger(multiplyLong(a, b), sign); }; BigInteger.prototype.times = BigInteger.prototype.multiply; function multiplySmallAndArray(a, b, sign) { // a >= 0 if (a < BASE) { return new BigInteger(multiplySmall(b, a), sign); } return new BigInteger(multiplyLong(b, smallToArray(a)), sign); } SmallInteger.prototype._multiplyBySmall = function (a) { if (isPrecise(a.value * this.value)) { return new SmallInteger(a.value * this.value); } return multiplySmallAndArray(Math.abs(a.value), smallToArray(Math.abs(this.value)), this.sign !== a.sign); }; BigInteger.prototype._multiplyBySmall = function (a) { if (a.value === 0) return Integer[0]; if (a.value === 1) return this; if (a.value === -1) return this.negate(); return multiplySmallAndArray(Math.abs(a.value), this.value, this.sign !== a.sign); }; SmallInteger.prototype.multiply = function (v) { return parseValue(v)._multiplyBySmall(this); }; SmallInteger.prototype.times = SmallInteger.prototype.multiply; NativeBigInt.prototype.multiply = function (v) { return new NativeBigInt(this.value * parseValue(v).value); } NativeBigInt.prototype.times = NativeBigInt.prototype.multiply; function square(a) { //console.assert(2 * BASE * BASE < MAX_INT); var l = a.length, r = createArray(l + l), base = BASE, product, carry, i, a_i, a_j; for (i = 0; i < l; i++) { a_i = a[i]; carry = 0 - a_i * a_i; for (var j = i; j < l; j++) { a_j = a[j]; product = 2 * (a_i * a_j) + r[i + j] + carry; carry = Math.floor(product / base); r[i + j] = product - carry * base; } r[i + l] = carry; } trim(r); return r; } BigInteger.prototype.square = function () { return new BigInteger(square(this.value), false); }; SmallInteger.prototype.square = function () { var value = this.value * this.value; if (isPrecise(value)) return new SmallInteger(value); return new BigInteger(square(smallToArray(Math.abs(this.value))), false); }; NativeBigInt.prototype.square = function (v) { return new NativeBigInt(this.value * this.value); } function divMod1(a, b) { // Left over from previous version. Performs faster than divMod2 on smaller input sizes. var a_l = a.length, b_l = b.length, base = BASE, result = createArray(b.length), divisorMostSignificantDigit = b[b_l - 1], // normalization lambda = Math.ceil(base / (2 * divisorMostSignificantDigit)), remainder = multiplySmall(a, lambda), divisor = multiplySmall(b, lambda), quotientDigit, shift, carry, borrow, i, l, q; if (remainder.length <= a_l) remainder.push(0); divisor.push(0); divisorMostSignificantDigit = divisor[b_l - 1]; for (shift = a_l - b_l; shift >= 0; shift--) { quotientDigit = base - 1; if (remainder[shift + b_l] !== divisorMostSignificantDigit) { quotientDigit = Math.floor((remainder[shift + b_l] * base + remainder[shift + b_l - 1]) / divisorMostSignificantDigit); } // quotientDigit <= base - 1 carry = 0; borrow = 0; l = divisor.length; for (i = 0; i < l; i++) { carry += quotientDigit * divisor[i]; q = Math.floor(carry / base); borrow += remainder[shift + i] - (carry - q * base); carry = q; if (borrow < 0) { remainder[shift + i] = borrow + base; borrow = -1; } else { remainder[shift + i] = borrow; borrow = 0; } } while (borrow !== 0) { quotientDigit -= 1; carry = 0; for (i = 0; i < l; i++) { carry += remainder[shift + i] - base + divisor[i]; if (carry < 0) { remainder[shift + i] = carry + base; carry = 0; } else { remainder[shift + i] = carry; carry = 1; } } borrow += carry; } result[shift] = quotientDigit; } // denormalization remainder = divModSmall(remainder, lambda)[0]; return [arrayToSmall(result), arrayToSmall(remainder)]; } function divMod2(a, b) { // Implementation idea shamelessly stolen from Silent Matt's library http://silentmatt.com/biginteger/ // Performs faster than divMod1 on larger input sizes. var a_l = a.length, b_l = b.length, result = [], part = [], base = BASE, guess, xlen, highx, highy, check; while (a_l) { part.unshift(a[--a_l]); trim(part); if (compareAbs(part, b) < 0) { result.push(0); continue; } xlen = part.length; highx = part[xlen - 1] * base + part[xlen - 2]; highy = b[b_l - 1] * base + b[b_l - 2]; if (xlen > b_l) { highx = (highx + 1) * base; } guess = Math.ceil(highx / highy); do { check = multiplySmall(b, guess); if (compareAbs(check, part) <= 0) break; guess--; } while (guess); result.push(guess); part = subtract(part, check); } result.reverse(); return [arrayToSmall(result), arrayToSmall(part)]; } function divModSmall(value, lambda) { var length = value.length, quotient = createArray(length), base = BASE, i, q, remainder, divisor; remainder = 0; for (i = length - 1; i >= 0; --i) { divisor = remainder * base + value[i]; q = truncate(divisor / lambda); remainder = divisor - q * lambda; quotient[i] = q | 0; } return [quotient, remainder | 0]; } function divModAny(self, v) { var value, n = parseValue(v); if (supportsNativeBigInt) { return [new NativeBigInt(self.value / n.value), new NativeBigInt(self.value % n.value)]; } var a = self.value, b = n.value; var quotient; if (b === 0) throw new Error("Cannot divide by zero"); if (self.isSmall) { if (n.isSmall) { return [new SmallInteger(truncate(a / b)), new SmallInteger(a % b)]; } return [Integer[0], self]; } if (n.isSmall) { if (b === 1) return [self, Integer[0]]; if (b == -1) return [self.negate(), Integer[0]]; var abs = Math.abs(b); if (abs < BASE) { value = divModSmall(a, abs); quotient = arrayToSmall(value[0]); var remainder = value[1]; if (self.sign) remainder = -remainder; if (typeof quotient === "number") { if (self.sign !== n.sign) quotient = -quotient; return [new SmallInteger(quotient), new SmallInteger(remainder)]; } return [new BigInteger(quotient, self.sign !== n.sign), new SmallInteger(remainder)]; } b = smallToArray(abs); } var comparison = compareAbs(a, b); if (comparison === -1) return [Integer[0], self]; if (comparison === 0) return [Integer[self.sign === n.sign ? 1 : -1], Integer[0]]; // divMod1 is faster on smaller input sizes if (a.length + b.length <= 200) value = divMod1(a, b); else value = divMod2(a, b); quotient = value[0]; var qSign = self.sign !== n.sign, mod = value[1], mSign = self.sign; if (typeof quotient === "number") { if (qSign) quotient = -quotient; quotient = new SmallInteger(quotient); } else quotient = new BigInteger(quotient, qSign); if (typeof mod === "number") { if (mSign) mod = -mod; mod = new SmallInteger(mod); } else mod = new BigInteger(mod, mSign); return [quotient, mod]; } BigInteger.prototype.divmod = function (v) { var result = divModAny(this, v); return { quotient: result[0], remainder: result[1] }; }; NativeBigInt.prototype.divmod = SmallInteger.prototype.divmod = BigInteger.prototype.divmod; BigInteger.prototype.divide = function (v) { return divModAny(this, v)[0]; }; NativeBigInt.prototype.over = NativeBigInt.prototype.divide = function (v) { return new NativeBigInt(this.value / parseValue(v).value); }; SmallInteger.prototype.over = SmallInteger.prototype.divide = BigInteger.prototype.over = BigInteger.prototype.divide; BigInteger.prototype.mod = function (v) { return divModAny(this, v)[1]; }; NativeBigInt.prototype.mod = NativeBigInt.prototype.remainder = function (v) { return new NativeBigInt(this.value % parseValue(v).value); }; SmallInteger.prototype.remainder = SmallInteger.prototype.mod = BigInteger.prototype.remainder = BigInteger.prototype.mod; BigInteger.prototype.pow = function (v) { var n = parseValue(v), a = this.value, b = n.value, value, x, y; if (b === 0) return Integer[1]; if (a === 0) return Integer[0]; if (a === 1) return Integer[1]; if (a === -1) return n.isEven() ? Integer[1] : Integer[-1]; if (n.sign) { return Integer[0]; } if (!n.isSmall) throw new Error("The exponent " + n.toString() + " is too large."); if (this.isSmall) { if (isPrecise(value = Math.pow(a, b))) return new SmallInteger(truncate(value)); } x = this; y = Integer[1]; while (true) { if (b & 1 === 1) { y = y.times(x); --b; } if (b === 0) break; b /= 2; x = x.square(); } return y; }; SmallInteger.prototype.pow = BigInteger.prototype.pow; NativeBigInt.prototype.pow = function (v) { var n = parseValue(v); var a = this.value, b = n.value; var _0 = BigInt(0), _1 = BigInt(1), _2 = BigInt(2); if (b === _0) return Integer[1]; if (a === _0) return Integer[0]; if (a === _1) return Integer[1]; if (a === BigInt(-1)) return n.isEven() ? Integer[1] : Integer[-1]; if (n.isNegative()) return new NativeBigInt(_0); var x = this; var y = Integer[1]; while (true) { if ((b & _1) === _1) { y = y.times(x); --b; } if (b === _0) break; b /= _2; x = x.square(); } return y; } BigInteger.prototype.modPow = function (exp, mod) { exp = parseValue(exp); mod = parseValue(mod); if (mod.isZero()) throw new Error("Cannot take modPow with modulus 0"); var r = Integer[1], base = this.mod(mod); while (exp.isPositive()) { if (base.isZero()) return Integer[0]; if (exp.isOdd()) r = r.multiply(base).mod(mod); exp = exp.divide(2); base = base.square().mod(mod); } return r; }; NativeBigInt.prototype.modPow = SmallInteger.prototype.modPow = BigInteger.prototype.modPow; function compareAbs(a, b) { if (a.length !== b.length) { return a.length > b.length ? 1 : -1; } for (var i = a.length - 1; i >= 0; i--) { if (a[i] !== b[i]) return a[i] > b[i] ? 1 : -1; } return 0; } BigInteger.prototype.compareAbs = function (v) { var n = parseValue(v), a = this.value, b = n.value; if (n.isSmall) return 1; return compareAbs(a, b); }; SmallInteger.prototype.compareAbs = function (v) { var n = parseValue(v), a = Math.abs(this.value), b = n.value; if (n.isSmall) { b = Math.abs(b); return a === b ? 0 : a > b ? 1 : -1; } return -1; }; NativeBigInt.prototype.compareAbs = function (v) { var a = this.value; var b = parseValue(v).value; a = a >= 0 ? a : -a; b = b >= 0 ? b : -b; return a === b ? 0 : a > b ? 1 : -1; } BigInteger.prototype.compare = function (v) { // See discussion about comparison with Infinity: // https://github.com/peterolson/BigInteger.js/issues/61 if (v === Infinity) { return -1; } if (v === -Infinity) { return 1; } var n = parseValue(v), a = this.value, b = n.value; if (this.sign !== n.sign) { return n.sign ? 1 : -1; } if (n.isSmall) { return this.sign ? -1 : 1; } return compareAbs(a, b) * (this.sign ? -1 : 1); }; BigInteger.prototype.compareTo = BigInteger.prototype.compare; SmallInteger.prototype.compare = function (v) { if (v === Infinity) { return -1; } if (v === -Infinity) { return 1; } var n = parseValue(v), a = this.value, b = n.value; if (n.isSmall) { return a == b ? 0 : a > b ? 1 : -1; } if (a < 0 !== n.sign) { return a < 0 ? -1 : 1; } return a < 0 ? 1 : -1; }; SmallInteger.prototype.compareTo = SmallInteger.prototype.compare; NativeBigInt.prototype.compare = function (v) { if (v === Infinity) { return -1; } if (v === -Infinity) { return 1; } var a = this.value; var b = parseValue(v).value; return a === b ? 0 : a > b ? 1 : -1; } NativeBigInt.prototype.compareTo = NativeBigInt.prototype.compare; BigInteger.prototype.equals = function (v) { return this.compare(v) === 0; }; NativeBigInt.prototype.eq = NativeBigInt.prototype.equals = SmallInteger.prototype.eq = SmallInteger.prototype.equals = BigInteger.prototype.eq = BigInteger.prototype.equals; BigInteger.prototype.notEquals = function (v) { return this.compare(v) !== 0; }; NativeBigInt.prototype.neq = NativeBigInt.prototype.notEquals = SmallInteger.prototype.neq = SmallInteger.prototype.notEquals = BigInteger.prototype.neq = BigInteger.prototype.notEquals; BigInteger.prototype.greater = function (v) { return this.compare(v) > 0; }; NativeBigInt.prototype.gt = NativeBigInt.prototype.greater = SmallInteger.prototype.gt = SmallInteger.prototype.greater = BigInteger.prototype.gt = BigInteger.prototype.greater; BigInteger.prototype.lesser = function (v) { return this.compare(v) < 0; }; NativeBigInt.prototype.lt = NativeBigInt.prototype.lesser = SmallInteger.prototype.lt = SmallInteger.prototype.lesser = BigInteger.prototype.lt = BigInteger.prototype.lesser; BigInteger.prototype.greaterOrEquals = function (v) { return this.compare(v) >= 0; }; NativeBigInt.prototype.geq = NativeBigInt.prototype.greaterOrEquals = SmallInteger.prototype.geq = SmallInteger.prototype.greaterOrEquals = BigInteger.prototype.geq = BigInteger.prototype.greaterOrEquals; BigInteger.prototype.lesserOrEquals = function (v) { return this.compare(v) <= 0; }; NativeBigInt.prototype.leq = NativeBigInt.prototype.lesserOrEquals = SmallInteger.prototype.leq = SmallInteger.prototype.lesserOrEquals = BigInteger.prototype.leq = BigInteger.prototype.lesserOrEquals; BigInteger.prototype.isEven = function () { return (this.value[0] & 1) === 0; }; SmallInteger.prototype.isEven = function () { return (this.value & 1) === 0; }; NativeBigInt.prototype.isEven = function () { return (this.value & BigInt(1)) === BigInt(0); } BigInteger.prototype.isOdd = function () { return (this.value[0] & 1) === 1; }; SmallInteger.prototype.isOdd = function () { return (this.value & 1) === 1; }; NativeBigInt.prototype.isOdd = function () { return (this.value & BigInt(1)) === BigInt(1); } BigInteger.prototype.isPositive = function () { return !this.sign; }; SmallInteger.prototype.isPositive = function () { return this.value > 0; }; NativeBigInt.prototype.isPositive = SmallInteger.prototype.isPositive; BigInteger.prototype.isNegative = function () { return this.sign; }; SmallInteger.prototype.isNegative = function () { return this.value < 0; }; NativeBigInt.prototype.isNegative = SmallInteger.prototype.isNegative; BigInteger.prototype.isUnit = function () { return false; }; SmallInteger.prototype.isUnit = function () { return Math.abs(this.value) === 1; }; NativeBigInt.prototype.isUnit = function () { return this.abs().value === BigInt(1); } BigInteger.prototype.isZero = function () { return false; }; SmallInteger.prototype.isZero = function () { return this.value === 0; }; NativeBigInt.prototype.isZero = function () { return this.value === BigInt(0); } BigInteger.prototype.isDivisibleBy = function (v) { var n = parseValue(v); if (n.isZero()) return false; if (n.isUnit()) return true; if (n.compareAbs(2) === 0) return this.isEven(); return this.mod(n).isZero(); }; NativeBigInt.prototype.isDivisibleBy = SmallInteger.prototype.isDivisibleBy = BigInteger.prototype.isDivisibleBy; function isBasicPrime(v) { var n = v.abs(); if (n.isUnit()) return false; if (n.equals(2) || n.equals(3) || n.equals(5)) return true; if (n.isEven() || n.isDivisibleBy(3) || n.isDivisibleBy(5)) return false; if (n.lesser(49)) return true; // we don't know if it's prime: let the other functions figure it out } function millerRabinTest(n, a) { var nPrev = n.prev(), b = nPrev, r = 0, d, t, i, x; while (b.isEven()) b = b.divide(2), r++; next: for (i = 0; i < a.length; i++) { if (n.lesser(a[i])) continue; x = bigInt(a[i]).modPow(b, n); if (x.isUnit() || x.equals(nPrev)) continue; for (d = r - 1; d != 0; d--) { x = x.square().mod(n); if (x.isUnit()) return false; if (x.equals(nPrev)) continue next; } return false; } return true; } // Set "strict" to true to force GRH-supported lower bound of 2*log(N)^2 BigInteger.prototype.isPrime = function (strict) { var isPrime = isBasicPrime(this); if (isPrime !== undefined) return isPrime; var n = this.abs(); var bits = n.bitLength(); if (bits <= 64) return millerRabinTest(n, [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37]); var logN = Math.log(2) * bits.toJSNumber(); var t = Math.ceil((strict === true) ? (2 * Math.pow(logN, 2)) : logN); for (var a = [], i = 0; i < t; i++) { a.push(bigInt(i + 2)); } return millerRabinTest(n, a); }; NativeBigInt.prototype.isPrime = SmallInteger.prototype.isPrime = BigInteger.prototype.isPrime; BigInteger.prototype.isProbablePrime = function (iterations) { var isPrime = isBasicPrime(this); if (isPrime !== undefined) return isPrime; var n = this.abs(); var t = iterations === undefined ? 5 : iterations; for (var a = [], i = 0; i < t; i++) { a.push(bigInt.randBetween(2, n.minus(2))); } return millerRabinTest(n, a); }; NativeBigInt.prototype.isProbablePrime = SmallInteger.prototype.isProbablePrime = BigInteger.prototype.isProbablePrime; BigInteger.prototype.modInv = function (n) { var t = bigInt.zero, newT = bigInt.one, r = parseValue(n), newR = this.abs(), q, lastT, lastR; while (!newR.isZero()) { q = r.divide(newR); lastT = t; lastR = r; t = newT; r = newR; newT = lastT.subtract(q.multiply(newT)); newR = lastR.subtract(q.multiply(newR)); } if (!r.isUnit()) throw new Error(this.toString() + " and " + n.toString() + " are not co-prime"); if (t.compare(0) === -1) { t = t.add(n); } if (this.isNegative()) { return t.negate(); } return t; }; NativeBigInt.prototype.modInv = SmallInteger.prototype.modInv = BigInteger.prototype.modInv; BigInteger.prototype.next = function () { var value = this.value; if (this.sign) { return subtractSmall(value, 1, this.sign); } return new BigInteger(addSmall(value, 1), this.sign); }; SmallInteger.prototype.next = function () { var value = this.value; if (value + 1 < MAX_INT) return new SmallInteger(value + 1); return new BigInteger(MAX_INT_ARR, false); }; NativeBigInt.prototype.next = function () { return new NativeBigInt(this.value + BigInt(1)); } BigInteger.prototype.prev = function () { var value = this.value; if (this.sign) { return new BigInteger(addSmall(value, 1), true); } return subtractSmall(value, 1, this.sign); }; SmallInteger.prototype.prev = function () { var value = this.value; if (value - 1 > -MAX_INT) return new SmallInteger(value - 1); return new BigInteger(MAX_INT_ARR, true); }; NativeBigInt.prototype.prev = function () { return new NativeBigInt(this.value - BigInt(1)); } var powersOfTwo = [1]; while (2 * powersOfTwo[powersOfTwo.length - 1] <= BASE) powersOfTwo.push(2 * powersOfTwo[powersOfTwo.length - 1]); var powers2Length = powersOfTwo.length, highestPower2 = powersOfTwo[powers2Length - 1]; function shift_isSmall(n) { return Math.abs(n) <= BASE; } BigInteger.prototype.shiftLeft = function (v) { var n = parseValue(v).toJSNumber(); if (!shift_isSmall(n)) { throw new Error(String(n) + " is too large for shifting."); } if (n < 0) return this.shiftRight(-n); var result = this; if (result.isZero()) return result; while (n >= powers2Length) { result = result.multiply(highestPower2); n -= powers2Length - 1; } return result.multiply(powersOfTwo[n]); }; NativeBigInt.prototype.shiftLeft = SmallInteger.prototype.shiftLeft = BigInteger.prototype.shiftLeft; BigInteger.prototype.shiftRight = function (v) { var remQuo; var n = parseValue(v).toJSNumber(); if (!shift_isSmall(n)) { throw new Error(String(n) + " is too large for shifting."); } if (n < 0) return this.shiftLeft(-n); var result = this; while (n >= powers2Length) { if (result.isZero() || (result.isNegative() && result.isUnit())) return result; remQuo = divModAny(result, highestPower2); result = remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0]; n -= powers2Length - 1; } remQuo = divModAny(result, powersOfTwo[n]); return remQuo[1].isNegative() ? remQuo[0].prev() : remQuo[0]; }; NativeBigInt.prototype.shiftRight = SmallInteger.prototype.shiftRight = BigInteger.prototype.shiftRight; function bitwise(x, y, fn) { y = parseValue(y); var xSign = x.isNegative(), ySign = y.isNegative(); var xRem = xSign ? x.not() : x, yRem = ySign ? y.not() : y; var xDigit = 0, yDigit = 0; var xDivMod = null, yDivMod = null; var result = []; while (!xRem.isZero() || !yRem.isZero()) { xDivMod = divModAny(xRem, highestPower2); xDigit = xDivMod[1].toJSNumber(); if (xSign) { xDigit = highestPower2 - 1 - xDigit; // two's complement for negative numbers } yDivMod = divModAny(yRem, highestPower2); yDigit = yDivMod[1].toJSNumber(); if (ySign) { yDigit = highestPower2 - 1 - yDigit; // two's complement for negative numbers } xRem = xDivMod[0]; yRem = yDivMod[0]; result.push(fn(xDigit, yDigit)); } var sum = fn(xSign ? 1 : 0, ySign ? 1 : 0) !== 0 ? bigInt(-1) : bigInt(0); for (var i = result.length - 1; i >= 0; i -= 1) { sum = sum.multiply(highestPower2).add(bigInt(result[i])); } return sum; } BigInteger.prototype.not = function () { return this.negate().prev(); }; NativeBigInt.prototype.not = SmallInteger.prototype.not = BigInteger.prototype.not; BigInteger.prototype.and = function (n) { return bitwise(this, n, function (a, b) { return a & b; }); }; NativeBigInt.prototype.and = SmallInteger.prototype.and = BigInteger.prototype.and; BigInteger.prototype.or = function (n) { return bitwise(this, n, function (a, b) { return a | b; }); }; NativeBigInt.prototype.or = SmallInteger.prototype.or = BigInteger.prototype.or; BigInteger.prototype.xor = function (n) { return bitwise(this, n, function (a, b) { return a ^ b; }); }; NativeBigInt.prototype.xor = SmallInteger.prototype.xor = BigInteger.prototype.xor; var LOBMASK_I = 1 << 30, LOBMASK_BI = (BASE & -BASE) * (BASE & -BASE) | LOBMASK_I; function roughLOB(n) { // get lowestOneBit (rough) // SmallInteger: return Min(lowestOneBit(n), 1 << 30) // BigInteger: return Min(lowestOneBit(n), 1 << 14) [BASE=1e7] var v = n.value, x = typeof v === "number" ? v | LOBMASK_I : typeof v === "bigint" ? v | BigInt(LOBMASK_I) : v[0] + v[1] * BASE | LOBMASK_BI; return x & -x; } function integerLogarithm(value, base) { if (base.compareTo(value) <= 0) { var tmp = integerLogarithm(value, base.square(base)); var p = tmp.p; var e = tmp.e; var t = p.multiply(base); return t.compareTo(value) <= 0 ? { p: t, e: e * 2 + 1 } : { p: p, e: e * 2 }; } return { p: bigInt(1), e: 0 }; } BigInteger.prototype.bitLength = function () { var n = this; if (n.compareTo(bigInt(0)) < 0) { n = n.negate().subtract(bigInt(1)); } if (n.compareTo(bigInt(0)) === 0) { return bigInt(0); } return bigInt(integerLogarithm(n, bigInt(2)).e).add(bigInt(1)); } NativeBigInt.prototype.bitLength = SmallInteger.prototype.bitLength = BigInteger.prototype.bitLength; function max(a, b) { a = parseValue(a); b = parseValue(b); return a.greater(b) ? a : b; } function min(a, b) { a = parseValue(a); b = parseValue(b); return a.lesser(b) ? a : b; } function gcd(a, b) { a = parseValue(a).abs(); b = parseValue(b).abs(); if (a.equals(b)) return a; if (a.isZero()) return b; if (b.isZero()) return a; var c = Integer[1], d, t; while (a.isEven() && b.isEven()) { d = min(roughLOB(a), roughLOB(b)); a = a.divide(d); b = b.divide(d); c = c.multiply(d); } while (a.isEven()) { a = a.divide(roughLOB(a)); } do { while (b.isEven()) { b = b.divide(roughLOB(b)); } if (a.greater(b)) { t = b; b = a; a = t; } b = b.subtract(a); } while (!b.isZero()); return c.isUnit() ? a : a.multiply(c); } function lcm(a, b) { a = parseValue(a).abs(); b = parseValue(b).abs(); return a.divide(gcd(a, b)).multiply(b); } function randBetween(a, b) { a = parseValue(a); b = parseValue(b); var low = min(a, b), high = max(a, b); var range = high.subtract(low).add(1); if (range.isSmall) return low.add(Math.floor(Math.random() * range)); var digits = toBase(range, BASE).value; var result = [], restricted = true; for (var i = 0; i < digits.length; i++) { var top = restricted ? digits[i] : BASE; var digit = truncate(Math.random() * top); result.push(digit); if (digit < top) restricted = false; } return low.add(Integer.fromArray(result, BASE, false)); } var parseBase = function (text, base, alphabet, caseSensitive) { alphabet = alphabet || DEFAULT_ALPHABET; text = String(text); if (!caseSensitive) { text = text.toLowerCase(); alphabet = alphabet.toLowerCase(); } var length = text.length; var i; var absBase = Math.abs(base); var alphabetValues = {}; for (i = 0; i < alphabet.length; i++) { alphabetValues[alphabet[i]] = i; } for (i = 0; i < length; i++) { var c = text[i]; if (c === "-") continue; if (c in alphabetValues) { if (alphabetValues[c] >= absBase) { if (c === "1" && absBase === 1) continue; throw new Error(c + " is not a valid digit in base " + base + "."); } } } base = parseValue(base); var digits = []; var isNegative = text[0] === "-"; for (i = isNegative ? 1 : 0; i < text.length; i++) { var c = text[i]; if (c in alphabetValues) digits.push(parseValue(alphabetValues[c])); else if (c === "<") { var start = i; do { i++; } while (text[i] !== ">" && i < text.length); digits.push(parseValue(text.slice(start + 1, i))); } else throw new Error(c + " is not a valid character"); } return parseBaseFromArray(digits, base, isNegative); }; function parseBaseFromArray(digits, base, isNegative) { var val = Integer[0], pow = Integer[1], i; for (i = digits.length - 1; i >= 0; i--) { val = val.add(digits[i].times(pow)); pow = pow.times(base); } return isNegative ? val.negate() : val; } function stringify(digit, alphabet) { alphabet = alphabet || DEFAULT_ALPHABET; if (digit < alphabet.length) { return alphabet[digit]; } return "<" + digit + ">"; } function toBase(n, base) { base = bigInt(base); if (base.isZero()) { if (n.isZero()) return { value: [0], isNegative: false }; throw new Error("Cannot convert nonzero numbers to base 0."); } if (base.equals(-1)) { if (n.isZero()) return { value: [0], isNegative: false }; if (n.isNegative()) return { value: [].concat.apply([], Array.apply(null, Array(-n.toJSNumber())) .map(Array.prototype.valueOf, [1, 0]) ), isNegative: false }; var arr = Array.apply(null, Array(n.toJSNumber() - 1)) .map(Array.prototype.valueOf, [0, 1]); arr.unshift([1]); return { value: [].concat.apply([], arr), isNegative: false }; } var neg = false; if (n.isNegative() && base.isPositive()) { neg = true; n = n.abs(); } if (base.isUnit()) { if (n.isZero()) return { value: [0], isNegative: false }; return { value: Array.apply(null, Array(n.toJSNumber())) .map(Number.prototype.valueOf, 1), isNegative: neg }; } var out = []; var left = n, divmod; while (left.isNegative() || left.compareAbs(base) >= 0) { divmod = left.divmod(base); left = divmod.quotient; var digit = divmod.remainder; if (digit.isNegative()) { digit = base.minus(digit).abs(); left = left.next(); } out.push(digit.toJSNumber()); } out.push(left.toJSNumber()); return { value: out.reverse(), isNegative: neg }; } function toBaseString(n, base, alphabet) { var arr = toBase(n, base); return (arr.isNegative ? "-" : "") + arr.value.map(function (x) { return stringify(x, alphabet); }).join(''); } BigInteger.prototype.toArray = function (radix) { return toBase(this, radix); }; SmallInteger.prototype.toArray = function (radix) { return toBase(this, radix); }; NativeBigInt.prototype.toArray = function (radix) { return toBase(this, radix); }; BigInteger.prototype.toString = function (radix, alphabet) { if (radix === undefined) radix = 10; if (radix !== 10) return toBaseString(this, radix, alphabet); var v = this.value, l = v.length, str = String(v[--l]), zeros = "0000000", digit; while (--l >= 0) { digit = String(v[l]); str += zeros.slice(digit.length) + digit; } var sign = this.sign ? "-" : ""; return sign + str; }; SmallInteger.prototype.toString = function (radix, alphabet) { if (radix === undefined) radix = 10; if (radix != 10) return toBaseString(this, radix, alphabet); return String(this.value); }; NativeBigInt.prototype.toString = SmallInteger.prototype.toString; NativeBigInt.prototype.toJSON = BigInteger.prototype.toJSON = SmallInteger.prototype.toJSON = function () { return this.toString(); } BigInteger.prototype.valueOf = function () { return parseInt(this.toString(), 10); }; BigInteger.prototype.toJSNumber = BigInteger.prototype.valueOf; SmallInteger.prototype.valueOf = function () { return this.value; }; SmallInteger.prototype.toJSNumber = SmallInteger.prototype.valueOf; NativeBigInt.prototype.valueOf = NativeBigInt.prototype.toJSNumber = function () { return parseInt(this.toString(), 10); } function parseStringValue(v) { if (isPrecise(+v)) { var x = +v; if (x === truncate(x)) return supportsNativeBigInt ? new NativeBigInt(BigInt(x)) : new SmallInteger(x); throw new Error("Invalid integer: " + v); } var sign = v[0] === "-"; if (sign) v = v.slice(1); var split = v.split(/e/i); if (split.length > 2) throw new Error("Invalid integer: " + split.join("e")); if (split.length === 2) { var exp = split[1]; if (exp[0] === "+") exp = exp.slice(1); exp = +exp; if (exp !== truncate(exp) || !isPrecise(exp)) throw new Error("Invalid integer: " + exp + " is not a valid exponent."); var text = split[0]; var decimalPlace = text.indexOf("."); if (decimalPlace >= 0) { exp -= text.length - decimalPlace - 1; text = text.slice(0, decimalPlace) + text.slice(decimalPlace + 1); } if (exp < 0) throw new Error("Cannot include negative exponent part for integers"); text += (new Array(exp + 1)).join("0"); v = text; } var isValid = /^([0-9][0-9]*)$/.test(v); if (!isValid) throw new Error("Invalid integer: " + v); if (supportsNativeBigInt) { return new NativeBigInt(BigInt(sign ? "-" + v : v)); } var r = [], max = v.length, l = LOG_BASE, min = max - l; while (max > 0) { r.push(+v.slice(min, max)); min -= l; if (min < 0) min = 0; max -= l; } trim(r); return new BigInteger(r, sign); } function parseNumberValue(v) { if (supportsNativeBigInt) { return new NativeBigInt(BigInt(v)); } if (isPrecise(v)) { if (v !== truncate(v)) throw new Error(v + " is not an integer."); return new SmallInteger(v); } return parseStringValue(v.toString()); } function parseValue(v) { if (typeof v === "number") { return parseNumberValue(v); } if (typeof v === "string") { return parseStringValue(v); } if (typeof v === "bigint") { return new NativeBigInt(v); } return v; } // Pre-define numbers in range [-999,999] for (var i = 0; i < 1000; i++) { Integer[i] = parseValue(i); if (i > 0) Integer[-i] = parseValue(-i); } // Backwards compatibility Integer.one = Integer[1]; Integer.zero = Integer[0]; Integer.minusOne = Integer[-1]; Integer.max = max; Integer.min = min; Integer.gcd = gcd; Integer.lcm = lcm; Integer.isInstance = function (x) { return x instanceof BigInteger || x instanceof SmallInteger || x instanceof NativeBigInt; }; Integer.randBetween = randBetween; Integer.fromArray = function (digits, base, isNegative) { return parseBaseFromArray(digits.map(parseValue), parseValue(base || 10), isNegative); }; return Integer; })(); // Node.js check if (typeof module !== "undefined" && module.hasOwnProperty("exports")) { module.exports = bigInt; } //amd check if (typeof define === "function" && define.amd) { define("big-integer", [], function () { return bigInt; }); }
Package.describe({ name: 'johnantoni:meteor-appear', summary: 'jQuery plugin for tracking elements appearance in browser viewport', version: '0.0.2', git: 'https://github.com/johnantoni/meteor-appear', documentation: 'README.md' }); Package.on_use(function(api) { api.add_files([ 'jquery.appear/jquery.appear.js' ], ['client']); });
/*! modernizr 3.3.1 (Custom Build) | MIT * * https://modernizr.com/download/?-ambientlight-animation-apng-appearance-applicationcache-atobbtoa-audioloop-audiopreload-backdropfilter-backgroundblendmode-backgroundcliptext-backgroundsize-bgpositionshorthand-bgpositionxy-bgrepeatspace_bgrepeatround-bgsizecover-blobworkers-borderimage-borderradius-boxshadow-boxsizing-canvas-canvastext-capture-checked-classlist-contextmenu-cookies-cors-createelementattrs_createelement_attrs-cryptography-cssall-cssanimations-csscalc-csschunit-csscolumns-cssescape-cssexunit-cssfilters-cssgradients-csshairline-csshyphens_softhyphens_softhyphensfind-cssinvalid-cssmask-csspointerevents-csspositionsticky-csspseudoanimations-csspseudotransitions-cssreflections-cssremunit-cssresize-cssscrollbar-csstransforms-csstransforms3d-csstransitions-cssvalid-cssvhunit-cssvmaxunit-cssvminunit-cssvwunit-cubicbezierrange-dataset-datauri-dataworkers-directory-displaytable-documentfragment-ellipsis-fileinput-filereader-filesystem-flash-flexbox-flexboxlegacy-flexboxtweener-flexwrap-fontface-forcetouch-formattribute-formvalidation-fullscreen-generatedcontent-geolocation-getusermedia-hashchange-hidden-hiddenscroll-history-hsla-imgcrossorigin-inlinesvg-inputformmethod-inputformtarget-inputtypes-jpeg2000-jpegxr-json-lastchild-ligatures-localizednumber-localstorage-matchmedia-mediaqueries-multiplebgs-nthchild-objectfit-opacity-overflowscrolling-pagevisibility-placeholder-pointerevents-preserve3d-regions-requestautocomplete-rgba-sandbox-scriptasync-scrollsnappoints-seamless-search-shapes-sharedworkers-siblinggeneral-sizes-smil-srcdoc-srcset-stylescoped-subpixelfont-supports-svgasimg-svgclippaths-svgfilters-svgforeignobject-target-templatestrings-textalignlast-textareamaxlength-textshadow-transferables-typedarrays-urlparser-userdata-userselect-video-videoautoplay-videoloop-videopreload-webaudio-webglextensions-webpalpha-webworkers-willchange-wrapflow-xhr2-xhrresponsetype-xhrresponsetypearraybuffer-xhrresponsetypeblob-xhrresponsetypedocument-xhrresponsetypejson-xhrresponsetypetext-atrule-domprefixes-hasevent-mq-prefixed-prefixedcss-prefixedcssvalue-prefixes-printshiv-setclasses !*/ ;!function(window,document,undefined){function is(A,e){return typeof A===e}function testRunner(){var A,e,t,n,r,o,i;for(var d in tests){if(tests.hasOwnProperty(d)){if(A=[],e=tests[d],e.name&&(A.push(e.name.toLowerCase()),e.options&&e.options.aliases&&e.options.aliases.length)){for(t=0;t<e.options.aliases.length;t++){A.push(e.options.aliases[t].toLowerCase())}}for(n=is(e.fn,"function")?e.fn():e.fn,r=0;r<A.length;r++){o=A[r],i=o.split("."),1===i.length?Modernizr[i[0]]=n:(!Modernizr[i[0]]||Modernizr[i[0]] instanceof Boolean||(Modernizr[i[0]]=new Boolean(Modernizr[i[0]])),Modernizr[i[0]][i[1]]=n),classes.push((n?"":"no-")+i.join("-"))}}}}function setClasses(A){var e=docElement.className,t=Modernizr._config.classPrefix||"";if(isSVG&&(e=e.baseVal),Modernizr._config.enableJSClass){var n=new RegExp("(^|\\s)"+t+"no-js(\\s|$)");e=e.replace(n,"$1"+t+"js$2")}Modernizr._config.enableClasses&&(e+=" "+t+A.join(" "+t),isSVG?docElement.className.baseVal=e:docElement.className=e)}function createElement(){return"function"!=typeof document.createElement?document.createElement(arguments[0]):isSVG?document.createElementNS.call(document,"http://www.w3.org/2000/svg",arguments[0]):document.createElement.apply(document,arguments)}function domToCSS(A){return A.replace(/([A-Z])/g,function(A,e){return"-"+e.toLowerCase()}).replace(/^ms-/,"-ms-")}function cssToDOM(A){return A.replace(/([a-z])-([a-z])/g,function(A,e,t){return e+t.toUpperCase()}).replace(/^-/,"")}function getBody(){var A=document.body;return A||(A=createElement(isSVG?"svg":"body"),A.fake=!0),A}function injectElementWithStyles(A,e,t,n){var r,o,i,d,a="modernizr",s=createElement("div"),l=getBody();if(parseInt(t,10)){for(;t--;){i=createElement("div"),i.id=n?n[t]:a+(t+1),s.appendChild(i)}}return r=createElement("style"),r.type="text/css",r.id="s"+a,(l.fake?l:s).appendChild(r),l.appendChild(s),r.styleSheet?r.styleSheet.cssText=A:r.appendChild(document.createTextNode(A)),s.id=a,l.fake&&(l.style.background="",l.style.overflow="hidden",d=docElement.style.overflow,docElement.style.overflow="hidden",docElement.appendChild(l)),o=e(s,A),l.fake?(l.parentNode.removeChild(l),docElement.style.overflow=d,docElement.offsetHeight):s.parentNode.removeChild(s),!!o}function contains(A,e){return !!~(""+A).indexOf(e)}function roundedEquals(A,e){return A-1===e||A===e||A+1===e}function addTest(A,e){if("object"==typeof A){for(var t in A){hasOwnProp(A,t)&&addTest(t,A[t])}}else{A=A.toLowerCase();var n=A.split("."),r=Modernizr[n[0]];if(2==n.length&&(r=r[n[1]]),"undefined"!=typeof r){return Modernizr}e="function"==typeof e?e():e,1==n.length?Modernizr[n[0]]=e:(!Modernizr[n[0]]||Modernizr[n[0]] instanceof Boolean||(Modernizr[n[0]]=new Boolean(Modernizr[n[0]])),Modernizr[n[0]][n[1]]=e),setClasses([(e&&0!=e?"":"no-")+n.join("-")]),Modernizr._trigger(A,e)}return Modernizr}function nativeTestProps(A,e){var t=A.length;if("CSS" in window&&"supports" in window.CSS){for(;t--;){if(window.CSS.supports(domToCSS(A[t]),e)){return !0}}return !1}if("CSSSupportsRule" in window){for(var n=[];t--;){n.push("("+domToCSS(A[t])+":"+e+")")}return n=n.join(" or "),injectElementWithStyles("@supports ("+n+") { #modernizr { position: absolute; } }",function(A){return"absolute"==getComputedStyle(A,null).position})}return undefined}function testProps(A,e,t,n){function r(){i&&(delete mStyle.style,delete mStyle.modElem)}if(n=is(n,"undefined")?!1:n,!is(t,"undefined")){var o=nativeTestProps(A,t);if(!is(o,"undefined")){return o}}for(var i,d,a,s,l,c=["modernizr","tspan","samp"];!mStyle.style&&c.length;){i=!0,mStyle.modElem=createElement(c.shift()),mStyle.style=mStyle.modElem.style}for(a=A.length,d=0;a>d;d++){if(s=A[d],l=mStyle.style[s],contains(s,"-")&&(s=cssToDOM(s)),mStyle.style[s]!==undefined){if(n||is(t,"undefined")){return r(),"pfx"==e?s:!0}try{mStyle.style[s]=t}catch(u){}if(mStyle.style[s]!=l){return r(),"pfx"==e?s:!0}}}return r(),!1}function fnBind(A,e){return function(){return A.apply(e,arguments)}}function testDOMProps(A,e,t){var n;for(var r in A){if(A[r] in e){return t===!1?A[r]:(n=e[A[r]],is(n,"function")?fnBind(n,t||e):n)}}return !1}function testPropsAll(A,e,t,n,r){var o=A.charAt(0).toUpperCase()+A.slice(1),i=(A+" "+cssomPrefixes.join(o+" ")+o).split(" ");return is(e,"string")||is(e,"undefined")?testProps(i,e,n,r):(i=(A+" "+domPrefixes.join(o+" ")+o).split(" "),testDOMProps(i,e,t))}function testAllProps(A,e,t){return testPropsAll(A,undefined,undefined,e,t)}var classes=[],tests=[],ModernizrProto={_version:"3.3.1",_config:{classPrefix:"",enableClasses:!0,enableJSClass:!0,usePrefixes:!0},_q:[],on:function(A,e){var t=this;setTimeout(function(){e(t[A])},0)},addTest:function(A,e,t){tests.push({name:A,fn:e,options:t})},addAsyncTest:function(A){tests.push({name:null,fn:A})}},Modernizr=function(){};Modernizr.prototype=ModernizrProto,Modernizr=new Modernizr,Modernizr.addTest("applicationcache","applicationCache" in window),Modernizr.addTest("cookies",function(){try{document.cookie="cookietest=1";var A=-1!=document.cookie.indexOf("cookietest=");return document.cookie="cookietest=1; expires=Thu, 01-Jan-1970 00:00:01 GMT",A}catch(e){return !1}}),Modernizr.addTest("cors","XMLHttpRequest" in window&&"withCredentials" in new XMLHttpRequest),Modernizr.addTest("geolocation","geolocation" in navigator),Modernizr.addTest("json","JSON" in window&&"parse" in JSON&&"stringify" in JSON),Modernizr.addTest("history",function(){var A=navigator.userAgent;return -1===A.indexOf("Android 2.")&&-1===A.indexOf("Android 4.0")||-1===A.indexOf("Mobile Safari")||-1!==A.indexOf("Chrome")||-1!==A.indexOf("Windows Phone")?window.history&&"pushState" in window.history:!1}),Modernizr.addTest("templatestrings",function(){var supports;try{eval("``"),supports=!0}catch(e){}return !!supports}),Modernizr.addTest("typedarrays","ArrayBuffer" in window),Modernizr.addTest("webaudio",function(){var A="webkitAudioContext" in window,e="AudioContext" in window;return Modernizr._config.usePrefixes?A||e:e});var CSS=window.CSS;Modernizr.addTest("cssescape",CSS?"function"==typeof CSS.escape:!1);var newSyntax="CSS" in window&&"supports" in window.CSS,oldSyntax="supportsCSS" in window;Modernizr.addTest("supports",newSyntax||oldSyntax),Modernizr.addTest("target",function(){var A=window.document;if(!("querySelectorAll" in A)){return !1}try{return A.querySelectorAll(":target"),!0}catch(e){return !1}}),Modernizr.addTest("filereader",!!(window.File&&window.FileList&&window.FileReader)),Modernizr.addTest("xhrresponsetype",function(){if("undefined"==typeof XMLHttpRequest){return !1}var A=new XMLHttpRequest;return A.open("get","/",!0),"response" in A}()),Modernizr.addTest("xhr2","XMLHttpRequest" in window&&"withCredentials" in new XMLHttpRequest),Modernizr.addTest("localstorage",function(){var A="modernizr";try{return localStorage.setItem(A,A),localStorage.removeItem(A),!0}catch(e){return !1}}),Modernizr.addTest("svgfilters",function(){var A=!1;try{A="SVGFEColorMatrixElement" in window&&2==SVGFEColorMatrixElement.SVG_FECOLORMATRIX_TYPE_SATURATE}catch(e){}return A}),Modernizr.addTest("atobbtoa","atob" in window&&"btoa" in window,{aliases:["atob-btoa"]}),Modernizr.addTest("sharedworkers","SharedWorker" in window),Modernizr.addTest("webworkers","Worker" in window);var prefixes=ModernizrProto._config.usePrefixes?" -webkit- -moz- -o- -ms- ".split(" "):["",""];ModernizrProto._prefixes=prefixes;var docElement=document.documentElement;Modernizr.addTest("contextmenu","contextMenu" in docElement&&"HTMLMenuItemElement" in window),Modernizr.addTest("cssall","all" in docElement.style),Modernizr.addTest("willchange","willChange" in docElement.style),Modernizr.addTest("classlist","classList" in docElement),Modernizr.addTest("documentfragment",function(){return"createDocumentFragment" in document&&"appendChild" in docElement});var isSVG="svg"===docElement.nodeName.toLowerCase(),html5;isSVG||!function(A,e){function t(A,e){var t=A.createElement("p"),n=A.getElementsByTagName("head")[0]||A.documentElement;return t.innerHTML="x<style>"+e+"</style>",n.insertBefore(t.lastChild,n.firstChild)}function n(){var A=M.elements;return"string"==typeof A?A.split(" "):A}function r(A,e){var t=M.elements;"string"!=typeof t&&(t=t.join(" ")),"string"!=typeof A&&(A=A.join(" ")),M.elements=t+" "+A,s(e)}function o(A){var e=B[A[D]];return e||(e={},v++,A[D]=v,B[v]=e),e}function i(A,t,n){if(t||(t=e),f){return t.createElement(A)}n||(n=o(t));var r;return r=n.cache[A]?n.cache[A].cloneNode():P.test(A)?(n.cache[A]=n.createElem(A)).cloneNode():n.createElem(A),!r.canHaveChildren||E.test(A)||r.tagUrn?r:n.frag.appendChild(r)}function d(A,t){if(A||(A=e),f){return A.createDocumentFragment()}t=t||o(A);for(var r=t.frag.cloneNode(),i=0,d=n(),a=d.length;a>i;i++){r.createElement(d[i])}return r}function a(A,e){e.cache||(e.cache={},e.createElem=A.createElement,e.createFrag=A.createDocumentFragment,e.frag=e.createFrag()),A.createElement=function(t){return M.shivMethods?i(t,A,e):e.createElem(t)},A.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+n().join().replace(/[\w\-:]+/g,function(A){return e.createElem(A),e.frag.createElement(A),'c("'+A+'")'})+");return n}")(M,e.frag)}function s(A){A||(A=e);var n=o(A);return !M.shivCSS||m||n.hasCSS||(n.hasCSS=!!t(A,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),f||a(A,n),A}function l(A){for(var e,t=A.getElementsByTagName("*"),r=t.length,o=RegExp("^(?:"+n().join("|")+")$","i"),i=[];r--;){e=t[r],o.test(e.nodeName)&&i.push(e.applyElement(c(e)))}return i}function c(A){for(var e,t=A.attributes,n=t.length,r=A.ownerDocument.createElement(b+":"+A.nodeName);n--;){e=t[n],e.specified&&r.setAttribute(e.nodeName,e.nodeValue)}return r.style.cssText=A.style.cssText,r}function u(A){for(var e,t=A.split("{"),r=t.length,o=RegExp("(^|[\\s,>+~])("+n().join("|")+")(?=[[\\s,>+~#.:]|$)","gi"),i="$1"+b+"\\:$2";r--;){e=t[r]=t[r].split("}"),e[e.length-1]=e[e.length-1].replace(o,i),t[r]=e.join("}")}return t.join("{")}function w(A){for(var e=A.length;e--;){A[e].removeNode()}}function p(A){function e(){clearTimeout(i._removeSheetTimer),n&&n.removeNode(!0),n=null}var n,r,i=o(A),d=A.namespaces,a=A.parentWindow;return !C||A.printShived?A:("undefined"==typeof d[b]&&d.add(b),a.attachEvent("onbeforeprint",function(){e();for(var o,i,d,a=A.styleSheets,s=[],c=a.length,w=Array(c);c--;){w[c]=a[c]}for(;d=w.pop();){if(!d.disabled&&y.test(d.media)){try{o=d.imports,i=o.length}catch(p){i=0}for(c=0;i>c;c++){w.push(o[c])}try{s.push(d.cssText)}catch(p){}}}s=u(s.reverse().join("")),r=l(A),n=t(A,s)}),a.attachEvent("onafterprint",function(){w(r),clearTimeout(i._removeSheetTimer),i._removeSheetTimer=setTimeout(e,500)}),A.printShived=!0,A)}var m,f,g="3.7.3",h=A.html5||{},E=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,P=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,D="_html5shiv",v=0,B={};!function(){try{var A=e.createElement("a");A.innerHTML="<xyz></xyz>",m="hidden" in A,f=1==A.childNodes.length||function(){e.createElement("a");var A=e.createDocumentFragment();return"undefined"==typeof A.cloneNode||"undefined"==typeof A.createDocumentFragment||"undefined"==typeof A.createElement}()}catch(t){m=!0,f=!0}}();var M={elements:h.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video",version:g,shivCSS:h.shivCSS!==!1,supportsUnknownElements:f,shivMethods:h.shivMethods!==!1,type:"default",shivDocument:s,createElement:i,createDocumentFragment:d,addElements:r};A.html5=M,s(e);var y=/^$|\b(?:all|print)\b/,b="html5shiv",C=!f&&function(){var t=e.documentElement;return !("undefined"==typeof e.namespaces||"undefined"==typeof e.parentWindow||"undefined"==typeof t.applyElement||"undefined"==typeof t.removeNode||"undefined"==typeof A.attachEvent)}();M.type+=" print",M.shivPrint=p,p(e),"object"==typeof module&&module.exports&&(module.exports=M)}("undefined"!=typeof window?window:this,document);var omPrefixes="Moz O ms Webkit",domPrefixes=ModernizrProto._config.usePrefixes?omPrefixes.toLowerCase().split(" "):[];ModernizrProto._domPrefixes=domPrefixes;var cssomPrefixes=ModernizrProto._config.usePrefixes?omPrefixes.split(" "):[];ModernizrProto._cssomPrefixes=cssomPrefixes;var atRule=function(A){var e,t=prefixes.length,n=window.CSSRule;if("undefined"==typeof n){return undefined}if(!A){return !1}if(A=A.replace(/^@/,""),e=A.replace(/-/g,"_").toUpperCase()+"_RULE",e in n){return"@"+A}for(var r=0;t>r;r++){var o=prefixes[r],i=o.toUpperCase()+"_"+e;if(i in n){return"@-"+o.toLowerCase()+"-"+A}}return !1};ModernizrProto.atRule=atRule;var hasEvent=function(){function A(A,t){var n;return A?(t&&"string"!=typeof t||(t=createElement(t||"div")),A="on"+A,n=A in t,!n&&e&&(t.setAttribute||(t=createElement("div")),t.setAttribute(A,""),n="function"==typeof t[A],t[A]!==undefined&&(t[A]=undefined),t.removeAttribute(A)),n):!1}var e=!("onblur" in document.documentElement);return A}();ModernizrProto.hasEvent=hasEvent,Modernizr.addTest("ambientlight",hasEvent("devicelight",window)),Modernizr.addTest("hashchange",function(){return hasEvent("hashchange",window)===!1?!1:document.documentMode===undefined||document.documentMode>7}),Modernizr.addTest("inputsearchevent",hasEvent("search")),Modernizr.addTest("pointerevents",function(){var A=!1,e=domPrefixes.length;for(A=Modernizr.hasEvent("pointerdown");e--&&!A;){hasEvent(domPrefixes[e]+"pointerdown")&&(A=!0)}return A});var prefixedCSSValue=function(A,e){var t=!1,n=createElement("div"),r=n.style;if(A in r){var o=domPrefixes.length;for(r[A]=e,t=r[A];o--&&!t;){r[A]="-"+domPrefixes[o]+"-"+e,t=r[A]}}return""===t&&(t=!1),t};ModernizrProto.prefixedCSSValue=prefixedCSSValue,Modernizr.addTest("canvas",function(){var A=createElement("canvas");return !(!A.getContext||!A.getContext("2d"))}),Modernizr.addTest("canvastext",function(){return Modernizr.canvas===!1?!1:"function"==typeof createElement("canvas").getContext("2d").fillText}),Modernizr.addTest("userdata",!!createElement("div").addBehavior),Modernizr.addTest("video",function(){var A=createElement("video"),e=!1;try{(e=!!A.canPlayType)&&(e=new Boolean(e),e.ogg=A.canPlayType('video/ogg; codecs="theora"').replace(/^no$/,""),e.h264=A.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/,""),e.webm=A.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,""),e.vp9=A.canPlayType('video/webm; codecs="vp9"').replace(/^no$/,""),e.hls=A.canPlayType('application/x-mpegURL; codecs="avc1.42E01E"').replace(/^no$/,""))}catch(t){}return e}),Modernizr.addTest("audioloop","loop" in createElement("audio")),Modernizr.addTest("webanimations","animate" in createElement("div")),Modernizr.addTest("bgpositionshorthand",function(){var A=createElement("a"),e=A.style,t="right 10px bottom 10px";return e.cssText="background-position: "+t+";",e.backgroundPosition===t}),Modernizr.addTest("csscalc",function(){var A="width:",e="calc(10px);",t=createElement("a");return t.style.cssText=A+prefixes.join(e+A),!!t.style.length}),Modernizr.addTest("cubicbezierrange",function(){var A=createElement("a");return A.style.cssText=prefixes.join("transition-timing-function:cubic-bezier(1,0,0,1.1); "),!!A.style.length}),Modernizr.addTest("cssgradients",function(){for(var A,e="background-image:",t="gradient(linear,left top,right bottom,from(#9f9),to(white));",n="",r=0,o=prefixes.length-1;o>r;r++){A=0===r?"to ":"",n+=e+prefixes[r]+"linear-gradient("+A+"left top, #9f9, white);"}Modernizr._config.usePrefixes&&(n+=e+"-webkit-"+t);var i=createElement("a"),d=i.style;return d.cssText=n,(""+d.backgroundImage).indexOf("gradient")>-1}),Modernizr.addTest("multiplebgs",function(){var A=createElement("a").style;return A.cssText="background:url(https://),url(https://),red url(https://)",/(url\s*\(.*?){3}/.test(A.background)}),Modernizr.addTest("opacity",function(){var A=createElement("a").style;return A.cssText=prefixes.join("opacity:.55;"),/^0.55$/.test(A.opacity)}),Modernizr.addTest("csspointerevents",function(){var A=createElement("a").style;return A.cssText="pointer-events:auto","auto"===A.pointerEvents}),Modernizr.addTest("csspositionsticky",function(){var A="position:",e="sticky",t=createElement("a"),n=t.style;return n.cssText=A+prefixes.join(e+";"+A).slice(0,-A.length),-1!==n.position.indexOf(e)}),Modernizr.addTest("regions",function(){if(isSVG){return !1}var A=Modernizr.prefixed("flowFrom"),e=Modernizr.prefixed("flowInto"),t=!1;if(!A||!e){return t}var n=createElement("iframe"),r=createElement("div"),o=createElement("div"),i=createElement("div"),d="modernizr_flow_for_regions_check";o.innerText="M",r.style.cssText="top: 150px; left: 150px; padding: 0px;",i.style.cssText="width: 50px; height: 50px; padding: 42px;",i.style[A]=d,r.appendChild(o),r.appendChild(i),docElement.appendChild(r);var a,s,l=o.getBoundingClientRect();return o.style[e]=d,a=o.getBoundingClientRect(),s=parseInt(a.left-l.left,10),docElement.removeChild(r),42==s?t=!0:(docElement.appendChild(n),l=n.getBoundingClientRect(),n.style[e]=d,a=n.getBoundingClientRect(),l.height>0&&l.height!==a.height&&0===a.height&&(t=!0)),o=i=r=n=undefined,t}),Modernizr.addTest("cssremunit",function(){var A=createElement("a").style;try{A.fontSize="3rem"}catch(e){}return/rem/.test(A.fontSize)}),Modernizr.addTest("rgba",function(){var A=createElement("a").style;return A.cssText="background-color:rgba(150,255,150,.5)",(""+A.backgroundColor).indexOf("rgba")>-1}),Modernizr.addTest("preserve3d",function(){var A=createElement("a"),e=createElement("a");A.style.cssText="display: block; transform-style: preserve-3d; transform-origin: right; transform: rotateY(40deg);",e.style.cssText="display: block; width: 9px; height: 1px; background: #000; transform-origin: right; transform: rotateY(40deg);",A.appendChild(e),docElement.appendChild(A);var t=e.getBoundingClientRect();return docElement.removeChild(A),t.width&&t.width<4}),Modernizr.addTest("hidden","hidden" in createElement("a")),Modernizr.addTest("fileinput",function(){if(navigator.userAgent.match(/(Android (1.0|1.1|1.5|1.6|2.0|2.1))|(Windows Phone (OS 7|8.0))|(XBLWP)|(ZuneWP)|(w(eb)?OSBrowser)|(webOS)|(Kindle\/(1.0|2.0|2.5|3.0))/)){return !1}var A=createElement("input");return A.type="file",!A.disabled}),Modernizr.addTest("capture","capture" in createElement("input")),Modernizr.addTest("dataset",function(){var A=createElement("div");return A.setAttribute("data-a-b","c"),!(!A.dataset||"c"!==A.dataset.aB)}),Modernizr.addTest("fileinputdirectory",function(){var A=createElement("input"),e="directory";if(A.type="file",e in A){return !0}for(var t=0,n=domPrefixes.length;n>t;t++){if(domPrefixes[t]+e in A){return !0}}return !1}),Modernizr.addTest("createelementattrs",function(){try{return"test"==createElement('<input name="test" />').getAttribute("name")}catch(A){return !1}},{aliases:["createelement-attrs"]}),Modernizr.addTest("placeholder","placeholder" in createElement("input")&&"placeholder" in createElement("textarea")),Modernizr.addTest("formattribute",function(){var A,e=createElement("form"),t=createElement("input"),n=createElement("div"),r="formtest"+(new Date).getTime(),o=!1;e.id=r;try{t.setAttribute("form",r)}catch(i){document.createAttribute&&(A=document.createAttribute("form"),A.nodeValue=r,t.setAttributeNode(A))}return n.appendChild(e),n.appendChild(t),docElement.appendChild(n),o=e.elements&&1===e.elements.length&&t.form==e,n.parentNode.removeChild(n),o}),Modernizr.addTest("seamless","seamless" in createElement("iframe")),Modernizr.addTest("srcdoc","srcdoc" in createElement("iframe")),Modernizr.addTest("sandbox","sandbox" in createElement("iframe")),Modernizr.addTest("imgcrossorigin","crossOrigin" in createElement("img")),Modernizr.addTest("srcset","srcset" in createElement("img")),Modernizr.addTest("inputformmethod",!!("formMethod" in createElement("input"))),Modernizr.addTest("inputformtarget",!!("formtarget" in createElement("input")),{aliases:["input-formtarget"]}),Modernizr.addTest("scriptasync","async" in createElement("script")),Modernizr.addTest("stylescoped","scoped" in createElement("style")),Modernizr.addTest("textareamaxlength",!!("maxLength" in createElement("textarea"))),Modernizr.addTest("inlinesvg",function(){var A=createElement("div");return A.innerHTML="<svg/>","http://www.w3.org/2000/svg"==("undefined"!=typeof SVGRect&&A.firstChild&&A.firstChild.namespaceURI)}),Modernizr.addTest("videoloop","loop" in createElement("video")),Modernizr.addTest("videopreload","preload" in createElement("video"));var mq=function(){var A=window.matchMedia||window.msMatchMedia;return A?function(e){var t=A(e);return t&&t.matches||!1}:function(A){var e=!1;return injectElementWithStyles("@media "+A+" { #modernizr { position: absolute; } }",function(A){e="absolute"==(window.getComputedStyle?window.getComputedStyle(A,null):A.currentStyle).position}),e}}();ModernizrProto.mq=mq,Modernizr.addTest("mediaqueries",mq("only all"));var testStyles=ModernizrProto.testStyles=injectElementWithStyles;Modernizr.addTest("hiddenscroll",function(){return testStyles("#modernizr {width:100px;height:100px;overflow:scroll}",function(A){return A.offsetWidth===A.clientWidth})}),Modernizr.addTest("checked",function(){return testStyles("#modernizr {position:absolute} #modernizr input {margin-left:10px} #modernizr :checked {margin-left:20px;display:block}",function(A){var e=createElement("input");return e.setAttribute("type","checkbox"),e.setAttribute("checked","checked"),A.appendChild(e),20===e.offsetLeft})}),testStyles("#modernizr{display: table; direction: ltr}#modernizr div{display: table-cell; padding: 10px}",function(A){var e,t=A.childNodes;e=t[0].offsetLeft<t[1].offsetLeft,Modernizr.addTest("displaytable",e,{aliases:["display-table"]})},2);var blacklist=function(){var A=navigator.userAgent,e=A.match(/applewebkit\/([0-9]+)/gi)&&parseFloat(RegExp.$1),t=A.match(/w(eb)?osbrowser/gi),n=A.match(/windows phone/gi)&&A.match(/iemobile\/([0-9])+/gi)&&parseFloat(RegExp.$1)>=9,r=533>e&&A.match(/android/gi);return t||r||n}();blacklist?Modernizr.addTest("fontface",!1):testStyles('@font-face {font-family:"font";src:url("https://")}',function(A,e){var t=document.getElementById("smodernizr"),n=t.sheet||t.styleSheet,r=n?n.cssRules&&n.cssRules[0]?n.cssRules[0].cssText:n.cssText||"":"",o=/src/i.test(r)&&0===r.indexOf(e.split(" ")[0]);Modernizr.addTest("fontface",o)}),testStyles('#modernizr{font:0/0 a}#modernizr:after{content:":)";visibility:hidden;font:7px/1 a}',function(A){Modernizr.addTest("generatedcontent",A.offsetHeight>=7)}),Modernizr.addTest("hairline",function(){return testStyles("#modernizr {border:.5px solid transparent}",function(A){return 1===A.offsetHeight})}),Modernizr.addTest("cssinvalid",function(){return testStyles("#modernizr input{height:0;border:0;padding:0;margin:0;width:10px} #modernizr input:invalid{width:50px}",function(A){var e=createElement("input");return e.required=!0,A.appendChild(e),e.clientWidth>10})}),testStyles("#modernizr div {width:100px} #modernizr :last-child{width:200px;display:block}",function(A){Modernizr.addTest("lastchild",A.lastChild.offsetWidth>A.firstChild.offsetWidth)},2),testStyles("#modernizr div {width:1px} #modernizr div:nth-child(2n) {width:2px;}",function(A){for(var e=A.getElementsByTagName("div"),t=!0,n=0;5>n;n++){t=t&&e[n].offsetWidth===n%2+1}Modernizr.addTest("nthchild",t)},5),testStyles("#modernizr{overflow: scroll; width: 40px; height: 40px; }#"+prefixes.join("scrollbar{width:0px} #modernizr::").split("#").slice(1).join("#")+"scrollbar{width:0px}",function(A){Modernizr.addTest("cssscrollbar",40==A.scrollWidth)}),Modernizr.addTest("siblinggeneral",function(){return testStyles("#modernizr div {width:100px} #modernizr div ~ div {width:200px;display:block}",function(A){return 200==A.lastChild.offsetWidth},2)}),testStyles("#modernizr{position: absolute; top: -10em; visibility:hidden; font: normal 10px arial;}#subpixel{float: left; font-size: 33.3333%;}",function(A){var e=A.firstChild;e.innerHTML="This is a text written in Arial",Modernizr.addTest("subpixelfont",window.getComputedStyle?"44px"!==window.getComputedStyle(e,null).getPropertyValue("width"):!1)},1,["subpixel"]),testStyles("#modernizr { width: 50vw; }",function(A){var e=parseInt(window.innerWidth/2,10),t=parseInt((window.getComputedStyle?getComputedStyle(A,null):A.currentStyle).width,10);Modernizr.addTest("cssvwunit",t==e)}),testStyles("#modernizr { height: 50vh; }",function(A){var e=parseInt(window.innerHeight/2,10),t=parseInt((window.getComputedStyle?getComputedStyle(A,null):A.currentStyle).height,10);Modernizr.addTest("cssvhunit",t==e)}),Modernizr.addTest("cssvalid",function(){return testStyles("#modernizr input{height:0;border:0;padding:0;margin:0;width:10px} #modernizr input:valid{width:50px}",function(A){var e=createElement("input");return A.appendChild(e),e.clientWidth>10})}),Modernizr.addTest("formvalidation",function(){var A=createElement("form");if(!("checkValidity" in A&&"addEventListener" in A)){return !1}if("reportValidity" in A){return !0}var e,t=!1;return Modernizr.formvalidationapi=!0,A.addEventListener("submit",function(A){(!window.opera||window.operamini)&&A.preventDefault(),A.stopPropagation()},!1),A.innerHTML='<input name="modTest" required="required" /><button></button>',testStyles("#modernizr form{position:absolute;top:-99999em}",function(n){n.appendChild(A),e=A.getElementsByTagName("input")[0],e.addEventListener("invalid",function(A){t=!0,A.preventDefault(),A.stopPropagation()},!1),Modernizr.formvalidationmessage=!!e.validationMessage,A.getElementsByTagName("button")[0].click()}),t});var inputElem=createElement("input"),inputtypes="search tel url email datetime date month week time datetime-local number range color".split(" "),inputs={};Modernizr.inputtypes=function(A){for(var e,t,n,r=A.length,o="1)",i=0;r>i;i++){inputElem.setAttribute("type",e=A[i]),n="text"!==inputElem.type&&"style" in inputElem,n&&(inputElem.value=o,inputElem.style.cssText="position:absolute;visibility:hidden;",/^range$/.test(e)&&inputElem.style.WebkitAppearance!==undefined?(docElement.appendChild(inputElem),t=document.defaultView,n=t.getComputedStyle&&"textfield"!==t.getComputedStyle(inputElem,null).WebkitAppearance&&0!==inputElem.offsetHeight,docElement.removeChild(inputElem)):/^(search|tel)$/.test(e)||(n=/^(url|email)$/.test(e)?inputElem.checkValidity&&inputElem.checkValidity()===!1:inputElem.value!=o)),inputs[A[i]]=!!n}return inputs}(inputtypes),Modernizr.addTest("localizednumber",function(){if(!Modernizr.inputtypes.number){return !1}if(!Modernizr.formvalidation){return !1}var A,e=createElement("div"),t=getBody(),n=function(){return docElement.insertBefore(t,docElement.firstElementChild||docElement.firstChild)}();e.innerHTML='<input type="number" value="1.0" step="0.1"/>';var r=e.childNodes[0];n.appendChild(e),r.focus();try{document.execCommand("InsertText",!1,"1,1")}catch(o){}return A="number"===r.type&&1.1===r.valueAsNumber&&r.checkValidity(),n.removeChild(e),t.fake&&n.parentNode.removeChild(n),A}),Modernizr.addTest("audio",function(){var A=createElement("audio"),e=!1;try{(e=!!A.canPlayType)&&(e=new Boolean(e),e.ogg=A.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),e.mp3=A.canPlayType('audio/mpeg; codecs="mp3"').replace(/^no$/,""),e.opus=A.canPlayType('audio/ogg; codecs="opus"')||A.canPlayType('audio/webm; codecs="opus"').replace(/^no$/,""),e.wav=A.canPlayType('audio/wav; codecs="1"').replace(/^no$/,""),e.m4a=(A.canPlayType("audio/x-m4a;")||A.canPlayType("audio/aac;")).replace(/^no$/,""))}catch(t){}return e});var modElem={elem:createElement("modernizr")};Modernizr._q.push(function(){delete modElem.elem}),Modernizr.addTest("csschunit",function(){var A,e=modElem.elem.style;try{e.fontSize="3ch",A=-1!==e.fontSize.indexOf("ch")}catch(t){A=!1}return A}),Modernizr.addTest("cssexunit",function(){var A,e=modElem.elem.style;try{e.fontSize="3ex",A=-1!==e.fontSize.indexOf("ex")}catch(t){A=!1}return A}),Modernizr.addTest("hsla",function(){var A=createElement("a").style;return A.cssText="background-color:hsla(120,40%,100%,.5)",contains(A.backgroundColor,"rgba")||contains(A.backgroundColor,"hsla")}),testStyles("#modernizr1{width: 50vmax}#modernizr2{width:50px;height:50px;overflow:scroll}#modernizr3{position:fixed;top:0;left:0;bottom:0;right:0}",function(A){var e=A.childNodes[2],t=A.childNodes[1],n=A.childNodes[0],r=parseInt((t.offsetWidth-t.clientWidth)/2,10),o=n.clientWidth/100,i=n.clientHeight/100,d=parseInt(50*Math.max(o,i),10),a=parseInt((window.getComputedStyle?getComputedStyle(e,null):e.currentStyle).width,10);Modernizr.addTest("cssvmaxunit",roundedEquals(d,a)||roundedEquals(d,a-r))},3),testStyles("#modernizr1{width: 50vm;width:50vmin}#modernizr2{width:50px;height:50px;overflow:scroll}#modernizr3{position:fixed;top:0;left:0;bottom:0;right:0}",function(A){var e=A.childNodes[2],t=A.childNodes[1],n=A.childNodes[0],r=parseInt((t.offsetWidth-t.clientWidth)/2,10),o=n.clientWidth/100,i=n.clientHeight/100,d=parseInt(50*Math.min(o,i),10),a=parseInt((window.getComputedStyle?getComputedStyle(e,null):e.currentStyle).width,10);Modernizr.addTest("cssvminunit",roundedEquals(d,a)||roundedEquals(d,a-r))},3),Modernizr.addTest("urlparser",function(){var A;try{return A=new URL("http://modernizr.com/"),"http://modernizr.com/"===A.href}catch(e){return !1}});var testXhrType=function(A){if("undefined"==typeof XMLHttpRequest){return !1}var e=new XMLHttpRequest;e.open("get","/",!0);try{e.responseType=A}catch(t){return !1}return"response" in e&&e.responseType==A};Modernizr.addTest("xhrresponsetypearraybuffer",testXhrType("arraybuffer")),Modernizr.addTest("xhrresponsetypeblob",testXhrType("blob")),Modernizr.addTest("xhrresponsetypedocument",testXhrType("document")),Modernizr.addTest("xhrresponsetypejson",testXhrType("json")),Modernizr.addTest("xhrresponsetypetext",testXhrType("text"));var toStringFn={}.toString;Modernizr.addTest("smil",function(){return !!document.createElementNS&&/SVGAnimate/.test(toStringFn.call(document.createElementNS("http://www.w3.org/2000/svg","animate")))}),Modernizr.addTest("svgclippaths",function(){return !!document.createElementNS&&/SVGClipPath/.test(toStringFn.call(document.createElementNS("http://www.w3.org/2000/svg","clipPath")))}),Modernizr.addTest("svgforeignobject",function(){return !!document.createElementNS&&/SVGForeignObject/.test(toStringFn.call(document.createElementNS("http://www.w3.org/2000/svg","foreignObject")))}),Modernizr.addTest("webgl",function(){var A=createElement("canvas"),e="probablySupportsContext" in A?"probablySupportsContext":"supportsContext";return e in A?A[e]("webgl")||A[e]("experimental-webgl"):"WebGLRenderingContext" in window}),Modernizr.addAsyncTest(function(){if(Modernizr.webglextensions=new Boolean(!1),Modernizr.webgl){var A,e,t;try{A=createElement("canvas"),e=A.getContext("webgl")||A.getContext("experimental-webgl"),t=e.getSupportedExtensions()}catch(n){return}e!==undefined&&(Modernizr.webglextensions=new Boolean(!0));for(var r=-1,o=t.length;++r<o;){Modernizr.webglextensions[t[r]]=!0}A=undefined}}),Modernizr.addTest("blobconstructor",function(){try{return !!new Blob}catch(A){return !1}},{aliases:["blob-constructor"]});var hasOwnProp;!function(){var A={}.hasOwnProperty;hasOwnProp=is(A,"undefined")||is(A.call,"undefined")?function(A,e){return e in A&&is(A.constructor.prototype[e],"undefined")}:function(e,t){return A.call(e,t)}}(),ModernizrProto._l={},ModernizrProto.on=function(A,e){this._l[A]||(this._l[A]=[]),this._l[A].push(e),Modernizr.hasOwnProperty(A)&&setTimeout(function(){Modernizr._trigger(A,Modernizr[A])},0)},ModernizrProto._trigger=function(A,e){if(this._l[A]){var t=this._l[A];setTimeout(function(){var A,n;for(A=0;A<t.length;A++){(n=t[A])(e)}},0),delete this._l[A]}},Modernizr._q.push(function(){ModernizrProto.addTest=addTest}),Modernizr.addAsyncTest(function(){var A,e,t=function(A){docElement.contains(A)||docElement.appendChild(A)},n=function(A){A.fake&&A.parentNode&&A.parentNode.removeChild(A)},r=function(A,e){var t=!!A;if(t&&(t=new Boolean(t),t.blocked="blocked"===A),addTest("flash",function(){return t}),e&&s.contains(e)){for(;e.parentNode!==s;){e=e.parentNode}s.removeChild(e)}};try{e="ActiveXObject" in window&&"Pan" in new window.ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch(o){}if(A=!("plugins" in navigator&&"Shockwave Flash" in navigator.plugins||e),A||isSVG){r(!1)}else{var i,d,a=createElement("embed"),s=getBody();if(a.type="application/x-shockwave-flash",s.appendChild(a),!("Pan" in a||e)){return t(s),r("blocked",a),void n(s)}i=function(){return t(s),docElement.contains(s)?(docElement.contains(a)?(d=a.style.cssText,""!==d?r("blocked",a):r(!0,a)):r("blocked"),void n(s)):(s=document.body||s,a=createElement("embed"),a.type="application/x-shockwave-flash",s.appendChild(a),setTimeout(i,1000))},setTimeout(i,10)}}),Modernizr.addAsyncTest(function(){function A(t){clearTimeout(e);var r=t!==undefined&&"loadeddata"===t.type?!0:!1;n.removeEventListener("loadeddata",A,!1),addTest("audiopreload",r),n.parentNode.removeChild(n)}var e,t=300,n=createElement("audio"),r=n.style;if(!(Modernizr.audio&&"preload" in n)){return void addTest("audiopreload",!1)}r.position="absolute",r.height=0,r.width=0;try{if(Modernizr.audio.mp3){n.src="data:audio/mpeg;base64,//MUxAAB6AXgAAAAAPP+c6nf//yi/6f3//MUxAMAAAIAAAjEcH//0fTX6C9Lf//0//MUxA4BeAIAAAAAAKX2/6zv//+IlR4f//MUxBMCMAH8AAAAABYWalVMQU1FMy45//MUxBUB0AH0AAAAADkuM1VVVVVVVVVV//MUxBgBUATowAAAAFVVVVVVVVVVVVVV"}else{if(Modernizr.audio.m4a){n.src="data:audio/x-m4a;base64,AAAAGGZ0eXBNNEEgAAACAGlzb21pc28yAAAACGZyZWUAAAAfbWRhdN4EAABsaWJmYWFjIDEuMjgAAAFoAQBHAAACiG1vb3YAAABsbXZoZAAAAAB8JbCAfCWwgAAAA+gAAAAYAAEAAAEAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAG0dHJhawAAAFx0a2hkAAAAD3wlsIB8JbCAAAAAAQAAAAAAAAAYAAAAAAAAAAAAAAAAAQAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAABUG1kaWEAAAAgbWRoZAAAAAB8JbCAfCWwgAAArEQAAAQAVcQAAAAAAC1oZGxyAAAAAAAAAABzb3VuAAAAAAAAAAAAAAAAU291bmRIYW5kbGVyAAAAAPttaW5mAAAAEHNtaGQAAAAAAAAAAAAAACRkaW5mAAAAHGRyZWYAAAAAAAAAAQAAAAx1cmwgAAAAAQAAAL9zdGJsAAAAW3N0c2QAAAAAAAAAAQAAAEttcDRhAAAAAAAAAAEAAAAAAAAAAAACABAAAAAArEQAAAAAACdlc2RzAAAAAAMZAAEABBFAFQAAAAABftAAAAAABQISCAYBAgAAABhzdHRzAAAAAAAAAAEAAAABAAAEAAAAABxzdHNjAAAAAAAAAAEAAAABAAAAAQAAAAEAAAAUc3RzegAAAAAAAAAXAAAAAQAAABRzdGNvAAAAAAAAAAEAAAAoAAAAYHVkdGEAAABYbWV0YQAAAAAAAAAhaGRscgAAAAAAAAAAbWRpcmFwcGwAAAAAAAAAAAAAAAAraWxzdAAAACOpdG9vAAAAG2RhdGEAAAABAAAAAExhdmY1Mi42NC4y"}else{if(Modernizr.audio.ogg){n.src="data:audio/ogg;base64,T2dnUwACAAAAAAAAAAD/QwAAAAAAAM2LVKsBHgF2b3JiaXMAAAAAAUSsAAAAAAAAgLsAAAAAAAC4AU9nZ1MAAAAAAAAAAAAA/0MAAAEAAADmvOe6Dy3/////////////////MgN2b3JiaXMdAAAAWGlwaC5PcmcgbGliVm9yYmlzIEkgMjAwNzA2MjIAAAAAAQV2b3JiaXMfQkNWAQAAAQAYY1QpRplS0kqJGXOUMUaZYpJKiaWEFkJInXMUU6k515xrrLm1IIQQGlNQKQWZUo5SaRljkCkFmVIQS0kldBI6J51jEFtJwdaYa4tBthyEDZpSTCnElFKKQggZU4wpxZRSSkIHJXQOOuYcU45KKEG4nHOrtZaWY4updJJK5yRkTEJIKYWSSgelU05CSDWW1lIpHXNSUmpB6CCEEEK2IIQNgtCQVQAAAQDAQBAasgoAUAAAEIqhGIoChIasAgAyAAAEoCiO4iiOIzmSY0kWEBqyCgAAAgAQAADAcBRJkRTJsSRL0ixL00RRVX3VNlVV9nVd13Vd13UgNGQVAAABAEBIp5mlGiDCDGQYCA1ZBQAgAAAARijCEANCQ1YBAAABAABiKDmIJrTmfHOOg2Y5aCrF5nRwItXmSW4q5uacc845J5tzxjjnnHOKcmYxaCa05pxzEoNmKWgmtOacc57E5kFrqrTmnHPGOaeDcUYY55xzmrTmQWo21uaccxa0pjlqLsXmnHMi5eZJbS7V5pxzzjnnnHPOOeecc6oXp3NwTjjnnHOi9uZabkIX55xzPhmne3NCOOecc84555xzzjnnnHOC0JBVAAAQAABBGDaGcacgSJ+jgRhFiGnIpAfdo8MkaAxyCqlHo6ORUuoglFTGSSmdIDRkFQAACAAAIYQUUkghhRRSSCGFFFKIIYYYYsgpp5yCCiqppKKKMsoss8wyyyyzzDLrsLPOOuwwxBBDDK20EktNtdVYY62555xrDtJaaa211koppZRSSikIDVkFAIAAABAIGWSQQUYhhRRSiCGmnHLKKaigAkJDVgEAgAAAAgAAADzJc0RHdERHdERHdERHdETHczxHlERJlERJtEzL1ExPFVXVlV1b1mXd9m1hF3bd93Xf93Xj14VhWZZlWZZlWZZlWZZlWZZlWYLQkFUAAAgAAIAQQgghhRRSSCGlGGPMMeegk1BCIDRkFQAACAAgAAAAwFEcxXEkR3IkyZIsSZM0S7M8zdM8TfREURRN01RFV3RF3bRF2ZRN13RN2XRVWbVdWbZt2dZtX5Zt3/d93/d93/d93/d93/d1HQgNWQUASAAA6EiOpEiKpEiO4ziSJAGhIasAABkAAAEAKIqjOI7jSJIkSZakSZ7lWaJmaqZneqqoAqEhqwAAQAAAAQAAAAAAKJriKabiKaLiOaIjSqJlWqKmaq4om7Lruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7ruq7rui4QGrIKAJAAANCRHMmRHEmRFEmRHMkBQkNWAQAyAAACAHAMx5AUybEsS9M8zdM8TfRET/RMTxVd0QVCQ1YBAIAAAAIAAAAAADAkw1IsR3M0SZRUS7VUTbVUSxVVT1VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVTVN0zRNIDRkJQAABADAYo3B5SAhJSXl3hDCEJOeMSYhtV4hBJGS3jEGFYOeMqIMct5C4xCDHggNWREARAEAAMYgxxBzyDlHqZMSOeeodJQa5xyljlJnKcWYYs0oldhSrI1zjlJHraOUYiwtdpRSjanGAgAAAhwAAAIshEJDVgQAUQAAhDFIKaQUYow5p5xDjCnnmHOGMeYcc44556B0UirnnHROSsQYc445p5xzUjonlXNOSiehAACAAAcAgAALodCQFQFAnACAQZI8T/I0UZQ0TxRFU3RdUTRd1/I81fRMU1U90VRVU1Vt2VRVWZY8zzQ901RVzzRV1VRVWTZVVZZFVdVt03V123RV3ZZt2/ddWxZ2UVVt3VRd2zdV1/Zd2fZ9WdZ1Y/I8VfVM03U903Rl1XVtW3VdXfdMU5ZN15Vl03Vt25VlXXdl2fc103Rd01Vl2XRd2XZlV7ddWfZ903WF35VlX1dlWRh2XfeFW9eV5XRd3VdlVzdWWfZ9W9eF4dZ1YZk8T1U903RdzzRdV3VdX1dd19Y105Rl03Vt2VRdWXZl2fddV9Z1zzRl2XRd2zZdV5ZdWfZ9V5Z13XRdX1dlWfhVV/Z1WdeV4dZt4Tdd1/dVWfaFV5Z14dZ1Ybl1XRg+VfV9U3aF4XRl39eF31luXTiW0XV9YZVt4VhlWTl+4ViW3feVZXRdX1ht2RhWWRaGX/id5fZ943h1XRlu3efMuu8Mx++k+8rT1W1jmX3dWWZfd47hGDq/8OOpqq+brisMpywLv+3rxrP7vrKMruv7qiwLvyrbwrHrvvP8vrAso+z6wmrLwrDatjHcvm4sv3Acy2vryjHrvlG2dXxfeArD83R1XXlmXcf2dXTjRzh+ygAAgAEHAIAAE8pAoSErAoA4AQCPJImiZFmiKFmWKIqm6LqiaLqupGmmqWmeaVqaZ5qmaaqyKZquLGmaaVqeZpqap5mmaJqua5qmrIqmKcumasqyaZqy7LqybbuubNuiacqyaZqybJqmLLuyq9uu7Oq6pFmmqXmeaWqeZ5qmasqyaZquq3meanqeaKqeKKqqaqqqraqqLFueZ5qa6KmmJ4qqaqqmrZqqKsumqtqyaaq2bKqqbbuq7Pqybeu6aaqybaqmLZuqatuu7OqyLNu6L2maaWqeZ5qa55mmaZqybJqqK1uep5qeKKqq5ommaqqqLJumqsqW55mqJ4qq6omea5qqKsumatqqaZq2bKqqLZumKsuubfu+68qybqqqbJuqauumasqybMu+78qq7oqmKcumqtqyaaqyLduy78uyrPuiacqyaaqybaqqLsuybRuzbPu6aJqybaqmLZuqKtuyLfu6LNu678qub6uqrOuyLfu67vqucOu6MLyybPuqrPq6K9u6b+sy2/Z9RNOUZVM1bdtUVVl2Zdn2Zdv2fdE0bVtVVVs2TdW2ZVn2fVm2bWE0Tdk2VVXWTdW0bVmWbWG2ZeF2Zdm3ZVv2ddeVdV/XfePXZd3murLty7Kt+6qr+rbu+8Jw667wCgAAGHAAAAgwoQwUGrISAIgCAACMYYwxCI1SzjkHoVHKOecgZM5BCCGVzDkIIZSSOQehlJQy5yCUklIIoZSUWgshlJRSawUAABQ4AAAE2KApsThAoSErAYBUAACD41iW55miatqyY0meJ4qqqaq27UiW54miaaqqbVueJ4qmqaqu6+ua54miaaqq6+q6aJqmqaqu67q6Lpqiqaqq67qyrpumqqquK7uy7Oumqqqq68quLPvCqrquK8uybevCsKqu68qybNu2b9y6ruu+7/vCka3rui78wjEMRwEA4AkOAEAFNqyOcFI0FlhoyEoAIAMAgDAGIYMQQgYhhJBSSiGllBIAADDgAAAQYEIZKDRkRQAQJwAAGEMppJRSSimllFJKKaWUUkoppZRSSimllFJKKaWUUkgppZRSSimllFJKKaWUUkoppZRSSimllFJKKaWUUkoppZRSSimllFJKKaWUUkqppJRSSimllFJKKaWUUkoppZRSSimllFJKKaWUUkoppZRSSimllFJKKaWUUkoppZRSSimllFJKKaWUUkoppZRSSimllFJKKaWUUkoppZRSSimllFJKKaWUUkoppZRSSimllFJKKaWUUkoppZRSSimllFJKKaWUUkoppZRSSimllFJKKaWUUkoppZRSSimllFJKKaWUUkoppZRSSimllFJKKaWUUkoppZRSSimllFJKKaWUUkoppZRSSimllFJKKaWUUkoppZRSSimllFJKKaWUUkoppZRSSimllFJKKaWUUkoplVJKKaWUUkoppZRSSimllFJKKaWUUkoppZRSSimllFJKKaWUUkoppZRSSimllFJKKaWUUkoppZRSSimllFJKKaWUUkoppZRSSimllFJKKaWUUkoppZRSCgCQinAAkHowoQwUGrISAEgFAACMUUopxpyDEDHmGGPQSSgpYsw5xhyUklLlHIQQUmktt8o5CCGk1FJtmXNSWosx5hgz56SkFFvNOYdSUoux5ppr7qS0VmuuNedaWqs115xzzbm0FmuuOdecc8sx15xzzjnnGHPOOeecc84FAOA0OACAHtiwOsJJ0VhgoSErAYBUAAACGaUYc8456BBSjDnnHIQQIoUYc845CCFUjDnnHHQQQqgYc8w5CCGEkDnnHIQQQgghcw466CCEEEIHHYQQQgihlM5BCCGEEEooIYQQQgghhBA6CCGEEEIIIYQQQgghhFJKCCGEEEIJoZRQAABggQMAQIANqyOcFI0FFhqyEgAAAgCAHJagUs6EQY5Bjw1BylEzDUJMOdGZYk5qMxVTkDkQnXQSGWpB2V4yCwAAgCAAIMAEEBggKPhCCIgxAABBiMwQCYVVsMCgDBoc5gHAA0SERACQmKBIu7iALgNc0MVdB0IIQhCCWBxAAQk4OOGGJ97whBucoFNU6iAAAAAAAAwA4AEA4KAAIiKaq7C4wMjQ2ODo8AgAAAAAABYA+AAAOD6AiIjmKiwuMDI0Njg6PAIAAAAAAAAAAICAgAAAAAAAQAAAAICAT2dnUwAE7AwAAAAAAAD/QwAAAgAAADuydfsFAQEBAQEACg4ODg=="}else{if(!Modernizr.audio.wav){return void addTest("audiopreload",!1)}n.src="data:audio/wav;base64,UklGRvwZAABXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABAAZGF0YdgZAAAAAAEA/v8CAP//AAABAP////8DAPz/BAD9/wEAAAAAAAAAAAABAP7/AgD//wAAAQD//wAAAQD//wAAAQD+/wIA//8AAAAAAAD//wIA/v8BAAAA//8BAAAA//8BAP//AQAAAP//AQD//wEAAAD//wEA//8BAP//AQD//wEA//8BAP//AQD+/wMA/f8DAP3/AgD+/wIA/////wMA/f8CAP7/AgD+/wMA/f8CAP7/AgD//wAAAAAAAAAAAQD+/wIA/v8CAP7/AwD9/wIA/v8BAAEA/v8CAP7/AQAAAAAAAAD//wEAAAD//wIA/f8DAP7/AQD//wEAAAD//wEA//8CAP7/AQD//wIA/v8CAP7/AQAAAAAAAAD//wEAAAAAAAAA//8BAP//AgD9/wQA+/8FAPz/AgAAAP//AgD+/wEAAAD//wIA/v8CAP3/BAD8/wQA/P8DAP7/AwD8/wQA/P8DAP7/AQAAAAAA//8BAP//AgD+/wEAAAD//wIA/v8BAP//AQD//wEAAAD//wEA//8BAAAAAAAAAP//AgD+/wEAAAAAAAAAAAD//wEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//AgD+/wIA/v8BAP//AQABAP7/AQD//wIA/v8CAP3/AwD/////AgD9/wMA/v8BAP//AQAAAP//AQD//wEA//8BAP//AAABAP//AAABAP//AQD//wAAAAACAP3/AwD9/wIA//8BAP//AQD//wEA//8BAP//AgD9/wMA/v8AAAIA/f8CAAAA/v8EAPv/BAD9/wIAAAD+/wQA+v8HAPr/BAD+/wEAAAD//wIA/f8EAPz/BAD7/wUA/P8EAPz/AwD+/wEAAAD//wEAAAAAAP//AgD8/wUA+/8FAPz/AwD9/wIA//8AAAEA/v8CAP//AQD//wAAAAABAP//AgD9/wMA/f8EAPz/AwD+/wAAAwD7/wUA/P8DAP7/AQAAAP//AgD+/wEAAQD+/wIA/v8BAAEA/v8CAP7/AQAAAP//AgD9/wMA/f8DAP7/AgD+/wEAAAAAAAEA//8AAAEA/v8DAP3/AgD//wEA//8BAP7/AwD9/wMA/v8BAP//AQAAAP//AgD9/wMA/v8BAP//AQAAAP//AgD+/wEAAQD+/wIA/////wIA//8AAAEA/f8DAP//AAABAP////8DAP3/AwD+/wEA//8BAP//AQAAAAAA//8BAP//AQD//wEA//8BAP//AAAAAAEA//8BAP7/AgD//wEA//8AAAAAAAAAAAAAAAD//wIA/v8BAAAA//8BAAEA/v8BAAAA//8DAPz/AwD+/wIA/v8CAP3/AwD+/wEAAAD//wEA//8BAAAA//8BAAAA/v8EAPv/BAD+/wAAAAABAP7/AgD//wAAAAABAP7/AgD//wAAAAAAAAAAAAABAP3/BAD8/wQA/f8BAAAAAAABAP7/AgD+/wIA/v8CAP7/AgD+/wIA/v8BAAAAAAD//wIA/f8DAP7/AAABAP//AAACAPz/BAD9/wIA//8AAP//AwD9/wMA/P8EAP3/AwD9/wIA//8BAP//AQD+/wMA/f8DAP7/AAABAP//AQAAAP//AQD//wIA/f8DAP7/AQAAAP//AQAAAAAA//8CAP7/AQABAP7/AgD+/wEAAQD+/wIA/v8CAP////8CAP7/AgD//wAAAAABAP7/AwD9/wIAAAD+/wMA/f8CAP//AQD+/wMA/f8CAP//AAACAPz/BQD6/wUA/v///wIA/v8CAP3/BAD7/wYA+v8FAPz/AwD/////AgD+/wEAAAD//wEAAAD//wIA/f8DAP7/AQAAAP//AgD//wAA//8BAAAAAAAAAP//AQD//wEA//8AAAIA/f8DAP3/AgAAAP//AQD//wEA//8AAAEA//8BAP////8CAP//AAABAP3/BAD9/wIA/v8BAAEA//8BAP7/AgD//wEA//8AAAEA//8BAP//AAAAAAEA//8BAP7/AgD//wEA//8AAAAAAQD+/wIA/v8BAAAAAAD//wIA/v8BAAAAAAAAAAAAAQD+/wMA/f8CAP//AQD//wIA/f8DAP7/AQD//wEA//8CAP7/AAABAP7/AwD9/wMA/v8AAAEA//8BAAAAAAD//wIA/v8BAAAA//8CAP7/AgD+/wEA//8CAP7/AgD//wAAAAAAAAAAAQD//wEA/v8DAPz/BQD8/wIA//8AAAEAAAD//wEA//8BAP//AQAAAAAA//8BAP//AgD+/wEAAAAAAP//AQD+/wMA/////wEA/v8CAP//AQD//wEA//8AAAEA//8BAAAA/v8EAPz/AwD+/wEAAAAAAAAA//8CAP7/AQD//wEA//8BAP//AAABAP7/AwD9/wIA//8BAP//AQD//wEA//8AAAEA/v8EAPv/BAD9/wIA//8BAP7/AwD9/wIA//8AAAEA//8BAP//AQD//wAAAQD//wEAAAD+/wMA/v8AAAIA/f8DAP7/AQD//wAAAQD+/wMA/f8CAP//AAABAP7/AgD+/wMA/f8CAP7/AQABAP7/AgD+/wIA/v8CAP7/AwD8/wMA//8AAAEA//8AAAAAAAABAP//AQD//wAAAQD//wIA/f8DAP3/AwD+/wAAAgD9/wIA//8AAAEAAAD+/wMA/P8FAPv/BAD9/wIA//8AAP//AgD+/wIA/v8BAAAAAAD//wEAAAAAAP//AQD//wEA//8BAP//AAABAP7/AwD9/wIA//8BAP//AAABAP//AQD//wAAAQD//wEA//8BAP//AAABAAAA//8BAP7/AwD9/wMA/f8DAP3/AgD//wEA//8BAP7/AgD//wAAAgD8/wQA/f8CAP//AQD+/wMA/f8CAP7/AgD//wAAAAAAAAAAAAABAP7/AwD9/wIA/v8DAP3/AwD9/wIA/v8DAPz/BQD7/wQA/f8CAP7/AwD9/wMA/f8CAP//AQAAAP7/AwD+/wEA//8AAAEAAAAAAP//AAABAP//AQAAAP7/AwD9/wMA/f8CAP//AQD//wEA//8AAAIA/f8CAAAA//8BAAAA//8BAAAA/v8EAPv/BAD9/wIA//8AAAEA/v8CAP//AAABAP//AAABAP//AAABAP7/AwD8/wQA/f8CAAAA/v8DAP3/AwD9/wMA/v8BAAAA//8BAAAA//8CAP7/AQAAAAAAAAAAAAAA//8CAP7/AgD+/wIA/v8CAP7/AgD//wAAAQD//wAAAQD//wAAAQD//wAAAQD+/wIA//8AAAAAAQD+/wMA/f8CAP//AQD//wEA//8AAAEA/v8DAP3/AgD//wAAAAABAP7/AwD9/wIA//8AAAEA/v8DAP3/AgD//wAAAAABAP7/AwD8/wMA/v8CAP//AAD//wIA/v8CAP7/AQABAP7/AQAAAP//AgD/////AQD//wEAAAD//wEA/v8EAPv/BAD9/wMA/v8BAAAA//8BAAEA/P8GAPr/BQD8/wMA/v8BAAAA//8CAP7/AQABAP3/BAD7/wYA+/8EAPz/AwD//wEA//8BAP7/BAD8/wMA/v8AAAIA/v8BAAAA//8BAAAA//8BAAAA//8CAP3/AwD+/wAAAgD8/wUA/P8DAP7/AAABAAAAAAD//wEAAAD//wIA/f8DAP7/AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAEA/f8EAPz/AwD/////AgD+/wIA/f8DAP7/AgD+/wEA//8CAP7/AQD//wEAAAAAAP//AQAAAP//AgD9/wMA/v8BAAAA//8BAP//AQAAAP//AAACAP3/BAD7/wQA/v8BAAAA//8BAP//AQAAAP//AQAAAP7/BAD7/wUA+/8EAP3/AgD//wAAAQD+/wIA//8AAAEA/v8CAP//AQD+/wEAAAAAAAAAAAD//wEA//8CAP3/AwD9/wIA//8AAAAAAAAAAAAA//8BAP//AgD+/wEA//8CAP7/AQAAAP//AgD/////AgD/////AgD+/wIA//8AAP//AQABAP7/AgD9/wMA/v8CAP////8BAAAAAAAAAAAA//8CAP////8DAPz/AwD+/wEAAAAAAP//AQD//wEAAAD//wEAAAD+/wQA+/8FAPz/AgAAAP//AgD9/wMA/v8BAAAAAAD//wEAAAD//wIA/v8BAAAAAAD//wIA/v8BAAAA//8BAAAA//8CAP7/AQD//wEA//8BAAAA//8BAP//AAABAP//AQAAAP7/AgD//wEA//8AAAAAAQD+/wMA/P8EAP7///8DAPz/BQD8/wEAAQD+/wMA/v8AAAEA//8BAP//AQD//wEA/v8CAP//AQD//wAAAAABAAAA//8BAP//AQAAAAAA//8BAP//AgD+/wAAAQD//wIA/f8CAP//AQAAAP7/AwD9/wMA/v8BAP//AAABAP//AgD9/wIA//8BAAAA//8BAAAA//8CAP3/AwD+/wEAAAD+/wQA/P8DAP7/AAACAP7/AQAAAP//AQAAAP//AQAAAP//AgD9/wIAAAD//wIA/f8DAP7/AQD//wEA//8CAP7/AQD//wAAAQD//wEA//8AAAAAAQD//wEAAAD9/wUA+/8FAPz/AgD//wAAAQD//wAAAQD+/wMA/f8BAAEA/v8CAP7/AgD+/wIA/v8BAAAAAAAAAAAAAAD//wIA/v8CAP////8CAP7/AgD+/wIA/v8CAP7/AQAAAP//AQAAAP//AQD//wAAAQD//wAAAQD+/wMA/f8CAAAA/v8DAP3/AgAAAP//AQAAAP7/AwD9/wMA/v8BAP//AQD//wEAAAD+/wMA/f8CAAAA/v8CAP//AAAAAAEA//8AAAEA/v8DAP3/AwD9/wIA//8BAP//AgD8/wQA/v8BAAAA/v8CAP//AQD//wAAAAAAAAEA/f8EAPz/BAD9/wIA//8AAAAAAAABAP//AAAAAAAAAAABAP3/BAD9/wIA/v8BAAEA//8AAAAA//8CAP7/AgD9/wQA+/8FAPv/BQD8/wMA/f8DAP3/AwD+/wAAAgD9/wMA/f8CAAAA/v8EAPv/BQD7/wUA/P8DAP///v8DAP3/BAD8/wMA/f8DAP7/AQD//wEAAAD//wEA/v8CAAAA/v8CAP7/AgD//wAAAAAAAAAAAQD+/wIA//8AAAEA/v8DAPz/BAD9/wIA//8AAP//AgD//wEA/v8BAAAAAQD//wAAAAAAAAEA//8AAAEA//8BAP//AAABAP//AQD+/wIA/v8DAPz/BAD8/wQA/f8BAAAAAQD+/wMA/P8DAP//AAAAAAAAAAD//wMA+/8FAP3/AQABAP3/BAD8/wMA/v8BAAAA//8CAP3/AwD+/wEAAQD9/wMA/f8EAPz/BAD7/wQA/v8BAAEA/f8DAP7/AQAAAP//AgD+/wEAAAD//wIA/v8CAP7/AgD+/wEAAQD//wEA/v8CAP7/BAD7/wQA/f8CAAAA//8AAAAAAAABAP//AQD+/wEAAQD+/wMA/f8BAAEA/v8DAPz/AwD/////AwD8/wQA/P8DAP7/AgD//wAA//8BAAAAAAAAAP//AgD+/wEAAAD//wIA/v8BAAAA//8CAP3/AgD//wAAAQD+/wIA/v8BAAAA//8CAP7/AgD+/wEA//8CAP3/BAD7/wQA/v8BAAAA//8AAAEAAAD//wIA/f8DAP7/AgD+/wIA/v8CAP7/AgD+/wEAAAAAAP//AgD9/wMA/v8BAP//AgD9/wMA/v8AAAEA//8BAP//AQD//wEA//8AAAEA/v8EAPz/AgD//wAAAQAAAP//AAABAP//AQD//wEAAAD//wEA//8BAAEA/f8DAP7/AQABAP3/AwD+/wIA/////wEAAAAAAAAAAAD//wIA/v8CAP////8CAP7/AgD//wAA//8CAP3/BAD9/wAAAgD9/wMA/v8BAP//AQAAAP//AQAAAP//AgD9/wMA/f8EAPz/AwD+/wEAAAAAAAAAAAD//wIA/f8EAP3/AAABAAAA//8CAP7/AQAAAP//AQAAAAAA//8BAP//AQAAAP//AQAAAP//AQAAAP//AgD9/wMA/v8BAP//AQAAAP//AQD//wIA/v8CAP3/BAD9/wEAAAD//wEAAQD9/wMA/f8CAAAA/v8DAP3/AgD//wAAAQD+/wIA/v8CAP7/AQAAAP//AgD+/wEAAAAAAP//AwD7/wUA/f8BAAEA/v8BAAEA/v8DAP3/AgD//wEA//8BAP//AQD//wEA//8CAP3/BAD7/wQA/////wIA/v8AAAIA/v8CAP3/BAD7/wUA/P8DAP3/AwD9/wMA/v8AAAIA/v8CAP7/AgD+/wIA//8AAAEA/v8CAP7/AgD//wAAAAD//wEAAAAAAAAA//8BAP7/BAD7/wUA/P8CAAAA//8BAP//AQAAAP//AgD9/wMA/v8BAAAA//8BAAAA//8CAP3/AwD+/wEA//8CAP3/AwD+/wAAAwD8/wIAAAD//wIA/////wIA/v8CAP7/AgD+/wEAAAAAAAAAAAAAAP//AgD+/wIA//8AAAAA//8CAP7/AgD+/wEA//8CAP3/AwD9/wMA/v8BAP7/AwD9/wMA/f8CAP//AQD+/wIA//8BAP//AQD+/wMA/v8BAAAA//8BAAAA//8CAP7/AQAAAP//AgD+/wIA/v8CAP//AAAAAAEA//8BAP//AAABAAAA//8BAP//AQD//wEA//8BAP//AQAAAP//AQD//wEAAAD//wIA/f8CAAAA//8BAAAA//8BAP//AAABAP//AQD//wAAAAAAAAEA/v8CAP//AQD//wAAAAABAP7/AwD9/wIAAAD+/wIA//8BAP//AgD9/wMA/f8DAP7/AgD+/wEAAAAAAAEA/v8CAP7/AgD//wAAAAAAAAAAAAAAAP//AgD/////AgD9/wQA/f8BAAAAAAAAAAEA/f8DAP////8DAP3/AQABAP7/AgD//wAAAQD+/wMA/f8CAP7/AQABAP7/AwD7/wYA+v8FAP3/AQABAP7/AgD+/wMA/f8CAP7/AwD+/wEA//8BAP//AQAAAP7/BQD5/wcA+v8FAPz/AwD+/wIA/v8BAAAA//8DAPv/BQD8/wMA/////wEAAAAAAAAAAAD//wIA/f8DAP7/AQAAAP//AQAAAP//AgD+/wIA/v8BAAEA/f8EAPz/AwD+/wEA//8CAP7/AQD//wEA//8CAP7/AQAAAP//AgD+/wEAAAAAAAAAAAAAAAAAAAD//wIA/f8EAPz/AwD+/wEA//8CAP7/AgD+/wEAAQD+/wEAAQD+/wIA/////wIA//8AAAAAAAAAAAAAAAD//wEAAAAAAP//AgD9/wMA/v8BAP//AQAAAP//AQD//wEA//8BAP//AQD//wEA//8BAP//AQAAAP7/AwD9/wMA/v8BAP7/AwD9/wMA/v8BAP//AAABAP//AQD//wAAAAABAP//AAAAAAAAAQD//wEA/v8CAAAA/v8EAPv/BAD9/wIAAAD+/wMA/P8DAP//AAAAAP//AQD//wIA/f8DAP3/AwD9/wMA/v8BAAAA//8BAAAA//8CAP3/AwD9/wQA+/8FAPv/BQD8/wMA/v8BAAAA//8BAP//AgD+/wEAAAD//wIA/v8BAAEA/f8DAP3/AgAAAP//AQD//wAAAQD//wEA//8BAP//AQD//wEA/v8DAP3/AgAAAP7/AwD9/wIAAAD//wEAAAD//wIA/f8DAP7/AgD9/wQA+/8FAPz/AgAAAP//AgD9/wIA//8BAP//AQD//wEA//8BAP//AQD//wIA/f8DAP3/AgD//wAAAQD+/wIA/v8BAAEA/v8CAP7/AgD+/wMA/P8DAP//AAABAP7/AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEA/v8CAP3/BAD8/wMA/v8BAAAAAAD//wEAAAAAAAAAAAD//wEAAAAAAAAA//8BAP//AgD+/wEA//8CAP3/AwD9/wMA/f8EAPv/BAD+/wAAAQD//wEA//8BAP//AAABAP//AQD//wEAAAD//wEA//8BAP//AgD9/wMA/v8AAAIA/f8DAP7/AAACAP3/AwD+/wEA//8BAP//AQAAAP//AQAAAP7/AwD9/wMA/v8AAAEA//8BAP//AAAAAAEA//8AAAEA/v8CAP//AAAAAAEA/v8DAPz/BAD9/wEAAQD+/wEAAQD9/wQA/P8DAP7/AQAAAAAAAAAAAAAAAAAAAAAAAQD+/wIA/////wIA/v8BAAAA//8BAP//AQD//wEA//8BAAAA/v8EAPz/AwD///7/BAD8/wMA/////wIA/v8CAP////8CAP7/AgD+/wIA/v8CAP////8CAP7/AwD9/wIA/v8CAP//AAABAP7/AwD9/wEAAQD+/wMA/f8CAP//AAAAAAEA/v8DAPz/BAD9/wIA/v8CAP7/AgD//wAAAAD//wIA/v8CAP7/AQAAAAAA//8CAP7/AgD+/wIA/v8CAP7/AwD8/wUA+v8GAPv/AwD//wAAAAAAAAAA//8DAPv/BQD9/wAAAgD9/wMA/v8BAP//AQAAAP//AgD9/wMA/v8BAAAA//8BAAAAAAAAAP//AQAAAAAAAAD//wEA//8CAP3/AwD+/wAAAgD+/wEAAAD//wIA/v8CAP7/AgD/////AwD8/wUA/P8CAP//AQD//wIA/f8DAP3/AwD+/wAAAQD+/wMA/f8DAP3/AgD//wAAAQD//wEA//8BAP7/AwD+/wEA//8AAAEA//8CAPz/BAD9/wIA//8AAAEA/v8DAPz/BAD9/wIA//8AAAEA/v8CAP7/AgD//wEA/f8EAPz/BAD+////AgD//wAAAQD//wAAAQD//wEA//8BAP7/AwD+/wEA"}}}}catch(o){return void addTest("audiopreload",!1)}n.setAttribute("preload","auto"),n.style.cssText="display:none",docElement.appendChild(n),setTimeout(function(){n.addEventListener("loadeddata",A,!1),e=setTimeout(A,t)},0)}),Modernizr.addAsyncTest(function(){if(!Modernizr.canvas){return !1}var A=new Image,e=createElement("canvas"),t=e.getContext("2d");A.onload=function(){addTest("apng",function(){return"undefined"==typeof e.getContext?!1:(t.drawImage(A,0,0),0===t.getImageData(0,0,1,1).data[3])})},A.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACGFjVEwAAAABAAAAAcMq2TYAAAANSURBVAiZY2BgYPgPAAEEAQB9ssjfAAAAGmZjVEwAAAAAAAAAAQAAAAEAAAAAAAAAAAD6A+gBAbNU+2sAAAARZmRBVAAAAAEImWNgYGBgAAAABQAB6MzFdgAAAABJRU5ErkJggg=="}),Modernizr.addAsyncTest(function(){var A=new Image;A.onload=A.onerror=function(){addTest("jpeg2000",1==A.width)},A.src="data:image/jp2;base64,/0//UQAyAAAAAAABAAAAAgAAAAAAAAAAAAAABAAAAAQAAAAAAAAAAAAEBwEBBwEBBwEBBwEB/1IADAAAAAEAAAQEAAH/XAAEQED/ZAAlAAFDcmVhdGVkIGJ5IE9wZW5KUEVHIHZlcnNpb24gMi4wLjD/kAAKAAAAAABYAAH/UwAJAQAABAQAAf9dAAUBQED/UwAJAgAABAQAAf9dAAUCQED/UwAJAwAABAQAAf9dAAUDQED/k8+kEAGvz6QQAa/PpBABr994EAk//9k="}),Modernizr.addAsyncTest(function(){var A=new Image;A.onload=A.onerror=function(){addTest("jpegxr",1==A.width,{aliases:["jpeg-xr"]})},A.src="data:image/vnd.ms-photo;base64,SUm8AQgAAAAFAAG8AQAQAAAASgAAAIC8BAABAAAAAQAAAIG8BAABAAAAAQAAAMC8BAABAAAAWgAAAMG8BAABAAAAHwAAAAAAAAAkw91vA07+S7GFPXd2jckNV01QSE9UTwAZAYBxAAAAABP/gAAEb/8AAQAAAQAAAA=="}),Modernizr.addAsyncTest(function(){var A,e,t,n=createElement("img"),r="sizes" in n;!r&&"srcset" in n?(e="data:image/gif;base64,R0lGODlhAgABAPAAAP///wAAACH5BAAAAAAALAAAAAACAAEAAAICBAoAOw==",A="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",t=function(){addTest("sizes",2==n.width)},n.onload=t,n.onerror=t,n.setAttribute("sizes","9px"),n.srcset=A+" 1w,"+e+" 8w",n.src=A):addTest("sizes",r)}),Modernizr.addAsyncTest(function(){var A=new Image;A.onerror=function(){addTest("webpalpha",!1,{aliases:["webp-alpha"]})},A.onload=function(){addTest("webpalpha",1==A.width,{aliases:["webp-alpha"]})},A.src="data:image/webp;base64,UklGRkoAAABXRUJQVlA4WAoAAAAQAAAAAAAAAAAAQUxQSAwAAAABBxAR/Q9ERP8DAABWUDggGAAAADABAJ0BKgEAAQADADQlpAADcAD++/1QAA=="}),Modernizr.addTest("svgasimg",document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#Image","1.1")),Modernizr.addAsyncTest(function(){function A(){var A=new Image;A.onerror=function(){addTest("datauri",!0),Modernizr.datauri=new Boolean(!0),Modernizr.datauri.over32kb=!1},A.onload=function(){addTest("datauri",!0),Modernizr.datauri=new Boolean(!0),Modernizr.datauri.over32kb=1==A.width&&1==A.height};for(var e="R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";e.length<33000;){e="\r\n"+e}A.src="data:image/gif;base64,"+e}-1!==navigator.userAgent.indexOf("MSIE 7.")&&setTimeout(function(){addTest("datauri",!1)},10);var e=new Image;e.onerror=function(){addTest("datauri",!1)},e.onload=function(){1==e.width&&1==e.height?A():addTest("datauri",!1)},e.src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=="}),Modernizr.addAsyncTest(function(){function A(i){r++,clearTimeout(e);var d=i&&"playing"===i.type||0!==o.currentTime;return !d&&n>r?void (e=setTimeout(A,t)):(o.removeEventListener("playing",A,!1),addTest("videoautoplay",d),void o.parentNode.removeChild(o))}var e,t=200,n=5,r=0,o=createElement("video"),i=o.style;if(!(Modernizr.video&&"autoplay" in o)){return void addTest("videoautoplay",!1)}i.position="absolute",i.height=0,i.width=0;try{if(Modernizr.video.ogg){o.src="data:video/ogg;base64,T2dnUwACAAAAAAAAAABmnCATAAAAAHDEixYBKoB0aGVvcmEDAgEAAQABAAAQAAAQAAAAAAAFAAAAAQAAAAAAAAAAAGIAYE9nZ1MAAAAAAAAAAAAAZpwgEwEAAAACrA7TDlj///////////////+QgXRoZW9yYSsAAABYaXBoLk9yZyBsaWJ0aGVvcmEgMS4xIDIwMDkwODIyIChUaHVzbmVsZGEpAQAAABoAAABFTkNPREVSPWZmbXBlZzJ0aGVvcmEtMC4yOYJ0aGVvcmG+zSj3uc1rGLWpSUoQc5zmMYxSlKQhCDGMYhCEIQhAAAAAAAAAAAAAEW2uU2eSyPxWEvx4OVts5ir1aKtUKBMpJFoQ/nk5m41mUwl4slUpk4kkghkIfDwdjgajQYC8VioUCQRiIQh8PBwMhgLBQIg4FRba5TZ5LI/FYS/Hg5W2zmKvVoq1QoEykkWhD+eTmbjWZTCXiyVSmTiSSCGQh8PB2OBqNBgLxWKhQJBGIhCHw8HAyGAsFAiDgUCw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDAwPEhQUFQ0NDhESFRUUDg4PEhQVFRUOEBETFBUVFRARFBUVFRUVEhMUFRUVFRUUFRUVFRUVFRUVFRUVFRUVEAwLEBQZGxwNDQ4SFRwcGw4NEBQZHBwcDhATFhsdHRwRExkcHB4eHRQYGxwdHh4dGxwdHR4eHh4dHR0dHh4eHRALChAYKDM9DAwOExo6PDcODRAYKDlFOA4RFh0zV1A+EhYlOkRtZ00YIzdAUWhxXDFATldneXhlSFxfYnBkZ2MTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTExMTEhIVGRoaGhoSFBYaGhoaGhUWGRoaGhoaGRoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhESFh8kJCQkEhQYIiQkJCQWGCEkJCQkJB8iJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQkJCQREhgvY2NjYxIVGkJjY2NjGBo4Y2NjY2MvQmNjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjY2NjFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRISEhUXGBkbEhIVFxgZGxwSFRcYGRscHRUXGBkbHB0dFxgZGxwdHR0YGRscHR0dHhkbHB0dHR4eGxwdHR0eHh4REREUFxocIBERFBcaHCAiERQXGhwgIiUUFxocICIlJRcaHCAiJSUlGhwgIiUlJSkcICIlJSUpKiAiJSUlKSoqEBAQFBgcICgQEBQYHCAoMBAUGBwgKDBAFBgcICgwQEAYHCAoMEBAQBwgKDBAQEBgICgwQEBAYIAoMEBAQGCAgAfF5cdH1e3Ow/L66wGmYnfIUbwdUTe3LMRbqON8B+5RJEvcGxkvrVUjTMrsXYhAnIwe0dTJfOYbWrDYyqUrz7dw/JO4hpmV2LsQQvkUeGq1BsZLx+cu5iV0e0eScJ91VIQYrmqfdVSK7GgjOU0oPaPOu5IcDK1mNvnD+K8LwS87f8Jx2mHtHnUkTGAurWZlNQa74ZLSFH9oF6FPGxzLsjQO5Qe0edcpttd7BXBSqMCL4k/4tFrHIPuEQ7m1/uIWkbDMWVoDdOSuRQ9286kvVUlQjzOE6VrNguN4oRXYGkgcnih7t13/9kxvLYKQezwLTrO44sVmMPgMqORo1E0sm1/9SludkcWHwfJwTSybR4LeAz6ugWVgRaY8mV/9SluQmtHrzsBtRF/wPY+X0JuYTs+ltgrXAmlk10xQHmTu9VSIAk1+vcvU4ml2oNzrNhEtQ3CysNP8UeR35wqpKUBdGdZMSjX4WVi8nJpdpHnbhzEIdx7mwf6W1FKAiucMXrWUWVjyRf23chNtR9mIzDoT/6ZLYailAjhFlZuvPtSeZ+2oREubDoWmT3TguY+JHPdRVSLKxfKH3vgNqJ/9emeEYikGXDFNzaLjvTeGAL61mogOoeG3y6oU4rW55ydoj0lUTSR/mmRhPmF86uwIfzp3FtiufQCmppaHDlGE0r2iTzXIw3zBq5hvaTldjG4CPb9wdxAme0SyedVKczJ9AtYbgPOzYKJvZZImsN7ecrxWZg5dR6ZLj/j4qpWsIA+vYwE+Tca9ounMIsrXMB4Stiib2SPQtZv+FVIpfEbzv8ncZoLBXc3YBqTG1HsskTTotZOYTG+oVUjLk6zhP8bg4RhMUNtfZdO7FdpBuXzhJ5Fh8IKlJG7wtD9ik8rWOJxy6iQ3NwzBpQ219mlyv+FLicYs2iJGSE0u2txzed++D61ZWCiHD/cZdQVCqkO2gJpdpNaObhnDfAPrT89RxdWFZ5hO3MseBSIlANppdZNIV/Rwe5eLTDvkfWKzFnH+QJ7m9QWV1KdwnuIwTNtZdJMoXBf74OhRnh2t+OTGL+AVUnIkyYY+QG7g9itHXyF3OIygG2s2kud679ZWKqSFa9n3IHD6MeLv1lZ0XyduRhiDRtrNnKoyiFVLcBm0ba5Yy3fQkDh4XsFE34isVpOzpa9nR8iCpS4HoxG2rJpnRhf3YboVa1PcRouh5LIJv/uQcPNd095ickTaiGBnWLKVWRc0OnYTSyex/n2FofEPnDG8y3PztHrzOLK1xo6RAml2k9owKajOC0Wr4D5x+3nA0UEhK2m198wuBHF3zlWWVKWLN1CHzLClUfuoYBcx4b1llpeBKmbayaR58njtE9onD66lUcsg0Spm2snsb+8HaJRn4dYcLbCuBuYwziB8/5U1C1DOOz2gZjSZtrLJk6vrLF3hwY4Io9xuT/ruUFRSBkNtUzTOWhjh26irLEPx4jPZL3Fo3QrReoGTTM21xYTT9oFdhTUIvjqTkfkvt0bzgVUjq/hOYY8j60IaO/0AzRBtqkTS6R5ellZd5uKdzzhb8BFlDdAcrwkE0rbXTOPB+7Y0FlZO96qFL4Ykg21StJs8qIW7h16H5hGiv8V2Cflau7QVDepTAHa6Lgt6feiEvJDM21StJsmOH/hynURrKxvUpQ8BH0JF7BiyG2qZpnL/7AOU66gt+reLEXY8pVOCQvSsBtqZTNM8bk9ohRcwD18o/WVkbvrceVKRb9I59IEKysjBeTMmmbA21xu/6iHadLRxuIzkLpi8wZYmmbbWi32RVAUjruxWlJ//iFxE38FI9hNKOoCdhwf5fDe4xZ81lgREhK2m1j78vW1CqkuMu/AjBNK210kzRUX/B+69cMMUG5bYrIeZxVSEZISmkzbXOi9yxwIfPgdsov7R71xuJ7rFcACjG/9PzApqFq7wEgzNJm2suWESPuwrQvejj7cbnQxMkxpm21lUYJL0fKmogPPqywn7e3FvB/FCNxPJ85iVUkCE9/tLKx31G4CgNtWTTPFhMvlu8G4/TrgaZttTChljfNJGgOT2X6EqpETy2tYd9cCBI4lIXJ1/3uVUllZEJz4baqGF64yxaZ+zPLYwde8Uqn1oKANtUrSaTOPHkhvuQP3bBlEJ/LFe4pqQOHUI8T8q7AXx3fLVBgSCVpMba55YxN3rv8U1Dv51bAPSOLlZWebkL8vSMGI21lJmmeVxPRwFlZF1CpqCN8uLwymaZyjbXHCRytogPN3o/n74CNykfT+qqRv5AQlHcRxYrC5KvGmbbUwmZY/29BvF6C1/93x4WVglXDLFpmbapmF89HKTogRwqqSlGbu+oiAkcWFbklC6Zhf+NtTLFpn8oWz+HsNRVSgIxZWON+yVyJlE5tq/+GWLTMutYX9ekTySEQPLVNQQ3OfycwJBM0zNtZcse7CvcKI0V/zh16Dr9OSA21MpmmcrHC+6pTAPHPwoit3LHHqs7jhFNRD6W8+EBGoSEoaZttTCZljfduH/fFisn+dRBGAZYtMzbVMwvul/T/crK1NQh8gN0SRRa9cOux6clC0/mDLFpmbarmF8/e6CopeOLCNW6S/IUUg3jJIYiAcDoMcGeRbOvuTPjXR/tyo79LK3kqqkbxkkMRAOB0GODPItnX3Jnxro/25Ud+llbyVVSN4ySGIgHA6DHBnkWzr7kz410f7cqO/Syt5KqpFVJwn6gBEvBM0zNtZcpGOEPiysW8vvRd2R0f7gtjhqUvXL+gWVwHm4XJDBiMpmmZtrLfPwd/IugP5+fKVSysH1EXreFAcEhelGmbbUmZY4Xdo1vQWVnK19P4RuEnbf0gQnR+lDCZlivNM22t1ESmopPIgfT0duOfQrsjgG4tPxli0zJmF5trdL1JDUIUT1ZXSqQDeR4B8mX3TrRro/2McGeUvLtwo6jIEKMkCUXWsLyZROd9P/rFYNtXPBli0z398iVUlVKAjFlY437JXImUTm2r/4ZYtMy61hf16RPJIU9nZ1MABAwAAAAAAAAAZpwgEwIAAABhp658BScAAAAAAADnUFBQXIDGXLhwtttNHDhw5OcpQRMETBEwRPduylKVB0HRdF0A"}else{if(!Modernizr.video.h264){return void addTest("videoautoplay",!1)}o.src="data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAAAs1tZGF0AAACrgYF//+q3EXpvebZSLeWLNgg2SPu73gyNjQgLSBjb3JlIDE0OCByMjYwMSBhMGNkN2QzIC0gSC4yNjQvTVBFRy00IEFWQyBjb2RlYyAtIENvcHlsZWZ0IDIwMDMtMjAxNSAtIGh0dHA6Ly93d3cudmlkZW9sYW4ub3JnL3gyNjQuaHRtbCAtIG9wdGlvbnM6IGNhYmFjPTEgcmVmPTMgZGVibG9jaz0xOjA6MCBhbmFseXNlPTB4MzoweDExMyBtZT1oZXggc3VibWU9NyBwc3k9MSBwc3lfcmQ9MS4wMDowLjAwIG1peGVkX3JlZj0xIG1lX3JhbmdlPTE2IGNocm9tYV9tZT0xIHRyZWxsaXM9MSA4eDhkY3Q9MSBjcW09MCBkZWFkem9uZT0yMSwxMSBmYXN0X3Bza2lwPTEgY2hyb21hX3FwX29mZnNldD0tMiB0aHJlYWRzPTEgbG9va2FoZWFkX3RocmVhZHM9MSBzbGljZWRfdGhyZWFkcz0wIG5yPTAgZGVjaW1hdGU9MSBpbnRlcmxhY2VkPTAgYmx1cmF5X2NvbXBhdD0wIGNvbnN0cmFpbmVkX2ludHJhPTAgYmZyYW1lcz0zIGJfcHlyYW1pZD0yIGJfYWRhcHQ9MSBiX2JpYXM9MCBkaXJlY3Q9MSB3ZWlnaHRiPTEgb3Blbl9nb3A9MCB3ZWlnaHRwPTIga2V5aW50PTI1MCBrZXlpbnRfbWluPTEwIHNjZW5lY3V0PTQwIGludHJhX3JlZnJlc2g9MCByY19sb29rYWhlYWQ9NDAgcmM9Y3JmIG1idHJlZT0xIGNyZj0yMy4wIHFjb21wPTAuNjAgcXBtaW49MCBxcG1heD02OSBxcHN0ZXA9NCBpcF9yYXRpbz0xLjQwIGFxPTE6MS4wMACAAAAAD2WIhAA3//728P4FNjuZQQAAAu5tb292AAAAbG12aGQAAAAAAAAAAAAAAAAAAAPoAAAAZAABAAABAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAACGHRyYWsAAABcdGtoZAAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAZAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAgAAAAIAAAAAACRlZHRzAAAAHGVsc3QAAAAAAAAAAQAAAGQAAAAAAAEAAAAAAZBtZGlhAAAAIG1kaGQAAAAAAAAAAAAAAAAAACgAAAAEAFXEAAAAAAAtaGRscgAAAAAAAAAAdmlkZQAAAAAAAAAAAAAAAFZpZGVvSGFuZGxlcgAAAAE7bWluZgAAABR2bWhkAAAAAQAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAAA+3N0YmwAAACXc3RzZAAAAAAAAAABAAAAh2F2YzEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAgACAEgAAABIAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY//8AAAAxYXZjQwFkAAr/4QAYZ2QACqzZX4iIhAAAAwAEAAADAFA8SJZYAQAGaOvjyyLAAAAAGHN0dHMAAAAAAAAAAQAAAAEAAAQAAAAAHHN0c2MAAAAAAAAAAQAAAAEAAAABAAAAAQAAABRzdHN6AAAAAAAAAsUAAAABAAAAFHN0Y28AAAAAAAAAAQAAADAAAABidWR0YQAAAFptZXRhAAAAAAAAACFoZGxyAAAAAAAAAABtZGlyYXBwbAAAAAAAAAAAAAAAAC1pbHN0AAAAJal0b28AAAAdZGF0YQAAAAEAAAAATGF2ZjU2LjQwLjEwMQ=="}}catch(d){return void addTest("videoautoplay",!1)}o.setAttribute("autoplay",""),o.style.cssText="display:none",docElement.appendChild(o),setTimeout(function(){o.addEventListener("playing",A,!1),e=setTimeout(A,t)},0)}),Modernizr.addAsyncTest(function(){function A(){addTest("blobworkers",!1),e()}function e(){d&&n.revokeObjectURL(d),i&&i.terminate(),a&&clearTimeout(a)}try{var t=window.BlobBuilder,n=window.URL;Modernizr._config.usePrefix&&(t=t||window.MozBlobBuilder||window.WebKitBlobBuilder||window.MSBlobBuilder||window.OBlobBuilder,n=n||window.MozURL||window.webkitURL||window.MSURL||window.OURL);var r,o,i,d,a,s="Modernizr",l="this.onmessage=function(e){postMessage(e.data)}";try{r=new Blob([l],{type:"text/javascript"})}catch(c){}r||(o=new t,o.append(l),r=o.getBlob()),d=n.createObjectURL(r),i=new Worker(d),i.onmessage=function(A){addTest("blobworkers",s===A.data),e()},i.onerror=A,a=setTimeout(A,200),i.postMessage(s)}catch(c){A()}}),Modernizr.addAsyncTest(function(){try{var A="Modernizr",e=new Worker("data:text/javascript;base64,dGhpcy5vbm1lc3NhZ2U9ZnVuY3Rpb24oZSl7cG9zdE1lc3NhZ2UoZS5kYXRhKX0=");e.onmessage=function(t){e.terminate(),addTest("dataworkers",A===t.data),e=null},e.onerror=function(){addTest("dataworkers",!1),e=null},setTimeout(function(){addTest("dataworkers",!1)},200),e.postMessage(A)}catch(t){setTimeout(function(){addTest("dataworkers",!1)},0)}});var mStyle={style:modElem.elem.style};Modernizr._q.unshift(function(){delete mStyle.style});var testProp=ModernizrProto.testProp=function(A,e,t){return testProps([A],undefined,e,t)};Modernizr.addTest("textshadow",testProp("textShadow","1px 1px")),ModernizrProto.testAllProps=testPropsAll;var prefixed=ModernizrProto.prefixed=function(A,e,t){return 0===A.indexOf("@")?atRule(A):(-1!=A.indexOf("-")&&(A=cssToDOM(A)),e?testPropsAll(A,e,t):testPropsAll(A,"pfx"))},prefixedCSS=ModernizrProto.prefixedCSS=function(A){var e=prefixed(A);return e&&domToCSS(e)};Modernizr.addTest("forcetouch",function(){return hasEvent(prefixed("mouseforcewillbegin",window,!1),window)?MouseEvent.WEBKIT_FORCE_AT_MOUSE_DOWN&&MouseEvent.WEBKIT_FORCE_AT_FORCE_MOUSE_DOWN:!1}),Modernizr.addTest("fullscreen",!(!prefixed("exitFullscreen",document,!1)&&!prefixed("cancelFullScreen",document,!1)));var crypto=prefixed("crypto",window);Modernizr.addTest("crypto",!!prefixed("subtle",crypto)),Modernizr.addTest("pagevisibility",!!prefixed("hidden",document,!1)),Modernizr.addTest("backgroundblendmode",prefixed("backgroundBlendMode","text")),Modernizr.addTest("objectfit",!!prefixed("objectFit"),{aliases:["object-fit"]}),Modernizr.addTest("wrapflow",function(){var A=prefixed("wrapFlow");if(!A||isSVG){return !1}var e=A.replace(/([A-Z])/g,function(A,e){return"-"+e.toLowerCase()}).replace(/^ms-/,"-ms-"),t=createElement("div"),n=createElement("div"),r=createElement("span");n.style.cssText="position: absolute; left: 50px; width: 100px; height: 20px;"+e+":end;",r.innerText="X",t.appendChild(n),t.appendChild(r),docElement.appendChild(t);var o=r.offsetLeft;return docElement.removeChild(t),n=r=t=undefined,150==o}),Modernizr.addTest("filesystem",!!prefixed("requestFileSystem",window)),Modernizr.addTest("requestautocomplete",!!prefixed("requestAutocomplete",createElement("form"))),Modernizr.addTest("getusermedia",!!prefixed("getUserMedia",navigator)),Modernizr.addTest("matchmedia",!!prefixed("matchMedia",window));var url=prefixed("URL",window,!1);url=url&&window[url],Modernizr.addTest("bloburls",url&&"revokeObjectURL" in url&&"createObjectURL" in url),Modernizr.addAsyncTest(function(){function A(){addTest("transferables",!1),e()}function e(){d&&URL.revokeObjectURL(d),a&&a.terminate(),r&&clearTimeout(r)}var t=!!(Modernizr.blobconstructor&&Modernizr.bloburls&&Modernizr.webworkers&&Modernizr.typedarrays);if(!t){return addTest("transferables",!1)}try{var n,r,o='var hello = "world"',i=new Blob([o],{type:"text/javascript"}),d=URL.createObjectURL(i),a=new Worker(d);a.onerror=A,r=setTimeout(A,200),n=new ArrayBuffer(1),a.postMessage(n,[n]),addTest("transferables",0===n.byteLength),e()}catch(s){A()}}),ModernizrProto.testAllProps=testAllProps,Modernizr.addTest("ligatures",testAllProps("fontFeatureSettings",'"liga" 1')),Modernizr.addTest("cssanimations",testAllProps("animationName","a",!0)),Modernizr.addTest("csspseudoanimations",function(){var A=!1;if(!Modernizr.cssanimations||!window.getComputedStyle){return A}var e=["@",Modernizr._prefixes.join("keyframes csspseudoanimations { from { font-size: 10px; } }@").replace(/\@$/,""),'#modernizr:before { content:" "; font-size:5px;',Modernizr._prefixes.join("animation:csspseudoanimations 1ms infinite;"),"}"].join("");return Modernizr.testStyles(e,function(e){A="10px"===window.getComputedStyle(e,":before").getPropertyValue("font-size")}),A}),Modernizr.addTest("appearance",testAllProps("appearance")),Modernizr.addTest("backdropfilter",testAllProps("backdropFilter")),Modernizr.addTest("backgroundcliptext",function(){return testAllProps("backgroundClip","text")}),Modernizr.addTest("bgpositionxy",function(){return testAllProps("backgroundPositionX","3px",!0)&&testAllProps("backgroundPositionY","5px",!0)}),Modernizr.addTest("bgrepeatround",testAllProps("backgroundRepeat","round")),Modernizr.addTest("bgrepeatspace",testAllProps("backgroundRepeat","space")),Modernizr.addTest("backgroundsize",testAllProps("backgroundSize","100%",!0)),Modernizr.addTest("borderimage",testAllProps("borderImage","url() 1",!0)),Modernizr.addTest("bgsizecover",testAllProps("backgroundSize","cover")),Modernizr.addTest("borderradius",testAllProps("borderRadius","0px",!0)),Modernizr.addTest("boxshadow",testAllProps("boxShadow","1px 1px",!0)),Modernizr.addTest("boxsizing",testAllProps("boxSizing","border-box",!0)&&(document.documentMode===undefined||document.documentMode>7)),function(){Modernizr.addTest("csscolumns",function(){var A=!1,e=testAllProps("columnCount");try{(A=!!e)&&(A=new Boolean(A))}catch(t){}return A});for(var A,e,t=["Width","Span","Fill","Gap","Rule","RuleColor","RuleStyle","RuleWidth","BreakBefore","BreakAfter","BreakInside"],n=0;n<t.length;n++){A=t[n].toLowerCase(),e=testAllProps("column"+t[n]),("breakbefore"===A||"breakafter"===A||"breakinside"==A)&&(e=e||testAllProps(t[n])),Modernizr.addTest("csscolumns."+A,e)}}(),Modernizr.addTest("ellipsis",testAllProps("textOverflow","ellipsis")),Modernizr.addTest("cssfilters",function(){if(Modernizr.supports){return testAllProps("filter","blur(2px)")}var A=createElement("a");return A.style.cssText=prefixes.join("filter:blur(2px); "),!!A.style.length&&(document.documentMode===undefined||document.documentMode>9)}),Modernizr.addTest("flexbox",testAllProps("flexBasis","1px",!0)),Modernizr.addTest("flexboxlegacy",testAllProps("boxDirection","reverse",!0)),Modernizr.addTest("flexboxtweener",testAllProps("flexAlign","end",!0)),Modernizr.addTest("flexwrap",testAllProps("flexWrap","wrap",!0)),Modernizr.addAsyncTest(function(){function A(){function t(){try{var A=createElement("div"),e=createElement("span"),t=A.style,n=0,r=0,o=!1,i=document.body.firstElementChild||document.body.firstChild;return A.appendChild(e),e.innerHTML="Bacon ipsum dolor sit amet jerky velit in culpa hamburger et. Laborum dolor proident, enim dolore duis commodo et strip steak. Salami anim et, veniam consectetur dolore qui tenderloin jowl velit sirloin. Et ad culpa, fatback cillum jowl ball tip ham hock nulla short ribs pariatur aute. Pig pancetta ham bresaola, ut boudin nostrud commodo flank esse cow tongue culpa. Pork belly bresaola enim pig, ea consectetur nisi. Fugiat officia turkey, ea cow jowl pariatur ullamco proident do laborum velit sausage. Magna biltong sint tri-tip commodo sed bacon, esse proident aliquip. Ullamco ham sint fugiat, velit in enim sed mollit nulla cow ut adipisicing nostrud consectetur. Proident dolore beef ribs, laborum nostrud meatball ea laboris rump cupidatat labore culpa. Shankle minim beef, velit sint cupidatat fugiat tenderloin pig et ball tip. Ut cow fatback salami, bacon ball tip et in shank strip steak bresaola. In ut pork belly sed mollit tri-tip magna culpa veniam, short ribs qui in andouille ham consequat. Dolore bacon t-bone, velit short ribs enim strip steak nulla. Voluptate labore ut, biltong swine irure jerky. Cupidatat excepteur aliquip salami dolore. Ball tip strip steak in pork dolor. Ad in esse biltong. Dolore tenderloin exercitation ad pork loin t-bone, dolore in chicken ball tip qui pig. Ut culpa tongue, sint ribeye dolore ex shank voluptate hamburger. Jowl et tempor, boudin pork chop labore ham hock drumstick consectetur tri-tip elit swine meatball chicken ground round. Proident shankle mollit dolore. Shoulder ut duis t-bone quis reprehenderit. Meatloaf dolore minim strip steak, laboris ea aute bacon beef ribs elit shank in veniam drumstick qui. Ex laboris meatball cow tongue pork belly. Ea ball tip reprehenderit pig, sed fatback boudin dolore flank aliquip laboris eu quis. Beef ribs duis beef, cow corned beef adipisicing commodo nisi deserunt exercitation. Cillum dolor t-bone spare ribs, ham hock est sirloin. Brisket irure meatloaf in, boudin pork belly sirloin ball tip. Sirloin sint irure nisi nostrud aliqua. Nostrud nulla aute, enim officia culpa ham hock. Aliqua reprehenderit dolore sunt nostrud sausage, ea boudin pork loin ut t-bone ham tempor. Tri-tip et pancetta drumstick laborum. Ham hock magna do nostrud in proident. Ex ground round fatback, venison non ribeye in.",document.body.insertBefore(A,i),t.cssText="position:absolute;top:0;left:0;width:5em;text-align:justify;text-justification:newspaper;",n=e.offsetHeight,r=e.offsetWidth,t.cssText="position:absolute;top:0;left:0;width:5em;text-align:justify;text-justification:newspaper;"+prefixes.join("hyphens:auto; "),o=e.offsetHeight!=n||e.offsetWidth!=r,document.body.removeChild(A),A.removeChild(e),o}catch(d){return !1}}function n(A,e){try{var t=createElement("div"),n=createElement("span"),r=t.style,o=0,i=!1,d=!1,a=!1,s=document.body.firstElementChild||document.body.firstChild;return r.cssText="position:absolute;top:0;left:0;overflow:visible;width:1.25em;",t.appendChild(n),document.body.insertBefore(t,s),n.innerHTML="mm",o=n.offsetHeight,n.innerHTML="m"+A+"m",d=n.offsetHeight>o,e?(n.innerHTML="m<br />m",o=n.offsetWidth,n.innerHTML="m"+A+"m",a=n.offsetWidth>o):a=!0,d===!0&&a===!0&&(i=!0),document.body.removeChild(t),t.removeChild(n),i}catch(l){return !1}}function r(A){try{var e,t=createElement("input"),n=createElement("div"),r="lebowski",o=!1,i=document.body.firstElementChild||document.body.firstChild;n.innerHTML=r+A+r,document.body.insertBefore(n,i),document.body.insertBefore(t,n),t.setSelectionRange?(t.focus(),t.setSelectionRange(0,0)):t.createTextRange&&(e=t.createTextRange(),e.collapse(!0),e.moveEnd("character",0),e.moveStart("character",0),e.select());try{window.find?o=window.find(r+r):(e=window.self.document.body.createTextRange(),o=e.findText(r+r))}catch(d){o=!1}return document.body.removeChild(n),document.body.removeChild(t),o}catch(d){return !1}}return document.body||document.getElementsByTagName("body")[0]?(addTest("csshyphens",function(){if(!testAllProps("hyphens","auto",!0)){return !1}try{return t()}catch(A){return !1}}),addTest("softhyphens",function(){try{return n("&#173;",!0)&&n("&#8203;",!1)}catch(A){return !1}}),void addTest("softhyphensfind",function(){try{return r("&#173;")&&r("&#8203;")}catch(A){return !1}})):void setTimeout(A,e)}var e=300;setTimeout(A,e)}),Modernizr.addTest("cssmask",testAllProps("maskRepeat","repeat-x",!0)),Modernizr.addTest("overflowscrolling",testAllProps("overflowScrolling","touch",!0)),Modernizr.addTest("cssreflections",testAllProps("boxReflect","above",!0)),Modernizr.addTest("cssresize",testAllProps("resize","both",!0)),Modernizr.addTest("scrollsnappoints",testAllProps("scrollSnapType")),Modernizr.addTest("shapes",testAllProps("shapeOutside","content-box",!0)),Modernizr.addTest("csstransforms3d",function(){var A=!!testAllProps("perspective","1px",!0),e=Modernizr._config.usePrefixes;if(A&&(!e||"webkitPerspective" in docElement.style)){var t,n="#modernizr{width:0;height:0}";Modernizr.supports?t="@supports (perspective: 1px)":(t="@media (transform-3d)",e&&(t+=",(-webkit-transform-3d)")),t+="{#modernizr{width:7px;height:18px;margin:0;padding:0;border:0}}",testStyles(n+t,function(e){A=7===e.offsetWidth&&18===e.offsetHeight})}return A}),Modernizr.addTest("textalignlast",testAllProps("textAlignLast")),Modernizr.addTest("csstransforms",function(){return -1===navigator.userAgent.indexOf("Android 2.")&&testAllProps("transform","scale(1)",!0)}),Modernizr.addTest("csstransitions",testAllProps("transition","all",!0)),Modernizr.addTest("csspseudotransitions",function(){var A=!1;if(!Modernizr.csstransitions||!window.getComputedStyle){return A}var e='#modernizr:before { content:" "; font-size:5px;'+Modernizr._prefixes.join("transition:0s 100s;")+"}#modernizr.trigger:before { font-size:10px; }";return Modernizr.testStyles(e,function(e){window.getComputedStyle(e,":before").getPropertyValue("font-size"),e.className+="trigger",A="5px"===window.getComputedStyle(e,":before").getPropertyValue("font-size")}),A}),Modernizr.addTest("userselect",testAllProps("userSelect","none",!0)),testRunner(),setClasses(classes),delete ModernizrProto.addTest,delete ModernizrProto.addAsyncTest;for(var i=0;i<Modernizr._q.length;i++){Modernizr._q[i]()}window.Modernizr=Modernizr}(window,document); /*! jQuery v1.12.4 | (c) jQuery Foundation | jquery.org/license */ ;!function(d,c){"object"==typeof module&&"object"==typeof module.exports?module.exports=d.document?c(d,!0):function(b){if(!b.document){throw new Error("jQuery requires a window with a document")}return c(b)}:c(d)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=a.document,e=c.slice,f=c.concat,g=c.push,h=c.indexOf,i={},j=i.toString,k=i.hasOwnProperty,l={},m="1.12.4",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return e.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:e.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a){return n.each(this,a)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(e.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor()},push:g,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++){if(null!=(e=arguments[h])){for(d in e){a=g[d],c=e[d],g!==c&&(j&&c&&(n.isPlainObject(c)||(b=n.isArray(c)))?(b?(b=!1,f=a&&n.isArray(a)?a:[]):f=a&&n.isPlainObject(a)?a:{},g[d]=n.extend(j,f,c)):void 0!==c&&(g[d]=c))}}}return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray||function(a){return"array"===n.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){var b=a&&a.toString();return !n.isArray(a)&&b-parseFloat(b)+1>=0},isEmptyObject:function(a){var b;for(b in a){return !1}return !0},isPlainObject:function(a){var b;if(!a||"object"!==n.type(a)||a.nodeType||n.isWindow(a)){return !1}try{if(a.constructor&&!k.call(a,"constructor")&&!k.call(a.constructor.prototype,"isPrototypeOf")){return !1}}catch(c){return !1}if(!l.ownFirst){for(b in a){return k.call(a,b)}}for(b in a){}return void 0===b||k.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?i[j.call(a)]||"object":typeof a},globalEval:function(b){b&&n.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b){var c,d=0;if(s(a)){for(c=a.length;c>d;d++){if(b.call(a[d],d,a[d])===!1){break}}}else{for(d in a){if(b.call(a[d],d,a[d])===!1){break}}}return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):g.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(h){return h.call(b,a,c)}for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++){if(c in b&&b[c]===a){return c}}}return -1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d){a[e++]=b[d++]}if(c!==c){while(void 0!==b[d]){a[e++]=b[d++]}}return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++){d=!b(a[f],f),d!==h&&e.push(a[f])}return e},map:function(a,b,c){var d,e,g=0,h=[];if(s(a)){for(d=a.length;d>g;g++){e=b(a[g],g,c),null!=e&&h.push(e)}}else{for(g in a){e=b(a[g],g,c),null!=e&&h.push(e)}}return f.apply([],h)},guid:1,proxy:function(a,b){var c,d,f;return"string"==typeof b&&(f=a[b],b=a,a=f),n.isFunction(a)?(c=e.call(arguments,2),d=function(){return a.apply(b||this,c.concat(e.call(arguments)))},d.guid=a.guid=a.guid||n.guid++,d):void 0},now:function(){return +new Date},support:l}),"function"==typeof Symbol&&(n.fn[Symbol.iterator]=c[Symbol.iterator]),n.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(a,b){i["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=!!a&&"length" in a&&a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ga(),z=ga(),A=ga(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++){if(a[c]===b){return c}}return -1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+M+"))|)"+L+"*\\]",O=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+N+")*)|.*)\\)|)",P=new RegExp(L+"+","g"),Q=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),R=new RegExp("^"+L+"*,"+L+"*"),S=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),T=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),U=new RegExp(O),V=new RegExp("^"+M+"$"),W={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M+"|[*])"),ATTR:new RegExp("^"+N),PSEUDO:new RegExp("^"+O),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},X=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Z=/^[^{]+\{\s*\[native \w/,$=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,_=/[+~]/,aa=/'|\\/g,ba=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),ca=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},da=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(ea){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]){}a.length=c-1}}}function fa(a,b,d,e){var f,h,j,k,l,o,r,s,w=b&&b.ownerDocument,x=b?b.nodeType:9;if(d=d||[],"string"!=typeof a||!a||1!==x&&9!==x&&11!==x){return d}if(!e&&((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,p)){if(11!==x&&(o=$.exec(a))){if(f=o[1]){if(9===x){if(!(j=b.getElementById(f))){return d}if(j.id===f){return d.push(j),d}}else{if(w&&(j=w.getElementById(f))&&t(b,j)&&j.id===f){return d.push(j),d}}}else{if(o[2]){return H.apply(d,b.getElementsByTagName(a)),d}if((f=o[3])&&c.getElementsByClassName&&b.getElementsByClassName){return H.apply(d,b.getElementsByClassName(f)),d}}}if(c.qsa&&!A[a+" "]&&(!q||!q.test(a))){if(1!==x){w=b,s=a}else{if("object"!==b.nodeName.toLowerCase()){(k=b.getAttribute("id"))?k=k.replace(aa,"\\$&"):b.setAttribute("id",k=u),r=g(a),h=r.length,l=V.test(k)?"#"+k:"[id='"+k+"']";while(h--){r[h]=l+" "+qa(r[h])}s=r.join(","),w=_.test(a)&&oa(b.parentNode)||b}}if(s){try{return H.apply(d,w.querySelectorAll(s)),d}catch(y){}finally{k===u&&b.removeAttribute("id")}}}}return i(a.replace(Q,"$1"),b,d,e)}function ga(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ha(a){return a[u]=!0,a}function ia(a){var b=n.createElement("div");try{return !!a(b)}catch(c){return !1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ja(a,b){var c=a.split("|"),e=c.length;while(e--){d.attrHandle[c[e]]=b}}function ka(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d){return d}if(c){while(c=c.nextSibling){if(c===b){return -1}}}return a?1:-1}function la(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function na(a){return ha(function(b){return b=+b,ha(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--){c[e=f[g]]&&(c[e]=!(d[e]=c[e]))}})})}function oa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=fa.support={},f=fa.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fa.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=n.documentElement,p=!f(n),(e=n.defaultView)&&e.top!==e&&(e.addEventListener?e.addEventListener("unload",da,!1):e.attachEvent&&e.attachEvent("onunload",da)),c.attributes=ia(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ia(function(a){return a.appendChild(n.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=Z.test(n.getElementsByClassName),c.getById=ia(function(a){return o.appendChild(a).id=u,!n.getElementsByName||!n.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ba,ca);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ba,ca);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++]){1===c.nodeType&&d.push(c)}return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return"undefined"!=typeof b.getElementsByClassName&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=Z.test(n.querySelectorAll))&&(ia(function(a){o.appendChild(a).innerHTML="<a id='"+u+"'></a><select id='"+u+"-\r\\' msallowcapture=''><option selected=''></option></select>",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ia(function(a){var b=n.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=Z.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ia(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",O)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=Z.test(o.compareDocumentPosition),t=b||Z.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b){while(b=b.parentNode){if(b===a){return !0}}}return !1},B=b?function(a,b){if(a===b){return l=!0,0}var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===n||a.ownerDocument===v&&t(v,a)?-1:b===n||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b){return l=!0,0}var c,d=0,e=a.parentNode,f=b.parentNode,g=[a],h=[b];if(!e||!f){return a===n?-1:b===n?1:e?-1:f?1:k?J(k,a)-J(k,b):0}if(e===f){return ka(a,b)}c=a;while(c=c.parentNode){g.unshift(c)}c=b;while(c=c.parentNode){h.unshift(c)}while(g[d]===h[d]){d++}return d?ka(g[d],h[d]):g[d]===v?-1:h[d]===v?1:0},n):n},fa.matches=function(a,b){return fa(a,null,null,b)},fa.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(T,"='$1']"),c.matchesSelector&&p&&!A[b+" "]&&(!r||!r.test(b))&&(!q||!q.test(b))){try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType){return d}}catch(e){}}return fa(b,n,null,[a]).length>0},fa.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fa.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fa.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fa.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++]){b===a[f]&&(e=d.push(f))}while(e--){a.splice(d[e],1)}}return k=null,a},e=fa.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent){return a.textContent}for(a=a.firstChild;a;a=a.nextSibling){c+=e(a)}}else{if(3===f||4===f){return a.nodeValue}}}else{while(b=a[d++]){c+=e(b)}}return c},d=fa.selectors={cacheLength:50,createPseudo:ha,match:W,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ba,ca),a[3]=(a[3]||a[4]||a[5]||"").replace(ba,ca),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fa.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fa.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return W.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&U.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ba,ca).toLowerCase();return"*"===a?function(){return !0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fa.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(P," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return !!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h,t=!1;if(q){if(f){while(p){m=b;while(m=m[p]){if(h?m.nodeName.toLowerCase()===r:1===m.nodeType){return !1}}o=p="only"===a&&!o&&"nextSibling"}return !0}if(o=[g?q.firstChild:q.lastChild],g&&s){m=q,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n&&j[2],m=n&&q.childNodes[n];while(m=++n&&m&&m[p]||(t=n=0)||o.pop()){if(1===m.nodeType&&++t&&m===b){k[a]=[w,n,t];break}}}else{if(s&&(m=b,l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),j=k[a]||[],n=j[0]===w&&j[1],t=n),t===!1){while(m=++n&&m&&m[p]||(t=n=0)||o.pop()){if((h?m.nodeName.toLowerCase()===r:1===m.nodeType)&&++t&&(s&&(l=m[u]||(m[u]={}),k=l[m.uniqueID]||(l[m.uniqueID]={}),k[a]=[w,t]),m===b)){break}}}}return t-=e,t===d||t%d===0&&t/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fa.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ha(function(a,c){var d,f=e(a,b),g=f.length;while(g--){d=J(a,f[g]),a[d]=!(c[d]=f[g])}}):function(a){return e(a,0,c)}):e}},pseudos:{not:ha(function(a){var b=[],c=[],d=h(a.replace(Q,"$1"));return d[u]?ha(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--){(f=g[h])&&(a[h]=!(b[h]=f))}}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ha(function(a){return function(b){return fa(a,b).length>0}}),contains:ha(function(a){return a=a.replace(ba,ca),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ha(function(a){return V.test(a||"")||fa.error("unsupported lang: "+a),a=a.replace(ba,ca).toLowerCase(),function(b){var c;do{if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang")){return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-")}}while((b=b.parentNode)&&1===b.nodeType);return !1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling){if(a.nodeType<6){return !1}}return !0},parent:function(a){return !d.pseudos.empty(a)},header:function(a){return Y.test(a.nodeName)},input:function(a){return X.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:na(function(){return[0]}),last:na(function(a,b){return[b-1]}),eq:na(function(a,b,c){return[0>c?c+b:c]}),even:na(function(a,b){for(var c=0;b>c;c+=2){a.push(c)}return a}),odd:na(function(a,b){for(var c=1;b>c;c+=2){a.push(c)}return a}),lt:na(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;){a.push(d)}return a}),gt:na(function(a,b,c){for(var d=0>c?c+b:c;++d<b;){a.push(d)}return a})}},d.pseudos.nth=d.pseudos.eq;for(b in {radio:!0,checkbox:!0,file:!0,password:!0,image:!0}){d.pseudos[b]=la(b)}for(b in {submit:!0,reset:!0}){d.pseudos[b]=ma(b)}function pa(){}pa.prototype=d.filters=d.pseudos,d.setFilters=new pa,g=fa.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k){return b?0:k.slice(0)}h=a,i=[],j=d.preFilter;while(h){c&&!(e=R.exec(h))||(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=S.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(Q," ")}),h=h.slice(c.length));for(g in d.filter){!(e=W[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length))}if(!c){break}}return b?h.length:h?fa.error(a):z(a,i).slice(0)};function qa(a){for(var b=0,c=a.length,d="";c>b;b++){d+=a[b].value}return d}function ra(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d]){if(1===b.nodeType||e){return a(b,c,f)}}}:function(b,c,g){var h,i,j,k=[w,f];if(g){while(b=b[d]){if((1===b.nodeType||e)&&a(b,c,g)){return !0}}}else{while(b=b[d]){if(1===b.nodeType||e){if(j=b[u]||(b[u]={}),i=j[b.uniqueID]||(j[b.uniqueID]={}),(h=i[d])&&h[0]===w&&h[1]===f){return k[2]=h[2]}if(i[d]=k,k[2]=a(b,c,g)){return !0}}}}}}function sa(a){return a.length>1?function(b,c,d){var e=a.length;while(e--){if(!a[e](b,c,d)){return !1}}return !0}:a[0]}function ta(a,b,c){for(var d=0,e=b.length;e>d;d++){fa(a,b[d],c)}return c}function ua(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++){(f=a[h])&&(c&&!c(f,d,e)||(g.push(f),j&&b.push(h)))}return g}function va(a,b,c,d,e,f){return d&&!d[u]&&(d=va(d)),e&&!e[u]&&(e=va(e,f)),ha(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ta(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ua(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ua(r,n),d(j,[],h,i),k=j.length;while(k--){(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}}if(f){if(e||a){if(e){j=[],k=r.length;while(k--){(l=r[k])&&j.push(q[k]=l)}e(null,r=[],j,i)}k=r.length;while(k--){(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}}else{r=ua(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)}})}function wa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=ra(function(a){return a===b},h,!0),l=ra(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++){if(c=d.relative[a[i].type]){m=[ra(sa(m),c)]}else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++){if(d.relative[a[e].type]){break}}return va(i>1&&sa(m),i>1&&qa(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(Q,"$1"),c,e>i&&wa(a.slice(i,e)),f>e&&wa(a=a.slice(e)),f>e&&qa(a))}m.push(c)}}return sa(m)}function xa(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,o,q,r=0,s="0",t=f&&[],u=[],v=j,x=f||e&&d.find.TAG("*",k),y=w+=null==v?1:Math.random()||0.1,z=x.length;for(k&&(j=g===n||g||k);s!==z&&null!=(l=x[s]);s++){if(e&&l){o=0,g||l.ownerDocument===n||(m(l),h=!p);while(q=a[o++]){if(q(l,g||n,h)){i.push(l);break}}k&&(w=y)}c&&((l=!q&&l)&&r--,f&&t.push(l))}if(r+=s,c&&s!==r){o=0;while(q=b[o++]){q(t,u,g,h)}if(f){if(r>0){while(s--){t[s]||u[s]||(u[s]=F.call(i))}}u=ua(u)}H.apply(i,u),k&&!f&&u.length>0&&r+b.length>1&&fa.uniqueSort(i)}return k&&(w=y,j=v),t};return c?ha(f):f}return h=fa.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--){f=wa(b[c]),f[u]?d.push(f):e.push(f)}f=A(a,xa(e,d)),f.selector=a}return f},i=fa.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(ba,ca),b)||[])[0],!b){return e}n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=W.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type]){break}if((m=d.find[l])&&(f=m(k.matches[0].replace(ba,ca),_.test(j[0].type)&&oa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qa(j),!a){return H.apply(e,f),e}break}}}return(n||h(a,o))(f,b,!p,e,!b||_.test(a)&&oa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ia(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ia(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||ja("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ia(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ja("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ia(function(a){return null==a.getAttribute("disabled")})||ja(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fa}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.uniqueSort=n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType){if(1===a.nodeType){if(e&&n(a).is(c)){break}d.push(a)}}return d},v=function(a,b){for(var c=[];a;a=a.nextSibling){1===a.nodeType&&a!==b&&c.push(a)}return c},w=n.expr.match.needsContext,x=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,y=/^.[^:#\[\.,]*$/;function z(a,b,c){if(n.isFunction(b)){return n.grep(a,function(a,d){return !!b.call(a,d,a)!==c})}if(b.nodeType){return n.grep(a,function(a){return a===b!==c})}if("string"==typeof b){if(y.test(b)){return n.filter(b,a,c)}b=n.filter(b,a)}return n.grep(a,function(a){return n.inArray(a,b)>-1!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a){return this.pushStack(n(a).filter(function(){for(b=0;e>b;b++){if(n.contains(d[b],this)){return !0}}}))}for(b=0;e>b;b++){n.find(a,d[b],c)}return c=this.pushStack(e>1?n.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(z(this,a||[],!1))},not:function(a){return this.pushStack(z(this,a||[],!0))},is:function(a){return !!z(this,"string"==typeof a&&w.test(a)?n(a):a||[],!1).length}});var A,B=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=n.fn.init=function(a,b,c){var e,f;if(!a){return this}if(c=c||A,"string"==typeof a){if(e="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:B.exec(a),!e||!e[1]&&b){return !b||b.jquery?(b||c).find(a):this.constructor(b).find(a)}if(e[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(e[1],b&&b.nodeType?b.ownerDocument||b:d,!0)),x.test(e[1])&&n.isPlainObject(b)){for(e in b){n.isFunction(this[e])?this[e](b[e]):this.attr(e,b[e])}}return this}if(f=d.getElementById(e[2]),f&&f.parentNode){if(f.id!==e[2]){return A.find(a)}this.length=1,this[0]=f}return this.context=d,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof c.ready?c.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};C.prototype=n.fn,A=n(d);var D=/^(?:parents|prev(?:Until|All))/,E={children:!0,contents:!0,next:!0,prev:!0};n.fn.extend({has:function(a){var b,c=n(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++){if(n.contains(this,c[b])){return !0}}})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=w.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++){for(c=this[d];c&&c!==b;c=c.parentNode){if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}}}return this.pushStack(f.length>1?n.uniqueSort(f):f)},index:function(a){return a?"string"==typeof a?n.inArray(this[0],n(a)):n.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.uniqueSort(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function F(a,b){do{a=a[b]}while(a&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return u(a,"parentNode")},parentsUntil:function(a,b,c){return u(a,"parentNode",c)},next:function(a){return F(a,"nextSibling")},prev:function(a){return F(a,"previousSibling")},nextAll:function(a){return u(a,"nextSibling")},prevAll:function(a){return u(a,"previousSibling")},nextUntil:function(a,b,c){return u(a,"nextSibling",c)},prevUntil:function(a,b,c){return u(a,"previousSibling",c)},siblings:function(a){return v((a.parentNode||{}).firstChild,a)},children:function(a){return v(a.firstChild)},contents:function(a){return n.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(E[a]||(e=n.uniqueSort(e)),D.test(a)&&(e=e.reverse())),this.pushStack(e)}});var G=/\S+/g;function H(a){var b={};return n.each(a.match(G)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?H(a):n.extend({},a);var b,c,d,e,f=[],g=[],h=-1,i=function(){for(e=a.once,d=b=!0;g.length;h=-1){c=g.shift();while(++h<f.length){f[h].apply(c[0],c[1])===!1&&a.stopOnFalse&&(h=f.length,c=!1)}}a.memory||(c=!1),b=!1,e&&(f=c?[]:"")},j={add:function(){return f&&(c&&!b&&(h=f.length-1,g.push(c)),function d(b){n.each(b,function(b,c){n.isFunction(c)?a.unique&&j.has(c)||f.push(c):c&&c.length&&"string"!==n.type(c)&&d(c)})}(arguments),c&&!b&&i()),this},remove:function(){return n.each(arguments,function(a,b){var c;while((c=n.inArray(b,f,c))>-1){f.splice(c,1),h>=c&&h--}}),this},has:function(a){return a?n.inArray(a,f)>-1:f.length>0},empty:function(){return f&&(f=[]),this},disable:function(){return e=g=[],f=c="",this},disabled:function(){return !f},lock:function(){return e=!0,c||j.disable(),this},locked:function(){return !!e},fireWith:function(a,c){return e||(c=c||[],c=[a,c.slice?c.slice():c],g.push(c),b||i()),this},fire:function(){return j.fireWith(this,arguments),this},fired:function(){return !!d}};return j},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().progress(c.notify).done(c.resolve).fail(c.reject):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=e.call(arguments),d=c.length,f=1!==d||a&&n.isFunction(a.promise)?d:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(d){b[a]=this,c[a]=arguments.length>1?e.call(arguments):d,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(d>1){for(i=new Array(d),j=new Array(d),k=new Array(d);d>b;b++){c[b]&&n.isFunction(c[b].promise)?c[b].promise().progress(h(b,j,i)).done(h(b,k,c)).fail(g.reject):--f}}return f||g.resolveWith(k,c),g.promise()}});var I;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(I.resolveWith(d,[n]),n.fn.triggerHandler&&(n(d).triggerHandler("ready"),n(d).off("ready"))))}});function J(){d.addEventListener?(d.removeEventListener("DOMContentLoaded",K),a.removeEventListener("load",K)):(d.detachEvent("onreadystatechange",K),a.detachEvent("onload",K))}function K(){(d.addEventListener||"load"===a.event.type||"complete"===d.readyState)&&(J(),n.ready())}n.ready.promise=function(b){if(!I){if(I=n.Deferred(),"complete"===d.readyState||"loading"!==d.readyState&&!d.documentElement.doScroll){a.setTimeout(n.ready)}else{if(d.addEventListener){d.addEventListener("DOMContentLoaded",K),a.addEventListener("load",K)}else{d.attachEvent("onreadystatechange",K),a.attachEvent("onload",K);var c=!1;try{c=null==a.frameElement&&d.documentElement}catch(e){}c&&c.doScroll&&!function f(){if(!n.isReady){try{c.doScroll("left")}catch(b){return a.setTimeout(f,50)}J(),n.ready()}}()}}}return I.promise(b)},n.ready.promise();var L;for(L in n(l)){break}l.ownFirst="0"===L,l.inlineBlockNeedsLayout=!1,n(function(){var a,b,c,e;c=d.getElementsByTagName("body")[0],c&&c.style&&(b=d.createElement("div"),e=d.createElement("div"),e.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(e).appendChild(b),"undefined"!=typeof b.style.zoom&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",l.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(e))}),function(){var a=d.createElement("div");l.deleteExpando=!0;try{delete a.test}catch(b){l.deleteExpando=!1}a=null}();var M=function(a){var b=n.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b},N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(O,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}n.data(a,b,c)}else{c=void 0}}return c}function Q(a){var b;for(b in a){if(("data"!==b||!n.isEmptyObject(a[b]))&&"toJSON"!==b){return !1}}return !0}function R(a,b,d,e){if(M(a)){var f,g,h=n.expando,i=a.nodeType,j=i?n.cache:a,k=i?a[h]:a[h]&&h;if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b){return k||(k=i?a[h]=c.pop()||n.guid++:h),j[k]||(j[k]=i?{}:{toJSON:n.noop}),"object"!=typeof b&&"function"!=typeof b||(e?j[k]=n.extend(j[k],b):j[k].data=n.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[n.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[n.camelCase(b)])):f=g,f}}}function S(a,b,c){if(M(a)){var d,e,f=a.nodeType,g=f?n.cache:a,h=f?a[n.expando]:n.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){n.isArray(b)?b=b.concat(n.map(b,n.camelCase)):b in d?b=[b]:(b=n.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--){delete d[b[e]]}if(c?!Q(d):!n.isEmptyObject(d)){return}}(c||(delete g[h].data,Q(g[h])))&&(f?n.cleanData([a],!0):l.deleteExpando||g!=g.window?delete g[h]:g[h]=void 0)}}}n.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?n.cache[a[n.expando]]:a[n.expando],!!a&&!Q(a)},data:function(a,b,c){return R(a,b,c)},removeData:function(a,b){return S(a,b)},_data:function(a,b,c){return R(a,b,c,!0)},_removeData:function(a,b){return S(a,b,!0)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=n.data(f),1===f.nodeType&&!n._data(f,"parsedAttrs"))){c=g.length;while(c--){g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d])))}n._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){n.data(this,a)}):arguments.length>1?this.each(function(){n.data(this,a,b)}):f?P(f,a,n.data(f,a)):void 0},removeData:function(a){return this.each(function(){n.removeData(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=n._data(a,b),c&&(!d||n.isArray(c)?d=n._data(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return n._data(a,c)||n._data(a,c,{empty:n.Callbacks("once memory").add(function(){n._removeData(a,b+"queue"),n._removeData(a,c)})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?n.queue(this[0],a):void 0===b?this:this.each(function(){var c=n.queue(this,a,b);n._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&n.dequeue(this,a)})},dequeue:function(a){return this.each(function(){n.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=n.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--){c=n._data(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h))}return h(),e.promise(b)}}),function(){var a;l.shrinkWrapBlocks=function(){if(null!=a){return a}a=!1;var b,c,e;return c=d.getElementsByTagName("body")[0],c&&c.style?(b=d.createElement("div"),e=d.createElement("div"),e.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(e).appendChild(b),"undefined"!=typeof b.style.zoom&&(b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:1px;width:1px;zoom:1",b.appendChild(d.createElement("div")).style.width="5px",a=3!==b.offsetWidth),c.removeChild(e),a):void 0}}();var T=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,U=new RegExp("^(?:([+-])=|)("+T+")([a-z%]*)$","i"),V=["Top","Right","Bottom","Left"],W=function(a,b){return a=b||a,"none"===n.css(a,"display")||!n.contains(a.ownerDocument,a)};function X(a,b,c,d){var e,f=1,g=20,h=d?function(){return d.cur()}:function(){return n.css(a,b,"")},i=h(),j=c&&c[3]||(n.cssNumber[b]?"":"px"),k=(n.cssNumber[b]||"px"!==j&&+i)&&U.exec(n.css(a,b));if(k&&k[3]!==j){j=j||k[3],c=c||[],k=+i||1;do{f=f||".5",k/=f,n.style(a,b,k+j)}while(f!==(f=h()/i)&&1!==f&&--g)}return c&&(k=+k||+i||0,e=c[1]?k+(c[1]+1)*c[2]:+c[2],d&&(d.unit=j,d.start=k,d.end=e)),e}var Y=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c){Y(a,b,h,c[h],!0,f,g)}}else{if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b)){for(;i>h;h++){b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)))}}}return e?a:j?b.call(a):i?b(a[0],c):f},Z=/^(?:checkbox|radio)$/i,$=/<([\w:-]+)/,_=/^$|\/(?:java|ecma)script/i,aa=/^\s+/,ba="abbr|article|aside|audio|bdi|canvas|data|datalist|details|dialog|figcaption|figure|footer|header|hgroup|main|mark|meter|nav|output|picture|progress|section|summary|template|time|video";function ca(a){var b=ba.split("|"),c=a.createDocumentFragment();if(c.createElement){while(b.length){c.createElement(b.pop())}}return c}!function(){var a=d.createElement("div"),b=d.createDocumentFragment(),c=d.createElement("input");a.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",l.leadingWhitespace=3===a.firstChild.nodeType,l.tbody=!a.getElementsByTagName("tbody").length,l.htmlSerialize=!!a.getElementsByTagName("link").length,l.html5Clone="<:nav></:nav>"!==d.createElement("nav").cloneNode(!0).outerHTML,c.type="checkbox",c.checked=!0,b.appendChild(c),l.appendChecked=c.checked,a.innerHTML="<textarea>x</textarea>",l.noCloneChecked=!!a.cloneNode(!0).lastChild.defaultValue,b.appendChild(a),c=d.createElement("input"),c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),a.appendChild(c),l.checkClone=a.cloneNode(!0).cloneNode(!0).lastChild.checked,l.noCloneEvent=!!a.addEventListener,a[n.expando]=1,l.attributes=!a.getAttribute(n.expando)}();var da={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:l.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]};da.optgroup=da.option,da.tbody=da.tfoot=da.colgroup=da.caption=da.thead,da.th=da.td;function ea(a,b){var c,d,e=0,f="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):void 0;if(!f){for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++){!b||n.nodeName(d,b)?f.push(d):n.merge(f,ea(d,b))}}return void 0===b||b&&n.nodeName(a,b)?n.merge([a],f):f}function fa(a,b){for(var c,d=0;null!=(c=a[d]);d++){n._data(c,"globalEval",!b||n._data(b[d],"globalEval"))}}var ga=/<|&#?\w+;/,ha=/<tbody/i;function ia(a){Z.test(a.type)&&(a.defaultChecked=a.checked)}function ja(a,b,c,d,e){for(var f,g,h,i,j,k,m,o=a.length,p=ca(b),q=[],r=0;o>r;r++){if(g=a[r],g||0===g){if("object"===n.type(g)){n.merge(q,g.nodeType?[g]:g)}else{if(ga.test(g)){i=i||p.appendChild(b.createElement("div")),j=($.exec(g)||["",""])[1].toLowerCase(),m=da[j]||da._default,i.innerHTML=m[1]+n.htmlPrefilter(g)+m[2],f=m[0];while(f--){i=i.lastChild}if(!l.leadingWhitespace&&aa.test(g)&&q.push(b.createTextNode(aa.exec(g)[0])),!l.tbody){g="table"!==j||ha.test(g)?"<table>"!==m[1]||ha.test(g)?0:i:i.firstChild,f=g&&g.childNodes.length;while(f--){n.nodeName(k=g.childNodes[f],"tbody")&&!k.childNodes.length&&g.removeChild(k)}}n.merge(q,i.childNodes),i.textContent="";while(i.firstChild){i.removeChild(i.firstChild)}i=p.lastChild}else{q.push(b.createTextNode(g))}}}}i&&p.removeChild(i),l.appendChecked||n.grep(ea(q,"input"),ia),r=0;while(g=q[r++]){if(d&&n.inArray(g,d)>-1){e&&e.push(g)}else{if(h=n.contains(g.ownerDocument,g),i=ea(p.appendChild(g),"script"),h&&fa(i),c){f=0;while(g=i[f++]){_.test(g.type||"")&&c.push(g)}}}}return i=null,p}!function(){var b,c,e=d.createElement("div");for(b in {submit:!0,change:!0,focusin:!0}){c="on"+b,(l[b]=c in a)||(e.setAttribute(c,"t"),l[b]=e.attributes[c].expando===!1)}e=null}();var ka=/^(?:input|select|textarea)$/i,la=/^key/,ma=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,na=/^(?:focusinfocus|focusoutblur)$/,oa=/^([^.]*)(?:\.(.+)|)/;function pa(){return !0}function qa(){return !1}function ra(){try{return d.activeElement}catch(a){}}function sa(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof c&&(d=d||c,c=void 0);for(h in b){sa(a,h,c,d,b[h],f)}return a}if(null==d&&null==e?(e=c,d=c=void 0):null==e&&("string"==typeof c?(e=d,d=void 0):(e=d,d=c,c=void 0)),e===!1){e=qa}else{if(!e){return a}}return 1===f&&(g=e,e=function(a){return n().off(a),g.apply(this,arguments)},e.guid=g.guid||(g.guid=n.guid++)),a.each(function(){n.event.add(this,b,e,d,c)})}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=n._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=n.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return"undefined"==typeof n||a&&n.event.triggered===a.type?void 0:n.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(G)||[""],h=b.length;while(h--){f=oa.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=n.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=n.event.special[o]||{},l=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},i),(m=g[o])||(m=g[o]=[],m.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,l):m.push(l),n.event.global[o]=!0)}a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=n.hasData(a)&&n._data(a);if(r&&(k=r.events)){b=(b||"").match(G)||[""],j=b.length;while(j--){if(h=oa.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=m.length;while(f--){g=m[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(m.splice(f,1),g.selector&&m.delegateCount--,l.remove&&l.remove.call(a,g))}i&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete k[o])}else{for(o in k){n.event.remove(a,o+b[j],c,d,!0)}}}n.isEmptyObject(k)&&(delete r.handle,n._removeData(a,"events"))}},trigger:function(b,c,e,f){var g,h,i,j,l,m,o,p=[e||d],q=k.call(b,"type")?b.type:b,r=k.call(b,"namespace")?b.namespace.split("."):[];if(i=m=e=e||d,3!==e.nodeType&&8!==e.nodeType&&!na.test(q+n.event.triggered)&&(q.indexOf(".")>-1&&(r=q.split("."),q=r.shift(),r.sort()),h=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=f?2:3,b.namespace=r.join("."),b.rnamespace=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=e),c=null==c?[b]:n.makeArray(c,[b]),l=n.event.special[q]||{},f||!l.trigger||l.trigger.apply(e,c)!==!1)){if(!f&&!l.noBubble&&!n.isWindow(e)){for(j=l.delegateType||q,na.test(j+q)||(i=i.parentNode);i;i=i.parentNode){p.push(i),m=i}m===(e.ownerDocument||d)&&p.push(m.defaultView||m.parentWindow||a)}o=0;while((i=p[o++])&&!b.isPropagationStopped()){b.type=o>1?j:l.bindType||q,g=(n._data(i,"events")||{})[b.type]&&n._data(i,"handle"),g&&g.apply(i,c),g=h&&i[h],g&&g.apply&&M(i)&&(b.result=g.apply(i,c),b.result===!1&&b.preventDefault())}if(b.type=q,!f&&!b.isDefaultPrevented()&&(!l._default||l._default.apply(p.pop(),c)===!1)&&M(e)&&h&&e[q]&&!n.isWindow(e)){m=e[h],m&&(e[h]=null),n.event.triggered=q;try{e[q]()}catch(s){}n.event.triggered=void 0,m&&(e[h]=m)}return b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,d,f,g,h=[],i=e.call(arguments),j=(n._data(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped()){a.rnamespace&&!a.rnamespace.test(g.namespace)||(a.handleObj=g,a.data=g.data,d=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==d&&(a.result=d)===!1&&(a.preventDefault(),a.stopPropagation()))}}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&("click"!==a.type||isNaN(a.button)||a.button<1)){for(;i!=this;i=i.parentNode||this){if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(d=[],c=0;h>c;c++){f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>-1:n.find(e,this,null,[i]).length),d[e]&&d.push(f)}d.length&&g.push({elem:i,handlers:d})}}}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},fix:function(a){if(a[n.expando]){return a}var b,c,e,f=a.type,g=a,h=this.fixHooks[f];h||(this.fixHooks[f]=h=ma.test(f)?this.mouseHooks:la.test(f)?this.keyHooks:{}),e=h.props?this.props.concat(h.props):this.props,a=new n.Event(g),b=e.length;while(b--){c=e[b],a[c]=g[c]}return a.target||(a.target=g.srcElement||d),3===a.target.nodeType&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,h.filter?h.filter(a,g):a},props:"altKey bubbles cancelable ctrlKey currentTarget detail eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,e,f,g=b.button,h=b.fromElement;return null==a.pageX&&null!=b.clientX&&(e=a.target.ownerDocument||d,f=e.documentElement,c=e.body,a.pageX=b.clientX+(f&&f.scrollLeft||c&&c.scrollLeft||0)-(f&&f.clientLeft||c&&c.clientLeft||0),a.pageY=b.clientY+(f&&f.scrollTop||c&&c.scrollTop||0)-(f&&f.clientTop||c&&c.clientTop||0)),!a.relatedTarget&&h&&(a.relatedTarget=h===a.target?b.toElement:h),a.which||void 0===g||(a.which=1&g?1:2&g?3:4&g?2:0),a}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==ra()&&this.focus){try{return this.focus(),!1}catch(a){}}},delegateType:"focusin"},blur:{trigger:function(){return this===ra()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return n.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):void 0},_default:function(a){return n.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c){var d=n.extend(new n.Event,c,{type:a,isSimulated:!0});n.event.trigger(d,null,b),d.isDefaultPrevented()&&c.preventDefault()}},n.removeEvent=d.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c)}:function(a,b,c){var d="on"+b;a.detachEvent&&("undefined"==typeof a[d]&&(a[d]=null),a.detachEvent(d,c))},n.Event=function(a,b){return this instanceof n.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?pa:qa):this.type=a,b&&n.extend(this,b),this.timeStamp=a&&a.timeStamp||n.now(),void (this[n.expando]=!0)):new n.Event(a,b)},n.Event.prototype={constructor:n.Event,isDefaultPrevented:qa,isPropagationStopped:qa,isImmediatePropagationStopped:qa,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=pa,a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=pa,a&&!this.isSimulated&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=pa,a&&a.stopImmediatePropagation&&a.stopImmediatePropagation(),this.stopPropagation()}},n.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){n.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return e&&(e===d||n.contains(d,e))||(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),l.submit||(n.event.special.submit={setup:function(){return n.nodeName(this,"form")?!1:void n.event.add(this,"click._submit keypress._submit",function(a){var b=a.target,c=n.nodeName(b,"input")||n.nodeName(b,"button")?n.prop(b,"form"):void 0;c&&!n._data(c,"submit")&&(n.event.add(c,"submit._submit",function(a){a._submitBubble=!0}),n._data(c,"submit",!0))})},postDispatch:function(a){a._submitBubble&&(delete a._submitBubble,this.parentNode&&!a.isTrigger&&n.event.simulate("submit",this.parentNode,a))},teardown:function(){return n.nodeName(this,"form")?!1:void n.event.remove(this,"._submit")}}),l.change||(n.event.special.change={setup:function(){return ka.test(this.nodeName)?("checkbox"!==this.type&&"radio"!==this.type||(n.event.add(this,"propertychange._change",function(a){"checked"===a.originalEvent.propertyName&&(this._justChanged=!0)}),n.event.add(this,"click._change",function(a){this._justChanged&&!a.isTrigger&&(this._justChanged=!1),n.event.simulate("change",this,a)})),!1):void n.event.add(this,"beforeactivate._change",function(a){var b=a.target;ka.test(b.nodeName)&&!n._data(b,"change")&&(n.event.add(b,"change._change",function(a){!this.parentNode||a.isSimulated||a.isTrigger||n.event.simulate("change",this.parentNode,a)}),n._data(b,"change",!0))})},handle:function(a){var b=a.target;return this!==b||a.isSimulated||a.isTrigger||"radio"!==b.type&&"checkbox"!==b.type?a.handleObj.handler.apply(this,arguments):void 0},teardown:function(){return n.event.remove(this,"._change"),!ka.test(this.nodeName)}}),l.focusin||n.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){n.event.simulate(b,a.target,n.event.fix(a))};n.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=n._data(d,b);e||d.addEventListener(a,c,!0),n._data(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=n._data(d,b)-1;e?n._data(d,b,e):(d.removeEventListener(a,c,!0),n._removeData(d,b))}}}),n.fn.extend({on:function(a,b,c,d){return sa(this,a,b,c,d)},one:function(a,b,c,d){return sa(this,a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj){return d=a.handleObj,n(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this}if("object"==typeof a){for(e in a){this.off(e,b,a[e])}return this}return b!==!1&&"function"!=typeof b||(c=b,b=void 0),c===!1&&(c=qa),this.each(function(){n.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){n.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?n.event.trigger(a,b,c,!0):void 0}});var ta=/ jQuery\d+="(?:null|\d+)"/g,ua=new RegExp("<(?:"+ba+")[\\s/>]","i"),va=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,wa=/<script|<style|<link/i,xa=/checked\s*(?:[^=]|=\s*.checked.)/i,ya=/^true\/(.*)/,za=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,Aa=ca(d),Ba=Aa.appendChild(d.createElement("div"));function Ca(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function Da(a){return a.type=(null!==n.find.attr(a,"type"))+"/"+a.type,a}function Ea(a){var b=ya.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function Fa(a,b){if(1===b.nodeType&&n.hasData(a)){var c,d,e,f=n._data(a),g=n._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h){for(d=0,e=h[c].length;e>d;d++){n.event.add(b,c,h[c][d])}}}g.data&&(g.data=n.extend({},g.data))}}function Ga(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!l.noCloneEvent&&b[n.expando]){e=n._data(b);for(d in e.events){n.removeEvent(b,d,e.handle)}b.removeAttribute(n.expando)}"script"===c&&b.text!==a.text?(Da(b).text=a.text,Ea(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),l.html5Clone&&a.innerHTML&&!n.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&Z.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:"input"!==c&&"textarea"!==c||(b.defaultValue=a.defaultValue)}}function Ha(a,b,c,d){b=f.apply([],b);var e,g,h,i,j,k,m=0,o=a.length,p=o-1,q=b[0],r=n.isFunction(q);if(r||o>1&&"string"==typeof q&&!l.checkClone&&xa.test(q)){return a.each(function(e){var f=a.eq(e);r&&(b[0]=q.call(this,e,f.html())),Ha(f,b,c,d)})}if(o&&(k=ja(b,a[0].ownerDocument,!1,a,d),e=k.firstChild,1===k.childNodes.length&&(k=e),e||d)){for(i=n.map(ea(k,"script"),Da),h=i.length;o>m;m++){g=k,m!==p&&(g=n.clone(g,!0,!0),h&&n.merge(i,ea(g,"script"))),c.call(a[m],g,m)}if(h){for(j=i[i.length-1].ownerDocument,n.map(i,Ea),m=0;h>m;m++){g=i[m],_.test(g.type||"")&&!n._data(g,"globalEval")&&n.contains(j,g)&&(g.src?n._evalUrl&&n._evalUrl(g.src):n.globalEval((g.text||g.textContent||g.innerHTML||"").replace(za,"")))}}k=e=null}return a}function Ia(a,b,c){for(var d,e=b?n.filter(b,a):a,f=0;null!=(d=e[f]);f++){c||1!==d.nodeType||n.cleanData(ea(d)),d.parentNode&&(c&&n.contains(d.ownerDocument,d)&&fa(ea(d,"script")),d.parentNode.removeChild(d))}return a}n.extend({htmlPrefilter:function(a){return a.replace(va,"<$1></$2>")},clone:function(a,b,c){var d,e,f,g,h,i=n.contains(a.ownerDocument,a);if(l.html5Clone||n.isXMLDoc(a)||!ua.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(Ba.innerHTML=a.outerHTML,Ba.removeChild(f=Ba.firstChild)),!(l.noCloneEvent&&l.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a))){for(d=ea(f),h=ea(a),g=0;null!=(e=h[g]);++g){d[g]&&Ga(e,d[g])}}if(b){if(c){for(h=h||ea(a),d=d||ea(f),g=0;null!=(e=h[g]);g++){Fa(e,d[g])}}else{Fa(a,f)}}return d=ea(f,"script"),d.length>0&&fa(d,!i&&ea(a,"script")),d=h=e=null,f},cleanData:function(a,b){for(var d,e,f,g,h=0,i=n.expando,j=n.cache,k=l.attributes,m=n.event.special;null!=(d=a[h]);h++){if((b||M(d))&&(f=d[i],g=f&&j[f])){if(g.events){for(e in g.events){m[e]?n.event.remove(d,e):n.removeEvent(d,e,g.handle)}}j[f]&&(delete j[f],k||"undefined"==typeof d.removeAttribute?d[i]=void 0:d.removeAttribute(i),c.push(f))}}}}),n.fn.extend({domManip:Ha,detach:function(a){return Ia(this,a,!0)},remove:function(a){return Ia(this,a)},text:function(a){return Y(this,function(a){return void 0===a?n.text(this):this.empty().append((this[0]&&this[0].ownerDocument||d).createTextNode(a))},null,a,arguments.length)},append:function(){return Ha(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ca(this,a);b.appendChild(a)}})},prepend:function(){return Ha(this,arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=Ca(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return Ha(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return Ha(this,arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&n.cleanData(ea(a,!1));while(a.firstChild){a.removeChild(a.firstChild)}a.options&&n.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return Y(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a){return 1===b.nodeType?b.innerHTML.replace(ta,""):void 0}if("string"==typeof a&&!wa.test(a)&&(l.htmlSerialize||!ua.test(a))&&(l.leadingWhitespace||!aa.test(a))&&!da[($.exec(a)||["",""])[1].toLowerCase()]){a=n.htmlPrefilter(a);try{for(;d>c;c++){b=this[c]||{},1===b.nodeType&&(n.cleanData(ea(b,!1)),b.innerHTML=a)}b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=[];return Ha(this,arguments,function(b){var c=this.parentNode;n.inArray(this,a)<0&&(n.cleanData(ea(this)),c&&c.replaceChild(b,this))},a)}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=0,e=[],f=n(a),h=f.length-1;h>=d;d++){c=d===h?this:this.clone(!0),n(f[d])[b](c),g.apply(e,c.get())}return this.pushStack(e)}});var Ja,Ka={HTML:"block",BODY:"block"};function La(a,b){var c=n(b.createElement(a)).appendTo(b.body),d=n.css(c[0],"display");return c.detach(),d}function Ma(a){var b=d,c=Ka[a];return c||(c=La(a,b),"none"!==c&&c||(Ja=(Ja||n("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=(Ja[0].contentWindow||Ja[0].contentDocument).document,b.write(),b.close(),c=La(a,b),Ja.detach()),Ka[a]=c),c}var Na=/^margin/,Oa=new RegExp("^("+T+")(?!px)[a-z%]+$","i"),Pa=function(a,b,c,d){var e,f,g={};for(f in b){g[f]=a.style[f],a.style[f]=b[f]}e=c.apply(a,d||[]);for(f in b){a.style[f]=g[f]}return e},Qa=d.documentElement;!function(){var b,c,e,f,g,h,i=d.createElement("div"),j=d.createElement("div");if(j.style){j.style.cssText="float:left;opacity:.5",l.opacity="0.5"===j.style.opacity,l.cssFloat=!!j.style.cssFloat,j.style.backgroundClip="content-box",j.cloneNode(!0).style.backgroundClip="",l.clearCloneStyle="content-box"===j.style.backgroundClip,i=d.createElement("div"),i.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",j.innerHTML="",i.appendChild(j),l.boxSizing=""===j.style.boxSizing||""===j.style.MozBoxSizing||""===j.style.WebkitBoxSizing,n.extend(l,{reliableHiddenOffsets:function(){return null==b&&k(),f},boxSizingReliable:function(){return null==b&&k(),e},pixelMarginRight:function(){return null==b&&k(),c},pixelPosition:function(){return null==b&&k(),b},reliableMarginRight:function(){return null==b&&k(),g},reliableMarginLeft:function(){return null==b&&k(),h}});function k(){var k,l,m=d.documentElement;m.appendChild(i),j.style.cssText="-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",b=e=h=!1,c=g=!0,a.getComputedStyle&&(l=a.getComputedStyle(j),b="1%"!==(l||{}).top,h="2px"===(l||{}).marginLeft,e="4px"===(l||{width:"4px"}).width,j.style.marginRight="50%",c="4px"===(l||{marginRight:"4px"}).marginRight,k=j.appendChild(d.createElement("div")),k.style.cssText=j.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",k.style.marginRight=k.style.width="0",j.style.width="1px",g=!parseFloat((a.getComputedStyle(k)||{}).marginRight),j.removeChild(k)),j.style.display="none",f=0===j.getClientRects().length,f&&(j.style.display="",j.innerHTML="<table><tr><td></td><td>t</td></tr></table>",j.childNodes[0].style.borderCollapse="separate",k=j.getElementsByTagName("td"),k[0].style.cssText="margin:0;border:0;padding:0;display:none",f=0===k[0].offsetHeight,f&&(k[0].style.display="",k[1].style.display="none",f=0===k[0].offsetHeight)),m.removeChild(i)}}}();var Ra,Sa,Ta=/^(top|right|bottom|left)$/;a.getComputedStyle?(Ra=function(b){var c=b.ownerDocument.defaultView;return c&&c.opener||(c=a),c.getComputedStyle(b)},Sa=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ra(a),g=c?c.getPropertyValue(b)||c[b]:void 0,""!==g&&void 0!==g||n.contains(a.ownerDocument,a)||(g=n.style(a,b)),c&&!l.pixelMarginRight()&&Oa.test(g)&&Na.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f),void 0===g?g:g+""}):Qa.currentStyle&&(Ra=function(a){return a.currentStyle},Sa=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ra(a),g=c?c[b]:void 0,null==g&&h&&h[b]&&(g=h[b]),Oa.test(g)&&!Ta.test(b)&&(d=h.left,e=a.runtimeStyle,f=e&&e.left,f&&(e.left=a.currentStyle.left),h.left="fontSize"===b?"1em":g,g=h.pixelLeft+"px",h.left=d,f&&(e.left=f)),void 0===g?g:g+""||"auto"});function Ua(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}var Va=/alpha\([^)]*\)/i,Wa=/opacity\s*=\s*([^)]*)/i,Xa=/^(none|table(?!-c[ea]).+)/,Ya=new RegExp("^("+T+")(.*)$","i"),Za={position:"absolute",visibility:"hidden",display:"block"},$a={letterSpacing:"0",fontWeight:"400"},_a=["Webkit","O","Moz","ms"],ab=d.createElement("div").style;function bb(a){if(a in ab){return a}var b=a.charAt(0).toUpperCase()+a.slice(1),c=_a.length;while(c--){if(a=_a[c]+b,a in ab){return a}}}function cb(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++){d=a[g],d.style&&(f[g]=n._data(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&W(d)&&(f[g]=n._data(d,"olddisplay",Ma(d.nodeName)))):(e=W(d),(c&&"none"!==c||!e)&&n._data(d,"olddisplay",e?c:n.css(d,"display"))))}for(g=0;h>g;g++){d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"))}return a}function db(a,b,c){var d=Ya.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function eb(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2){"margin"===c&&(g+=n.css(a,c+V[f],!0,e)),d?("content"===c&&(g-=n.css(a,"padding"+V[f],!0,e)),"margin"!==c&&(g-=n.css(a,"border"+V[f]+"Width",!0,e))):(g+=n.css(a,"padding"+V[f],!0,e),"padding"!==c&&(g+=n.css(a,"border"+V[f]+"Width",!0,e)))}return g}function fb(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=Ra(a),g=l.boxSizing&&"border-box"===n.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=Sa(a,b,f),(0>e||null==e)&&(e=a.style[b]),Oa.test(e)){return e}d=g&&(l.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+eb(a,b,c||(g?"border":"content"),d,f)+"px"}n.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Sa(a,"opacity");return""===c?"1":c}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":l.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=n.camelCase(b),i=a.style;if(b=n.cssProps[h]||(n.cssProps[h]=bb(h)||h),g=n.cssHooks[b]||n.cssHooks[h],void 0===c){return g&&"get" in g&&void 0!==(e=g.get(a,!1,d))?e:i[b]}if(f=typeof c,"string"===f&&(e=U.exec(c))&&e[1]&&(c=X(a,b,e),f="number"),null!=c&&c===c&&("number"===f&&(c+=e&&e[3]||(n.cssNumber[h]?"":"px")),l.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),!(g&&"set" in g&&void 0===(c=g.set(a,c,d))))){try{i[b]=c}catch(j){}}}},css:function(a,b,c,d){var e,f,g,h=n.camelCase(b);return b=n.cssProps[h]||(n.cssProps[h]=bb(h)||h),g=n.cssHooks[b]||n.cssHooks[h],g&&"get" in g&&(f=g.get(a,!0,c)),void 0===f&&(f=Sa(a,b,d)),"normal"===f&&b in $a&&(f=$a[b]),""===c||c?(e=parseFloat(f),c===!0||isFinite(e)?e||0:f):f}}),n.each(["height","width"],function(a,b){n.cssHooks[b]={get:function(a,c,d){return c?Xa.test(n.css(a,"display"))&&0===a.offsetWidth?Pa(a,Za,function(){return fb(a,b,d)}):fb(a,b,d):void 0},set:function(a,c,d){var e=d&&Ra(a);return db(a,c,d?eb(a,b,d,l.boxSizing&&"border-box"===n.css(a,"boxSizing",!1,e),e):0)}}}),l.opacity||(n.cssHooks.opacity={get:function(a,b){return Wa.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?0.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=n.isNumeric(b)?"alpha(opacity="+100*b+")":"",f=d&&d.filter||c.filter||"";c.zoom=1,(b>=1||""===b)&&""===n.trim(f.replace(Va,""))&&c.removeAttribute&&(c.removeAttribute("filter"),""===b||d&&!d.filter)||(c.filter=Va.test(f)?f.replace(Va,e):f+" "+e)}}),n.cssHooks.marginRight=Ua(l.reliableMarginRight,function(a,b){return b?Pa(a,{display:"inline-block"},Sa,[a,"marginRight"]):void 0}),n.cssHooks.marginLeft=Ua(l.reliableMarginLeft,function(a,b){return b?(parseFloat(Sa(a,"marginLeft"))||(n.contains(a.ownerDocument,a)?a.getBoundingClientRect().left-Pa(a,{marginLeft:0},function(){return a.getBoundingClientRect().left}):0))+"px":void 0}),n.each({margin:"",padding:"",border:"Width"},function(a,b){n.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++){e[a+V[d]+b]=f[d]||f[d-2]||f[0]}return e}},Na.test(a)||(n.cssHooks[a+b].set=db)}),n.fn.extend({css:function(a,b){return Y(this,function(a,b,c){var d,e,f={},g=0;if(n.isArray(b)){for(d=Ra(a),e=b.length;e>g;g++){f[b[g]]=n.css(a,b[g],!1,d)}return f}return void 0!==c?n.style(a,b,c):n.css(a,b)},a,b,arguments.length>1)},show:function(){return cb(this,!0)},hide:function(){return cb(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){W(this)?n(this).show():n(this).hide()})}});function gb(a,b,c,d,e){return new gb.prototype.init(a,b,c,d,e)}n.Tween=gb,gb.prototype={constructor:gb,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||n.easing._default,this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(n.cssNumber[c]?"":"px")},cur:function(){var a=gb.propHooks[this.prop];return a&&a.get?a.get(this):gb.propHooks._default.get(this)},run:function(a){var b,c=gb.propHooks[this.prop];return this.options.duration?this.pos=b=n.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):gb.propHooks._default.set(this),this}},gb.prototype.init.prototype=gb.prototype,gb.propHooks={_default:{get:function(a){var b;return 1!==a.elem.nodeType||null!=a.elem[a.prop]&&null==a.elem.style[a.prop]?a.elem[a.prop]:(b=n.css(a.elem,a.prop,""),b&&"auto"!==b?b:0)},set:function(a){n.fx.step[a.prop]?n.fx.step[a.prop](a):1!==a.elem.nodeType||null==a.elem.style[n.cssProps[a.prop]]&&!n.cssHooks[a.prop]?a.elem[a.prop]=a.now:n.style(a.elem,a.prop,a.now+a.unit)}}},gb.propHooks.scrollTop=gb.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},n.easing={linear:function(a){return a},swing:function(a){return 0.5-Math.cos(a*Math.PI)/2},_default:"swing"},n.fx=gb.prototype.init,n.fx.step={};var hb,ib,jb=/^(?:toggle|show|hide)$/,kb=/queueHooks$/;function lb(){return a.setTimeout(function(){hb=void 0}),hb=n.now()}function mb(a,b){var c,d={height:a},e=0;for(b=b?1:0;4>e;e+=2-b){c=V[e],d["margin"+c]=d["padding"+c]=a}return b&&(d.opacity=d.width=a),d}function nb(a,b,c){for(var d,e=(qb.tweeners[b]||[]).concat(qb.tweeners["*"]),f=0,g=e.length;g>f;f++){if(d=e[f].call(c,b,a)){return d}}}function ob(a,b,c){var d,e,f,g,h,i,j,k,m=this,o={},p=a.style,q=a.nodeType&&W(a),r=n._data(a,"fxshow");c.queue||(h=n._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,m.always(function(){m.always(function(){h.unqueued--,n.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height" in b||"width" in b)&&(c.overflow=[p.overflow,p.overflowX,p.overflowY],j=n.css(a,"display"),k="none"===j?n._data(a,"olddisplay")||Ma(a.nodeName):j,"inline"===k&&"none"===n.css(a,"float")&&(l.inlineBlockNeedsLayout&&"inline"!==Ma(a.nodeName)?p.zoom=1:p.display="inline-block")),c.overflow&&(p.overflow="hidden",l.shrinkWrapBlocks()||m.always(function(){p.overflow=c.overflow[0],p.overflowX=c.overflow[1],p.overflowY=c.overflow[2]}));for(d in b){if(e=b[d],jb.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(q?"hide":"show")){if("show"!==e||!r||void 0===r[d]){continue}q=!0}o[d]=r&&r[d]||n.style(a,d)}else{j=void 0}}if(n.isEmptyObject(o)){"inline"===("none"===j?Ma(a.nodeName):j)&&(p.display=j)}else{r?"hidden" in r&&(q=r.hidden):r=n._data(a,"fxshow",{}),f&&(r.hidden=!q),q?n(a).show():m.done(function(){n(a).hide()}),m.done(function(){var b;n._removeData(a,"fxshow");for(b in o){n.style(a,b,o[b])}});for(d in o){g=nb(q?r[d]:0,d,m),d in r||(r[d]=g.start,q&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}}function pb(a,b){var c,d,e,f,g;for(c in a){if(d=n.camelCase(c),e=b[d],f=a[c],n.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=n.cssHooks[d],g&&"expand" in g){f=g.expand(f),delete a[d];for(c in f){c in a||(a[c]=f[c],b[c]=e)}}else{b[d]=e}}}function qb(a,b,c){var d,e,f=0,g=qb.prefilters.length,h=n.Deferred().always(function(){delete i.elem}),i=function(){if(e){return !1}for(var b=hb||lb(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++){j.tweens[g].run(f)}return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:n.extend({},b),opts:n.extend(!0,{specialEasing:{},easing:n.easing._default},c),originalProperties:b,originalOptions:c,startTime:hb||lb(),duration:c.duration,tweens:[],createTween:function(b,c){var d=n.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e){return this}for(e=!0;d>c;c++){j.tweens[c].run(1)}return b?(h.notifyWith(a,[j,1,0]),h.resolveWith(a,[j,b])):h.rejectWith(a,[j,b]),this}}),k=j.props;for(pb(k,j.opts.specialEasing);g>f;f++){if(d=qb.prefilters[f].call(j,a,k,j.opts)){return n.isFunction(d.stop)&&(n._queueHooks(j.elem,j.opts.queue).stop=n.proxy(d.stop,d)),d}}return n.map(k,nb,j),n.isFunction(j.opts.start)&&j.opts.start.call(a,j),n.fx.timer(n.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}n.Animation=n.extend(qb,{tweeners:{"*":[function(a,b){var c=this.createTween(a,b);return X(c.elem,a,U.exec(b),c),c}]},tweener:function(a,b){n.isFunction(a)?(b=a,a=["*"]):a=a.match(G);for(var c,d=0,e=a.length;e>d;d++){c=a[d],qb.tweeners[c]=qb.tweeners[c]||[],qb.tweeners[c].unshift(b)}},prefilters:[ob],prefilter:function(a,b){b?qb.prefilters.unshift(a):qb.prefilters.push(a)}}),n.speed=function(a,b,c){var d=a&&"object"==typeof a?n.extend({},a):{complete:c||!c&&b||n.isFunction(a)&&a,duration:a,easing:c&&b||b&&!n.isFunction(b)&&b};return d.duration=n.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in n.fx.speeds?n.fx.speeds[d.duration]:n.fx.speeds._default,null!=d.queue&&d.queue!==!0||(d.queue="fx"),d.old=d.complete,d.complete=function(){n.isFunction(d.old)&&d.old.call(this),d.queue&&n.dequeue(this,d.queue)},d},n.fn.extend({fadeTo:function(a,b,c,d){return this.filter(W).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=n.isEmptyObject(a),f=n.speed(b,c,d),g=function(){var b=qb(this,n.extend({},a),f);(e||n._data(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=n.timers,g=n._data(this);if(e){g[e]&&g[e].stop&&d(g[e])}else{for(e in g){g[e]&&g[e].stop&&kb.test(e)&&d(g[e])}}for(e=f.length;e--;){f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1))}!b&&c||n.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=n._data(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=n.timers,g=d?d.length:0;for(c.finish=!0,n.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;){f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1))}for(b=0;g>b;b++){d[b]&&d[b].finish&&d[b].finish.call(this)}delete c.finish})}}),n.each(["toggle","show","hide"],function(a,b){var c=n.fn[b];n.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(mb(b,!0),a,d,e)}}),n.each({slideDown:mb("show"),slideUp:mb("hide"),slideToggle:mb("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){n.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),n.timers=[],n.fx.tick=function(){var a,b=n.timers,c=0;for(hb=n.now();c<b.length;c++){a=b[c],a()||b[c]!==a||b.splice(c--,1)}b.length||n.fx.stop(),hb=void 0},n.fx.timer=function(a){n.timers.push(a),a()?n.fx.start():n.timers.pop()},n.fx.interval=13,n.fx.start=function(){ib||(ib=a.setInterval(n.fx.tick,n.fx.interval))},n.fx.stop=function(){a.clearInterval(ib),ib=null},n.fx.speeds={slow:600,fast:200,_default:400},n.fn.delay=function(b,c){return b=n.fx?n.fx.speeds[b]||b:b,c=c||"fx",this.queue(c,function(c,d){var e=a.setTimeout(c,b);d.stop=function(){a.clearTimeout(e)}})},function(){var a,b=d.createElement("input"),c=d.createElement("div"),e=d.createElement("select"),f=e.appendChild(d.createElement("option"));c=d.createElement("div"),c.setAttribute("className","t"),c.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",a=c.getElementsByTagName("a")[0],b.setAttribute("type","checkbox"),c.appendChild(b),a=c.getElementsByTagName("a")[0],a.style.cssText="top:1px",l.getSetAttribute="t"!==c.className,l.style=/top/.test(a.getAttribute("style")),l.hrefNormalized="/a"===a.getAttribute("href"),l.checkOn=!!b.value,l.optSelected=f.selected,l.enctype=!!d.createElement("form").enctype,e.disabled=!0,l.optDisabled=!f.disabled,b=d.createElement("input"),b.setAttribute("value",""),l.input=""===b.getAttribute("value"),b.value="t",b.setAttribute("type","radio"),l.radioValue="t"===b.value}();var rb=/\r/g,sb=/[\x20\t\r\n\f]+/g;n.fn.extend({val:function(a){var b,c,d,e=this[0];if(arguments.length){return d=n.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,n(this).val()):a,null==e?e="":"number"==typeof e?e+="":n.isArray(e)&&(e=n.map(e,function(a){return null==a?"":a+""})),b=n.valHooks[this.type]||n.valHooks[this.nodeName.toLowerCase()],b&&"set" in b&&void 0!==b.set(this,e,"value")||(this.value=e))})}if(e){return b=n.valHooks[e.type]||n.valHooks[e.nodeName.toLowerCase()],b&&"get" in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(rb,""):null==c?"":c)}}}),n.extend({valHooks:{option:{get:function(a){var b=n.find.attr(a,"value");return null!=b?b:n.trim(n.text(a)).replace(sb," ")}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++){if(c=d[i],(c.selected||i===e)&&(l.optDisabled?!c.disabled:null===c.getAttribute("disabled"))&&(!c.parentNode.disabled||!n.nodeName(c.parentNode,"optgroup"))){if(b=n(c).val(),f){return b}g.push(b)}}return g},set:function(a,b){var c,d,e=a.options,f=n.makeArray(b),g=e.length;while(g--){if(d=e[g],n.inArray(n.valHooks.option.get(d),f)>-1){try{d.selected=c=!0}catch(h){d.scrollHeight}}else{d.selected=!1}}return c||(a.selectedIndex=-1),e}}}}),n.each(["radio","checkbox"],function(){n.valHooks[this]={set:function(a,b){return n.isArray(b)?a.checked=n.inArray(n(a).val(),b)>-1:void 0}},l.checkOn||(n.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var tb,ub,vb=n.expr.attrHandle,wb=/^(?:checked|selected)$/i,xb=l.getSetAttribute,yb=l.input;n.fn.extend({attr:function(a,b){return Y(this,n.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){n.removeAttr(this,a)})}}),n.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f){return"undefined"==typeof a.getAttribute?n.prop(a,b,c):(1===f&&n.isXMLDoc(a)||(b=b.toLowerCase(),e=n.attrHooks[b]||(n.expr.match.bool.test(b)?ub:tb)),void 0!==c?null===c?void n.removeAttr(a,b):e&&"set" in e&&void 0!==(d=e.set(a,c,b))?d:(a.setAttribute(b,c+""),c):e&&"get" in e&&null!==(d=e.get(a,b))?d:(d=n.find.attr(a,b),null==d?void 0:d))}},attrHooks:{type:{set:function(a,b){if(!l.radioValue&&"radio"===b&&n.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(G);if(f&&1===a.nodeType){while(c=f[e++]){d=n.propFix[c]||c,n.expr.match.bool.test(c)?yb&&xb||!wb.test(c)?a[d]=!1:a[n.camelCase("default-"+c)]=a[d]=!1:n.attr(a,c,""),a.removeAttribute(xb?c:d)}}}}),ub={set:function(a,b,c){return b===!1?n.removeAttr(a,c):yb&&xb||!wb.test(c)?a.setAttribute(!xb&&n.propFix[c]||c,c):a[n.camelCase("default-"+c)]=a[c]=!0,c}},n.each(n.expr.match.bool.source.match(/\w+/g),function(a,b){var c=vb[b]||n.find.attr;yb&&xb||!wb.test(b)?vb[b]=function(a,b,d){var e,f;return d||(f=vb[b],vb[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,vb[b]=f),e}:vb[b]=function(a,b,c){return c?void 0:a[n.camelCase("default-"+b)]?b.toLowerCase():null}}),yb&&xb||(n.attrHooks.value={set:function(a,b,c){return n.nodeName(a,"input")?void (a.defaultValue=b):tb&&tb.set(a,b,c)}}),xb||(tb={set:function(a,b,c){var d=a.getAttributeNode(c);return d||a.setAttributeNode(d=a.ownerDocument.createAttribute(c)),d.value=b+="","value"===c||b===a.getAttribute(c)?b:void 0}},vb.id=vb.name=vb.coords=function(a,b,c){var d;return c?void 0:(d=a.getAttributeNode(b))&&""!==d.value?d.value:null},n.valHooks.button={get:function(a,b){var c=a.getAttributeNode(b);return c&&c.specified?c.value:void 0},set:tb.set},n.attrHooks.contenteditable={set:function(a,b,c){tb.set(a,""===b?!1:b,c)}},n.each(["width","height"],function(a,b){n.attrHooks[b]={set:function(a,c){return""===c?(a.setAttribute(b,"auto"),c):void 0}}})),l.style||(n.attrHooks.style={get:function(a){return a.style.cssText||void 0},set:function(a,b){return a.style.cssText=b+""}});var zb=/^(?:input|select|textarea|button|object)$/i,Ab=/^(?:a|area)$/i;n.fn.extend({prop:function(a,b){return Y(this,n.prop,a,b,arguments.length>1)},removeProp:function(a){return a=n.propFix[a]||a,this.each(function(){try{this[a]=void 0,delete this[a]}catch(b){}})}}),n.extend({prop:function(a,b,c){var d,e,f=a.nodeType;if(3!==f&&8!==f&&2!==f){return 1===f&&n.isXMLDoc(a)||(b=n.propFix[b]||b,e=n.propHooks[b]),void 0!==c?e&&"set" in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get" in e&&null!==(d=e.get(a,b))?d:a[b]}},propHooks:{tabIndex:{get:function(a){var b=n.find.attr(a,"tabindex");return b?parseInt(b,10):zb.test(a.nodeName)||Ab.test(a.nodeName)&&a.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),l.hrefNormalized||n.each(["href","src"],function(a,b){n.propHooks[b]={get:function(a){return a.getAttribute(b,4)}}}),l.optSelected||(n.propHooks.selected={get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null},set:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}}),n.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){n.propFix[this.toLowerCase()]=this}),l.enctype||(n.propFix.enctype="encoding");var Bb=/[\t\r\n\f]/g;function Cb(a){return n.attr(a,"class")||""}n.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(n.isFunction(a)){return this.each(function(b){n(this).addClass(a.call(this,b,Cb(this)))})}if("string"==typeof a&&a){b=a.match(G)||[];while(c=this[i++]){if(e=Cb(c),d=1===c.nodeType&&(" "+e+" ").replace(Bb," ")){g=0;while(f=b[g++]){d.indexOf(" "+f+" ")<0&&(d+=f+" ")}h=n.trim(d),e!==h&&n.attr(c,"class",h)}}}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(n.isFunction(a)){return this.each(function(b){n(this).removeClass(a.call(this,b,Cb(this)))})}if(!arguments.length){return this.attr("class","")}if("string"==typeof a&&a){b=a.match(G)||[];while(c=this[i++]){if(e=Cb(c),d=1===c.nodeType&&(" "+e+" ").replace(Bb," ")){g=0;while(f=b[g++]){while(d.indexOf(" "+f+" ")>-1){d=d.replace(" "+f+" "," ")}}h=n.trim(d),e!==h&&n.attr(c,"class",h)}}}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):n.isFunction(a)?this.each(function(c){n(this).toggleClass(a.call(this,c,Cb(this),b),b)}):this.each(function(){var b,d,e,f;if("string"===c){d=0,e=n(this),f=a.match(G)||[];while(b=f[d++]){e.hasClass(b)?e.removeClass(b):e.addClass(b)}}else{void 0!==a&&"boolean"!==c||(b=Cb(this),b&&n._data(this,"__className__",b),n.attr(this,"class",b||a===!1?"":n._data(this,"__className__")||""))}})},hasClass:function(a){var b,c,d=0;b=" "+a+" ";while(c=this[d++]){if(1===c.nodeType&&(" "+Cb(c)+" ").replace(Bb," ").indexOf(b)>-1){return !0}}return !1}}),n.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){n.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),n.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var Db=a.location,Eb=n.now(),Fb=/\?/,Gb=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;n.parseJSON=function(b){if(a.JSON&&a.JSON.parse){return a.JSON.parse(b+"")}var c,d=null,e=n.trim(b+"");return e&&!n.trim(e.replace(Gb,function(a,b,e,f){return c&&b&&(d=0),0===d?a:(c=e||b,d+=!f-!e,"")}))?Function("return "+e)():n.error("Invalid JSON: "+b)},n.parseXML=function(b){var c,d;if(!b||"string"!=typeof b){return null}try{a.DOMParser?(d=new a.DOMParser,c=d.parseFromString(b,"text/xml")):(c=new a.ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b))}catch(e){c=void 0}return c&&c.documentElement&&!c.getElementsByTagName("parsererror").length||n.error("Invalid XML: "+b),c};var Hb=/#.*$/,Ib=/([?&])_=[^&]*/,Jb=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Kb=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Lb=/^(?:GET|HEAD)$/,Mb=/^\/\//,Nb=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Ob={},Pb={},Qb="*/".concat("*"),Rb=Db.href,Sb=Nb.exec(Rb.toLowerCase())||[];function Tb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(G)||[];if(n.isFunction(c)){while(d=f[e++]){"+"===d.charAt(0)?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}}}function Ub(a,b,c,d){var e={},f=a===Pb;function g(h){var i;return e[h]=!0,n.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Vb(a,b){var c,d,e=n.ajaxSettings.flatOptions||{};for(d in b){void 0!==b[d]&&((e[d]?a:c||(c={}))[d]=b[d])}return c&&n.extend(!0,a,c),a}function Wb(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0]){i.shift(),void 0===e&&(e=a.mimeType||b.getResponseHeader("Content-Type"))}if(e){for(g in h){if(h[g]&&h[g].test(e)){i.unshift(g);break}}}if(i[0] in c){f=i[0]}else{for(g in c){if(!i[0]||a.converters[g+" "+i[0]]){f=g;break}d||(d=g)}f=f||d}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function Xb(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1]){for(g in a.converters){j[g.toLowerCase()]=a.converters[g]}}f=k.shift();while(f){if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift()){if("*"===f){f=i}else{if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g){for(e in j){if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}}}if(g!==!0){if(g&&a["throws"]){b=g(b)}else{try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}}}}}}return{state:"success",data:b}}n.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Rb,type:"GET",isLocal:Kb.test(Sb[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Qb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":n.parseJSON,"text xml":n.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Vb(Vb(a,n.ajaxSettings),b):Vb(n.ajaxSettings,a)},ajaxPrefilter:Tb(Ob),ajaxTransport:Tb(Pb),ajax:function(b,c){"object"==typeof b&&(c=b,b=void 0),c=c||{};var d,e,f,g,h,i,j,k,l=n.ajaxSetup({},c),m=l.context||l,o=l.context&&(m.nodeType||m.jquery)?n(m):n.event,p=n.Deferred(),q=n.Callbacks("once memory"),r=l.statusCode||{},s={},t={},u=0,v="canceled",w={readyState:0,getResponseHeader:function(a){var b;if(2===u){if(!k){k={};while(b=Jb.exec(g)){k[b[1].toLowerCase()]=b[2]}}b=k[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===u?g:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return u||(a=t[c]=t[c]||a,s[a]=b),this},overrideMimeType:function(a){return u||(l.mimeType=a),this},statusCode:function(a){var b;if(a){if(2>u){for(b in a){r[b]=[r[b],a[b]]}}else{w.always(a[w.status])}}return this},abort:function(a){var b=a||v;return j&&j.abort(b),y(0,b),this}};if(p.promise(w).complete=q.add,w.success=w.done,w.error=w.fail,l.url=((b||l.url||Rb)+"").replace(Hb,"").replace(Mb,Sb[1]+"//"),l.type=c.method||c.type||l.method||l.type,l.dataTypes=n.trim(l.dataType||"*").toLowerCase().match(G)||[""],null==l.crossDomain&&(d=Nb.exec(l.url.toLowerCase()),l.crossDomain=!(!d||d[1]===Sb[1]&&d[2]===Sb[2]&&(d[3]||("http:"===d[1]?"80":"443"))===(Sb[3]||("http:"===Sb[1]?"80":"443")))),l.data&&l.processData&&"string"!=typeof l.data&&(l.data=n.param(l.data,l.traditional)),Ub(Ob,l,c,w),2===u){return w}i=n.event&&l.global,i&&0===n.active++&&n.event.trigger("ajaxStart"),l.type=l.type.toUpperCase(),l.hasContent=!Lb.test(l.type),f=l.url,l.hasContent||(l.data&&(f=l.url+=(Fb.test(f)?"&":"?")+l.data,delete l.data),l.cache===!1&&(l.url=Ib.test(f)?f.replace(Ib,"$1_="+Eb++):f+(Fb.test(f)?"&":"?")+"_="+Eb++)),l.ifModified&&(n.lastModified[f]&&w.setRequestHeader("If-Modified-Since",n.lastModified[f]),n.etag[f]&&w.setRequestHeader("If-None-Match",n.etag[f])),(l.data&&l.hasContent&&l.contentType!==!1||c.contentType)&&w.setRequestHeader("Content-Type",l.contentType),w.setRequestHeader("Accept",l.dataTypes[0]&&l.accepts[l.dataTypes[0]]?l.accepts[l.dataTypes[0]]+("*"!==l.dataTypes[0]?", "+Qb+"; q=0.01":""):l.accepts["*"]);for(e in l.headers){w.setRequestHeader(e,l.headers[e])}if(l.beforeSend&&(l.beforeSend.call(m,w,l)===!1||2===u)){return w.abort()}v="abort";for(e in {success:1,error:1,complete:1}){w[e](l[e])}if(j=Ub(Pb,l,c,w)){if(w.readyState=1,i&&o.trigger("ajaxSend",[w,l]),2===u){return w}l.async&&l.timeout>0&&(h=a.setTimeout(function(){w.abort("timeout")},l.timeout));try{u=1,j.send(s,y)}catch(x){if(!(2>u)){throw x}y(-1,x)}}else{y(-1,"No Transport")}function y(b,c,d,e){var k,s,t,v,x,y=c;2!==u&&(u=2,h&&a.clearTimeout(h),j=void 0,g=e||"",w.readyState=b>0?4:0,k=b>=200&&300>b||304===b,d&&(v=Wb(l,w,d)),v=Xb(l,v,w,k),k?(l.ifModified&&(x=w.getResponseHeader("Last-Modified"),x&&(n.lastModified[f]=x),x=w.getResponseHeader("etag"),x&&(n.etag[f]=x)),204===b||"HEAD"===l.type?y="nocontent":304===b?y="notmodified":(y=v.state,s=v.data,t=v.error,k=!t)):(t=y,!b&&y||(y="error",0>b&&(b=0))),w.status=b,w.statusText=(c||y)+"",k?p.resolveWith(m,[s,y,w]):p.rejectWith(m,[w,y,t]),w.statusCode(r),r=void 0,i&&o.trigger(k?"ajaxSuccess":"ajaxError",[w,l,k?s:t]),q.fireWith(m,[w,y]),i&&(o.trigger("ajaxComplete",[w,l]),--n.active||n.event.trigger("ajaxStop")))}return w},getJSON:function(a,b,c){return n.get(a,b,c,"json")},getScript:function(a,b){return n.get(a,void 0,b,"script")}}),n.each(["get","post"],function(a,b){n[b]=function(a,c,d,e){return n.isFunction(c)&&(e=e||d,d=c,c=void 0),n.ajax(n.extend({url:a,type:b,dataType:e,data:c,success:d},n.isPlainObject(a)&&a))}}),n._evalUrl=function(a){return n.ajax({url:a,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},n.fn.extend({wrapAll:function(a){if(n.isFunction(a)){return this.each(function(b){n(this).wrapAll(a.call(this,b))})}if(this[0]){var b=n(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&1===a.firstChild.nodeType){a=a.firstChild}return a}).append(this)}return this},wrapInner:function(a){return n.isFunction(a)?this.each(function(b){n(this).wrapInner(a.call(this,b))}):this.each(function(){var b=n(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=n.isFunction(a);return this.each(function(c){n(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){n.nodeName(this,"body")||n(this).replaceWith(this.childNodes)}).end()}});function Yb(a){return a.style&&a.style.display||n.css(a,"display")}function Zb(a){if(!n.contains(a.ownerDocument||d,a)){return !0}while(a&&1===a.nodeType){if("none"===Yb(a)||"hidden"===a.type){return !0}a=a.parentNode}return !1}n.expr.filters.hidden=function(a){return l.reliableHiddenOffsets()?a.offsetWidth<=0&&a.offsetHeight<=0&&!a.getClientRects().length:Zb(a)},n.expr.filters.visible=function(a){return !n.expr.filters.hidden(a)};var $b=/%20/g,_b=/\[\]$/,ac=/\r?\n/g,bc=/^(?:submit|button|image|reset|file)$/i,cc=/^(?:input|select|textarea|keygen)/i;function dc(a,b,c,d){var e;if(n.isArray(b)){n.each(b,function(b,e){c||_b.test(a)?d(a,e):dc(a+"["+("object"==typeof e&&null!=e?b:"")+"]",e,c,d)})}else{if(c||"object"!==n.type(b)){d(a,b)}else{for(e in b){dc(a+"["+e+"]",b[e],c,d)}}}}n.param=function(a,b){var c,d=[],e=function(a,b){b=n.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=n.ajaxSettings&&n.ajaxSettings.traditional),n.isArray(a)||a.jquery&&!n.isPlainObject(a)){n.each(a,function(){e(this.name,this.value)})}else{for(c in a){dc(c,a[c],b,e)}}return d.join("&").replace($b,"+")},n.fn.extend({serialize:function(){return n.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=n.prop(this,"elements");return a?n.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!n(this).is(":disabled")&&cc.test(this.nodeName)&&!bc.test(a)&&(this.checked||!Z.test(a))}).map(function(a,b){var c=n(this).val();return null==c?null:n.isArray(c)?n.map(c,function(a){return{name:b.name,value:a.replace(ac,"\r\n")}}):{name:b.name,value:c.replace(ac,"\r\n")}}).get()}}),n.ajaxSettings.xhr=void 0!==a.ActiveXObject?function(){return this.isLocal?ic():d.documentMode>8?hc():/^(get|post|head|put|delete|options)$/i.test(this.type)&&hc()||ic()}:hc;var ec=0,fc={},gc=n.ajaxSettings.xhr();a.attachEvent&&a.attachEvent("onunload",function(){for(var a in fc){fc[a](void 0,!0)}}),l.cors=!!gc&&"withCredentials" in gc,gc=l.ajax=!!gc,gc&&n.ajaxTransport(function(b){if(!b.crossDomain||l.cors){var c;return{send:function(d,e){var f,g=b.xhr(),h=++ec;if(g.open(b.type,b.url,b.async,b.username,b.password),b.xhrFields){for(f in b.xhrFields){g[f]=b.xhrFields[f]}}b.mimeType&&g.overrideMimeType&&g.overrideMimeType(b.mimeType),b.crossDomain||d["X-Requested-With"]||(d["X-Requested-With"]="XMLHttpRequest");for(f in d){void 0!==d[f]&&g.setRequestHeader(f,d[f]+"")}g.send(b.hasContent&&b.data||null),c=function(a,d){var f,i,j;if(c&&(d||4===g.readyState)){if(delete fc[h],c=void 0,g.onreadystatechange=n.noop,d){4!==g.readyState&&g.abort()}else{j={},f=g.status,"string"==typeof g.responseText&&(j.text=g.responseText);try{i=g.statusText}catch(k){i=""}f||!b.isLocal||b.crossDomain?1223===f&&(f=204):f=j.text?200:404}}j&&e(f,i,j,g.getAllResponseHeaders())},b.async?4===g.readyState?a.setTimeout(c):g.onreadystatechange=fc[h]=c:c()},abort:function(){c&&c(void 0,!0)}}}});function hc(){try{return new a.XMLHttpRequest}catch(b){}}function ic(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}n.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(a){return n.globalEval(a),a}}}),n.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),n.ajaxTransport("script",function(a){if(a.crossDomain){var b,c=d.head||n("head")[0]||d.documentElement;return{send:function(e,f){b=d.createElement("script"),b.async=!0,a.scriptCharset&&(b.charset=a.scriptCharset),b.src=a.url,b.onload=b.onreadystatechange=function(a,c){(c||!b.readyState||/loaded|complete/.test(b.readyState))&&(b.onload=b.onreadystatechange=null,b.parentNode&&b.parentNode.removeChild(b),b=null,c||f(200,"success"))},c.insertBefore(b,c.firstChild)},abort:function(){b&&b.onload(void 0,!0)}}}});var jc=[],kc=/(=)\?(?=&|$)|\?\?/;n.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=jc.pop()||n.expando+"_"+Eb++;return this[a]=!0,a}}),n.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(kc.test(b.url)?"url":"string"==typeof b.data&&0===(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&kc.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=n.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(kc,"$1"+e):b.jsonp!==!1&&(b.url+=(Fb.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||n.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){void 0===f?n(a).removeProp(e):a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,jc.push(e)),g&&n.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),n.parseHTML=function(a,b,c){if(!a||"string"!=typeof a){return null}"boolean"==typeof b&&(c=b,b=!1),b=b||d;var e=x.exec(a),f=!c&&[];return e?[b.createElement(e[1])]:(e=ja([a],b,f),f&&f.length&&n(f).remove(),n.merge([],e.childNodes))};var lc=n.fn.load;n.fn.load=function(a,b,c){if("string"!=typeof a&&lc){return lc.apply(this,arguments)}var d,e,f,g=this,h=a.indexOf(" ");return h>-1&&(d=n.trim(a.slice(h,a.length)),a=a.slice(0,h)),n.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(e="POST"),g.length>0&&n.ajax({url:a,type:e||"GET",dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?n("<div>").append(n.parseHTML(a)).find(d):a)}).always(c&&function(a,b){g.each(function(){c.apply(this,f||[a.responseText,b,a])})}),this},n.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){n.fn[b]=function(a){return this.on(b,a)}}),n.expr.filters.animated=function(a){return n.grep(n.timers,function(b){return a===b.elem}).length};function mc(a){return n.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}n.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=n.css(a,"position"),l=n(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=n.css(a,"top"),i=n.css(a,"left"),j=("absolute"===k||"fixed"===k)&&n.inArray("auto",[f,i])>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),n.isFunction(b)&&(b=b.call(a,c,n.extend({},h))),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using" in b?b.using.call(a,m):l.css(m)}},n.fn.extend({offset:function(a){if(arguments.length){return void 0===a?this:this.each(function(b){n.offset.setOffset(this,a,b)})}var b,c,d={top:0,left:0},e=this[0],f=e&&e.ownerDocument;if(f){return b=f.documentElement,n.contains(b,e)?("undefined"!=typeof e.getBoundingClientRect&&(d=e.getBoundingClientRect()),c=mc(f),{top:d.top+(c.pageYOffset||b.scrollTop)-(b.clientTop||0),left:d.left+(c.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}):d}},position:function(){if(this[0]){var a,b,c={top:0,left:0},d=this[0];return"fixed"===n.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),n.nodeName(a[0],"html")||(c=a.offset()),c.top+=n.css(a[0],"borderTopWidth",!0),c.left+=n.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-n.css(d,"marginTop",!0),left:b.left-c.left-n.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent;while(a&&!n.nodeName(a,"html")&&"static"===n.css(a,"position")){a=a.offsetParent}return a||Qa})}}),n.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c=/Y/.test(b);n.fn[a]=function(d){return Y(this,function(a,d,e){var f=mc(a);return void 0===e?f?b in f?f[b]:f.document.documentElement[d]:a[d]:void (f?f.scrollTo(c?n(f).scrollLeft():e,c?e:n(f).scrollTop()):a[d]=e)},a,d,arguments.length,null)}}),n.each(["top","left"],function(a,b){n.cssHooks[b]=Ua(l.pixelPosition,function(a,c){return c?(c=Sa(a,b),Oa.test(c)?n(a).position()[b]+"px":c):void 0})}),n.each({Height:"height",Width:"width"},function(a,b){n.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){n.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return Y(this,function(b,c,d){var e;return n.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?n.css(b,c,g):n.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),n.fn.extend({bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}}),n.fn.size=function(){return this.length},n.fn.andSelf=n.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return n});var nc=a.jQuery,oc=a.$;return n.noConflict=function(b){return a.$===n&&(a.$=oc),b&&a.jQuery===n&&(a.jQuery=nc),n},b||(a.jQuery=a.$=n),n});!function(x){function s(){var c,a,d={height:w.innerHeight,width:w.innerWidth};return d.height||(c=b.compatMode,(c||!x.support.boxModel)&&(a="CSS1Compat"===c?q:b.body,d={height:a.clientHeight,width:a.clientWidth})),d}function m(){return{top:w.pageYOffset||q.scrollTop||b.body.scrollTop,left:w.pageXOffset||q.scrollLeft||b.body.scrollLeft}}function j(){var f,h=x(),d=0;if(x.each(u,function(c,l){var a=l.data.selector,r=l.$element;h=h.add(a?r.find(a):r)}),f=h.length){for(g=g||s(),p=p||m();f>d;d++){if(x.contains(q,h[d])){var t,o,e,A=x(h[d]),z={height:A.height(),width:A.width()},i=A.offset(),y=A.data("inview");if(!p||!g){return}i.top+z.height>p.top&&i.top<p.top+g.height&&i.left+z.width>p.left&&i.left<p.left+g.width?(t=p.left>i.left?"right":p.left+g.width<i.left+z.width?"left":"both",o=p.top>i.top?"bottom":p.top+g.height<i.top+z.height?"top":"both",e=t+"-"+o,y&&y===e||A.data("inview",e).trigger("inview",[!0,t,o])):y&&A.data("inview",!1).trigger("inview",[!1])}}}}var g,p,k,u={},b=document,w=window,q=b.documentElement,v=x.expando;x.event.special.inview={add:function(a){u[a.guid+"-"+this[v]]={data:a,$element:x(this)},k||x.isEmptyObject(u)||(k=setInterval(j,250))},remove:function(c){try{delete u[c.guid+"-"+this[v]]}catch(a){}x.isEmptyObject(u)&&(clearInterval(k),k=null)}},x(w).bind("scroll resize scrollstop",function(){g=p=null}),!q.addEventListener&&q.attachEvent&&q.attachEvent("onfocusin",function(){p=null})}(jQuery); /*! * @preserve * riveted.js | v0.6.1 * Copyright (c) 2016 Rob Flaherty (@robflaherty) * Licensed under the MIT license */ ;!function(a,b){"function"==typeof define&&define.amd?define([],b):"object"==typeof module&&module.exports?module.exports=b():a.riveted=b()}(this,function(){var a=function(){function ab(b){b=b||{},P=parseInt(b.reportInterval,10)||5,Z=parseInt(b.idleTimeout,10)||30,W=b.gaGlobal||"ga","function"==typeof window[W]&&(C=!0),"undefined"!=typeof _gaq&&"function"==typeof _gaq.push&&(A=!0),"undefined"!=typeof dataLayer&&"function"==typeof dataLayer.push&&(Y=!0),j="gaTracker" in b&&"string"==typeof b.gaTracker?b.gaTracker+".send":"send","function"==typeof b.eventHandler&&(N=b.eventHandler),"function"==typeof b.userTimingHandler&&(U=b.userTimingHandler),z="nonInteraction" in b&&(b.nonInteraction===!1||"false"===b.nonInteraction)?!1:!0,K(document,"keydown",F),K(document,"click",F),K(window,"mousemove",S(F,500)),K(window,"scroll",S(F,500)),K(document,"visibilitychange",Q),K(document,"webkitvisibilitychange",Q)}function S(h,l){var f,d,k,b=null,g=0,c=function(){g=new Date,b=null,k=h.apply(f,d)};return function(){var i=new Date;g||(g=i);var e=l-(i-g);return f=this,d=arguments,0>=e?(clearTimeout(b),b=null,g=i,k=h.apply(f,d)):b||(b=setTimeout(c,e)),k}}function K(c,d,b){c.addEventListener?c.addEventListener(d,b,!1):c.attachEvent?c.attachEvent("on"+d,b):c["on"+d]=b}function X(){clearTimeout(B),O()}function Q(){(document.hidden||document.webkitHidden)&&X()}function af(){ag+=1,ag>0&&ag%P===0&&N(ag)}function O(){ae=!0,clearInterval(J)}function G(){X(),x=!0}function ad(){x=!1}function ac(){ae=!1,clearInterval(J),J=setInterval(af,1000)}function V(){var b=new Date,c=b-M;q=!0,U(c),J=setInterval(af,1000)}function aa(){M=new Date,ag=0,q=!1,ae=!1,clearInterval(J),clearTimeout(B)}function F(){x||(q||V(),ae&&ac(),clearTimeout(B),B=setTimeout(X,1000*Z+100))}var N,U,P,Z,z,C,A,j,Y,W,q=!1,ae=!1,x=!1,ag=0,M=new Date,J=null,B=null;return U=function(b){Y?dataLayer.push({event:"RivetedTiming",eventCategory:"Riveted",timingVar:"First Interaction",timingValue:b}):(C&&window[W](j,"timing","Riveted","First Interaction",b),A&&_gaq.push(["_trackTiming","Riveted","First Interaction",b,null,100]))},N=function(b){Y?dataLayer.push({event:"Riveted",eventCategory:"Riveted",eventAction:"Time Spent",eventLabel:b,eventValue:P,eventNonInteraction:z}):(C&&window[W](j,"event","Riveted","Time Spent",b.toString(),P,{nonInteraction:z}),A&&_gaq.push(["_trackEvent","Riveted","Time Spent",b.toString(),P,z]))},{init:ab,trigger:F,setIdle:X,on:ad,off:G,reset:aa}}();return a});!function(b){"function"==typeof define&&define.amd?define(["jquery"],b):"undefined"!=typeof exports?module.exports=b(require("jquery")):b(jQuery)}(function(d){var c=window.Slick||{};c=function(){function e(i,h){var b,g=this;g.defaults={accessibility:!0,adaptiveHeight:!1,appendArrows:d(i),appendDots:d(i),arrows:!0,asNavFor:null,prevArrow:'<button type="button" data-role="none" class="slick-prev" aria-label="Previous" tabindex="0" role="button">Previous</button>',nextArrow:'<button type="button" data-role="none" class="slick-next" aria-label="Next" tabindex="0" role="button">Next</button>',autoplay:!1,autoplaySpeed:3000,centerMode:!1,centerPadding:"50px",cssEase:"ease",customPaging:function(f,j){return d('<button type="button" data-role="none" role="button" tabindex="0" />').text(j+1)},dots:!1,dotsClass:"slick-dots",draggable:!0,easing:"linear",edgeFriction:0.35,fade:!1,focusOnSelect:!1,infinite:!0,initialSlide:0,lazyLoad:"ondemand",mobileFirst:!1,pauseOnHover:!0,pauseOnFocus:!0,pauseOnDotsHover:!1,respondTo:"window",responsive:null,rows:1,rtl:!1,slide:"",slidesPerRow:1,slidesToShow:1,slidesToScroll:1,speed:500,swipe:!0,swipeToSlide:!1,touchMove:!0,touchThreshold:5,useCSS:!0,useTransform:!0,variableWidth:!1,vertical:!1,verticalSwiping:!1,waitForAnimate:!0,zIndex:1000},g.initials={animating:!1,dragging:!1,autoPlayTimer:null,currentDirection:0,currentLeft:null,currentSlide:0,direction:1,$dots:null,listWidth:null,listHeight:null,loadIndex:0,$nextArrow:null,$prevArrow:null,slideCount:null,slideWidth:null,$slideTrack:null,$slides:null,sliding:!1,slideOffset:0,swipeLeft:null,$list:null,touchObject:{},transformsEnabled:!1,unslicked:!1},d.extend(g,g.initials),g.activeBreakpoint=null,g.animType=null,g.animProp=null,g.breakpoints=[],g.breakpointSettings=[],g.cssTransitions=!1,g.focussed=!1,g.interrupted=!1,g.hidden="hidden",g.paused=!0,g.positionProp=null,g.respondTo=null,g.rowCount=1,g.shouldClick=!0,g.$slider=d(i),g.$slidesCache=null,g.transformType=null,g.transitionType=null,g.visibilityChange="visibilitychange",g.windowWidth=0,g.windowTimer=null,b=d(i).data("slick")||{},g.options=d.extend({},g.defaults,h,b),g.currentSlide=g.options.initialSlide,g.originalSettings=g.options,"undefined"!=typeof document.mozHidden?(g.hidden="mozHidden",g.visibilityChange="mozvisibilitychange"):"undefined"!=typeof document.webkitHidden&&(g.hidden="webkitHidden",g.visibilityChange="webkitvisibilitychange"),g.autoPlay=d.proxy(g.autoPlay,g),g.autoPlayClear=d.proxy(g.autoPlayClear,g),g.autoPlayIterator=d.proxy(g.autoPlayIterator,g),g.changeSlide=d.proxy(g.changeSlide,g),g.clickHandler=d.proxy(g.clickHandler,g),g.selectHandler=d.proxy(g.selectHandler,g),g.setPosition=d.proxy(g.setPosition,g),g.swipeHandler=d.proxy(g.swipeHandler,g),g.dragHandler=d.proxy(g.dragHandler,g),g.keyHandler=d.proxy(g.keyHandler,g),g.instanceUid=a++,g.htmlExpr=/^(?:\s*(<[\w\W]+>)[^>]*)$/,g.registerBreakpoints(),g.init(!0)}var a=0;return e}(),c.prototype.activateADA=function(){var b=this;b.$slideTrack.find(".slick-active").attr({"aria-hidden":"false"}).find("a, input, button, select").attr({tabindex:"0"})},c.prototype.addSlide=c.prototype.slickAdd=function(a,h,g){var f=this;if("boolean"==typeof h){g=h,h=null}else{if(0>h||h>=f.slideCount){return !1}}f.unload(),"number"==typeof h?0===h&&0===f.$slides.length?d(a).appendTo(f.$slideTrack):g?d(a).insertBefore(f.$slides.eq(h)):d(a).insertAfter(f.$slides.eq(h)):g===!0?d(a).prependTo(f.$slideTrack):d(a).appendTo(f.$slideTrack),f.$slides=f.$slideTrack.children(this.options.slide),f.$slideTrack.children(this.options.slide).detach(),f.$slideTrack.append(f.$slides),f.$slides.each(function(e,i){d(i).attr("data-slick-index",e)}),f.$slidesCache=f.$slides,f.reinit()},c.prototype.animateHeight=function(){var f=this;if(1===f.options.slidesToShow&&f.options.adaptiveHeight===!0&&f.options.vertical===!1){var e=f.$slides.eq(f.currentSlide).outerHeight(!0);f.$list.animate({height:e},f.options.speed)}},c.prototype.animateSlide=function(a,h){var g={},f=this;f.animateHeight(),f.options.rtl===!0&&f.options.vertical===!1&&(a=-a),f.transformsEnabled===!1?f.options.vertical===!1?f.$slideTrack.animate({left:a},f.options.speed,f.options.easing,h):f.$slideTrack.animate({top:a},f.options.speed,f.options.easing,h):f.cssTransitions===!1?(f.options.rtl===!0&&(f.currentLeft=-f.currentLeft),d({animStart:f.currentLeft}).animate({animStart:a},{duration:f.options.speed,easing:f.options.easing,step:function(b){b=Math.ceil(b),f.options.vertical===!1?(g[f.animType]="translate("+b+"px, 0px)",f.$slideTrack.css(g)):(g[f.animType]="translate(0px,"+b+"px)",f.$slideTrack.css(g))},complete:function(){h&&h.call()}})):(f.applyTransition(),a=Math.ceil(a),f.options.vertical===!1?g[f.animType]="translate3d("+a+"px, 0px, 0px)":g[f.animType]="translate3d(0px,"+a+"px, 0px)",f.$slideTrack.css(g),h&&setTimeout(function(){f.disableTransition(),h.call()},f.options.speed))},c.prototype.getNavTarget=function(){var a=this,e=a.options.asNavFor;return e&&null!==e&&(e=d(e).not(a.$slider)),e},c.prototype.asNavFor=function(a){var f=this,e=f.getNavTarget();null!==e&&"object"==typeof e&&e.each(function(){var b=d(this).slick("getSlick");b.unslicked||b.slideHandler(a,!0)})},c.prototype.applyTransition=function(f){var e=this,g={};e.options.fade===!1?g[e.transitionType]=e.transformType+" "+e.options.speed+"ms "+e.options.cssEase:g[e.transitionType]="opacity "+e.options.speed+"ms "+e.options.cssEase,e.options.fade===!1?e.$slideTrack.css(g):e.$slides.eq(f).css(g)},c.prototype.autoPlay=function(){var b=this;b.autoPlayClear(),b.slideCount>b.options.slidesToShow&&(b.autoPlayTimer=setInterval(b.autoPlayIterator,b.options.autoplaySpeed))},c.prototype.autoPlayClear=function(){var b=this;b.autoPlayTimer&&clearInterval(b.autoPlayTimer)},c.prototype.autoPlayIterator=function(){var f=this,e=f.currentSlide+f.options.slidesToScroll;f.paused||f.interrupted||f.focussed||(f.options.infinite===!1&&(1===f.direction&&f.currentSlide+1===f.slideCount-1?f.direction=0:0===f.direction&&(e=f.currentSlide-f.options.slidesToScroll,f.currentSlide-1===0&&(f.direction=1))),f.slideHandler(e))},c.prototype.buildArrows=function(){var a=this;a.options.arrows===!0&&(a.$prevArrow=d(a.options.prevArrow).addClass("slick-arrow"),a.$nextArrow=d(a.options.nextArrow).addClass("slick-arrow"),a.slideCount>a.options.slidesToShow?(a.$prevArrow.removeClass("slick-hidden").removeAttr("aria-hidden tabindex"),a.$nextArrow.removeClass("slick-hidden").removeAttr("aria-hidden tabindex"),a.htmlExpr.test(a.options.prevArrow)&&a.$prevArrow.prependTo(a.options.appendArrows),a.htmlExpr.test(a.options.nextArrow)&&a.$nextArrow.appendTo(a.options.appendArrows),a.options.infinite!==!0&&a.$prevArrow.addClass("slick-disabled").attr("aria-disabled","true")):a.$prevArrow.add(a.$nextArrow).addClass("slick-hidden").attr({"aria-disabled":"true",tabindex:"-1"}))},c.prototype.buildDots=function(){var f,e,a=this;if(a.options.dots===!0&&a.slideCount>a.options.slidesToShow){for(a.$slider.addClass("slick-dotted"),e=d("<ul />").addClass(a.options.dotsClass),f=0;f<=a.getDotCount();f+=1){e.append(d("<li />").append(a.options.customPaging.call(this,a,f)))}a.$dots=e.appendTo(a.options.appendDots),a.$dots.find("li").first().addClass("slick-active").attr("aria-hidden","false")}},c.prototype.buildOut=function(){var a=this;a.$slides=a.$slider.children(a.options.slide+":not(.slick-cloned)").addClass("slick-slide"),a.slideCount=a.$slides.length,a.$slides.each(function(e,f){d(f).attr("data-slick-index",e).data("originalStyling",d(f).attr("style")||"")}),a.$slider.addClass("slick-slider"),a.$slideTrack=0===a.slideCount?d('<div class="slick-track"/>').appendTo(a.$slider):a.$slides.wrapAll('<div class="slick-track"/>').parent(),a.$list=a.$slideTrack.wrap('<div aria-live="polite" class="slick-list"/>').parent(),a.$slideTrack.css("opacity",0),(a.options.centerMode===!0||a.options.swipeToSlide===!0)&&(a.options.slidesToScroll=1),d("img[data-lazy]",a.$slider).not("[src]").addClass("slick-loading"),a.setupInfinite(),a.buildArrows(),a.buildDots(),a.updateDots(),a.setSlideClasses("number"==typeof a.currentSlide?a.currentSlide:0),a.options.draggable===!0&&a.$list.addClass("draggable")},c.prototype.buildRows=function(){var u,t,s,r,q,p,o,v=this;if(r=document.createDocumentFragment(),p=v.$slider.children(),v.options.rows>1){for(o=v.options.slidesPerRow*v.options.rows,q=Math.ceil(p.length/o),u=0;q>u;u++){var n=document.createElement("div");for(t=0;t<v.options.rows;t++){var m=document.createElement("div");for(s=0;s<v.options.slidesPerRow;s++){var l=u*o+(t*v.options.slidesPerRow+s);p.get(l)&&m.appendChild(p.get(l))}n.appendChild(m)}r.appendChild(n)}v.$slider.empty().append(r),v.$slider.children().children().children().css({width:100/v.options.slidesPerRow+"%",display:"inline-block"})}},c.prototype.checkResponsive=function(r,q){var o,n,m,p=this,l=!1,k=p.$slider.width(),a=window.innerWidth||d(window).width();if("window"===p.respondTo?m=a:"slider"===p.respondTo?m=k:"min"===p.respondTo&&(m=Math.min(a,k)),p.options.responsive&&p.options.responsive.length&&null!==p.options.responsive){n=null;for(o in p.breakpoints){p.breakpoints.hasOwnProperty(o)&&(p.originalSettings.mobileFirst===!1?m<p.breakpoints[o]&&(n=p.breakpoints[o]):m>p.breakpoints[o]&&(n=p.breakpoints[o]))}null!==n?null!==p.activeBreakpoint?(n!==p.activeBreakpoint||q)&&(p.activeBreakpoint=n,"unslick"===p.breakpointSettings[n]?p.unslick(n):(p.options=d.extend({},p.originalSettings,p.breakpointSettings[n]),r===!0&&(p.currentSlide=p.options.initialSlide),p.refresh(r)),l=n):(p.activeBreakpoint=n,"unslick"===p.breakpointSettings[n]?p.unslick(n):(p.options=d.extend({},p.originalSettings,p.breakpointSettings[n]),r===!0&&(p.currentSlide=p.options.initialSlide),p.refresh(r)),l=n):null!==p.activeBreakpoint&&(p.activeBreakpoint=null,p.options=p.originalSettings,r===!0&&(p.currentSlide=p.options.initialSlide),p.refresh(r),l=n),r||l===!1||p.$slider.trigger("breakpoint",[p,l])}},c.prototype.changeSlide=function(a,p){var m,l,k,o=this,n=d(a.currentTarget);switch(n.is("a")&&a.preventDefault(),n.is("li")||(n=n.closest("li")),k=o.slideCount%o.options.slidesToScroll!==0,m=k?0:(o.slideCount-o.currentSlide)%o.options.slidesToScroll,a.data.message){case"previous":l=0===m?o.options.slidesToScroll:o.options.slidesToShow-m,o.slideCount>o.options.slidesToShow&&o.slideHandler(o.currentSlide-l,!1,p);break;case"next":l=0===m?o.options.slidesToScroll:m,o.slideCount>o.options.slidesToShow&&o.slideHandler(o.currentSlide+l,!1,p);break;case"index":var j=0===a.data.index?0:a.data.index||n.index()*o.options.slidesToScroll;o.slideHandler(o.checkNavigable(j),!1,p),n.children().trigger("focus");break;default:return}},c.prototype.checkNavigable=function(g){var j,i,f=this;if(j=f.getNavigableIndexes(),i=0,g>j[j.length-1]){g=j[j.length-1]}else{for(var h in j){if(g<j[h]){g=i;break}i=j[h]}}return g},c.prototype.cleanUpEvents=function(){var a=this;a.options.dots&&null!==a.$dots&&d("li",a.$dots).off("click.slick",a.changeSlide).off("mouseenter.slick",d.proxy(a.interrupt,a,!0)).off("mouseleave.slick",d.proxy(a.interrupt,a,!1)),a.$slider.off("focus.slick blur.slick"),a.options.arrows===!0&&a.slideCount>a.options.slidesToShow&&(a.$prevArrow&&a.$prevArrow.off("click.slick",a.changeSlide),a.$nextArrow&&a.$nextArrow.off("click.slick",a.changeSlide)),a.$list.off("touchstart.slick mousedown.slick",a.swipeHandler),a.$list.off("touchmove.slick mousemove.slick",a.swipeHandler),a.$list.off("touchend.slick mouseup.slick",a.swipeHandler),a.$list.off("touchcancel.slick mouseleave.slick",a.swipeHandler),a.$list.off("click.slick",a.clickHandler),d(document).off(a.visibilityChange,a.visibility),a.cleanUpSlideEvents(),a.options.accessibility===!0&&a.$list.off("keydown.slick",a.keyHandler),a.options.focusOnSelect===!0&&d(a.$slideTrack).children().off("click.slick",a.selectHandler),d(window).off("orientationchange.slick.slick-"+a.instanceUid,a.orientationChange),d(window).off("resize.slick.slick-"+a.instanceUid,a.resize),d("[draggable!=true]",a.$slideTrack).off("dragstart",a.preventDefault),d(window).off("load.slick.slick-"+a.instanceUid,a.setPosition),d(document).off("ready.slick.slick-"+a.instanceUid,a.setPosition)},c.prototype.cleanUpSlideEvents=function(){var a=this;a.$list.off("mouseenter.slick",d.proxy(a.interrupt,a,!0)),a.$list.off("mouseleave.slick",d.proxy(a.interrupt,a,!1))},c.prototype.cleanUpRows=function(){var e,f=this;f.options.rows>1&&(e=f.$slides.children().children(),e.removeAttr("style"),f.$slider.empty().append(e))},c.prototype.clickHandler=function(f){var e=this;e.shouldClick===!1&&(f.stopImmediatePropagation(),f.stopPropagation(),f.preventDefault())},c.prototype.destroy=function(a){var e=this;e.autoPlayClear(),e.touchObject={},e.cleanUpEvents(),d(".slick-cloned",e.$slider).detach(),e.$dots&&e.$dots.remove(),e.$prevArrow&&e.$prevArrow.length&&(e.$prevArrow.removeClass("slick-disabled slick-arrow slick-hidden").removeAttr("aria-hidden aria-disabled tabindex").css("display",""),e.htmlExpr.test(e.options.prevArrow)&&e.$prevArrow.remove()),e.$nextArrow&&e.$nextArrow.length&&(e.$nextArrow.removeClass("slick-disabled slick-arrow slick-hidden").removeAttr("aria-hidden aria-disabled tabindex").css("display",""),e.htmlExpr.test(e.options.nextArrow)&&e.$nextArrow.remove()),e.$slides&&(e.$slides.removeClass("slick-slide slick-active slick-center slick-visible slick-current").removeAttr("aria-hidden").removeAttr("data-slick-index").each(function(){d(this).attr("style",d(this).data("originalStyling"))}),e.$slideTrack.children(this.options.slide).detach(),e.$slideTrack.detach(),e.$list.detach(),e.$slider.append(e.$slides)),e.cleanUpRows(),e.$slider.removeClass("slick-slider"),e.$slider.removeClass("slick-initialized"),e.$slider.removeClass("slick-dotted"),e.unslicked=!0,a||e.$slider.trigger("destroy",[e])},c.prototype.disableTransition=function(f){var e=this,g={};g[e.transitionType]="",e.options.fade===!1?e.$slideTrack.css(g):e.$slides.eq(f).css(g)},c.prototype.fadeSlide=function(f,e){var g=this;g.cssTransitions===!1?(g.$slides.eq(f).css({zIndex:g.options.zIndex}),g.$slides.eq(f).animate({opacity:1},g.options.speed,g.options.easing,e)):(g.applyTransition(f),g.$slides.eq(f).css({opacity:1,zIndex:g.options.zIndex}),e&&setTimeout(function(){g.disableTransition(f),e.call()},g.options.speed))},c.prototype.fadeSlideOut=function(f){var e=this;e.cssTransitions===!1?e.$slides.eq(f).animate({opacity:0,zIndex:e.options.zIndex-2},e.options.speed,e.options.easing):(e.applyTransition(f),e.$slides.eq(f).css({opacity:0,zIndex:e.options.zIndex-2}))},c.prototype.filterSlides=c.prototype.slickFilter=function(f){var e=this;null!==f&&(e.$slidesCache=e.$slides,e.unload(),e.$slideTrack.children(this.options.slide).detach(),e.$slidesCache.filter(f).appendTo(e.$slideTrack),e.reinit())},c.prototype.focusHandler=function(){var a=this;a.$slider.off("focus.slick blur.slick").on("focus.slick blur.slick","*:not(.slick-arrow)",function(e){e.stopImmediatePropagation();var b=d(this);setTimeout(function(){a.options.pauseOnFocus&&(a.focussed=b.is(":focus"),a.autoPlay())},0)})},c.prototype.getCurrent=c.prototype.slickCurrentSlide=function(){var b=this;return b.currentSlide},c.prototype.getDotCount=function(){var f=this,e=0,h=0,g=0;if(f.options.infinite===!0){for(;e<f.slideCount;){++g,e=h+f.options.slidesToScroll,h+=f.options.slidesToScroll<=f.options.slidesToShow?f.options.slidesToScroll:f.options.slidesToShow}}else{if(f.options.centerMode===!0){g=f.slideCount}else{if(f.options.asNavFor){for(;e<f.slideCount;){++g,e=h+f.options.slidesToScroll,h+=f.options.slidesToScroll<=f.options.slidesToShow?f.options.slidesToScroll:f.options.slidesToShow}}else{g=1+Math.ceil((f.slideCount-f.options.slidesToShow)/f.options.slidesToScroll)}}}return g-1},c.prototype.getLeft=function(h){var l,k,i,g=this,j=0;return g.slideOffset=0,k=g.$slides.first().outerHeight(!0),g.options.infinite===!0?(g.slideCount>g.options.slidesToShow&&(g.slideOffset=g.slideWidth*g.options.slidesToShow*-1,j=k*g.options.slidesToShow*-1),g.slideCount%g.options.slidesToScroll!==0&&h+g.options.slidesToScroll>g.slideCount&&g.slideCount>g.options.slidesToShow&&(h>g.slideCount?(g.slideOffset=(g.options.slidesToShow-(h-g.slideCount))*g.slideWidth*-1,j=(g.options.slidesToShow-(h-g.slideCount))*k*-1):(g.slideOffset=g.slideCount%g.options.slidesToScroll*g.slideWidth*-1,j=g.slideCount%g.options.slidesToScroll*k*-1))):h+g.options.slidesToShow>g.slideCount&&(g.slideOffset=(h+g.options.slidesToShow-g.slideCount)*g.slideWidth,j=(h+g.options.slidesToShow-g.slideCount)*k),g.slideCount<=g.options.slidesToShow&&(g.slideOffset=0,j=0),g.options.centerMode===!0&&g.options.infinite===!0?g.slideOffset+=g.slideWidth*Math.floor(g.options.slidesToShow/2)-g.slideWidth:g.options.centerMode===!0&&(g.slideOffset=0,g.slideOffset+=g.slideWidth*Math.floor(g.options.slidesToShow/2)),l=g.options.vertical===!1?h*g.slideWidth*-1+g.slideOffset:h*k*-1+j,g.options.variableWidth===!0&&(i=g.slideCount<=g.options.slidesToShow||g.options.infinite===!1?g.$slideTrack.children(".slick-slide").eq(h):g.$slideTrack.children(".slick-slide").eq(h+g.options.slidesToShow),l=g.options.rtl===!0?i[0]?-1*(g.$slideTrack.width()-i[0].offsetLeft-i.width()):0:i[0]?-1*i[0].offsetLeft:0,g.options.centerMode===!0&&(i=g.slideCount<=g.options.slidesToShow||g.options.infinite===!1?g.$slideTrack.children(".slick-slide").eq(h):g.$slideTrack.children(".slick-slide").eq(h+g.options.slidesToShow+1),l=g.options.rtl===!0?i[0]?-1*(g.$slideTrack.width()-i[0].offsetLeft-i.width()):0:i[0]?-1*i[0].offsetLeft:0,l+=(g.$list.width()-i.outerWidth())/2)),l},c.prototype.getOption=c.prototype.slickGetOption=function(f){var e=this;return e.options[f]},c.prototype.getNavigableIndexes=function(){var h,g=this,f=0,j=0,i=[];for(g.options.infinite===!1?h=g.slideCount:(f=-1*g.options.slidesToScroll,j=-1*g.options.slidesToScroll,h=2*g.slideCount);h>f;){i.push(f),f=j+g.options.slidesToScroll,j+=g.options.slidesToScroll<=g.options.slidesToShow?g.options.slidesToScroll:g.options.slidesToShow}return i},c.prototype.getSlick=function(){return this},c.prototype.getSlideCount=function(){var h,g,f,a=this;return f=a.options.centerMode===!0?a.slideWidth*Math.floor(a.options.slidesToShow/2):0,a.options.swipeToSlide===!0?(a.$slideTrack.find(".slick-slide").each(function(e,b){return b.offsetLeft-f+d(b).outerWidth()/2>-1*a.swipeLeft?(g=b,!1):void 0}),h=Math.abs(d(g).attr("data-slick-index")-a.currentSlide)||1):a.options.slidesToScroll},c.prototype.goTo=c.prototype.slickGoTo=function(f,e){var g=this;g.changeSlide({data:{message:"index",index:parseInt(f)}},e)},c.prototype.init=function(a){var e=this;d(e.$slider).hasClass("slick-initialized")||(d(e.$slider).addClass("slick-initialized"),e.buildRows(),e.buildOut(),e.setProps(),e.startLoad(),e.loadSlider(),e.initializeEvents(),e.updateArrows(),e.updateDots(),e.checkResponsive(!0),e.focusHandler()),a&&e.$slider.trigger("init",[e]),e.options.accessibility===!0&&e.initADA(),e.options.autoplay&&(e.paused=!1,e.autoPlay())},c.prototype.initADA=function(){var a=this;a.$slides.add(a.$slideTrack.find(".slick-cloned")).attr({"aria-hidden":"true",tabindex:"-1"}).find("a, input, button, select").attr({tabindex:"-1"}),a.$slideTrack.attr("role","listbox"),a.$slides.not(a.$slideTrack.find(".slick-cloned")).each(function(b){d(this).attr({role:"option","aria-describedby":"slick-slide"+a.instanceUid+b})}),null!==a.$dots&&a.$dots.attr("role","tablist").find("li").each(function(b){d(this).attr({role:"presentation","aria-selected":"false","aria-controls":"navigation"+a.instanceUid+b,id:"slick-slide"+a.instanceUid+b})}).first().attr("aria-selected","true").end().find("button").attr("role","button").end().closest("div").attr("role","toolbar"),a.activateADA()},c.prototype.initArrowEvents=function(){var b=this;b.options.arrows===!0&&b.slideCount>b.options.slidesToShow&&(b.$prevArrow.off("click.slick").on("click.slick",{message:"previous"},b.changeSlide),b.$nextArrow.off("click.slick").on("click.slick",{message:"next"},b.changeSlide))},c.prototype.initDotEvents=function(){var a=this;a.options.dots===!0&&a.slideCount>a.options.slidesToShow&&d("li",a.$dots).on("click.slick",{message:"index"},a.changeSlide),a.options.dots===!0&&a.options.pauseOnDotsHover===!0&&d("li",a.$dots).on("mouseenter.slick",d.proxy(a.interrupt,a,!0)).on("mouseleave.slick",d.proxy(a.interrupt,a,!1))},c.prototype.initSlideEvents=function(){var a=this;a.options.pauseOnHover&&(a.$list.on("mouseenter.slick",d.proxy(a.interrupt,a,!0)),a.$list.on("mouseleave.slick",d.proxy(a.interrupt,a,!1)))},c.prototype.initializeEvents=function(){var a=this;a.initArrowEvents(),a.initDotEvents(),a.initSlideEvents(),a.$list.on("touchstart.slick mousedown.slick",{action:"start"},a.swipeHandler),a.$list.on("touchmove.slick mousemove.slick",{action:"move"},a.swipeHandler),a.$list.on("touchend.slick mouseup.slick",{action:"end"},a.swipeHandler),a.$list.on("touchcancel.slick mouseleave.slick",{action:"end"},a.swipeHandler),a.$list.on("click.slick",a.clickHandler),d(document).on(a.visibilityChange,d.proxy(a.visibility,a)),a.options.accessibility===!0&&a.$list.on("keydown.slick",a.keyHandler),a.options.focusOnSelect===!0&&d(a.$slideTrack).children().on("click.slick",a.selectHandler),d(window).on("orientationchange.slick.slick-"+a.instanceUid,d.proxy(a.orientationChange,a)),d(window).on("resize.slick.slick-"+a.instanceUid,d.proxy(a.resize,a)),d("[draggable!=true]",a.$slideTrack).on("dragstart",a.preventDefault),d(window).on("load.slick.slick-"+a.instanceUid,a.setPosition),d(document).on("ready.slick.slick-"+a.instanceUid,a.setPosition)},c.prototype.initUI=function(){var b=this;b.options.arrows===!0&&b.slideCount>b.options.slidesToShow&&(b.$prevArrow.show(),b.$nextArrow.show()),b.options.dots===!0&&b.slideCount>b.options.slidesToShow&&b.$dots.show()},c.prototype.keyHandler=function(f){var e=this;f.target.tagName.match("TEXTAREA|INPUT|SELECT")||(37===f.keyCode&&e.options.accessibility===!0?e.changeSlide({data:{message:e.options.rtl===!0?"next":"previous"}}):39===f.keyCode&&e.options.accessibility===!0&&e.changeSlide({data:{message:e.options.rtl===!0?"previous":"next"}}))},c.prototype.lazyLoad=function(){function h(b){d("img[data-lazy]",b).each(function(){var m=d(this),g=d(this).attr("data-lazy"),f=document.createElement("img");f.onload=function(){m.animate({opacity:0},100,function(){m.attr("src",g).animate({opacity:1},200,function(){m.removeAttr("data-lazy").removeClass("slick-loading")}),a.$slider.trigger("lazyLoaded",[a,m,g])})},f.onerror=function(){m.removeAttr("data-lazy").removeClass("slick-loading").addClass("slick-lazyload-error"),a.$slider.trigger("lazyLoadError",[a,m,g])},f.src=g})}var l,k,j,i,a=this;a.options.centerMode===!0?a.options.infinite===!0?(j=a.currentSlide+(a.options.slidesToShow/2+1),i=j+a.options.slidesToShow+2):(j=Math.max(0,a.currentSlide-(a.options.slidesToShow/2+1)),i=2+(a.options.slidesToShow/2+1)+a.currentSlide):(j=a.options.infinite?a.options.slidesToShow+a.currentSlide:a.currentSlide,i=Math.ceil(j+a.options.slidesToShow),a.options.fade===!0&&(j>0&&j--,i<=a.slideCount&&i++)),l=a.$slider.find(".slick-slide").slice(j,i),h(l),a.slideCount<=a.options.slidesToShow?(k=a.$slider.find(".slick-slide"),h(k)):a.currentSlide>=a.slideCount-a.options.slidesToShow?(k=a.$slider.find(".slick-cloned").slice(0,a.options.slidesToShow),h(k)):0===a.currentSlide&&(k=a.$slider.find(".slick-cloned").slice(-1*a.options.slidesToShow),h(k))},c.prototype.loadSlider=function(){var b=this;b.setPosition(),b.$slideTrack.css({opacity:1}),b.$slider.removeClass("slick-loading"),b.initUI(),"progressive"===b.options.lazyLoad&&b.progressiveLazyLoad()},c.prototype.next=c.prototype.slickNext=function(){var b=this;b.changeSlide({data:{message:"next"}})},c.prototype.orientationChange=function(){var b=this;b.checkResponsive(),b.setPosition()},c.prototype.pause=c.prototype.slickPause=function(){var b=this;b.autoPlayClear(),b.paused=!0},c.prototype.play=c.prototype.slickPlay=function(){var b=this;b.autoPlay(),b.options.autoplay=!0,b.paused=!1,b.focussed=!1,b.interrupted=!1},c.prototype.postSlide=function(f){var e=this;e.unslicked||(e.$slider.trigger("afterChange",[e,f]),e.animating=!1,e.setPosition(),e.swipeLeft=null,e.options.autoplay&&e.autoPlay(),e.options.accessibility===!0&&e.initADA())},c.prototype.prev=c.prototype.slickPrev=function(){var b=this;b.changeSlide({data:{message:"previous"}})},c.prototype.preventDefault=function(b){b.preventDefault()},c.prototype.progressiveLazyLoad=function(a){a=a||1;var j,i,h,l=this,k=d("img[data-lazy]",l.$slider);k.length?(j=k.first(),i=j.attr("data-lazy"),h=document.createElement("img"),h.onload=function(){j.attr("src",i).removeAttr("data-lazy").removeClass("slick-loading"),l.options.adaptiveHeight===!0&&l.setPosition(),l.$slider.trigger("lazyLoaded",[l,j,i]),l.progressiveLazyLoad()},h.onerror=function(){3>a?setTimeout(function(){l.progressiveLazyLoad(a+1)},500):(j.removeAttr("data-lazy").removeClass("slick-loading").addClass("slick-lazyload-error"),l.$slider.trigger("lazyLoadError",[l,j,i]),l.progressiveLazyLoad())},h.src=i):l.$slider.trigger("allImagesLoaded",[l])},c.prototype.refresh=function(a){var g,f,h=this;f=h.slideCount-h.options.slidesToShow,!h.options.infinite&&h.currentSlide>f&&(h.currentSlide=f),h.slideCount<=h.options.slidesToShow&&(h.currentSlide=0),g=h.currentSlide,h.destroy(!0),d.extend(h,h.initials,{currentSlide:g}),h.init(),a||h.changeSlide({data:{message:"index",index:g}},!1)},c.prototype.registerBreakpoints=function(){var j,i,h,a=this,g=a.options.responsive||null;if("array"===d.type(g)&&g.length){a.respondTo=a.options.respondTo||"window";for(j in g){if(h=a.breakpoints.length-1,i=g[j].breakpoint,g.hasOwnProperty(j)){for(;h>=0;){a.breakpoints[h]&&a.breakpoints[h]===i&&a.breakpoints.splice(h,1),h--}a.breakpoints.push(i),a.breakpointSettings[i]=g[j].settings}}a.breakpoints.sort(function(b,e){return a.options.mobileFirst?b-e:e-b})}},c.prototype.reinit=function(){var a=this;a.$slides=a.$slideTrack.children(a.options.slide).addClass("slick-slide"),a.slideCount=a.$slides.length,a.currentSlide>=a.slideCount&&0!==a.currentSlide&&(a.currentSlide=a.currentSlide-a.options.slidesToScroll),a.slideCount<=a.options.slidesToShow&&(a.currentSlide=0),a.registerBreakpoints(),a.setProps(),a.setupInfinite(),a.buildArrows(),a.updateArrows(),a.initArrowEvents(),a.buildDots(),a.updateDots(),a.initDotEvents(),a.cleanUpSlideEvents(),a.initSlideEvents(),a.checkResponsive(!1,!0),a.options.focusOnSelect===!0&&d(a.$slideTrack).children().on("click.slick",a.selectHandler),a.setSlideClasses("number"==typeof a.currentSlide?a.currentSlide:0),a.setPosition(),a.focusHandler(),a.paused=!a.options.autoplay,a.autoPlay(),a.$slider.trigger("reInit",[a])},c.prototype.resize=function(){var a=this;d(window).width()!==a.windowWidth&&(clearTimeout(a.windowDelay),a.windowDelay=window.setTimeout(function(){a.windowWidth=d(window).width(),a.checkResponsive(),a.unslicked||a.setPosition()},50))},c.prototype.removeSlide=c.prototype.slickRemove=function(f,e,h){var g=this;return"boolean"==typeof f?(e=f,f=e===!0?0:g.slideCount-1):f=e===!0?--f:f,g.slideCount<1||0>f||f>g.slideCount-1?!1:(g.unload(),h===!0?g.$slideTrack.children().remove():g.$slideTrack.children(this.options.slide).eq(f).remove(),g.$slides=g.$slideTrack.children(this.options.slide),g.$slideTrack.children(this.options.slide).detach(),g.$slideTrack.append(g.$slides),g.$slidesCache=g.$slides,void g.reinit())},c.prototype.setCSS=function(g){var i,h,f=this,j={};f.options.rtl===!0&&(g=-g),i="left"==f.positionProp?Math.ceil(g)+"px":"0px",h="top"==f.positionProp?Math.ceil(g)+"px":"0px",j[f.positionProp]=g,f.transformsEnabled===!1?f.$slideTrack.css(j):(j={},f.cssTransitions===!1?(j[f.animType]="translate("+i+", "+h+")",f.$slideTrack.css(j)):(j[f.animType]="translate3d("+i+", "+h+", 0px)",f.$slideTrack.css(j)))},c.prototype.setDimensions=function(){var f=this;f.options.vertical===!1?f.options.centerMode===!0&&f.$list.css({padding:"0px "+f.options.centerPadding}):(f.$list.height(f.$slides.first().outerHeight(!0)*f.options.slidesToShow),f.options.centerMode===!0&&f.$list.css({padding:f.options.centerPadding+" 0px"})),f.listWidth=f.$list.width(),f.listHeight=f.$list.height(),f.options.vertical===!1&&f.options.variableWidth===!1?(f.slideWidth=Math.ceil(f.listWidth/f.options.slidesToShow),f.$slideTrack.width(Math.ceil(f.slideWidth*f.$slideTrack.children(".slick-slide").length))):f.options.variableWidth===!0?f.$slideTrack.width(5000*f.slideCount):(f.slideWidth=Math.ceil(f.listWidth),f.$slideTrack.height(Math.ceil(f.$slides.first().outerHeight(!0)*f.$slideTrack.children(".slick-slide").length)));var e=f.$slides.first().outerWidth(!0)-f.$slides.first().width();f.options.variableWidth===!1&&f.$slideTrack.children(".slick-slide").width(f.slideWidth-e)},c.prototype.setFade=function(){var e,a=this;a.$slides.each(function(f,b){e=a.slideWidth*f*-1,a.options.rtl===!0?d(b).css({position:"relative",right:e,top:0,zIndex:a.options.zIndex-2,opacity:0}):d(b).css({position:"relative",left:e,top:0,zIndex:a.options.zIndex-2,opacity:0})}),a.$slides.eq(a.currentSlide).css({zIndex:a.options.zIndex-1,opacity:1})},c.prototype.setHeight=function(){var f=this;if(1===f.options.slidesToShow&&f.options.adaptiveHeight===!0&&f.options.vertical===!1){var e=f.$slides.eq(f.currentSlide).outerHeight(!0);f.$list.css("height",e)}},c.prototype.setOption=c.prototype.slickSetOption=function(){var n,m,l,k,i,a=this,j=!1;if("object"===d.type(arguments[0])?(l=arguments[0],j=arguments[1],i="multiple"):"string"===d.type(arguments[0])&&(l=arguments[0],k=arguments[1],j=arguments[2],"responsive"===arguments[0]&&"array"===d.type(arguments[1])?i="responsive":"undefined"!=typeof arguments[1]&&(i="single")),"single"===i){a.options[l]=k}else{if("multiple"===i){d.each(l,function(b,e){a.options[b]=e})}else{if("responsive"===i){for(m in k){if("array"!==d.type(a.options.responsive)){a.options.responsive=[k[m]]}else{for(n=a.options.responsive.length-1;n>=0;){a.options.responsive[n].breakpoint===k[m].breakpoint&&a.options.responsive.splice(n,1),n--}a.options.responsive.push(k[m])}}}}}j&&(a.unload(),a.reinit())},c.prototype.setPosition=function(){var b=this;b.setDimensions(),b.setHeight(),b.options.fade===!1?b.setCSS(b.getLeft(b.currentSlide)):b.setFade(),b.$slider.trigger("setPosition",[b])},c.prototype.setProps=function(){var f=this,e=document.body.style;f.positionProp=f.options.vertical===!0?"top":"left","top"===f.positionProp?f.$slider.addClass("slick-vertical"):f.$slider.removeClass("slick-vertical"),(void 0!==e.WebkitTransition||void 0!==e.MozTransition||void 0!==e.msTransition)&&f.options.useCSS===!0&&(f.cssTransitions=!0),f.options.fade&&("number"==typeof f.options.zIndex?f.options.zIndex<3&&(f.options.zIndex=3):f.options.zIndex=f.defaults.zIndex),void 0!==e.OTransform&&(f.animType="OTransform",f.transformType="-o-transform",f.transitionType="OTransition",void 0===e.perspectiveProperty&&void 0===e.webkitPerspective&&(f.animType=!1)),void 0!==e.MozTransform&&(f.animType="MozTransform",f.transformType="-moz-transform",f.transitionType="MozTransition",void 0===e.perspectiveProperty&&void 0===e.MozPerspective&&(f.animType=!1)),void 0!==e.webkitTransform&&(f.animType="webkitTransform",f.transformType="-webkit-transform",f.transitionType="webkitTransition",void 0===e.perspectiveProperty&&void 0===e.webkitPerspective&&(f.animType=!1)),void 0!==e.msTransform&&(f.animType="msTransform",f.transformType="-ms-transform",f.transitionType="msTransition",void 0===e.msTransform&&(f.animType=!1)),void 0!==e.transform&&f.animType!==!1&&(f.animType="transform",f.transformType="transform",f.transitionType="transition"),f.transformsEnabled=f.options.useTransform&&null!==f.animType&&f.animType!==!1},c.prototype.setSlideClasses=function(h){var l,k,j,i,g=this;k=g.$slider.find(".slick-slide").removeClass("slick-active slick-center slick-current").attr("aria-hidden","true"),g.$slides.eq(h).addClass("slick-current"),g.options.centerMode===!0?(l=Math.floor(g.options.slidesToShow/2),g.options.infinite===!0&&(h>=l&&h<=g.slideCount-1-l?g.$slides.slice(h-l,h+l+1).addClass("slick-active").attr("aria-hidden","false"):(j=g.options.slidesToShow+h,k.slice(j-l+1,j+l+2).addClass("slick-active").attr("aria-hidden","false")),0===h?k.eq(k.length-1-g.options.slidesToShow).addClass("slick-center"):h===g.slideCount-1&&k.eq(g.options.slidesToShow).addClass("slick-center")),g.$slides.eq(h).addClass("slick-center")):h>=0&&h<=g.slideCount-g.options.slidesToShow?g.$slides.slice(h,h+g.options.slidesToShow).addClass("slick-active").attr("aria-hidden","false"):k.length<=g.options.slidesToShow?k.addClass("slick-active").attr("aria-hidden","false"):(i=g.slideCount%g.options.slidesToShow,j=g.options.infinite===!0?g.options.slidesToShow+h:h,g.options.slidesToShow==g.options.slidesToScroll&&g.slideCount-h<g.options.slidesToShow?k.slice(j-(g.options.slidesToShow-i),j+i).addClass("slick-active").attr("aria-hidden","false"):k.slice(j,j+g.options.slidesToShow).addClass("slick-active").attr("aria-hidden","false")),"ondemand"===g.options.lazyLoad&&g.lazyLoad()},c.prototype.setupInfinite=function(){var h,g,f,a=this;if(a.options.fade===!0&&(a.options.centerMode=!1),a.options.infinite===!0&&a.options.fade===!1&&(g=null,a.slideCount>a.options.slidesToShow)){for(f=a.options.centerMode===!0?a.options.slidesToShow+1:a.options.slidesToShow,h=a.slideCount;h>a.slideCount-f;h-=1){g=h-1,d(a.$slides[g]).clone(!0).attr("id","").attr("data-slick-index",g-a.slideCount).prependTo(a.$slideTrack).addClass("slick-cloned")}for(h=0;f>h;h+=1){g=h,d(a.$slides[g]).clone(!0).attr("id","").attr("data-slick-index",g+a.slideCount).appendTo(a.$slideTrack).addClass("slick-cloned")}a.$slideTrack.find(".slick-cloned").find("[id]").each(function(){d(this).attr("id","")})}},c.prototype.interrupt=function(f){var e=this;f||e.autoPlay(),e.interrupted=f},c.prototype.selectHandler=function(a){var h=this,g=d(a.target).is(".slick-slide")?d(a.target):d(a.target).parents(".slick-slide"),f=parseInt(g.attr("data-slick-index"));return f||(f=0),h.slideCount<=h.options.slidesToShow?(h.setSlideClasses(f),void h.asNavFor(f)):void h.slideHandler(f)},c.prototype.slideHandler=function(t,s,r){var q,p,o,n,k,m=null,l=this;return s=s||!1,l.animating===!0&&l.options.waitForAnimate===!0||l.options.fade===!0&&l.currentSlide===t||l.slideCount<=l.options.slidesToShow?void 0:(s===!1&&l.asNavFor(t),q=t,m=l.getLeft(q),n=l.getLeft(l.currentSlide),l.currentLeft=null===l.swipeLeft?n:l.swipeLeft,l.options.infinite===!1&&l.options.centerMode===!1&&(0>t||t>l.getDotCount()*l.options.slidesToScroll)?void (l.options.fade===!1&&(q=l.currentSlide,r!==!0?l.animateSlide(n,function(){l.postSlide(q)}):l.postSlide(q))):l.options.infinite===!1&&l.options.centerMode===!0&&(0>t||t>l.slideCount-l.options.slidesToScroll)?void (l.options.fade===!1&&(q=l.currentSlide,r!==!0?l.animateSlide(n,function(){l.postSlide(q)}):l.postSlide(q))):(l.options.autoplay&&clearInterval(l.autoPlayTimer),p=0>q?l.slideCount%l.options.slidesToScroll!==0?l.slideCount-l.slideCount%l.options.slidesToScroll:l.slideCount+q:q>=l.slideCount?l.slideCount%l.options.slidesToScroll!==0?0:q-l.slideCount:q,l.animating=!0,l.$slider.trigger("beforeChange",[l,l.currentSlide,p]),o=l.currentSlide,l.currentSlide=p,l.setSlideClasses(l.currentSlide),l.options.asNavFor&&(k=l.getNavTarget(),k=k.slick("getSlick"),k.slideCount<=k.options.slidesToShow&&k.setSlideClasses(l.currentSlide)),l.updateDots(),l.updateArrows(),l.options.fade===!0?(r!==!0?(l.fadeSlideOut(o),l.fadeSlide(p,function(){l.postSlide(p)})):l.postSlide(p),void l.animateHeight()):void (r!==!0?l.animateSlide(m,function(){l.postSlide(p)}):l.postSlide(p))))},c.prototype.startLoad=function(){var b=this;b.options.arrows===!0&&b.slideCount>b.options.slidesToShow&&(b.$prevArrow.hide(),b.$nextArrow.hide()),b.options.dots===!0&&b.slideCount>b.options.slidesToShow&&b.$dots.hide(),b.$slider.addClass("slick-loading")},c.prototype.swipeDirection=function(){var g,f,j,i,h=this;return g=h.touchObject.startX-h.touchObject.curX,f=h.touchObject.startY-h.touchObject.curY,j=Math.atan2(f,g),i=Math.round(180*j/Math.PI),0>i&&(i=360-Math.abs(i)),45>=i&&i>=0?h.options.rtl===!1?"left":"right":360>=i&&i>=315?h.options.rtl===!1?"left":"right":i>=135&&225>=i?h.options.rtl===!1?"right":"left":h.options.verticalSwiping===!0?i>=35&&135>=i?"down":"up":"vertical"},c.prototype.swipeEnd=function(f){var h,g,e=this;if(e.dragging=!1,e.interrupted=!1,e.shouldClick=e.touchObject.swipeLength>10?!1:!0,void 0===e.touchObject.curX){return !1}if(e.touchObject.edgeHit===!0&&e.$slider.trigger("edge",[e,e.swipeDirection()]),e.touchObject.swipeLength>=e.touchObject.minSwipe){switch(g=e.swipeDirection()){case"left":case"down":h=e.options.swipeToSlide?e.checkNavigable(e.currentSlide+e.getSlideCount()):e.currentSlide+e.getSlideCount(),e.currentDirection=0;break;case"right":case"up":h=e.options.swipeToSlide?e.checkNavigable(e.currentSlide-e.getSlideCount()):e.currentSlide-e.getSlideCount(),e.currentDirection=1}"vertical"!=g&&(e.slideHandler(h),e.touchObject={},e.$slider.trigger("swipe",[e,g]))}else{e.touchObject.startX!==e.touchObject.curX&&(e.slideHandler(e.currentSlide),e.touchObject={})}},c.prototype.swipeHandler=function(f){var e=this;if(!(e.options.swipe===!1||"ontouchend" in document&&e.options.swipe===!1||e.options.draggable===!1&&-1!==f.type.indexOf("mouse"))){switch(e.touchObject.fingerCount=f.originalEvent&&void 0!==f.originalEvent.touches?f.originalEvent.touches.length:1,e.touchObject.minSwipe=e.listWidth/e.options.touchThreshold,e.options.verticalSwiping===!0&&(e.touchObject.minSwipe=e.listHeight/e.options.touchThreshold),f.data.action){case"start":e.swipeStart(f);break;case"move":e.swipeMove(f);break;case"end":e.swipeEnd(f)}}},c.prototype.swipeMove=function(j){var o,n,m,l,k,i=this;return k=void 0!==j.originalEvent?j.originalEvent.touches:null,!i.dragging||k&&1!==k.length?!1:(o=i.getLeft(i.currentSlide),i.touchObject.curX=void 0!==k?k[0].pageX:j.clientX,i.touchObject.curY=void 0!==k?k[0].pageY:j.clientY,i.touchObject.swipeLength=Math.round(Math.sqrt(Math.pow(i.touchObject.curX-i.touchObject.startX,2))),i.options.verticalSwiping===!0&&(i.touchObject.swipeLength=Math.round(Math.sqrt(Math.pow(i.touchObject.curY-i.touchObject.startY,2)))),n=i.swipeDirection(),"vertical"!==n?(void 0!==j.originalEvent&&i.touchObject.swipeLength>4&&j.preventDefault(),l=(i.options.rtl===!1?1:-1)*(i.touchObject.curX>i.touchObject.startX?1:-1),i.options.verticalSwiping===!0&&(l=i.touchObject.curY>i.touchObject.startY?1:-1),m=i.touchObject.swipeLength,i.touchObject.edgeHit=!1,i.options.infinite===!1&&(0===i.currentSlide&&"right"===n||i.currentSlide>=i.getDotCount()&&"left"===n)&&(m=i.touchObject.swipeLength*i.options.edgeFriction,i.touchObject.edgeHit=!0),i.options.vertical===!1?i.swipeLeft=o+m*l:i.swipeLeft=o+m*(i.$list.height()/i.listWidth)*l,i.options.verticalSwiping===!0&&(i.swipeLeft=o+m*l),i.options.fade===!0||i.options.touchMove===!1?!1:i.animating===!0?(i.swipeLeft=null,!1):void i.setCSS(i.swipeLeft)):void 0)},c.prototype.swipeStart=function(f){var g,e=this;return e.interrupted=!0,1!==e.touchObject.fingerCount||e.slideCount<=e.options.slidesToShow?(e.touchObject={},!1):(void 0!==f.originalEvent&&void 0!==f.originalEvent.touches&&(g=f.originalEvent.touches[0]),e.touchObject.startX=e.touchObject.curX=void 0!==g?g.pageX:f.clientX,e.touchObject.startY=e.touchObject.curY=void 0!==g?g.pageY:f.clientY,void (e.dragging=!0))},c.prototype.unfilterSlides=c.prototype.slickUnfilter=function(){var b=this;null!==b.$slidesCache&&(b.unload(),b.$slideTrack.children(this.options.slide).detach(),b.$slidesCache.appendTo(b.$slideTrack),b.reinit())},c.prototype.unload=function(){var a=this;d(".slick-cloned",a.$slider).remove(),a.$dots&&a.$dots.remove(),a.$prevArrow&&a.htmlExpr.test(a.options.prevArrow)&&a.$prevArrow.remove(),a.$nextArrow&&a.htmlExpr.test(a.options.nextArrow)&&a.$nextArrow.remove(),a.$slides.removeClass("slick-slide slick-active slick-visible slick-current").attr("aria-hidden","true").css("width","")},c.prototype.unslick=function(f){var e=this;e.$slider.trigger("unslick",[e,f]),e.destroy()},c.prototype.updateArrows=function(){var e,f=this;e=Math.floor(f.options.slidesToShow/2),f.options.arrows===!0&&f.slideCount>f.options.slidesToShow&&!f.options.infinite&&(f.$prevArrow.removeClass("slick-disabled").attr("aria-disabled","false"),f.$nextArrow.removeClass("slick-disabled").attr("aria-disabled","false"),0===f.currentSlide?(f.$prevArrow.addClass("slick-disabled").attr("aria-disabled","true"),f.$nextArrow.removeClass("slick-disabled").attr("aria-disabled","false")):f.currentSlide>=f.slideCount-f.options.slidesToShow&&f.options.centerMode===!1?(f.$nextArrow.addClass("slick-disabled").attr("aria-disabled","true"),f.$prevArrow.removeClass("slick-disabled").attr("aria-disabled","false")):f.currentSlide>=f.slideCount-1&&f.options.centerMode===!0&&(f.$nextArrow.addClass("slick-disabled").attr("aria-disabled","true"),f.$prevArrow.removeClass("slick-disabled").attr("aria-disabled","false")))},c.prototype.updateDots=function(){var b=this;null!==b.$dots&&(b.$dots.find("li").removeClass("slick-active").attr("aria-hidden","true"),b.$dots.find("li").eq(Math.floor(b.currentSlide/b.options.slidesToScroll)).addClass("slick-active").attr("aria-hidden","false"))},c.prototype.visibility=function(){var b=this;b.options.autoplay&&(document[b.hidden]?b.interrupted=!0:b.interrupted=!1)},d.fn.slick=function(){var i,h,b=this,l=arguments[0],k=Array.prototype.slice.call(arguments,1),j=b.length;for(i=0;j>i;i++){if("object"==typeof l||"undefined"==typeof l?b[i].slick=new c(b[i],l):h=b[i].slick[l].apply(b[i].slick,k),"undefined"!=typeof h){return h}}return b}}); /*! * JavaScript Cookie v2.1.4 * https://github.com/js-cookie/js-cookie * * Copyright 2006, 2015 Klaus Hartl & Fagner Brack * Released under the MIT license */ ;(function(b){var d=false;if(typeof define==="function"&&define.amd){define(b);d=true}if(typeof exports==="object"){module.exports=b();d=true}if(!d){var a=window.Cookies;var c=window.Cookies=b();c.noConflict=function(){window.Cookies=a;return c}}}(function(){function b(){var f=0;var c={};for(;f<arguments.length;f++){var d=arguments[f];for(var e in d){c[e]=d[e]}}return c}function a(d){function c(r,p,l){var t;if(typeof document==="undefined"){return}if(arguments.length>1){l=b({path:"/"},c.defaults,l);if(typeof l.expires==="number"){var h=new Date();h.setMilliseconds(h.getMilliseconds()+l.expires*86400000);l.expires=h}l.expires=l.expires?l.expires.toUTCString():"";try{t=JSON.stringify(p);if(/^[\{\[]/.test(t)){p=t}}catch(n){}if(!d.write){p=encodeURIComponent(String(p)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent)}else{p=d.write(p,r)}r=encodeURIComponent(String(r));r=r.replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent);r=r.replace(/[\(\)]/g,escape);var k="";for(var o in l){if(!l[o]){continue}k+="; "+o;if(l[o]===true){continue}k+="="+l[o]}return(document.cookie=r+"="+p+k)}if(!r){t={}}var s=document.cookie?document.cookie.split("; "):[];var q=/(%[0-9A-Z]{2})+/g;var m=0;for(;m<s.length;m++){var j=s[m].split("=");var g=j.slice(1).join("=");if(g.charAt(0)==='"'){g=g.slice(1,-1)}try{var f=j[0].replace(q,decodeURIComponent);g=d.read?d.read(g,f):d(g,f)||g.replace(q,decodeURIComponent);if(this.json){try{g=JSON.parse(g)}catch(n){}}if(r===f){t=g;break}if(!r){t[f]=g}}catch(n){}}return t}c.set=c;c.get=function(e){return c.call(c,e)};c.getJSON=function(){return c.apply({json:true},[].slice.call(arguments))};c.defaults={};c.remove=function(f,e){c(f,"",b(e,{expires:-1}))};c.withConverter=a;return c}return a(function(){})}));var gad_skin_ad="";function showHeaderCode(){$("#dfp_ppd").before("<div id='OOP_Inter' style='dispaly:none;font-size:0px;line-height:0px' ></div>");if(_as_inter!="undefined"&&$("#OOP_Inter").length>0){googletag.cmd.push(function(){googletag.defineOutOfPageSlot(_as_inter,"OOP_Inter").addService(googletag.pubads());googletag.display("OOP_Inter")})}}function showPPD(a){if($("#"+a).length>0){googletag.cmd.push(function(){$page_type_slot="";if(typeof(bn_page_label)!="undefined"){if(bn_page_label=="content_master"){$page_type_slot="detail"}}if($page_type_slot=="detail"){var b=googletag.sizeMapping().addSize([1,1],[300,250]).addSize([728,200],[728,90]).addSize([1100,200],[1100,400]).build()}else{var b=googletag.sizeMapping().addSize([1,1],[728,90]).addSize([1024,200],[970,250]).addSize([1100,200],[1100,400]).build()}if($page_type_slot=="detail"){var c=googletag.defineSlot(_as_ppd,[[300,250],[728,90],[1100,400]],a).defineSizeMapping(b).addService(googletag.pubads())}else{var c=googletag.defineSlot(_as_ppd,[[728,90],[970,250],[1100,400]],a).defineSizeMapping(b).addService(googletag.pubads())}googletag.display(a)})}}function showBoxAds(a,b){googletag.cmd.push(function(){atfAS300=googletag.defineSlot(b,[[300,250],[300,600]],a).addService(googletag.pubads());googletag.display(a)})}function showAtf(a){showBoxAds(a,_as_atf)}function showBtf(a){showBoxAds(a,_as_btf)}function showBigAds(a,b){googletag.cmd.push(function(){var c=googletag.sizeMapping().addSize([1,1],[728,90]).addSize([1024,200],[970,250]).addSize([1100,200],[1100,250]).build();var d=googletag.defineSlot(b,[[[728,90],[970,250],[1100,250]]],a).defineSizeMapping(c).addService(googletag.pubads());googletag.display(a)})}function showBigAdsForMicrosite(a,b){googletag.cmd.push(function(){var c=googletag.sizeMapping().addSize([1,1],[728,90]).addSize([1024,200],[970,250]).addSize([1100,200],[1100,250]).build();var d=googletag.defineSlot(b,[[[728,90],[970,250],[1100,250]]],a).defineSizeMapping(c).addService(googletag.pubads());googletag.display(a)})}function showBig1(a){showBigAds(a,_as_big1)}function showBig2(a){showBigAds(a,_as_big2)}function showBigForMicrosite(a){showBigAdsForMicrosite(a,_as_big2)}function showBig3(a){showBigAds(a,_as_big3)}function showBad(a){googletag.cmd.push(function(){var b=googletag.sizeMapping().addSize([1,1],[728,90]).addSize([1024,200],[970,250]).addSize([1100,200],[1100,250]).build();var c=googletag.defineSlot(_as_bad,[[[728,90],[970,250],[1100,250]]],a).defineSizeMapping(b).addService(googletag.pubads());googletag.display(a)})}function showFooterCode(){$("#footer_ads").before("<div style='height: 1px; background: #fff;' id='OOP_Innov'></div><div id='OOP_Pop'></div><div id='OOP_Shosh'></div>");googletag.cmd.push(function(){console.log("screen size "+$(window).width());if((typeof bn_disable_skinner=="undefined")&&$("#OOP_Innov").length>0&&(typeof _as_innov!="undefined")){var a=googletag.sizeMapping().addSize([0,0],[2,2]).addSize([1320,200],[1,1]).build();gad_skin_ad=googletag.defineOutOfPageSlot(_as_innov,"OOP_Innov").defineSizeMapping(a).addService(googletag.pubads());googletag.display("OOP_Innov")}if($("#OOP_Pop").length>0&&(typeof _as_pop!="undefined")){googletag.defineOutOfPageSlot(_as_pop,"OOP_Pop").addService(googletag.pubads());googletag.display("OOP_Pop")}if($("#OOP_Shosh").length>0&&(typeof _as_shosh!="undefined")){googletag.defineOutOfPageSlot(_as_shosh,"OOP_Shosh").addService(googletag.pubads());googletag.display("OOP_Shosh")}})}function showStickyAdd(){var a="/7176/Indiatimes/IT_ROS_Sticky_160";if($(window).width()>=1368){$(".wrap").before("<div style='display:none;height: 600px; width:160px; background: #fff;' id='OOP_Sticky'></div>")}googletag.cmd.push(function(){if((typeof bn_disable_skinner=="undefined")&&$("#OOP_Sticky").length>0&&(typeof a!="undefined")&&$(window).width()>=1368){var b=googletag.sizeMapping().addSize([0,0],[160,600]).build();gad_skin_ad=googletag.defineSlot(a,[[[160,600]]],"OOP_Sticky").defineSizeMapping(b).addService(googletag.pubads());googletag.display("OOP_Sticky")}});$(document).ready(function(){var i=$(window).width();var k=$(".article-container").width();var c=Math.floor((i-k)/2);if(c<=160&&c>=0){var b=Math.ceil($(".article-container").offset().left+$(".article-container").width()+(160-c))+"px"}else{var b=Math.ceil($(".article-container").offset().left+$(".article-container").width()+15)+"px"}document.getElementById("OOP_Sticky").style.left=b;if($("#OOP_Sticky").length>0){var e=$("#OOP_Sticky");var j=e.offset().top;var f=122;e.css("position","fixed");var d=$(window).scrollTop();var h=(d+f)<j?0:d-j+f;var g=$("footer").offset().top-$("#OOP_Sticky").height()-f-122;if(h>g){var h=g}e.css("top",h+"px")}})}function showBtf2(a){googletag.cmd.push(function(){atfAS_btf_2=googletag.defineSlot(_as_btf_2,[[468,60],[580,400],[580,250],[300,250]],a).addService(googletag.pubads());googletag.display(a)})}function showBtf2_980(a){showAdsInsideContent(a)}function showAd320100(a){googletag.cmd.push(function(){atfAS_btf_2=googletag.defineSlot(_as_320,[320,100],a).addService(googletag.pubads());googletag.display(a)})}function showAdsInsideContent(a){if(bn_disable_ads_flag!="1"){googletag.cmd.push(function(){atfAS_btf_2=googletag.defineSlot(_as_inside_content,[[728,90],[728,250]],a).addService(googletag.pubads());googletag.display(a)})}}function showAdPhotogallery(a){if(bn_disable_ads_flag!="1"){_as_photogallery="/7176/Indiatimes/Indiatimes_Microsite_MREC";googletag.cmd.push(function(){__ad_photogallery=googletag.defineSlot(_as_photogallery,[300,250],a).addService(googletag.pubads());googletag.display(a)})}}function refreshPhotogalleryAds(){console.log("refresh photogallery ads");if(typeof __ad_photogallery!=="undefined"){googletag.pubads().refresh([__ad_photogallery])}}Array.prototype.push_with_limit=function(b,a){var a=a||10;var c=this.length;if(c==a){this.shift()}this.push(b)};function createCookie(c,d,e){if(e){var b=new Date();b.setTime(b.getTime()+(e*24*60*60*1000));var a="; expires="+b.toGMTString()}else{var a=""}document.cookie=c+"="+d+a+"; path=/"}function readCookie(b){var e=b+"=";var a=document.cookie.split(";");for(var d=0;d<a.length;d++){var f=a[d];while(f.charAt(0)==" "){f=f.substring(1,f.length)}if(f.indexOf(e)==0){return f.substring(e.length,f.length)}}return null}function eraseCookie(a){createCookie(a,"",-1)}function postInterstialAd(a){googletag.cmd.push(function(){_post_int=googletag.defineSlot(_post_int,[[800,400]],a).addService(googletag.pubads());googletag.display(a)})};
// $(function(){var e=$("pre");for(i=0;i<e.length;i++){var n=$("pre").eq(i),r=n.html().match(/.*\n/g);for(j=0;j<r.length;j++)r[j]=`<code>${r[j].replace(/\r?\n/g,"")}</code>\n`;n.html(r.join(""))}}); function code_number_jekyll(){ let codes = document.getElementsByTagName("pre") for(let i = 0; i < codes.length; i++){ let n = codes[i] if(n.className != "highlight") continue let r = n.innerHTML.match(/.*\n/g) for(let j = 0; j < r.length; j++){ r[j] = `<code>${r[j].replace(/\r?\n/g, "")}</code>\n` } n.innerHTML = "<div class='icon'><div class='copy' onclick='copy_code(this)'></div></div>" + r.join("") } } code_number_jekyll() function copy_code(e){ let str = e.parentElement.parentElement.getElementsByTagName("code")[0].innerText navigator.clipboard.writeText(str) let modal_window = document.createElement("div") modal_window.classList += "cp_modal_window" modal_window.innerHTML = `<div class="main"><div class='message'>コピーしました!</div> <div class="button"><input type="button" value="OK" onclick="close_modal_window(this)"></div></div>` document.body.append(modal_window) } function close_modal_window(e){ e.parentElement.parentElement.parentElement.remove() }
export const NAME = 'zoomist' export const MODULES = ['slider', 'zoomer'] export const CLASS_CONTAINER = `${NAME}-container` export const CLASS_WRAPPER = `${NAME}-wrapper` export const CLASS_IMAGE = `${NAME}-image` export const CLASS_SLIDER = `${NAME}-slider` export const CLASS_SLIDER_MAIN = `${NAME}-slider-main` export const CLASS_SLIDER_BAR = `${NAME}-slider-bar` export const CLASS_SLIDER_BUTTON = `${NAME}-slider-button` export const CLASS_ZOOMER = `${NAME}-zoomer` export const CLASS_ZOOMER_IN = `${NAME}-in-zoomer` export const CLASS_ZOOMER_OUT = `${NAME}-out-zoomer` export const CLASS_ZOOMER_DISABLE = `${NAME}-zoomer-disable` export const IS_BROWSER = typeof window !== 'undefined' && typeof window.document !== 'undefined' export const IS_TOUCH = IS_BROWSER && 'ontouchstart' in window ? true : false export const EVENT_TOUCH_START = IS_TOUCH ? 'touchstart' : 'mousedown' export const EVENT_TOUCH_MOVE = IS_TOUCH ? 'touchmove' : 'mousemove' export const EVENT_TOUCH_END = IS_TOUCH ? 'touchend' : 'mouseup' export const EVENT_RESIZE = 'resize' export const EVENT_WHEEL = 'wheel'
// Actions export const NOTIFY = 'monod/notification/NOTIFY'; const CLOSE = 'monod/notification/CLOSE'; // Action Creators export function notify(message, level) { return { type: NOTIFY, message, level }; } export function close(index) { return { type: CLOSE, index }; } export function info(message) { return notify(message, 'info'); } export function error(message) { return notify(message, 'error'); } export function warning(message) { return notify(message, 'warning'); } // Reducer const initialState = { messages: [], }; function doNotify(state, action) { const idx = state.messages.findIndex( m => action.message === m.content && action.level === m.level, ); if (-1 !== idx) { return { messages: state.messages.map((m, index) => { if (idx === index) { return { ...m, count: m.count + 1, }; } return m; }), }; } return { messages: state.messages.concat({ content: action.message, level: action.level, count: 1, }), }; } function doClose(state, action) { return { messages: state.messages.filter((_, index) => index !== action.index), }; } export default function reducer(state = initialState, action = {}) { switch (action.type) { case NOTIFY: return doNotify(state, action); case CLOSE: return doClose(state, action); default: return state; } }