code
stringlengths
2
1.05M
document.onclick = function(e) { var symbol = document.createElement("div"); symbol.style.position = "absolute"; symbol.style.left = (e.pageX) + "px"; symbol.style.top = (e.pageY) + "px"; symbol.style.zIndex = 9999; symbol.style.transition="all 1.5s"; symbol.style.border="1px red solid"; symbol.style.borderColor = `rgb(${Math.floor(Math.random()*256)},${Math.floor(Math.random()*256)},${Math.floor(Math.random()*256)})`; // 随机颜色 symbol.style.borderRadius="100%"; symbol.style.width = "0px"; symbol.style.height = "0px"; symbol.addEventListener("transitionend",function(et){ // 动画结束移除dom if(et.propertyName == "opacity" && et.srcElement.style.opacity==0) et.srcElement.remove(); }); document.body.appendChild(symbol); requestAnimationFrame(()=>{ symbol.style.width = "80px"; symbol.style.margin = "-7px -40px"; symbol.style.height = "14px"; symbol.style.opacity = 0; }); };
/*global define*/ // ignore non-camel case decided by server /* jshint -W106*/ define(['underscore', 'backbone'], function(_, Backbone) { 'use strict'; var UserRequestModel = Backbone.Model.extend({ url: function() { return '/api/v2/cluster/' + this.get('cluster') + '/request/' + this.get('id'); }, defaults: { id: 0, cluster: 1 } }); return UserRequestModel; });
import { Range } from 'monaco-editor'; import { throttle } from 'underscore'; import DirtyDiffWorker from './diff_worker'; import Disposable from '../common/disposable'; export const getDiffChangeType = change => { if (change.modified) { return 'modified'; } else if (change.added) { return 'added'; } else if (change.removed) { return 'removed'; } return ''; }; export const getDecorator = change => ({ range: new Range(change.lineNumber, 1, change.endLineNumber, 1), options: { isWholeLine: true, linesDecorationsClassName: `dirty-diff dirty-diff-${getDiffChangeType(change)}`, }, }); export default class DirtyDiffController { constructor(modelManager, decorationsController) { this.disposable = new Disposable(); this.models = new Map(); this.editorSimpleWorker = null; this.modelManager = modelManager; this.decorationsController = decorationsController; this.dirtyDiffWorker = new DirtyDiffWorker(); this.throttledComputeDiff = throttle(this.computeDiff, 250); this.decorate = this.decorate.bind(this); this.dirtyDiffWorker.addEventListener('message', this.decorate); } attachModel(model) { if (this.models.has(model.url)) return; model.onChange(() => this.throttledComputeDiff(model)); model.onDispose(() => { this.decorationsController.removeDecorations(model); this.models.delete(model.url); }); this.models.set(model.url, model); } computeDiff(model) { this.dirtyDiffWorker.postMessage({ path: model.path, originalContent: model.getOriginalModel().getValue(), newContent: model.getModel().getValue(), }); } reDecorate(model) { if (this.decorationsController.hasDecorations(model)) { this.decorationsController.decorate(model); } else { this.computeDiff(model); } } decorate({ data }) { const decorations = data.changes.map(change => getDecorator(change)); const model = this.modelManager.getModel(data.path); this.decorationsController.addDecorations(model, 'dirtyDiff', decorations); } dispose() { this.disposable.dispose(); this.models.clear(); this.dirtyDiffWorker.removeEventListener('message', this.decorate); this.dirtyDiffWorker.terminate(); } }
/** * This file has been modified from its orginal sources. * * Copyright (c) 2012 Software in the Public Interest Inc (SPI) * Copyright (c) 2012 David Pratt * * 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. * *** * Copyright (c) 2008-2012 Appcelerator Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. **/ (function () { var CreateProcess = Ti.Process.createProcess; Ti.Process.createProcess = function () { var process = CreateProcess.apply(Ti.Process, arguments); /** * @tiapi(method=True,name=Process.Process.setOnReadLine,since=0.5) * @tiarg[Function, fn] a callback that is called with every line of output received from this process */ process.setOnReadLine = function (fn) { process.buffer = ''; process.setOnRead(function (event) { var str = event.data.toString(); if (process.buffer.length > 0) { str = process.buffer + str; process.buffer = ''; } var lines = str.split(/\r?\n/); var lastLine = lines[lines.length - 1]; if (str.indexOf(lastLine) + lastLine.length < str.length) { process.buffer = lines.pop(); } for (var i = 0; i < lines.length; i++) { fn.apply(fn, [lines[i]]); } }); process.addEventListener("exit", function (event) { if (process.buffer.length > 0) { fn(process.buffer); process.buffer = null; } }); }; return process; }; /** * @tiapi(method=True,name=Process.launch,since=0.2,deprecated=True) * @tiapi This method is deprecated. See Process.Process.createProcess() * @tiarg[String, command] The command to launch * @tiarg[Array<String>, arguments] A list of arguments to the command */ Ti.Process.launch = function (cmd, args) { Ti.API.warn("Ti.Process.launch is deprecated, please use Ti.Process.createProcess instead"); if (!args) args = []; args.unshift(cmd); var process = CreateProcess.call(Ti.Process, args); var buffer = ''; var onRead = null; var onExit = null; process.setOnRead(function (event) { if (!onRead) { buffer += event.data.toString(); } else { if (buffer.length > 0) { onRead(buffer); buffer = ''; } else { onRead(event.data.toString()); } } }); process.setOnExit(function (event) { if (onExit) onExit(process.getExitCode()); }); // wrap so that we can proxy the underlying Process object methods var processWrapper = { set onread(fn) { onRead = fn; }, set onexit(fn) { onExit = fn; }, terminate: function () { process.terminate(); }, isRunning: function () { return process.isRunning(); } }; process.launch(); return processWrapper; }; })();
// queue-flow Copyright (C) 2012-2013 by David Ellis // // 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 isAsync = require('is-async'); var EventEmitter = require('async-cancelable-events'); var util = require('util'); var nextTick = global.setImmediate ? global.setImmediate : process.nextTick; var q; // Determines if this queue has a name, and either finds or returns said named queue, // or decides it's an unnamed queue and returns said queue. function qFunc(nameOrArray, QType) { QType = QType || this.q.defaultQ; if(typeof(nameOrArray) === "string") { if(!this.namedQueues[nameOrArray]) { this.namedQueues[nameOrArray] = new QType(nameOrArray, this.q); } return this.namedQueues[nameOrArray]; } else if(nameOrArray instanceof Array) { return new QType(nameOrArray, this.q); } else if(nameOrArray instanceof Object && typeof(nameOrArray.pipe) === 'function' && typeof(nameOrArray.on) === 'function') { var newQ = new QType(undefined, this.q); nameOrArray.on('data', newQ.push.bind(newQ)); nameOrArray.on('end', newQ.close.bind(newQ)); return newQ; } else { return new QType(undefined, this.q); } } // `exists` returns whether or not a named queue exists in function exists(queueName) { return !!this.namedQueues[queueName] && typeof(this.namedQueues[queueName]) === 'object'; } // `clearQueue` removes a queue from a q environment function clearQueue(nameOrQueue) { if(typeof(nameOrQueue) === 'string') { if(this.namedQueues[nameOrQueue]) delete this.namedQueues[nameOrQueue]; } else { Object.keys(this.namedQueues).forEach(function(name) { if(this.namedQueues[name] === nameOrQueue) delete this.namedQueues[name]; }.bind(this)); } } // `addQueue` adds a queue to a q environment function addQueue(name, queue) { this.namedQueues[name] = queue; } // `makeAsync` and `makeSync` helper methods allow a more fluent API to force // async or sync methods, suggested by a colleague, and fits better in the // `queue-flow` API. function makeAsync(qfMethod) { return function() { return qfMethod.apply(this, Array.prototype.slice.call(arguments, 0).map(function(arg) { if(arg instanceof Function) arg.async = true; return arg; }) ); }; } function makeSync(qfMethod) { return function() { return qfMethod.apply(this, Array.prototype.slice.call(arguments, 0).map(function(arg) { if(arg instanceof Function) arg.sync = true; return arg; }) ); }; } // `tuple` converts an object into an array of arrays. The arrays are tuples of the // key-value pairs from the object, so they can be processed individually in a queue-flow // if desired, rather than considering the whole object as a single item in the queue. function tuple(obj) { return Object.keys(obj).reduce(function(outArr, key) { return outArr.concat([[key, obj[key]]]); }, []); } // ## The `Q` constructor function, which either uses the supplied queueing engine, or // uses the built-in in-memory engine. function Q(nameOrArray, namespace) { EventEmitter.call(this); this.namespace = namespace; // Private variables, the handlers and actual queue array this.wasName = nameOrArray instanceof Array ? false : true; var queue = this.queue = nameOrArray instanceof Array ? nameOrArray : []; var handler = function() {}; var handlerSet = false; var handlerBusy = false; var recentlyEmptied = false; // Privileged methods // `setHandler` defines the special function to call to process the queue // assumed to be ready initially, when called marked busy, call provided callback to // mark ready again. this.setHandler = function setHandler(handlerFunc) { handler = handlerFunc; handlerSet = true; if(!handlerBusy) handlerCallback(function() {}); return this; }.bind(this); // Eliminate the need for all the binds in the handlerCallback var handlerEmitter = this.emit.bind(this); var handlerRuns = 0; function handlerCall() { handler(queue.shift(), handlerCallback); } // The `handlerCallback` is provided to the handler along with the dequeued value. // If there is more work to be done, it continues, otherwise is marks the handler // as ready for when the data next arrives var handlerCallback = function handlerCallback(done) { done(); handlerBusy = false; if(queue && queue.length > 0) { handlerRuns = handlerRuns % 50; if(handlerRuns) { handlerRuns++; handlerBusy = true; handlerCall(); } else { handlerRuns++; handlerBusy = true; nextTick(handlerCall); } } else if(!recentlyEmptied) { handlerEmitter('empty'); recentlyEmptied = true; } }; // Inserts a specified value into the queue, if allowed by the event handlers, and // calls the special handler function, if it's ready. this.push = function push() { recentlyEmptied = false; var values = Array.prototype.slice.call(arguments, 0); this.emitSync('push', values); Array.prototype.push.apply(queue, values); if(handlerSet && !handlerBusy) handlerCallback(function() {}); return this; }.bind(this); // `write` is a synonym for `push` so a queue can be treated as a writeable stream this.write = this.push; // For node 0.6 and 0.8 compatibility, listen for the `pipe` event and register // an event handler to call `push` this.on('pipe', function(piper) { piper.on('data', this.push); }.bind(this)); this.pushOne = function pushOne(val) { recentlyEmptied = false; this.emitSync('push', [val]); queue.push(val); if(handlerSet && !handlerBusy) handlerCallback(function() {}); return this; }.bind(this); // Signals that the queue is being destroyed and then, if allowed, destroys it this.close = function close() { this.emit('close', function(result) { if(result) { // Stop accepting new items so the queue can actually close // if processing time is slower than newly enqueued values come in this.removeAllListeners('push'); this.on('push', function() { return false; }); // Whatever made it into the queue at this point in time, allow it to be // processed and de-queued. var flushQueue = function() { var tempHandler = handler; handlerSet = false; handler = function() {}; queue = undefined; this.push = this.pushOne = function() { throw new Error('Queue already closed'); }; if(namespace) namespace.clearQueue(this); if(tempHandler instanceof Function) { tempHandler('close'); } }.bind(this); if(!handlerBusy && queue && !queue.length) flushQueue(); if(handlerBusy || (queue && queue.length)) { this.removeAllListeners('empty'); this.on('empty', flushQueue); } } }.bind(this)); return this; }.bind(this); // `end` is a synonym for `close` so a queue can be treated as a writeable stream this.end = this.close; // Kills the queue (and all sub-queues) immediately, no possibility of blocking // with an event handler. this.kill = function kill() { this.emit('kill'); var tempHandler = handler; handlerSet = false; handler = function() {}; queue = undefined; this.push = this.pushOne = function() { throw new Error('Queue already closed'); }; if(namespace) namespace.clearQueue(this); if(tempHandler instanceof Function) { tempHandler('kill'); } }.bind(this); // Start processing the queue after the next JS event loop cycle and return the queue // object to the remaining code. if(handlerSet && !handlerBusy) handlerCallback(function() {}); if(queue.length > 0) this.on('empty', this.close); return this; } util.inherits(Q, EventEmitter); // ## `Q` prototype methods, the methods to be most commonly used by users of `queue-flow` // `as` names or aliases the given queue Q.prototype.as = function as(name) { if(this.namespace) this.namespace.addQueue(name, this); return this; }; // `concat` is a simpler wrapper around `push` that takes a single array // and covers up the relatively nasty `apply` mechanism (when dealing with // queue-flow's particular object model. Getting the *queue-flow* object // requires `q('nameHere')` and `q('nameHere').push.apply(q('nameHere'), array)` // is ugly and verbose. Q.prototype.concat = function concat(array) { this.push.apply(this, array); return this; }; // `each` creates an output queue that simply copies the input queue results, // while also passing these results to the provided callback for side-effect // purposes. The output queue is so the data is not destroyed by the `each` // method. Q.prototype.each = function each(callback) { var outQueue = new this.constructor(null, this.namespace); this.setHandler(function(value, next) { if(!next) { outQueue[value](); } else { if(isAsync(callback, 2)) { callback(value, function() { next(outQueue.push.bind(outQueue, value)); }); } else { callback(value); next(outQueue.push.bind(outQueue, value)); } } }); return outQueue; }; Q.prototype.eachAsync = makeAsync(Q.prototype.each); Q.prototype.eachSync = makeSync(Q.prototype.each); // `wait` is a no-op `each` that simply delays the queue by a specified amount // or by the amount specified by the callback function (if the argument is a // function instead of a number). This is useful for ratelimiting queues that // otherwise hammer an external service. Q.prototype.wait = function wait(delay) { return this.each(function(val, callback) { if(typeof(delay) === 'function') { if(isAsync(delay, 2)) { delay(val, function(delay) { setTimeout(callback, delay); }); } else { setTimeout(callback, delay(val)); } } else { setTimeout(callback, delay); } }); }; Q.prototype.waitAsync = makeAsync(Q.prototype.wait); Q.prototype.waitSync = makeSync(Q.prototype.wait); // `inOut` is a helper function used by several of the Q prototype methods that // take an input queue and produce an output queue. var inOut = function inOut(outQueue, setter, callback) { this.setHandler(function(value, next) { if(!next) { outQueue[value](); } else { if(isAsync(callback, 2)) { callback(value, function(result) { next(setter.bind(this, value, result)); }); } else { next(setter.bind(this, value, callback(value))); } } }); return outQueue; }; // `map` creates an output queue, and executes // the given callback on each value, pushing the // result into the output queue before continuing // to process the input queue Q.prototype.map = function map(callback) { var outQueue = new this.constructor(null, this.namespace); if(isAsync(callback, 2)) { this.setHandler(function(value, next) { if(!next) { outQueue[value](); } else { callback(value, function(result) { next(function() { outQueue.pushOne(result); }); }); } }); } else { this.setHandler(function(value, next) { if(!next) { outQueue[value](); } else { next(function() { outQueue.pushOne(callback(value)); }); } }); } return outQueue; }; Q.prototype.mapAsync = makeAsync(Q.prototype.map); Q.prototype.mapSync = makeSync(Q.prototype.map); // `reduce` creates an output variable, and executes once upstream has // `close()`d, it does one of three things, depending on the value of // `last`: if undefined it returns an anonymous queue and pushes that // sole result into the queue and closes it immediately. If `last` is // a string, it pushes that result into the named queue. If `last` is // a function, it does not create a queue and instead calls `last` with // the `out` value. Q.prototype.reduce = function reduce(callback, last, initial) { var out = initial; var outQueue; if(!last) outQueue = new this.constructor(null, this.namespace); this.setHandler(function(value, next) { if(!next) { if(!!last && last instanceof Function) last(out); if(!!last && typeof(last) === 'string') q(last).push(out); if(!last) { outQueue.push(out); outQueue[value](); } } else { if(isAsync(callback, 3)) { callback(out, value, function(result) { next(function() { out = result; }); }); } else { next(function() { out = callback(out, value); }); } } }.bind(this)); return outQueue || this; }; Q.prototype.reduceAsync = makeAsync(Q.prototype.reduce); Q.prototype.reduceSync = makeSync(Q.prototype.reduce); // `filter` creates an output queue, and executes // the given callback on each value, pushing the // original value *only* if the callback returns true. Q.prototype.filter = function filter(callback) { var outQueue = new this.constructor(null, this.namespace); return inOut.bind(this)(outQueue, function filterSetter(value, result) { if(result) outQueue.push(value); }, callback); }; Q.prototype.filterAsync = makeAsync(Q.prototype.filter); Q.prototype.filterSync = makeSync(Q.prototype.filter); // `branch` pushes values from the queue into another queue. If that name // is provided directly to `branch` it will always push to that named queue. // If a reference to the queue itself is provided branch it will push to that // particular queue. If a function is provided, it will provide it with each // value in the queue and expect to be returned the name, reference, or array // of either to push the value into. Q.prototype.branch = function branch(callback) { var self = this; this.setHandler(function(value, next) { function queueProcessor(queue) { if(typeof(queue) === 'string') { self.namespace(queue).push(value); } else if(typeof(queue) === 'object' && !!queue.push) { queue.push(value); } } if(!!next) { if(typeof(callback) === 'function' && isAsync(callback, 2)) { callback(value, function(result) { next(function() { if(result instanceof Array) { result.forEach(queueProcessor); } else { queueProcessor(result); } }); }); } else if(typeof(callback) === 'function') { var result = callback(value); next(function() { if(result instanceof Array) { result.forEach(queueProcessor); } else { queueProcessor(result); } }); } else if(callback instanceof Array) { next(function() { callback.forEach(queueProcessor); }); } else { next(function() { queueProcessor(callback); }); } } }); return this; }; Q.prototype.branchAsync = makeAsync(Q.prototype.branch); Q.prototype.branchSync = makeSync(Q.prototype.branch); // `everySome` helper function that is used to implement `Q.prototype.every` // and `Q.prototype.some`, similar to `reduce`, the behavior of `everySome` // will change whether `last` is a function, a string, or falsy. var everySome = function everySome(polarity, callback, last) { var outQueue; if(!last) outQueue = new this.constructor(null, this.namespace); function shortCircuit(value, next) { if(!!next) next(function() {}); } this.setHandler(function(value, next) { if(!next) { if(!last) { outQueue.push(!polarity); outQueue.close(); } if(!!last && last instanceof Function) last(!polarity); // Reverse the polarity on the deflector shield! if(!!last && typeof(last) === 'string') q(last).push(!polarity); } else { if(isAsync(callback, 2)) { callback(value, function(result) { next(function() { if(result === polarity) { this.setHandler(shortCircuit); if(!last) { outQueue.push(polarity); outQueue.close(); } if(!!last && last instanceof Function) last(polarity); if(!!last && typeof(last) === 'string') q(last).push(polarity); } }.bind(this)); }.bind(this)); } else { next(function() { if(callback(value) === polarity) { this.setHandler(shortCircuit); if(!last) { outQueue.push(polarity); outQueue.close(); } if(!!last && last instanceof Function) last(polarity); if(!!last && typeof(last) === 'string') q(last).push(polarity); } }.bind(this)); } } }.bind(this)); return outQueue || this; }; // `every` returns true only if the callback has returned true every time. Immediately returns false // when false and closes the input queue in this event. A specialization of the `reduce` method. Q.prototype.every = function every(callback, last) { return everySome.bind(this, false, callback, last)(); }; Q.prototype.everyAsync = makeAsync(Q.prototype.every); Q.prototype.everySync = makeSync(Q.prototype.every); // `some` returns true only if the callback has returned true at least once. Immediately returns true // when true and closes the input queue in this event. Q.prototype.some = function some(callback, last) { return everySome.bind(this, true, callback, last)(); }; Q.prototype.someAsync = makeAsync(Q.prototype.some); Q.prototype.someSync = makeSync(Q.prototype.some); // `toArray` returns an array from the given queue. A specialization of the `reduce` method. // Has the same three behaviors depending on the type of value `last` is, function, string, or // falsy. Q.prototype.toArray = function toArray(last) { var outQueue = this; if(!last) { outQueue = new this.constructor(null, this.namespace); this.on('close', function() { outQueue.push(this.queue).close(); }.bind(this)); } else if(typeof last === 'string') { this.on('close', function() { q(last).push(this.queue).close(); }.bind(this)); } else if(typeof last === 'function') { this.on('close', last.bind(this, this.queue)); } if(!this.wasName) this.close(); return outQueue; }; // `flatten` takes an input queue and produces an output queue of values that are not arrays. Any // array encountered is split and enqueued into the new queue recursively, unless given a depth to // flatten to (`true` == 1 in this case). Intended to be nearly identical to underscore's `flatten` Q.prototype.flatten = function flatten(depth) { var outQueue = new this.constructor(null, this.namespace); function processValue(value, currDepth) { if(value && value instanceof Array) { if(depth && typeof(depth) === 'number' && depth === currDepth) { outQueue.push(value); } else { value.forEach(function(value) { processValue(value, currDepth+1); }); } } else { outQueue.push(value); } } this.setHandler(function(value, next) { if(!next) { outQueue[value](); } else { next(function() { processValue(value, 0); }); } }); return outQueue; }; // `shortCiruit` and `ercb` are functions common to both the `node` and `exec` methods below. // `shortCircuit` consumes the remaining queue without doing any processing, and `ercb` is a // callback function with significant error logic, depending on what value is passed into the // `onError` argument for `node` and `exec`. /* jshint maxparams: 6 */ function ercb(outQueue, onError, next, value, error, result) { if(!error) { next(function() { outQueue.push(result); }); } else { if(!!onError && onError instanceof Function) { onError(error, result, value); } else if(typeof(onError) === 'string') { next(function() { q(onError).push([error, result, value]); }); } else if(typeof(onError) === 'object') { // Assume a queue-flow constructed object next(function() { onError.push([error, result, value]); }); } } } // `node` is a slightly modified version of `map` that takes the input value, and if it is an // array, provides each value as an independent argument to the provided callback. It also assumes // the method returns a correct result and throws an error, or if async calls the callback with two // arguments, considered to be `error` and `value`, in that order, which matches most of the // Node.js API callbacks. A second parameter can also be set to determine what `node` does when // an error is returned. If not set, `node` simply ignores the error and value and processes the // next item in the queue. If set to `true`, it kills the queue at this point. If set to a function, // it kills the queue and calls the function with the error and value. If set to a string, it // passes the error and value into a queue of the same name and continues processing the rest of // the queue. If there was an error, for useful debugging the original params passed to exec are // also provided. Q.prototype.node = function node(callback, onError) { var outQueue = new this.constructor(null, this.namespace); this.setHandler(function(value, next) { if(!(value instanceof Array)) value = [value]; if(!next) { outQueue[value](); } else { if(isAsync(callback, value.length+1)) { value.push(ercb.bind(this, outQueue, onError, next, value)); callback.apply(this, value); } else { try { ercb.bind(this)(outQueue, onError, next, value, undefined, callback.apply(this, value)); } catch(e) { ercb.bind(this)(outQueue, onError, next, value, e); } } } }.bind(this)); return outQueue; }; Q.prototype.nodeAsync = makeAsync(Q.prototype.node); Q.prototype.nodeSync = makeSync(Q.prototype.node); // ``exec`` assumes the incoming value is a function to execute and takes a couple of arguments. // The first is an array of arguments for the function, or a function that returns an array of // arguments based on the function to be run, while the second is what to do if there is an error, // similar to ``node`` above. ``execCommon`` is the base for all three versions of ``exec`` function execCommon(forceSyncAsync, args, onError) { var outQueue = new this.constructor(null, this.namespace); this.setHandler(function(value, next) { if(!next) return outQueue[value](); if(!(value instanceof Function)) return ercb(outQueue, onError, next, value, new Error('Not a function'), undefined); function execFunc(args) { if(forceSyncAsync === 'async' || (forceSyncAsync !== 'sync' && isAsync(value, args.length+1))) { args.push(ercb.bind(this, outQueue, onError, next, value)); value.apply(this, args); } else { try { ercb(outQueue, onError, next, value, undefined, value.apply(this, args)); } catch(e) { ercb(outQueue, onError, next, value, e); } } } if(args instanceof Function && isAsync(args, 2)) { args(value, function() { execFunc.bind(this)(Array.prototype.slice.call(arguments, 0)); }); } else if(args instanceof Function) { try { var args2 = args(value); args2 = args2 instanceof Array ? args2 : [args2]; execFunc.bind(this)(args2); } catch(e) { ercb.bind(this)(outQueue, onError, next, value, e); } } else if(args instanceof Array) { execFunc.bind(this)(args); } else { execFunc.bind(this)([args]); } }.bind(this)); return outQueue; } Q.prototype.exec = function exec(args, onError) { return execCommon.bind(this, false)(args, onError); }; Q.prototype.execSync = function execSync(args, onError) { return execCommon.bind(this, 'sync')(args, onError); }; Q.prototype.execAsync = function execAsync(args, onError) { return execCommon.bind(this, 'async')(args, onError); }; // ``subqueue`` allows re-usable queue definitions to be attached to the parent queue. An // anonymous queue is provided to the callback function, and that function must return the // endpoint of the sub-queue that will be continued along in the chain. Q.prototype.subqueue = function subqueue(callback) { if(isAsync(callback, 2)) { var inQueue = new this.constructor(null, this.namespace); var outQueue = new this.constructor(null, this.namespace); var buffer = []; this.each(buffer.push.bind(buffer)); callback(inQueue, function(intermediateQ) { inQueue.concat(buffer); intermediateQ.branch(outQueue); }); return outQueue; } else { return callback(this); } }; Q.prototype.subqueueSync = makeSync(Q.prototype.subqueue); Q.prototype.subqueueAsync = makeAsync(Q.prototype.subqueue); // ``promise`` allows the usage of CommonJS Promises in queues. It takes a function that uses // the value or values passed in as the arguments for the construction of the promise, and // then registers handlers for the success and failure scenarios, passing the successes down // and the failures into the specified error queue or callback. Promises are, by definition, async, so // ``promiseAsync`` is simply a synonym and ``promiseSync`` simply throws an error. Q.prototype.promise = function promise(callback, error) { var outQueue = new this.constructor(null, this.namespace); if(typeof(error) === 'string') { error = q(error).push.bind(q(error)); } else if(typeof(error) === 'object') { error = error.push.bind(error); } else if(typeof(error) !== 'function') { error = function() {}; } this.setHandler(function(value, next) { if(!next) return outQueue[value](); if(!(value instanceof Array)) value = [value]; callback.apply(this, value).then(function(result) { next(function() { outQueue.push(result); }); }, error); }); return outQueue; }; Q.prototype.promiseAsync = Q.prototype.promise; Q.prototype.promiseSync = function() { throw "Synchronous Promises are Nonsensical!"; }; // ``pipe`` pushes the queue results into the provided writeable object (and returns it so // if it is also readable, you can continue to ``pipe`` it just as you'd expect). Throws // an error if it can't find the ``write`` and ``end`` methods. Q.prototype.pipe = function pipe(writable) { if(typeof(writable.write) !== 'function' || typeof(writable.end) !== 'function') throw new Error('Not a valid writeable object!'); this.setHandler(function(value, next) { if(!next) return writable.end(); next(function() { writable.write(value); }); }); return writable; }; // ``drain`` is a simple callback that empties the attached queue and throws away the // results. This is useful for long-running queues to eliminate references to effectively // "dead" data without using the ``reduce`` hack to do so. No chaining is possible // after this call (for obvious reasons). Q.prototype.drain = function drain() { this.setHandler(function(value, next) { if(next && next instanceof Function) next(function() {}); }); return undefined; }; function ns() { // The q environment var qEnv = {}; var q = qFunc.bind(qEnv); qEnv.q = q; // Hash of named queues qEnv.namedQueues = {}; q.exists = exists.bind(qEnv); q.clearQueue = clearQueue.bind(qEnv); q.addQueue = addQueue.bind(qEnv); // Create a new queue-flow environment/namespace q.ns = ns; // Expose the `Q` constructor function (below) so third parties can extend its prototype q.Q = Q; // Specify the default constructor function for this namespace (may be overridden by user) q.defaultQ = Q; // ## Methods of `q`, mostly helper functions for users of `queue-flow` and the `Q` methods q.makeAsync = makeAsync; q.makeSync = makeSync; q.tuple = tuple; return q; } q = ns(); module.exports = q;
/** * Disallows space after object keys. * * Types: `Boolean` or `String` * * Values: * - `true` * - `"ignoreSingleLine"` ignores objects if the object only takes up a single line * (*deprecated* use `"allExcept": [ "singleline" ]`) * - `"ignoreMultiLine"` ignores objects if the object takes up multiple lines * (*deprecated* use `"allExcept": [ "multiline" ]`) * - `Object`: * - `"allExcept"`: array of exceptions: * - `"singleline"` ignores objects if the object only takes up a single line * - `"multiline"` ignores objects if the object takes up multiple lines * - `"aligned"` ignores aligned object properties * - `"method"` ignores method declarations * * #### Example * * ```js * "disallowSpaceAfterObjectKeys": true * ``` * * ##### Valid for `true` * ```js * var x = {a: 1}; * var y = { * a: 1, * b: 2 * } * ``` * * ##### Valid for `{ allExcept: ['singleline'] }` * ```js * var x = {a : 1}; * var y = { * a: 1, * b: 2 * } * ``` * * ##### Valid for `{ allExcept: ['multiline'] }` * ```js * var x = {a: 1}; * var y = { * a : 1, * b : 2 * } * ``` * * ##### Valid for `{ allExcept: ['aligned'] }` * ```js * var y = { * abc: 1, * d : 2 * } * ``` * * ##### Valid for `{ allExcept: ['method'] }` * ```js * var y = { * fn () { * return 42; * } * } * ``` * * ##### Invalid * ```js * var x = {a : 1}; * ``` */ var assert = require('assert'); var utils = require('../utils'); module.exports = function() {}; module.exports.prototype = { configure: function(options) { if (typeof options !== 'object') { assert( options === true || options === 'ignoreSingleLine' || options === 'ignoreMultiLine', this.getOptionName() + ' option requires a true value, "ignoreSingleLine", "ignoreMultiLine", or an object' ); var _options = { allExcept: [] }; if (options === 'ignoreSingleLine') { _options.allExcept.push('singleline'); } if (options === 'ignoreMultiLine') { _options.allExcept.push('multiline'); } return this.configure(_options); } else { assert( Array.isArray(options.allExcept), this.getOptionName() + ' option object requires allExcept array property' ); } this._exceptSingleline = options.allExcept.indexOf('singleline') > -1; this._exceptMultiline = options.allExcept.indexOf('multiline') > -1; this._exceptAligned = options.allExcept.indexOf('aligned') > -1; this._exceptMethod = options.allExcept.indexOf('method') > -1; assert( !this._exceptMultiline || !this._exceptAligned, this.getOptionName() + ' option allExcept property cannot contain `aligned` and `multiline` at the same time' ); assert( !this._exceptMultiline || !this._exceptSingleline, this.getOptionName() + ' option allExcept property cannot contain `singleline` and `multiline` at the same time' ); }, getOptionName: function() { return 'disallowSpaceAfterObjectKeys'; }, check: function(file, errors) { var exceptSingleline = this._exceptSingleline; var exceptMultiline = this._exceptMultiline; var exceptAligned = this._exceptAligned; var exceptMethod = this._exceptMethod; file.iterateNodesByType('ObjectExpression', function(node) { var multiline = node.loc.start.line !== node.loc.end.line; if (exceptSingleline && !multiline) { return; } if (exceptMultiline && multiline) { return; } var maxKeyEndPos = 0; var tokens = []; node.properties.forEach(function(property) { if (property.shorthand || property.kind !== 'init' || (exceptMethod && property.method) || utils.getBabelType(property) === 'SpreadProperty') { return; } var keyToken = file.getLastNodeToken(property.key); if (property.computed === true) { keyToken = file.getNextToken(keyToken); } if (exceptAligned) { maxKeyEndPos = Math.max(maxKeyEndPos, keyToken.loc.end.column); } tokens.push(keyToken); }); tokens.forEach(function(key) { var colon = file.getNextToken(key); var spaces = exceptAligned ? maxKeyEndPos - key.loc.end.column : 0; errors.assert.spacesBetween({ token: key, nextToken: colon, exactly: spaces, message: 'Illegal space after key', disallowNewLine: true }); }); }); } };
.factory('parseFilter', function () { return function (expression) { if (!expression) return {}; return _(expression.split(' and ')) .indexBy(function (d) { return d.split(' ').slice(0, 2).join(''); }) .mapValues(parseFilter) .value(); }; function parseFilter(text) { var parts = text.split(' ') , value = parts.slice(2).join(' ') , isString = _.startsWith(value, "'") , type = isString ? 'Edm.String' : 'Edm.Double'; if (isString) { value = value.substr(1, value.length - 2); } else { value = parseFloat(value); } return { name: parts[0], comparison: parts[1], value: value, type: type }; } })
/* A class to parse color values @author Stoyan Stefanov <sstoo@gmail.com> @link http://www.phpied.com/rgb-color-parser-in-javascript/ Use it if you like it canvg.js - Javascript SVG parser and renderer on Canvas MIT Licensed Gabe Lerner (gabelerner@gmail.com) http://code.google.com/p/canvg/ Requires: rgbcolor.js - http://www.phpied.com/rgb-color-parser-in-javascript/ Highcharts JS v2.2.2 (2012-04-26) CanVGRenderer Extension module (c) 2011-2012 Torstein H?nsi, Erik Olsson License: www.highcharts.com/license */ function RGBColor(m){this.ok=!1;m.charAt(0)=="#"&&(m=m.substr(1,6));var m=m.replace(/ /g,""),m=m.toLowerCase(),a={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b", darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff", gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa", lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080", oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd", slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"},c;for(c in a)m==c&&(m=a[c]);var d=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(b){return[parseInt(b[1]),parseInt(b[2]),parseInt(b[3])]}},{re:/^(\w{2})(\w{2})(\w{2})$/, example:["#00ff00","336699"],process:function(b){return[parseInt(b[1],16),parseInt(b[2],16),parseInt(b[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,example:["#fb0","f0f"],process:function(b){return[parseInt(b[1]+b[1],16),parseInt(b[2]+b[2],16),parseInt(b[3]+b[3],16)]}}];for(c=0;c<d.length;c++){var b=d[c].process,k=d[c].re.exec(m);if(k)channels=b(k),this.r=channels[0],this.g=channels[1],this.b=channels[2],this.ok=!0}this.r=this.r<0||isNaN(this.r)?0:this.r>255?255:this.r;this.g=this.g<0||isNaN(this.g)?0: this.g>255?255:this.g;this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b;this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"};this.toHex=function(){var b=this.r.toString(16),a=this.g.toString(16),d=this.b.toString(16);b.length==1&&(b="0"+b);a.length==1&&(a="0"+a);d.length==1&&(d="0"+d);return"#"+b+a+d};this.getHelpXML=function(){for(var b=[],k=0;k<d.length;k++)for(var c=d[k].example,h=0;h<c.length;h++)b[b.length]=c[h];for(var j in a)b[b.length]=j;c=document.createElement("ul"); c.setAttribute("id","rgbcolor-examples");for(k=0;k<b.length;k++)try{var l=document.createElement("li"),o=new RGBColor(b[k]),n=document.createElement("div");n.style.cssText="margin: 3px; border: 1px solid black; background:"+o.toHex()+"; color:"+o.toHex();n.appendChild(document.createTextNode("test"));var q=document.createTextNode(" "+b[k]+" -> "+o.toRGB()+" -> "+o.toHex());l.appendChild(n);l.appendChild(q);c.appendChild(l)}catch(p){}return c}} if(!window.console)window.console={},window.console.log=function(){},window.console.dir=function(){};if(!Array.prototype.indexOf)Array.prototype.indexOf=function(m){for(var a=0;a<this.length;a++)if(this[a]==m)return a;return-1}; (function(){function m(){var a={FRAMERATE:30,MAX_VIRTUAL_PIXELS:3E4};a.init=function(c){a.Definitions={};a.Styles={};a.Animations=[];a.Images=[];a.ctx=c;a.ViewPort=new function(){this.viewPorts=[];this.Clear=function(){this.viewPorts=[]};this.SetCurrent=function(a,b){this.viewPorts.push({width:a,height:b})};this.RemoveCurrent=function(){this.viewPorts.pop()};this.Current=function(){return this.viewPorts[this.viewPorts.length-1]};this.width=function(){return this.Current().width};this.height=function(){return this.Current().height}; this.ComputeSize=function(a){return a!=null&&typeof a=="number"?a:a=="x"?this.width():a=="y"?this.height():Math.sqrt(Math.pow(this.width(),2)+Math.pow(this.height(),2))/Math.sqrt(2)}}};a.init();a.ImagesLoaded=function(){for(var c=0;c<a.Images.length;c++)if(!a.Images[c].loaded)return!1;return!0};a.trim=function(a){return a.replace(/^\s+|\s+$/g,"")};a.compressSpaces=function(a){return a.replace(/[\s\r\t\n]+/gm," ")};a.ajax=function(a){var d;return(d=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP"))? (d.open("GET",a,!1),d.send(null),d.responseText):null};a.parseXml=function(a){if(window.DOMParser)return(new DOMParser).parseFromString(a,"text/xml");else{var a=a.replace(/<!DOCTYPE svg[^>]*>/,""),d=new ActiveXObject("Microsoft.XMLDOM");d.async="false";d.loadXML(a);return d}};a.Property=function(c,d){this.name=c;this.value=d;this.hasValue=function(){return this.value!=null&&this.value!==""};this.numValue=function(){if(!this.hasValue())return 0;var b=parseFloat(this.value);(this.value+"").match(/%$/)&& (b/=100);return b};this.valueOrDefault=function(b){return this.hasValue()?this.value:b};this.numValueOrDefault=function(b){return this.hasValue()?this.numValue():b};var b=this;this.Color={addOpacity:function(d){var c=b.value;if(d!=null&&d!=""){var f=new RGBColor(b.value);f.ok&&(c="rgba("+f.r+", "+f.g+", "+f.b+", "+d+")")}return new a.Property(b.name,c)}};this.Definition={getDefinition:function(){var d=b.value.replace(/^(url\()?#([^\)]+)\)?$/,"$2");return a.Definitions[d]},isUrl:function(){return b.value.indexOf("url(")== 0},getFillStyle:function(b){var d=this.getDefinition();return d!=null&&d.createGradient?d.createGradient(a.ctx,b):d!=null&&d.createPattern?d.createPattern(a.ctx,b):null}};this.Length={DPI:function(){return 96},EM:function(b){var d=12,c=new a.Property("fontSize",a.Font.Parse(a.ctx.font).fontSize);c.hasValue()&&(d=c.Length.toPixels(b));return d},toPixels:function(d){if(!b.hasValue())return 0;var c=b.value+"";return c.match(/em$/)?b.numValue()*this.EM(d):c.match(/ex$/)?b.numValue()*this.EM(d)/2:c.match(/px$/)? b.numValue():c.match(/pt$/)?b.numValue()*1.25:c.match(/pc$/)?b.numValue()*15:c.match(/cm$/)?b.numValue()*this.DPI(d)/2.54:c.match(/mm$/)?b.numValue()*this.DPI(d)/25.4:c.match(/in$/)?b.numValue()*this.DPI(d):c.match(/%$/)?b.numValue()*a.ViewPort.ComputeSize(d):b.numValue()}};this.Time={toMilliseconds:function(){if(!b.hasValue())return 0;var a=b.value+"";if(a.match(/s$/))return b.numValue()*1E3;a.match(/ms$/);return b.numValue()}};this.Angle={toRadians:function(){if(!b.hasValue())return 0;var a=b.value+ "";return a.match(/deg$/)?b.numValue()*(Math.PI/180):a.match(/grad$/)?b.numValue()*(Math.PI/200):a.match(/rad$/)?b.numValue():b.numValue()*(Math.PI/180)}}};a.Font=new function(){this.Styles=["normal","italic","oblique","inherit"];this.Variants=["normal","small-caps","inherit"];this.Weights="normal,bold,bolder,lighter,100,200,300,400,500,600,700,800,900,inherit".split(",");this.CreateFont=function(d,b,c,e,f,g){g=g!=null?this.Parse(g):this.CreateFont("","","","","",a.ctx.font);return{fontFamily:f|| g.fontFamily,fontSize:e||g.fontSize,fontStyle:d||g.fontStyle,fontWeight:c||g.fontWeight,fontVariant:b||g.fontVariant,toString:function(){return[this.fontStyle,this.fontVariant,this.fontWeight,this.fontSize,this.fontFamily].join(" ")}}};var c=this;this.Parse=function(d){for(var b={},d=a.trim(a.compressSpaces(d||"")).split(" "),k=!1,e=!1,f=!1,g=!1,h="",j=0;j<d.length;j++)if(!e&&c.Styles.indexOf(d[j])!=-1){if(d[j]!="inherit")b.fontStyle=d[j];e=!0}else if(!g&&c.Variants.indexOf(d[j])!=-1){if(d[j]!="inherit")b.fontVariant= d[j];e=g=!0}else if(!f&&c.Weights.indexOf(d[j])!=-1){if(d[j]!="inherit")b.fontWeight=d[j];e=g=f=!0}else if(k)d[j]!="inherit"&&(h+=d[j]);else{if(d[j]!="inherit")b.fontSize=d[j].split("/")[0];e=g=f=k=!0}if(h!="")b.fontFamily=h;return b}};a.ToNumberArray=function(c){for(var c=a.trim(a.compressSpaces((c||"").replace(/,/g," "))).split(" "),d=0;d<c.length;d++)c[d]=parseFloat(c[d]);return c};a.Point=function(a,d){this.x=a;this.y=d;this.angleTo=function(b){return Math.atan2(b.y-this.y,b.x-this.x)};this.applyTransform= function(b){var a=this.x*b[1]+this.y*b[3]+b[5];this.x=this.x*b[0]+this.y*b[2]+b[4];this.y=a}};a.CreatePoint=function(c){c=a.ToNumberArray(c);return new a.Point(c[0],c[1])};a.CreatePath=function(c){for(var c=a.ToNumberArray(c),d=[],b=0;b<c.length;b+=2)d.push(new a.Point(c[b],c[b+1]));return d};a.BoundingBox=function(a,d,b,k){this.y2=this.x2=this.y1=this.x1=Number.NaN;this.x=function(){return this.x1};this.y=function(){return this.y1};this.width=function(){return this.x2-this.x1};this.height=function(){return this.y2- this.y1};this.addPoint=function(b,a){if(b!=null){if(isNaN(this.x1)||isNaN(this.x2))this.x2=this.x1=b;if(b<this.x1)this.x1=b;if(b>this.x2)this.x2=b}if(a!=null){if(isNaN(this.y1)||isNaN(this.y2))this.y2=this.y1=a;if(a<this.y1)this.y1=a;if(a>this.y2)this.y2=a}};this.addX=function(b){this.addPoint(b,null)};this.addY=function(b){this.addPoint(null,b)};this.addBoundingBox=function(b){this.addPoint(b.x1,b.y1);this.addPoint(b.x2,b.y2)};this.addQuadraticCurve=function(b,a,d,c,k,l){d=b+2/3*(d-b);c=a+2/3*(c- a);this.addBezierCurve(b,a,d,d+1/3*(k-b),c,c+1/3*(l-a),k,l)};this.addBezierCurve=function(b,a,d,c,k,l,o,n){var q=[b,a],p=[d,c],s=[k,l],m=[o,n];this.addPoint(q[0],q[1]);this.addPoint(m[0],m[1]);for(i=0;i<=1;i++)b=function(b){return Math.pow(1-b,3)*q[i]+3*Math.pow(1-b,2)*b*p[i]+3*(1-b)*Math.pow(b,2)*s[i]+Math.pow(b,3)*m[i]},a=6*q[i]-12*p[i]+6*s[i],d=-3*q[i]+9*p[i]-9*s[i]+3*m[i],c=3*p[i]-3*q[i],d==0?a!=0&&(a=-c/a,0<a&&a<1&&(i==0&&this.addX(b(a)),i==1&&this.addY(b(a)))):(c=Math.pow(a,2)-4*c*d,c<0||(k= (-a+Math.sqrt(c))/(2*d),0<k&&k<1&&(i==0&&this.addX(b(k)),i==1&&this.addY(b(k))),a=(-a-Math.sqrt(c))/(2*d),0<a&&a<1&&(i==0&&this.addX(b(a)),i==1&&this.addY(b(a)))))};this.isPointInBox=function(b,a){return this.x1<=b&&b<=this.x2&&this.y1<=a&&a<=this.y2};this.addPoint(a,d);this.addPoint(b,k)};a.Transform=function(c){var d=this;this.Type={};this.Type.translate=function(b){this.p=a.CreatePoint(b);this.apply=function(b){b.translate(this.p.x||0,this.p.y||0)};this.applyToPoint=function(b){b.applyTransform([1, 0,0,1,this.p.x||0,this.p.y||0])}};this.Type.rotate=function(b){b=a.ToNumberArray(b);this.angle=new a.Property("angle",b[0]);this.cx=b[1]||0;this.cy=b[2]||0;this.apply=function(b){b.translate(this.cx,this.cy);b.rotate(this.angle.Angle.toRadians());b.translate(-this.cx,-this.cy)};this.applyToPoint=function(b){var a=this.angle.Angle.toRadians();b.applyTransform([1,0,0,1,this.p.x||0,this.p.y||0]);b.applyTransform([Math.cos(a),Math.sin(a),-Math.sin(a),Math.cos(a),0,0]);b.applyTransform([1,0,0,1,-this.p.x|| 0,-this.p.y||0])}};this.Type.scale=function(b){this.p=a.CreatePoint(b);this.apply=function(b){b.scale(this.p.x||1,this.p.y||this.p.x||1)};this.applyToPoint=function(b){b.applyTransform([this.p.x||0,0,0,this.p.y||0,0,0])}};this.Type.matrix=function(b){this.m=a.ToNumberArray(b);this.apply=function(b){b.transform(this.m[0],this.m[1],this.m[2],this.m[3],this.m[4],this.m[5])};this.applyToPoint=function(b){b.applyTransform(this.m)}};this.Type.SkewBase=function(b){this.base=d.Type.matrix;this.base(b);this.angle= new a.Property("angle",b)};this.Type.SkewBase.prototype=new this.Type.matrix;this.Type.skewX=function(b){this.base=d.Type.SkewBase;this.base(b);this.m=[1,0,Math.tan(this.angle.Angle.toRadians()),1,0,0]};this.Type.skewX.prototype=new this.Type.SkewBase;this.Type.skewY=function(b){this.base=d.Type.SkewBase;this.base(b);this.m=[1,Math.tan(this.angle.Angle.toRadians()),0,1,0,0]};this.Type.skewY.prototype=new this.Type.SkewBase;this.transforms=[];this.apply=function(b){for(var a=0;a<this.transforms.length;a++)this.transforms[a].apply(b)}; this.applyToPoint=function(b){for(var a=0;a<this.transforms.length;a++)this.transforms[a].applyToPoint(b)};for(var c=a.trim(a.compressSpaces(c)).split(/\s(?=[a-z])/),b=0;b<c.length;b++){var k=c[b].split("(")[0],e=c[b].split("(")[1].replace(")","");this.transforms.push(new this.Type[k](e))}};a.AspectRatio=function(c,d,b,k,e,f,g,h,j,l){var d=a.compressSpaces(d),d=d.replace(/^defer\s/,""),o=d.split(" ")[0]||"xMidYMid",d=d.split(" ")[1]||"meet",n=b/k,q=e/f,p=Math.min(n,q),m=Math.max(n,q);d=="meet"&&(k*= p,f*=p);d=="slice"&&(k*=m,f*=m);j=new a.Property("refX",j);l=new a.Property("refY",l);j.hasValue()&&l.hasValue()?c.translate(-p*j.Length.toPixels("x"),-p*l.Length.toPixels("y")):(o.match(/^xMid/)&&(d=="meet"&&p==q||d=="slice"&&m==q)&&c.translate(b/2-k/2,0),o.match(/YMid$/)&&(d=="meet"&&p==n||d=="slice"&&m==n)&&c.translate(0,e/2-f/2),o.match(/^xMax/)&&(d=="meet"&&p==q||d=="slice"&&m==q)&&c.translate(b-k,0),o.match(/YMax$/)&&(d=="meet"&&p==n||d=="slice"&&m==n)&&c.translate(0,e-f));o=="none"?c.scale(n, q):d=="meet"?c.scale(p,p):d=="slice"&&c.scale(m,m);c.translate(g==null?0:-g,h==null?0:-h)};a.Element={};a.Element.ElementBase=function(c){this.attributes={};this.styles={};this.children=[];this.attribute=function(b,d){var c=this.attributes[b];if(c!=null)return c;c=new a.Property(b,"");d==!0&&(this.attributes[b]=c);return c};this.style=function(b,d){var c=this.styles[b];if(c!=null)return c;c=this.attribute(b);if(c!=null&&c.hasValue())return c;c=this.parent;if(c!=null&&(c=c.style(b),c!=null&&c.hasValue()))return c; c=new a.Property(b,"");d==!0&&(this.styles[b]=c);return c};this.render=function(b){if(this.style("display").value!="none"&&this.attribute("visibility").value!="hidden"){b.save();this.setContext(b);if(this.attribute("mask").hasValue()){var a=this.attribute("mask").Definition.getDefinition();a!=null&&a.apply(b,this)}else this.style("filter").hasValue()?(a=this.style("filter").Definition.getDefinition(),a!=null&&a.apply(b,this)):this.renderChildren(b);this.clearContext(b);b.restore()}};this.setContext= function(){};this.clearContext=function(){};this.renderChildren=function(b){for(var a=0;a<this.children.length;a++)this.children[a].render(b)};this.addChild=function(b,d){var c=b;d&&(c=a.CreateElement(b));c.parent=this;this.children.push(c)};if(c!=null&&c.nodeType==1){for(var d=0;d<c.childNodes.length;d++){var b=c.childNodes[d];b.nodeType==1&&this.addChild(b,!0)}for(d=0;d<c.attributes.length;d++)b=c.attributes[d],this.attributes[b.nodeName]=new a.Property(b.nodeName,b.nodeValue);b=a.Styles[c.nodeName]; if(b!=null)for(var k in b)this.styles[k]=b[k];if(this.attribute("class").hasValue())for(var d=a.compressSpaces(this.attribute("class").value).split(" "),e=0;e<d.length;e++){b=a.Styles["."+d[e]];if(b!=null)for(k in b)this.styles[k]=b[k];b=a.Styles[c.nodeName+"."+d[e]];if(b!=null)for(k in b)this.styles[k]=b[k]}if(this.attribute("style").hasValue()){b=this.attribute("style").value.split(";");for(d=0;d<b.length;d++)a.trim(b[d])!=""&&(c=b[d].split(":"),k=a.trim(c[0]),c=a.trim(c[1]),this.styles[k]=new a.Property(k, c))}this.attribute("id").hasValue()&&a.Definitions[this.attribute("id").value]==null&&(a.Definitions[this.attribute("id").value]=this)}};a.Element.RenderedElementBase=function(c){this.base=a.Element.ElementBase;this.base(c);this.setContext=function(d){if(this.style("fill").Definition.isUrl()){var b=this.style("fill").Definition.getFillStyle(this);if(b!=null)d.fillStyle=b}else if(this.style("fill").hasValue())b=this.style("fill"),this.style("fill-opacity").hasValue()&&(b=b.Color.addOpacity(this.style("fill-opacity").value)), d.fillStyle=b.value=="none"?"rgba(0,0,0,0)":b.value;if(this.style("stroke").Definition.isUrl()){if(b=this.style("stroke").Definition.getFillStyle(this),b!=null)d.strokeStyle=b}else if(this.style("stroke").hasValue())b=this.style("stroke"),this.style("stroke-opacity").hasValue()&&(b=b.Color.addOpacity(this.style("stroke-opacity").value)),d.strokeStyle=b.value=="none"?"rgba(0,0,0,0)":b.value;if(this.style("stroke-width").hasValue())d.lineWidth=this.style("stroke-width").Length.toPixels();if(this.style("stroke-linecap").hasValue())d.lineCap= this.style("stroke-linecap").value;if(this.style("stroke-linejoin").hasValue())d.lineJoin=this.style("stroke-linejoin").value;if(this.style("stroke-miterlimit").hasValue())d.miterLimit=this.style("stroke-miterlimit").value;if(typeof d.font!="undefined")d.font=a.Font.CreateFont(this.style("font-style").value,this.style("font-variant").value,this.style("font-weight").value,this.style("font-size").hasValue()?this.style("font-size").Length.toPixels()+"px":"",this.style("font-family").value).toString(); this.attribute("transform").hasValue()&&(new a.Transform(this.attribute("transform").value)).apply(d);this.attribute("clip-path").hasValue()&&(b=this.attribute("clip-path").Definition.getDefinition(),b!=null&&b.apply(d));if(this.style("opacity").hasValue())d.globalAlpha=this.style("opacity").numValue()}};a.Element.RenderedElementBase.prototype=new a.Element.ElementBase;a.Element.PathElementBase=function(c){this.base=a.Element.RenderedElementBase;this.base(c);this.path=function(d){d!=null&&d.beginPath(); return new a.BoundingBox};this.renderChildren=function(d){this.path(d);a.Mouse.checkPath(this,d);d.fillStyle!=""&&d.fill();d.strokeStyle!=""&&d.stroke();var b=this.getMarkers();if(b!=null){if(this.style("marker-start").Definition.isUrl()){var c=this.style("marker-start").Definition.getDefinition();c.render(d,b[0][0],b[0][1])}if(this.style("marker-mid").Definition.isUrl())for(var c=this.style("marker-mid").Definition.getDefinition(),e=1;e<b.length-1;e++)c.render(d,b[e][0],b[e][1]);this.style("marker-end").Definition.isUrl()&& (c=this.style("marker-end").Definition.getDefinition(),c.render(d,b[b.length-1][0],b[b.length-1][1]))}};this.getBoundingBox=function(){return this.path()};this.getMarkers=function(){return null}};a.Element.PathElementBase.prototype=new a.Element.RenderedElementBase;a.Element.svg=function(c){this.base=a.Element.RenderedElementBase;this.base(c);this.baseClearContext=this.clearContext;this.clearContext=function(d){this.baseClearContext(d);a.ViewPort.RemoveCurrent()};this.baseSetContext=this.setContext; this.setContext=function(d){d.strokeStyle="rgba(0,0,0,0)";d.lineCap="butt";d.lineJoin="miter";d.miterLimit=4;this.baseSetContext(d);this.attribute("x").hasValue()&&this.attribute("y").hasValue()&&d.translate(this.attribute("x").Length.toPixels("x"),this.attribute("y").Length.toPixels("y"));var b=a.ViewPort.width(),c=a.ViewPort.height();if(typeof this.root=="undefined"&&this.attribute("width").hasValue()&&this.attribute("height").hasValue()){var b=this.attribute("width").Length.toPixels("x"),c=this.attribute("height").Length.toPixels("y"), e=0,f=0;this.attribute("refX").hasValue()&&this.attribute("refY").hasValue()&&(e=-this.attribute("refX").Length.toPixels("x"),f=-this.attribute("refY").Length.toPixels("y"));d.beginPath();d.moveTo(e,f);d.lineTo(b,f);d.lineTo(b,c);d.lineTo(e,c);d.closePath();d.clip()}a.ViewPort.SetCurrent(b,c);if(this.attribute("viewBox").hasValue()){var e=a.ToNumberArray(this.attribute("viewBox").value),f=e[0],g=e[1],b=e[2],c=e[3];a.AspectRatio(d,this.attribute("preserveAspectRatio").value,a.ViewPort.width(),b,a.ViewPort.height(), c,f,g,this.attribute("refX").value,this.attribute("refY").value);a.ViewPort.RemoveCurrent();a.ViewPort.SetCurrent(e[2],e[3])}}};a.Element.svg.prototype=new a.Element.RenderedElementBase;a.Element.rect=function(c){this.base=a.Element.PathElementBase;this.base(c);this.path=function(d){var b=this.attribute("x").Length.toPixels("x"),c=this.attribute("y").Length.toPixels("y"),e=this.attribute("width").Length.toPixels("x"),f=this.attribute("height").Length.toPixels("y"),g=this.attribute("rx").Length.toPixels("x"), h=this.attribute("ry").Length.toPixels("y");this.attribute("rx").hasValue()&&!this.attribute("ry").hasValue()&&(h=g);this.attribute("ry").hasValue()&&!this.attribute("rx").hasValue()&&(g=h);d!=null&&(d.beginPath(),d.moveTo(b+g,c),d.lineTo(b+e-g,c),d.quadraticCurveTo(b+e,c,b+e,c+h),d.lineTo(b+e,c+f-h),d.quadraticCurveTo(b+e,c+f,b+e-g,c+f),d.lineTo(b+g,c+f),d.quadraticCurveTo(b,c+f,b,c+f-h),d.lineTo(b,c+h),d.quadraticCurveTo(b,c,b+g,c),d.closePath());return new a.BoundingBox(b,c,b+e,c+f)}};a.Element.rect.prototype= new a.Element.PathElementBase;a.Element.circle=function(c){this.base=a.Element.PathElementBase;this.base(c);this.path=function(d){var b=this.attribute("cx").Length.toPixels("x"),c=this.attribute("cy").Length.toPixels("y"),e=this.attribute("r").Length.toPixels();d!=null&&(d.beginPath(),d.arc(b,c,e,0,Math.PI*2,!0),d.closePath());return new a.BoundingBox(b-e,c-e,b+e,c+e)}};a.Element.circle.prototype=new a.Element.PathElementBase;a.Element.ellipse=function(c){this.base=a.Element.PathElementBase;this.base(c); this.path=function(d){var b=4*((Math.sqrt(2)-1)/3),c=this.attribute("rx").Length.toPixels("x"),e=this.attribute("ry").Length.toPixels("y"),f=this.attribute("cx").Length.toPixels("x"),g=this.attribute("cy").Length.toPixels("y");d!=null&&(d.beginPath(),d.moveTo(f,g-e),d.bezierCurveTo(f+b*c,g-e,f+c,g-b*e,f+c,g),d.bezierCurveTo(f+c,g+b*e,f+b*c,g+e,f,g+e),d.bezierCurveTo(f-b*c,g+e,f-c,g+b*e,f-c,g),d.bezierCurveTo(f-c,g-b*e,f-b*c,g-e,f,g-e),d.closePath());return new a.BoundingBox(f-c,g-e,f+c,g+e)}};a.Element.ellipse.prototype= new a.Element.PathElementBase;a.Element.line=function(c){this.base=a.Element.PathElementBase;this.base(c);this.getPoints=function(){return[new a.Point(this.attribute("x1").Length.toPixels("x"),this.attribute("y1").Length.toPixels("y")),new a.Point(this.attribute("x2").Length.toPixels("x"),this.attribute("y2").Length.toPixels("y"))]};this.path=function(d){var b=this.getPoints();d!=null&&(d.beginPath(),d.moveTo(b[0].x,b[0].y),d.lineTo(b[1].x,b[1].y));return new a.BoundingBox(b[0].x,b[0].y,b[1].x,b[1].y)}; this.getMarkers=function(){var a=this.getPoints(),b=a[0].angleTo(a[1]);return[[a[0],b],[a[1],b]]}};a.Element.line.prototype=new a.Element.PathElementBase;a.Element.polyline=function(c){this.base=a.Element.PathElementBase;this.base(c);this.points=a.CreatePath(this.attribute("points").value);this.path=function(d){var b=new a.BoundingBox(this.points[0].x,this.points[0].y);d!=null&&(d.beginPath(),d.moveTo(this.points[0].x,this.points[0].y));for(var c=1;c<this.points.length;c++)b.addPoint(this.points[c].x, this.points[c].y),d!=null&&d.lineTo(this.points[c].x,this.points[c].y);return b};this.getMarkers=function(){for(var a=[],b=0;b<this.points.length-1;b++)a.push([this.points[b],this.points[b].angleTo(this.points[b+1])]);a.push([this.points[this.points.length-1],a[a.length-1][1]]);return a}};a.Element.polyline.prototype=new a.Element.PathElementBase;a.Element.polygon=function(c){this.base=a.Element.polyline;this.base(c);this.basePath=this.path;this.path=function(a){var b=this.basePath(a);a!=null&&(a.lineTo(this.points[0].x, this.points[0].y),a.closePath());return b}};a.Element.polygon.prototype=new a.Element.polyline;a.Element.path=function(c){this.base=a.Element.PathElementBase;this.base(c);c=this.attribute("d").value;c=c.replace(/,/gm," ");c=c.replace(/([MmZzLlHhVvCcSsQqTtAa])([MmZzLlHhVvCcSsQqTtAa])/gm,"$1 $2");c=c.replace(/([MmZzLlHhVvCcSsQqTtAa])([MmZzLlHhVvCcSsQqTtAa])/gm,"$1 $2");c=c.replace(/([MmZzLlHhVvCcSsQqTtAa])([^\s])/gm,"$1 $2");c=c.replace(/([^\s])([MmZzLlHhVvCcSsQqTtAa])/gm,"$1 $2");c=c.replace(/([0-9])([+\-])/gm, "$1 $2");c=c.replace(/(\.[0-9]*)(\.)/gm,"$1 $2");c=c.replace(/([Aa](\s+[0-9]+){3})\s+([01])\s*([01])/gm,"$1 $3 $4 ");c=a.compressSpaces(c);c=a.trim(c);this.PathParser=new function(d){this.tokens=d.split(" ");this.reset=function(){this.i=-1;this.previousCommand=this.command="";this.start=new a.Point(0,0);this.control=new a.Point(0,0);this.current=new a.Point(0,0);this.points=[];this.angles=[]};this.isEnd=function(){return this.i>=this.tokens.length-1};this.isCommandOrEnd=function(){return this.isEnd()? !0:this.tokens[this.i+1].match(/^[A-Za-z]$/)!=null};this.isRelativeCommand=function(){return this.command==this.command.toLowerCase()};this.getToken=function(){this.i+=1;return this.tokens[this.i]};this.getScalar=function(){return parseFloat(this.getToken())};this.nextCommand=function(){this.previousCommand=this.command;this.command=this.getToken()};this.getPoint=function(){return this.makeAbsolute(new a.Point(this.getScalar(),this.getScalar()))};this.getAsControlPoint=function(){var b=this.getPoint(); return this.control=b};this.getAsCurrentPoint=function(){var b=this.getPoint();return this.current=b};this.getReflectedControlPoint=function(){return this.previousCommand.toLowerCase()!="c"&&this.previousCommand.toLowerCase()!="s"?this.current:new a.Point(2*this.current.x-this.control.x,2*this.current.y-this.control.y)};this.makeAbsolute=function(b){if(this.isRelativeCommand())b.x=this.current.x+b.x,b.y=this.current.y+b.y;return b};this.addMarker=function(b,a,d){d!=null&&this.angles.length>0&&this.angles[this.angles.length- 1]==null&&(this.angles[this.angles.length-1]=this.points[this.points.length-1].angleTo(d));this.addMarkerAngle(b,a==null?null:a.angleTo(b))};this.addMarkerAngle=function(b,a){this.points.push(b);this.angles.push(a)};this.getMarkerPoints=function(){return this.points};this.getMarkerAngles=function(){for(var b=0;b<this.angles.length;b++)if(this.angles[b]==null)for(var a=b+1;a<this.angles.length;a++)if(this.angles[a]!=null){this.angles[b]=this.angles[a];break}return this.angles}}(c);this.path=function(d){var b= this.PathParser;b.reset();var c=new a.BoundingBox;for(d!=null&&d.beginPath();!b.isEnd();)switch(b.nextCommand(),b.command.toUpperCase()){case "M":var e=b.getAsCurrentPoint();b.addMarker(e);c.addPoint(e.x,e.y);d!=null&&d.moveTo(e.x,e.y);for(b.start=b.current;!b.isCommandOrEnd();)e=b.getAsCurrentPoint(),b.addMarker(e,b.start),c.addPoint(e.x,e.y),d!=null&&d.lineTo(e.x,e.y);break;case "L":for(;!b.isCommandOrEnd();){var f=b.current,e=b.getAsCurrentPoint();b.addMarker(e,f);c.addPoint(e.x,e.y);d!=null&& d.lineTo(e.x,e.y)}break;case "H":for(;!b.isCommandOrEnd();)e=new a.Point((b.isRelativeCommand()?b.current.x:0)+b.getScalar(),b.current.y),b.addMarker(e,b.current),b.current=e,c.addPoint(b.current.x,b.current.y),d!=null&&d.lineTo(b.current.x,b.current.y);break;case "V":for(;!b.isCommandOrEnd();)e=new a.Point(b.current.x,(b.isRelativeCommand()?b.current.y:0)+b.getScalar()),b.addMarker(e,b.current),b.current=e,c.addPoint(b.current.x,b.current.y),d!=null&&d.lineTo(b.current.x,b.current.y);break;case "C":for(;!b.isCommandOrEnd();){var g= b.current,f=b.getPoint(),h=b.getAsControlPoint(),e=b.getAsCurrentPoint();b.addMarker(e,h,f);c.addBezierCurve(g.x,g.y,f.x,f.y,h.x,h.y,e.x,e.y);d!=null&&d.bezierCurveTo(f.x,f.y,h.x,h.y,e.x,e.y)}break;case "S":for(;!b.isCommandOrEnd();)g=b.current,f=b.getReflectedControlPoint(),h=b.getAsControlPoint(),e=b.getAsCurrentPoint(),b.addMarker(e,h,f),c.addBezierCurve(g.x,g.y,f.x,f.y,h.x,h.y,e.x,e.y),d!=null&&d.bezierCurveTo(f.x,f.y,h.x,h.y,e.x,e.y);break;case "Q":for(;!b.isCommandOrEnd();)g=b.current,h=b.getAsControlPoint(), e=b.getAsCurrentPoint(),b.addMarker(e,h,h),c.addQuadraticCurve(g.x,g.y,h.x,h.y,e.x,e.y),d!=null&&d.quadraticCurveTo(h.x,h.y,e.x,e.y);break;case "T":for(;!b.isCommandOrEnd();)g=b.current,h=b.getReflectedControlPoint(),b.control=h,e=b.getAsCurrentPoint(),b.addMarker(e,h,h),c.addQuadraticCurve(g.x,g.y,h.x,h.y,e.x,e.y),d!=null&&d.quadraticCurveTo(h.x,h.y,e.x,e.y);break;case "A":for(;!b.isCommandOrEnd();){var g=b.current,j=b.getScalar(),l=b.getScalar(),f=b.getScalar()*(Math.PI/180),o=b.getScalar(),h=b.getScalar(), e=b.getAsCurrentPoint(),n=new a.Point(Math.cos(f)*(g.x-e.x)/2+Math.sin(f)*(g.y-e.y)/2,-Math.sin(f)*(g.x-e.x)/2+Math.cos(f)*(g.y-e.y)/2),q=Math.pow(n.x,2)/Math.pow(j,2)+Math.pow(n.y,2)/Math.pow(l,2);q>1&&(j*=Math.sqrt(q),l*=Math.sqrt(q));o=(o==h?-1:1)*Math.sqrt((Math.pow(j,2)*Math.pow(l,2)-Math.pow(j,2)*Math.pow(n.y,2)-Math.pow(l,2)*Math.pow(n.x,2))/(Math.pow(j,2)*Math.pow(n.y,2)+Math.pow(l,2)*Math.pow(n.x,2)));isNaN(o)&&(o=0);var p=new a.Point(o*j*n.y/l,o*-l*n.x/j),g=new a.Point((g.x+e.x)/2+Math.cos(f)* p.x-Math.sin(f)*p.y,(g.y+e.y)/2+Math.sin(f)*p.x+Math.cos(f)*p.y),m=function(b,a){return(b[0]*a[0]+b[1]*a[1])/(Math.sqrt(Math.pow(b[0],2)+Math.pow(b[1],2))*Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2)))},t=function(b,a){return(b[0]*a[1]<b[1]*a[0]?-1:1)*Math.acos(m(b,a))},o=t([1,0],[(n.x-p.x)/j,(n.y-p.y)/l]),q=[(n.x-p.x)/j,(n.y-p.y)/l],p=[(-n.x-p.x)/j,(-n.y-p.y)/l],n=t(q,p);if(m(q,p)<=-1)n=Math.PI;m(q,p)>=1&&(n=0);h==0&&n>0&&(n-=2*Math.PI);h==1&&n<0&&(n+=2*Math.PI);q=new a.Point(g.x-j*Math.cos((o+n)/ 2),g.y-l*Math.sin((o+n)/2));b.addMarkerAngle(q,(o+n)/2+(h==0?1:-1)*Math.PI/2);b.addMarkerAngle(e,n+(h==0?1:-1)*Math.PI/2);c.addPoint(e.x,e.y);d!=null&&(m=j>l?j:l,e=j>l?1:j/l,j=j>l?l/j:1,d.translate(g.x,g.y),d.rotate(f),d.scale(e,j),d.arc(0,0,m,o,o+n,1-h),d.scale(1/e,1/j),d.rotate(-f),d.translate(-g.x,-g.y))}break;case "Z":d!=null&&d.closePath(),b.current=b.start}return c};this.getMarkers=function(){for(var a=this.PathParser.getMarkerPoints(),b=this.PathParser.getMarkerAngles(),c=[],e=0;e<a.length;e++)c.push([a[e], b[e]]);return c}};a.Element.path.prototype=new a.Element.PathElementBase;a.Element.pattern=function(c){this.base=a.Element.ElementBase;this.base(c);this.createPattern=function(d){var b=new a.Element.svg;b.attributes.viewBox=new a.Property("viewBox",this.attribute("viewBox").value);b.attributes.x=new a.Property("x",this.attribute("x").value);b.attributes.y=new a.Property("y",this.attribute("y").value);b.attributes.width=new a.Property("width",this.attribute("width").value);b.attributes.height=new a.Property("height", this.attribute("height").value);b.children=this.children;var c=document.createElement("canvas");c.width=this.attribute("width").Length.toPixels("x");c.height=this.attribute("height").Length.toPixels("y");b.render(c.getContext("2d"));return d.createPattern(c,"repeat")}};a.Element.pattern.prototype=new a.Element.ElementBase;a.Element.marker=function(c){this.base=a.Element.ElementBase;this.base(c);this.baseRender=this.render;this.render=function(d,b,c){d.translate(b.x,b.y);this.attribute("orient").valueOrDefault("auto")== "auto"&&d.rotate(c);this.attribute("markerUnits").valueOrDefault("strokeWidth")=="strokeWidth"&&d.scale(d.lineWidth,d.lineWidth);d.save();var e=new a.Element.svg;e.attributes.viewBox=new a.Property("viewBox",this.attribute("viewBox").value);e.attributes.refX=new a.Property("refX",this.attribute("refX").value);e.attributes.refY=new a.Property("refY",this.attribute("refY").value);e.attributes.width=new a.Property("width",this.attribute("markerWidth").value);e.attributes.height=new a.Property("height", this.attribute("markerHeight").value);e.attributes.fill=new a.Property("fill",this.attribute("fill").valueOrDefault("black"));e.attributes.stroke=new a.Property("stroke",this.attribute("stroke").valueOrDefault("none"));e.children=this.children;e.render(d);d.restore();this.attribute("markerUnits").valueOrDefault("strokeWidth")=="strokeWidth"&&d.scale(1/d.lineWidth,1/d.lineWidth);this.attribute("orient").valueOrDefault("auto")=="auto"&&d.rotate(-c);d.translate(-b.x,-b.y)}};a.Element.marker.prototype= new a.Element.ElementBase;a.Element.defs=function(c){this.base=a.Element.ElementBase;this.base(c);this.render=function(){}};a.Element.defs.prototype=new a.Element.ElementBase;a.Element.GradientBase=function(c){this.base=a.Element.ElementBase;this.base(c);this.gradientUnits=this.attribute("gradientUnits").valueOrDefault("objectBoundingBox");this.stops=[];for(c=0;c<this.children.length;c++)this.stops.push(this.children[c]);this.getGradient=function(){};this.createGradient=function(d,b){var c=this;this.attribute("xlink:href").hasValue()&& (c=this.attribute("xlink:href").Definition.getDefinition());for(var e=this.getGradient(d,b),f=0;f<c.stops.length;f++)e.addColorStop(c.stops[f].offset,c.stops[f].color);if(this.attribute("gradientTransform").hasValue()){c=a.ViewPort.viewPorts[0];f=new a.Element.rect;f.attributes.x=new a.Property("x",-a.MAX_VIRTUAL_PIXELS/3);f.attributes.y=new a.Property("y",-a.MAX_VIRTUAL_PIXELS/3);f.attributes.width=new a.Property("width",a.MAX_VIRTUAL_PIXELS);f.attributes.height=new a.Property("height",a.MAX_VIRTUAL_PIXELS); var g=new a.Element.g;g.attributes.transform=new a.Property("transform",this.attribute("gradientTransform").value);g.children=[f];f=new a.Element.svg;f.attributes.x=new a.Property("x",0);f.attributes.y=new a.Property("y",0);f.attributes.width=new a.Property("width",c.width);f.attributes.height=new a.Property("height",c.height);f.children=[g];g=document.createElement("canvas");g.width=c.width;g.height=c.height;c=g.getContext("2d");c.fillStyle=e;f.render(c);return c.createPattern(g,"no-repeat")}return e}}; a.Element.GradientBase.prototype=new a.Element.ElementBase;a.Element.linearGradient=function(c){this.base=a.Element.GradientBase;this.base(c);this.getGradient=function(a,b){var c=b.getBoundingBox(),e=this.gradientUnits=="objectBoundingBox"?c.x()+c.width()*this.attribute("x1").numValue():this.attribute("x1").Length.toPixels("x"),f=this.gradientUnits=="objectBoundingBox"?c.y()+c.height()*this.attribute("y1").numValue():this.attribute("y1").Length.toPixels("y"),g=this.gradientUnits=="objectBoundingBox"? c.x()+c.width()*this.attribute("x2").numValue():this.attribute("x2").Length.toPixels("x"),c=this.gradientUnits=="objectBoundingBox"?c.y()+c.height()*this.attribute("y2").numValue():this.attribute("y2").Length.toPixels("y");return a.createLinearGradient(e,f,g,c)}};a.Element.linearGradient.prototype=new a.Element.GradientBase;a.Element.radialGradient=function(c){this.base=a.Element.GradientBase;this.base(c);this.getGradient=function(a,b){var c=b.getBoundingBox(),e=this.gradientUnits=="objectBoundingBox"? c.x()+c.width()*this.attribute("cx").numValue():this.attribute("cx").Length.toPixels("x"),f=this.gradientUnits=="objectBoundingBox"?c.y()+c.height()*this.attribute("cy").numValue():this.attribute("cy").Length.toPixels("y"),g=e,h=f;this.attribute("fx").hasValue()&&(g=this.gradientUnits=="objectBoundingBox"?c.x()+c.width()*this.attribute("fx").numValue():this.attribute("fx").Length.toPixels("x"));this.attribute("fy").hasValue()&&(h=this.gradientUnits=="objectBoundingBox"?c.y()+c.height()*this.attribute("fy").numValue(): this.attribute("fy").Length.toPixels("y"));c=this.gradientUnits=="objectBoundingBox"?(c.width()+c.height())/2*this.attribute("r").numValue():this.attribute("r").Length.toPixels();return a.createRadialGradient(g,h,0,e,f,c)}};a.Element.radialGradient.prototype=new a.Element.GradientBase;a.Element.stop=function(c){this.base=a.Element.ElementBase;this.base(c);this.offset=this.attribute("offset").numValue();c=this.style("stop-color");this.style("stop-opacity").hasValue()&&(c=c.Color.addOpacity(this.style("stop-opacity").value)); this.color=c.value};a.Element.stop.prototype=new a.Element.ElementBase;a.Element.AnimateBase=function(c){this.base=a.Element.ElementBase;this.base(c);a.Animations.push(this);this.duration=0;this.begin=this.attribute("begin").Time.toMilliseconds();this.maxDuration=this.begin+this.attribute("dur").Time.toMilliseconds();this.getProperty=function(){var a=this.attribute("attributeType").value,b=this.attribute("attributeName").value;return a=="CSS"?this.parent.style(b,!0):this.parent.attribute(b,!0)};this.initialValue= null;this.removed=!1;this.calcValue=function(){return""};this.update=function(a){if(this.initialValue==null)this.initialValue=this.getProperty().value;if(this.duration>this.maxDuration)if(this.attribute("repeatCount").value=="indefinite")this.duration=0;else return this.attribute("fill").valueOrDefault("remove")=="remove"&&!this.removed?(this.removed=!0,this.getProperty().value=this.initialValue,!0):!1;this.duration+=a;a=!1;if(this.begin<this.duration)a=this.calcValue(),this.attribute("type").hasValue()&& (a=this.attribute("type").value+"("+a+")"),this.getProperty().value=a,a=!0;return a};this.progress=function(){return(this.duration-this.begin)/(this.maxDuration-this.begin)}};a.Element.AnimateBase.prototype=new a.Element.ElementBase;a.Element.animate=function(c){this.base=a.Element.AnimateBase;this.base(c);this.calcValue=function(){var a=this.attribute("from").numValue(),b=this.attribute("to").numValue();return a+(b-a)*this.progress()}};a.Element.animate.prototype=new a.Element.AnimateBase;a.Element.animateColor= function(c){this.base=a.Element.AnimateBase;this.base(c);this.calcValue=function(){var a=new RGBColor(this.attribute("from").value),b=new RGBColor(this.attribute("to").value);if(a.ok&&b.ok){var c=a.r+(b.r-a.r)*this.progress(),e=a.g+(b.g-a.g)*this.progress(),a=a.b+(b.b-a.b)*this.progress();return"rgb("+parseInt(c,10)+","+parseInt(e,10)+","+parseInt(a,10)+")"}return this.attribute("from").value}};a.Element.animateColor.prototype=new a.Element.AnimateBase;a.Element.animateTransform=function(c){this.base= a.Element.animate;this.base(c)};a.Element.animateTransform.prototype=new a.Element.animate;a.Element.font=function(c){this.base=a.Element.ElementBase;this.base(c);this.horizAdvX=this.attribute("horiz-adv-x").numValue();this.isArabic=this.isRTL=!1;this.missingGlyph=this.fontFace=null;this.glyphs=[];for(c=0;c<this.children.length;c++){var d=this.children[c];if(d.type=="font-face")this.fontFace=d,d.style("font-family").hasValue()&&(a.Definitions[d.style("font-family").value]=this);else if(d.type=="missing-glyph")this.missingGlyph= d;else if(d.type=="glyph")d.arabicForm!=""?(this.isArabic=this.isRTL=!0,typeof this.glyphs[d.unicode]=="undefined"&&(this.glyphs[d.unicode]=[]),this.glyphs[d.unicode][d.arabicForm]=d):this.glyphs[d.unicode]=d}};a.Element.font.prototype=new a.Element.ElementBase;a.Element.fontface=function(c){this.base=a.Element.ElementBase;this.base(c);this.ascent=this.attribute("ascent").value;this.descent=this.attribute("descent").value;this.unitsPerEm=this.attribute("units-per-em").numValue()};a.Element.fontface.prototype= new a.Element.ElementBase;a.Element.missingglyph=function(c){this.base=a.Element.path;this.base(c);this.horizAdvX=0};a.Element.missingglyph.prototype=new a.Element.path;a.Element.glyph=function(c){this.base=a.Element.path;this.base(c);this.horizAdvX=this.attribute("horiz-adv-x").numValue();this.unicode=this.attribute("unicode").value;this.arabicForm=this.attribute("arabic-form").value};a.Element.glyph.prototype=new a.Element.path;a.Element.text=function(c){this.base=a.Element.RenderedElementBase; this.base(c);if(c!=null){this.children=[];for(var d=0;d<c.childNodes.length;d++){var b=c.childNodes[d];b.nodeType==1?this.addChild(b,!0):b.nodeType==3&&this.addChild(new a.Element.tspan(b),!1)}}this.baseSetContext=this.setContext;this.setContext=function(b){this.baseSetContext(b);if(this.style("dominant-baseline").hasValue())b.textBaseline=this.style("dominant-baseline").value;if(this.style("alignment-baseline").hasValue())b.textBaseline=this.style("alignment-baseline").value};this.renderChildren= function(b){for(var a=this.style("text-anchor").valueOrDefault("start"),c=this.attribute("x").Length.toPixels("x"),d=this.attribute("y").Length.toPixels("y"),h=0;h<this.children.length;h++){var j=this.children[h];j.attribute("x").hasValue()?j.x=j.attribute("x").Length.toPixels("x"):(j.attribute("dx").hasValue()&&(c+=j.attribute("dx").Length.toPixels("x")),j.x=c);c=j.measureText(b);if(a!="start"&&(h==0||j.attribute("x").hasValue())){for(var l=c,o=h+1;o<this.children.length;o++){var n=this.children[o]; if(n.attribute("x").hasValue())break;l+=n.measureText(b)}j.x-=a=="end"?l:l/2}c=j.x+c;j.attribute("y").hasValue()?j.y=j.attribute("y").Length.toPixels("y"):(j.attribute("dy").hasValue()&&(d+=j.attribute("dy").Length.toPixels("y")),j.y=d);d=j.y;j.render(b)}}};a.Element.text.prototype=new a.Element.RenderedElementBase;a.Element.TextElementBase=function(c){this.base=a.Element.RenderedElementBase;this.base(c);this.getGlyph=function(a,b,c){var e=b[c],f=null;if(a.isArabic){var g="isolated";if((c==0||b[c- 1]==" ")&&c<b.length-2&&b[c+1]!=" ")g="terminal";c>0&&b[c-1]!=" "&&c<b.length-2&&b[c+1]!=" "&&(g="medial");if(c>0&&b[c-1]!=" "&&(c==b.length-1||b[c+1]==" "))g="initial";typeof a.glyphs[e]!="undefined"&&(f=a.glyphs[e][g],f==null&&a.glyphs[e].type=="glyph"&&(f=a.glyphs[e]))}else f=a.glyphs[e];if(f==null)f=a.missingGlyph;return f};this.renderChildren=function(c){var b=this.parent.style("font-family").Definition.getDefinition();if(b!=null){var k=this.parent.style("font-size").numValueOrDefault(a.Font.Parse(a.ctx.font).fontSize), e=this.parent.style("font-style").valueOrDefault(a.Font.Parse(a.ctx.font).fontStyle),f=this.getText();b.isRTL&&(f=f.split("").reverse().join(""));for(var g=a.ToNumberArray(this.parent.attribute("dx").value),h=0;h<f.length;h++){var j=this.getGlyph(b,f,h),l=k/b.fontFace.unitsPerEm;c.translate(this.x,this.y);c.scale(l,-l);var o=c.lineWidth;c.lineWidth=c.lineWidth*b.fontFace.unitsPerEm/k;e=="italic"&&c.transform(1,0,0.4,1,0,0);j.render(c);e=="italic"&&c.transform(1,0,-0.4,1,0,0);c.lineWidth=o;c.scale(1/ l,-1/l);c.translate(-this.x,-this.y);this.x+=k*(j.horizAdvX||b.horizAdvX)/b.fontFace.unitsPerEm;typeof g[h]!="undefined"&&!isNaN(g[h])&&(this.x+=g[h])}}else c.strokeStyle!=""&&c.strokeText(a.compressSpaces(this.getText()),this.x,this.y),c.fillStyle!=""&&c.fillText(a.compressSpaces(this.getText()),this.x,this.y)};this.getText=function(){};this.measureText=function(c){var b=this.parent.style("font-family").Definition.getDefinition();if(b!=null){var c=this.parent.style("font-size").numValueOrDefault(a.Font.Parse(a.ctx.font).fontSize), k=0,e=this.getText();b.isRTL&&(e=e.split("").reverse().join(""));for(var f=a.ToNumberArray(this.parent.attribute("dx").value),g=0;g<e.length;g++){var h=this.getGlyph(b,e,g);k+=(h.horizAdvX||b.horizAdvX)*c/b.fontFace.unitsPerEm;typeof f[g]!="undefined"&&!isNaN(f[g])&&(k+=f[g])}return k}b=a.compressSpaces(this.getText());if(!c.measureText)return b.length*10;c.save();this.setContext(c);b=c.measureText(b).width;c.restore();return b}};a.Element.TextElementBase.prototype=new a.Element.RenderedElementBase; a.Element.tspan=function(c){this.base=a.Element.TextElementBase;this.base(c);this.text=c.nodeType==3?c.nodeValue:c.childNodes.length>0?c.childNodes[0].nodeValue:c.text;this.getText=function(){return this.text}};a.Element.tspan.prototype=new a.Element.TextElementBase;a.Element.tref=function(c){this.base=a.Element.TextElementBase;this.base(c);this.getText=function(){var a=this.attribute("xlink:href").Definition.getDefinition();if(a!=null)return a.children[0].getText()}};a.Element.tref.prototype=new a.Element.TextElementBase; a.Element.a=function(c){this.base=a.Element.TextElementBase;this.base(c);this.hasText=!0;for(var d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeType!=3)this.hasText=!1;this.text=this.hasText?c.childNodes[0].nodeValue:"";this.getText=function(){return this.text};this.baseRenderChildren=this.renderChildren;this.renderChildren=function(b){if(this.hasText){this.baseRenderChildren(b);var c=new a.Property("fontSize",a.Font.Parse(a.ctx.font).fontSize);a.Mouse.checkBoundingBox(this,new a.BoundingBox(this.x, this.y-c.Length.toPixels("y"),this.x+this.measureText(b),this.y))}else c=new a.Element.g,c.children=this.children,c.parent=this,c.render(b)};this.onclick=function(){window.open(this.attribute("xlink:href").value)};this.onmousemove=function(){a.ctx.canvas.style.cursor="pointer"}};a.Element.a.prototype=new a.Element.TextElementBase;a.Element.image=function(c){this.base=a.Element.RenderedElementBase;this.base(c);a.Images.push(this);this.img=document.createElement("img");this.loaded=!1;var d=this;this.img.onload= function(){d.loaded=!0};this.img.src=this.attribute("xlink:href").value;this.renderChildren=function(b){var c=this.attribute("x").Length.toPixels("x"),d=this.attribute("y").Length.toPixels("y"),f=this.attribute("width").Length.toPixels("x"),g=this.attribute("height").Length.toPixels("y");f==0||g==0||(b.save(),b.translate(c,d),a.AspectRatio(b,this.attribute("preserveAspectRatio").value,f,this.img.width,g,this.img.height,0,0),b.drawImage(this.img,0,0),b.restore())}};a.Element.image.prototype=new a.Element.RenderedElementBase; a.Element.g=function(c){this.base=a.Element.RenderedElementBase;this.base(c);this.getBoundingBox=function(){for(var c=new a.BoundingBox,b=0;b<this.children.length;b++)c.addBoundingBox(this.children[b].getBoundingBox());return c}};a.Element.g.prototype=new a.Element.RenderedElementBase;a.Element.symbol=function(c){this.base=a.Element.RenderedElementBase;this.base(c);this.baseSetContext=this.setContext;this.setContext=function(c){this.baseSetContext(c);if(this.attribute("viewBox").hasValue()){var b= a.ToNumberArray(this.attribute("viewBox").value),k=b[0],e=b[1];width=b[2];height=b[3];a.AspectRatio(c,this.attribute("preserveAspectRatio").value,this.attribute("width").Length.toPixels("x"),width,this.attribute("height").Length.toPixels("y"),height,k,e);a.ViewPort.SetCurrent(b[2],b[3])}}};a.Element.symbol.prototype=new a.Element.RenderedElementBase;a.Element.style=function(c){this.base=a.Element.ElementBase;this.base(c);for(var c=c.childNodes[0].nodeValue+(c.childNodes.length>1?c.childNodes[1].nodeValue: ""),c=c.replace(/(\/\*([^*]|[\r\n]|(\*+([^*\/]|[\r\n])))*\*+\/)|(^[\s]*\/\/.*)/gm,""),c=a.compressSpaces(c),c=c.split("}"),d=0;d<c.length;d++)if(a.trim(c[d])!="")for(var b=c[d].split("{"),k=b[0].split(","),b=b[1].split(";"),e=0;e<k.length;e++){var f=a.trim(k[e]);if(f!=""){for(var g={},h=0;h<b.length;h++){var j=b[h].indexOf(":"),l=b[h].substr(0,j),j=b[h].substr(j+1,b[h].length-j);l!=null&&j!=null&&(g[a.trim(l)]=new a.Property(a.trim(l),a.trim(j)))}a.Styles[f]=g;if(f=="@font-face"){f=g["font-family"].value.replace(/"/g, "");g=g.src.value.split(",");for(h=0;h<g.length;h++)if(g[h].indexOf('format("svg")')>0){l=g[h].indexOf("url");j=g[h].indexOf(")",l);l=g[h].substr(l+5,j-l-6);l=a.parseXml(a.ajax(l)).getElementsByTagName("font");for(j=0;j<l.length;j++){var o=a.CreateElement(l[j]);a.Definitions[f]=o}}}}}};a.Element.style.prototype=new a.Element.ElementBase;a.Element.use=function(c){this.base=a.Element.RenderedElementBase;this.base(c);this.baseSetContext=this.setContext;this.setContext=function(a){this.baseSetContext(a); this.attribute("x").hasValue()&&a.translate(this.attribute("x").Length.toPixels("x"),0);this.attribute("y").hasValue()&&a.translate(0,this.attribute("y").Length.toPixels("y"))};this.getDefinition=function(){var a=this.attribute("xlink:href").Definition.getDefinition();if(this.attribute("width").hasValue())a.attribute("width",!0).value=this.attribute("width").value;if(this.attribute("height").hasValue())a.attribute("height",!0).value=this.attribute("height").value;return a};this.path=function(a){var b= this.getDefinition();b!=null&&b.path(a)};this.renderChildren=function(a){var b=this.getDefinition();b!=null&&b.render(a)}};a.Element.use.prototype=new a.Element.RenderedElementBase;a.Element.mask=function(c){this.base=a.Element.ElementBase;this.base(c);this.apply=function(a,b){var c=this.attribute("x").Length.toPixels("x"),e=this.attribute("y").Length.toPixels("y"),f=this.attribute("width").Length.toPixels("x"),g=this.attribute("height").Length.toPixels("y"),h=b.attribute("mask").value;b.attribute("mask").value= "";var j=document.createElement("canvas");j.width=c+f;j.height=e+g;var l=j.getContext("2d");this.renderChildren(l);var o=document.createElement("canvas");o.width=c+f;o.height=e+g;var n=o.getContext("2d");b.render(n);n.globalCompositeOperation="destination-in";n.fillStyle=l.createPattern(j,"no-repeat");n.fillRect(0,0,c+f,e+g);a.fillStyle=n.createPattern(o,"no-repeat");a.fillRect(0,0,c+f,e+g);b.attribute("mask").value=h};this.render=function(){}};a.Element.mask.prototype=new a.Element.ElementBase;a.Element.clipPath= function(c){this.base=a.Element.ElementBase;this.base(c);this.apply=function(a){for(var b=0;b<this.children.length;b++)this.children[b].path&&(this.children[b].path(a),a.clip())};this.render=function(){}};a.Element.clipPath.prototype=new a.Element.ElementBase;a.Element.filter=function(c){this.base=a.Element.ElementBase;this.base(c);this.apply=function(a,b){var c=b.getBoundingBox(),e=this.attribute("x").Length.toPixels("x"),f=this.attribute("y").Length.toPixels("y");if(e==0||f==0)e=c.x1,f=c.y1;var g= this.attribute("width").Length.toPixels("x"),h=this.attribute("height").Length.toPixels("y");if(g==0||h==0)g=c.width(),h=c.height();c=b.style("filter").value;b.style("filter").value="";var j=0.2*g,l=0.2*h,o=document.createElement("canvas");o.width=g+2*j;o.height=h+2*l;var n=o.getContext("2d");n.translate(-e+j,-f+l);b.render(n);for(var q=0;q<this.children.length;q++)this.children[q].apply(n,0,0,g+2*j,h+2*l);a.drawImage(o,0,0,g+2*j,h+2*l,e-j,f-l,g+2*j,h+2*l);b.style("filter",!0).value=c};this.render= function(){}};a.Element.filter.prototype=new a.Element.ElementBase;a.Element.feGaussianBlur=function(c){function d(a,c,d,f,g){for(var h=0;h<g;h++)for(var j=0;j<f;j++)for(var l=a[h*f*4+j*4+3]/255,o=0;o<4;o++){for(var n=d[0]*(l==0?255:a[h*f*4+j*4+o])*(l==0||o==3?1:l),q=1;q<d.length;q++){var p=Math.max(j-q,0),m=a[h*f*4+p*4+3]/255,p=Math.min(j+q,f-1),p=a[h*f*4+p*4+3]/255,t=d[q],r;m==0?r=255:(r=Math.max(j-q,0),r=a[h*f*4+r*4+o]);m=r*(m==0||o==3?1:m);p==0?r=255:(r=Math.min(j+q,f-1),r=a[h*f*4+r*4+o]);n+= t*(m+r*(p==0||o==3?1:p))}c[j*g*4+h*4+o]=n}}this.base=a.Element.ElementBase;this.base(c);this.apply=function(a,c,e,f,g){var e=this.attribute("stdDeviation").numValue(),c=a.getImageData(0,0,f,g),e=Math.max(e,0.01),h=Math.ceil(e*4)+1;mask=[];for(var j=0;j<h;j++)mask[j]=Math.exp(-0.5*(j/e)*(j/e));e=mask;h=0;for(j=1;j<e.length;j++)h+=Math.abs(e[j]);h=2*h+Math.abs(e[0]);for(j=0;j<e.length;j++)e[j]/=h;tmp=[];d(c.data,tmp,e,f,g);d(tmp,c.data,e,g,f);a.clearRect(0,0,f,g);a.putImageData(c,0,0)}};a.Element.filter.prototype= new a.Element.feGaussianBlur;a.Element.title=function(){};a.Element.title.prototype=new a.Element.ElementBase;a.Element.desc=function(){};a.Element.desc.prototype=new a.Element.ElementBase;a.Element.MISSING=function(a){console.log("ERROR: Element '"+a.nodeName+"' not yet implemented.")};a.Element.MISSING.prototype=new a.Element.ElementBase;a.CreateElement=function(c){var d=c.nodeName.replace(/^[^:]+:/,""),d=d.replace(/\-/g,""),b=null,b=typeof a.Element[d]!="undefined"?new a.Element[d](c):new a.Element.MISSING(c); b.type=c.nodeName;return b};a.load=function(c,d){a.loadXml(c,a.ajax(d))};a.loadXml=function(c,d){a.loadXmlDoc(c,a.parseXml(d))};a.loadXmlDoc=function(c,d){a.init(c);var b=function(a){for(var b=c.canvas;b;)a.x-=b.offsetLeft,a.y-=b.offsetTop,b=b.offsetParent;window.scrollX&&(a.x+=window.scrollX);window.scrollY&&(a.y+=window.scrollY);return a};if(a.opts.ignoreMouse!=!0)c.canvas.onclick=function(c){c=b(new a.Point(c!=null?c.clientX:event.clientX,c!=null?c.clientY:event.clientY));a.Mouse.onclick(c.x,c.y)}, c.canvas.onmousemove=function(c){c=b(new a.Point(c!=null?c.clientX:event.clientX,c!=null?c.clientY:event.clientY));a.Mouse.onmousemove(c.x,c.y)};var k=a.CreateElement(d.documentElement),e=k.root=!0,f=function(){a.ViewPort.Clear();c.canvas.parentNode&&a.ViewPort.SetCurrent(c.canvas.parentNode.clientWidth,c.canvas.parentNode.clientHeight);if(a.opts.ignoreDimensions!=!0){if(k.style("width").hasValue())c.canvas.width=k.style("width").Length.toPixels("x"),c.canvas.style.width=c.canvas.width+"px";if(k.style("height").hasValue())c.canvas.height= k.style("height").Length.toPixels("y"),c.canvas.style.height=c.canvas.height+"px"}var b=c.canvas.clientWidth||c.canvas.width,d=c.canvas.clientHeight||c.canvas.height;a.ViewPort.SetCurrent(b,d);if(a.opts!=null&&a.opts.offsetX!=null)k.attribute("x",!0).value=a.opts.offsetX;if(a.opts!=null&&a.opts.offsetY!=null)k.attribute("y",!0).value=a.opts.offsetY;if(a.opts!=null&&a.opts.scaleWidth!=null&&a.opts.scaleHeight!=null){var f=1,g=1;k.attribute("width").hasValue()&&(f=k.attribute("width").Length.toPixels("x")/ a.opts.scaleWidth);k.attribute("height").hasValue()&&(g=k.attribute("height").Length.toPixels("y")/a.opts.scaleHeight);k.attribute("width",!0).value=a.opts.scaleWidth;k.attribute("height",!0).value=a.opts.scaleHeight;k.attribute("viewBox",!0).value="0 0 "+b*f+" "+d*g;k.attribute("preserveAspectRatio",!0).value="none"}a.opts.ignoreClear!=!0&&c.clearRect(0,0,b,d);k.render(c);e&&(e=!1,a.opts!=null&&typeof a.opts.renderCallback=="function"&&a.opts.renderCallback())},g=!0;a.ImagesLoaded()&&(g=!1,f()); a.intervalID=setInterval(function(){var b=!1;g&&a.ImagesLoaded()&&(g=!1,b=!0);a.opts.ignoreMouse!=!0&&(b|=a.Mouse.hasEvents());if(a.opts.ignoreAnimation!=!0)for(var c=0;c<a.Animations.length;c++)b|=a.Animations[c].update(1E3/a.FRAMERATE);a.opts!=null&&typeof a.opts.forceRedraw=="function"&&a.opts.forceRedraw()==!0&&(b=!0);b&&(f(),a.Mouse.runEvents())},1E3/a.FRAMERATE)};a.stop=function(){a.intervalID&&clearInterval(a.intervalID)};a.Mouse=new function(){this.events=[];this.hasEvents=function(){return this.events.length!= 0};this.onclick=function(a,d){this.events.push({type:"onclick",x:a,y:d,run:function(a){if(a.onclick)a.onclick()}})};this.onmousemove=function(a,d){this.events.push({type:"onmousemove",x:a,y:d,run:function(a){if(a.onmousemove)a.onmousemove()}})};this.eventElements=[];this.checkPath=function(a,d){for(var b=0;b<this.events.length;b++){var k=this.events[b];d.isPointInPath&&d.isPointInPath(k.x,k.y)&&(this.eventElements[b]=a)}};this.checkBoundingBox=function(a,d){for(var b=0;b<this.events.length;b++){var k= this.events[b];d.isPointInBox(k.x,k.y)&&(this.eventElements[b]=a)}};this.runEvents=function(){a.ctx.canvas.style.cursor="";for(var c=0;c<this.events.length;c++)for(var d=this.events[c],b=this.eventElements[c];b;)d.run(b),b=b.parent;this.events=[];this.eventElements=[]}};return a}this.canvg=function(a,c,d){if(a==null&&c==null&&d==null)for(var c=document.getElementsByTagName("svg"),b=0;b<c.length;b++){a=c[b];d=document.createElement("canvas");d.width=a.clientWidth;d.height=a.clientHeight;a.parentNode.insertBefore(d, a);a.parentNode.removeChild(a);var k=document.createElement("div");k.appendChild(a);canvg(d,k.innerHTML)}else d=d||{},typeof a=="string"&&(a=document.getElementById(a)),a.svg==null?(b=m(),a.svg=b):(b=a.svg,b.stop()),b.opts=d,a=a.getContext("2d"),typeof c.documentElement!="undefined"?b.loadXmlDoc(a,c):c.substr(0,1)=="<"?b.loadXml(a,c):b.load(a,c)}})(); if(CanvasRenderingContext2D)CanvasRenderingContext2D.prototype.drawSvg=function(m,a,c,d,b){canvg(this.canvas,m,{ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0,ignoreClear:!0,offsetX:a,offsetY:c,scaleWidth:d,scaleHeight:b})}; (function(m){var a=m.css,c=m.CanVGRenderer,d=m.SVGRenderer,b=m.extend,k=m.merge,e=m.addEvent,f=m.placeBox,g=m.createElement,h=m.discardElement;b(c.prototype,d.prototype);b(c.prototype,{create:function(a,b,c,d){this.setContainer(b,c,d);this.configure(a)},setContainer:function(a,b,c){var d=a.style,e=a.parentNode,f=d.left,d=d.top,h=a.offsetWidth,k=a.offsetHeight,m={visibility:"hidden",position:"absolute"};this.init.apply(this,[a,b,c]);this.canvas=g("canvas",{width:h,height:k},{position:"relative",left:f, top:d},a);this.ttLine=g("div",null,m,e);this.ttDiv=g("div",null,m,e);this.ttTimer=void 0;this.hiddenSvg=a=g("div",{width:h,height:k},{visibility:"hidden",left:f,top:d},e);a.appendChild(this.box)},configure:function(b){var c=this,d=b.options.tooltip,g=d.borderWidth,h=c.ttDiv,m=d.style,s=c.ttLine,t=parseInt(m.padding,10),m=k(m,{padding:t+"px","background-color":d.backgroundColor,"border-style":"solid","border-width":g+"px","border-radius":d.borderRadius+"px"});d.shadow&&(m=k(m,{"box-shadow":"1px 1px 3px gray", "-webkit-box-shadow":"1px 1px 3px gray"}));a(h,m);a(s,{"border-left":"1px solid darkgray"});e(b,"tooltipRefresh",function(d){var e=b.container,g=e.offsetLeft,k=e.offsetTop;h.innerHTML=d.text;e=f(h.offsetWidth,h.offsetHeight,g,k,e.offsetWidth,e.offsetHeight,{x:d.x,y:d.y},12);a(h,{visibility:"visible",left:e.x+"px",top:e.y+"px","border-color":d.borderColor});a(s,{visibility:"visible",left:g+d.x+"px",top:k+b.plotTop+"px",height:b.plotHeight+"px"});c.ttTimer!==void 0&&clearTimeout(c.ttTimer);c.ttTimer= setTimeout(function(){a(h,{visibility:"hidden"});a(s,{visibility:"hidden"})},3E3)})},destroy:function(){h(this.canvas);this.ttTimer!==void 0&&clearTimeout(this.ttTimer);h(this.ttLine);h(this.ttDiv);h(this.hiddenSvg);return d.prototype.destroy.apply(this)},color:function(a,b,c){a&&a.linearGradient&&(a=a.stops[a.stops.length-1][1]);return d.prototype.color.call(this,a,b,c)},draw:function(){window.canvg(this.canvas,this.hiddenSvg.innerHTML)}})})(Highcharts);
const electron = require('electron') const BrowserWindow = electron.BrowserWindow const Menu = electron.Menu const app = electron.app let template = [{ label: 'Edit', submenu: [{ label: 'Undo', accelerator: 'CmdOrCtrl+Z', role: 'undo' }, { label: 'Redo', accelerator: 'Shift+CmdOrCtrl+Z', role: 'redo' }, { type: 'separator' }, { label: 'Cut', accelerator: 'CmdOrCtrl+X', role: 'cut' }, { label: 'Copy', accelerator: 'CmdOrCtrl+C', role: 'copy' }, { label: 'Paste', accelerator: 'CmdOrCtrl+V', role: 'paste' }, { label: 'Select All', accelerator: 'CmdOrCtrl+A', role: 'selectall' }] }, { label: 'View', submenu: [{ label: 'Reload', accelerator: 'CmdOrCtrl+R', click: function (item, focusedWindow) { if (focusedWindow) { // on reload, start fresh and close any old // open secondary windows if (focusedWindow.id === 1) { BrowserWindow.getAllWindows().forEach(function (win) { if (win.id > 1) { win.close() } }) } focusedWindow.reload() } } }, { label: 'Toggle Full Screen', accelerator: (function () { if (process.platform === 'darwin') { return 'Ctrl+Command+F' } else { return 'F11' } })(), click: function (item, focusedWindow) { if (focusedWindow) { focusedWindow.setFullScreen(!focusedWindow.isFullScreen()) } } }, { label: 'Toggle Developer Tools', accelerator: (function () { if (process.platform === 'darwin') { return 'Alt+Command+I' } else { return 'Ctrl+Shift+I' } })(), click: function (item, focusedWindow) { if (focusedWindow) { focusedWindow.toggleDevTools() } } }, { type: 'separator' }, { label: 'App Menu Demo', click: function (item, focusedWindow) { if (focusedWindow) { const options = { type: 'info', title: 'Application Menu Demo', buttons: ['Ok'], message: 'This demo is for the Menu section, showing how to create a clickable menu item in the application menu.' } electron.dialog.showMessageBox(focusedWindow, options, function () {}) } } }] }, { label: 'Window', role: 'window', submenu: [{ label: 'Minimize', accelerator: 'CmdOrCtrl+M', role: 'minimize' }, { label: 'Close', accelerator: 'CmdOrCtrl+W', role: 'close' }, { type: 'separator' }, { label: 'Reopen Window', accelerator: 'CmdOrCtrl+Shift+T', enabled: false, key: 'reopenMenuItem', click: function () { app.emit('activate') } }] }, { label: 'Help', role: 'help', submenu: [{ label: 'Learn More', click: function () { electron.shell.openExternal('http://electron.atom.io') } }] }] function addUpdateMenuItems (items, position) { if (process.mas) return const version = electron.app.getVersion() let updateItems = [{ label: `Version ${version}`, enabled: false }, { label: 'Checking for Update', enabled: false, key: 'checkingForUpdate' }, { label: 'Check for Update', visible: false, key: 'checkForUpdate', click: function () { require('electron').autoUpdater.checkForUpdates() } }, { label: 'Restart and Install Update', enabled: true, visible: false, key: 'restartToUpdate', click: function () { require('electron').autoUpdater.quitAndInstall() } }] items.splice.apply(items, [position, 0].concat(updateItems)) } function findReopenMenuItem () { const menu = Menu.getApplicationMenu() if (!menu) return let reopenMenuItem menu.items.forEach(function (item) { if (item.submenu) { item.submenu.items.forEach(function (item) { if (item.key === 'reopenMenuItem') { reopenMenuItem = item } }) } }) return reopenMenuItem } if (process.platform === 'darwin') { const name = electron.app.getName() template.unshift({ label: name, submenu: [{ label: `About ${name}`, role: 'about' }, { type: 'separator' }, { label: 'Services', role: 'services', submenu: [] }, { type: 'separator' }, { label: `Hide ${name}`, accelerator: 'Command+H', role: 'hide' }, { label: 'Hide Others', accelerator: 'Command+Alt+H', role: 'hideothers' }, { label: 'Show All', role: 'unhide' }, { type: 'separator' }, { label: 'Quit', accelerator: 'Command+Q', click: function () { app.quit() } }] }) // Window menu. template[3].submenu.push({ type: 'separator' }, { label: 'Bring All to Front', role: 'front' }) addUpdateMenuItems(template[0].submenu, 1) } if (process.platform === 'win32') { const helpMenu = template[template.length - 1].submenu addUpdateMenuItems(helpMenu, 0) } app.on('ready', function () { const menu = Menu.buildFromTemplate(template) Menu.setApplicationMenu(menu) }) app.on('browser-window-created', function () { let reopenMenuItem = findReopenMenuItem() if (reopenMenuItem) reopenMenuItem.enabled = false }) app.on('window-all-closed', function () { let reopenMenuItem = findReopenMenuItem() if (reopenMenuItem) reopenMenuItem.enabled = true })
/*global window */ (function() { "use strict"; var av, // The JSAV object arrSize, // Full array size arrdata = [], // The array to be sorted; keep for reset answer = [], // Array that holds the correct order for the values jsavInput, // JSAV array of input values jsavBins, // JSAV array that serves as a point for user to click on bins jsavLists = [], // The actual set of lists empty = [], // Dummy for empty data to reset bin array blockHeight = 29; // Width/height of an array or list element // Variables used to keep track of the index and array of the // currently selected element within click handler var ValueIndex = -1; var openHashPRO = { userInput: null, // Boolean: Tells us if user ever did anything // function that initialise JSAV library initJSAV: function(asize) { var i, j; var temp = []; // Do all of the one-time initializations arrSize = asize; arrdata = JSAV.utils.rand.numKeys(0, 999, arrSize); for (i = 0; i < 10; i++) { empty[i] = ""; } reset(); // Set up handler for reset button $("#reset").click(function() { reset(); }); // Compute the answer for (i = 0; i < 10; i++) { temp[i] = []; } for (i = 0; i < arrSize; i++) { var a = arrdata[i] % 10; temp[a][temp[a].length] = arrdata[i]; } var curr = 0; for (i = 0; i < 10; i++) { for (j = 0; j < temp[i].length; j++) { answer[curr++] = temp[i][j]; } } }, // Check user's answer for correctness checkAnswer: function(aSize) { var i, j; var curr = 0; for (i = 0; i < 10; i++) { for (j = 0; j < jsavLists[i].size(); j++) { if (jsavLists[i].get(j).value() !== answer[curr++]) { return false; } } } if (curr !== aSize) { return false; } return true; } }; // Handle a click event on an array // On click of bottom array element, highlight. // On click of (free) position in top array, move highlighted element there. function clickHandler(arr, index) { if (ValueIndex === -1) { // Nothing is selected. We must be in the input array if (arr !== jsavInput) { return; } // Wasn't in input array // Don't let the user select an empty element, if (arr.value(index) === "") { return; } arr.highlight(index); ValueIndex = index; } else if (arr !== jsavBins) { // He is unhighlighting, or highlighting new element if (ValueIndex === index) { jsavInput.unhighlight(ValueIndex); ValueIndex = -1; } else { jsavInput.unhighlight(ValueIndex); jsavInput.highlight(index); ValueIndex = index; } } else { // Move currently selected element from input array to selected bin jsavLists[index].addLast(jsavInput.value(ValueIndex)); jsavLists[index].layout({center: false}); jsavInput.unhighlight(ValueIndex); jsavInput.value(ValueIndex, ""); ValueIndex = -1; } openHashPRO.userInput = true; } // reset function definition function reset() { var i; // Clear the old JSAV canvas. if ($("#OpenHashPRO")) { $("#OpenHashPRO").empty(); } // Set up the display av = new JSAV("OpenHashPRO"); jsavInput = av.ds.array(arrdata, {indexed: true, center: false, layout: "vertical", top: 10}); jsavInput.click(function(index) { clickHandler(this, index); }); jsavBins = av.ds.array(empty, {indexed: true, center: false, layout: "vertical", top: 10, left: 200}); jsavBins.click(function(index) { clickHandler(this, index); }); for (i = 0; i < 10; i++) { jsavLists[i] = av.ds.list({top: (12 + i * blockHeight), left: 260, nodegap: 30}); jsavLists[i].layout({center: false}); } av.displayInit(); av.recorded(); openHashPRO.userInput = false; ValueIndex = -1; } window.openHashPRO = window.openHashPRO || openHashPRO; }());
// Flags: --expose-internals 'use strict'; const common = require('../common'); const assert = require('assert'); const net = require('net'); const fs = require('fs'); const { getSystemErrorName } = require('util'); const { internalBinding } = require('internal/test/binding'); const { TCP, constants: TCPConstants } = internalBinding('tcp_wrap'); const { Pipe, constants: PipeConstants } = internalBinding('pipe_wrap'); const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); function closeServer() { return common.mustCall(function() { this.close(); }); } // server.listen(pipe) creates a new pipe wrap, // so server.close() doesn't actually unlink this existing pipe. // It needs to be unlinked separately via handle.close() function closePipeServer(handle) { return common.mustCall(function() { this.close(); handle.close(); }); } let counter = 0; // Avoid conflict with listen-path function randomPipePath() { return `${common.PIPE}-listen-handle-${counter++}`; } function randomHandle(type) { let handle, errno, handleName; if (type === 'tcp') { handle = new TCP(TCPConstants.SOCKET); errno = handle.bind('0.0.0.0', 0); handleName = 'arbitrary tcp port'; } else { const path = randomPipePath(); handle = new Pipe(PipeConstants.SOCKET); errno = handle.bind(path); handleName = `pipe ${path}`; } if (errno < 0) { assert.fail(`unable to bind ${handleName}: ${getSystemErrorName(errno)}`); } if (!common.isWindows) { // `fd` doesn't work on Windows. // err >= 0 but fd = -1, should not happen assert.notStrictEqual(handle.fd, -1, `Bound ${handleName} has fd -1 and errno ${errno}`); } return handle; } // Not a public API, used by child_process { // Test listen(tcp) net.createServer() .listen(randomHandle('tcp')) .on('listening', closeServer()); // Test listen(tcp, cb) net.createServer() .listen(randomHandle('tcp'), closeServer()); } function randomPipes(number) { const arr = []; for (let i = 0; i < number; ++i) { arr.push(randomHandle('pipe')); } return arr; } // Not a public API, used by child_process if (!common.isWindows) { // Windows doesn't support {fd: <n>} const handles = randomPipes(2); // Generate pipes in advance // Test listen(pipe) net.createServer() .listen(handles[0]) .on('listening', closePipeServer(handles[0])); // Test listen(pipe, cb) net.createServer() .listen(handles[1], closePipeServer(handles[1])); } { // Test listen({handle: tcp}, cb) net.createServer() .listen({ handle: randomHandle('tcp') }, closeServer()); // Test listen({handle: tcp}) net.createServer() .listen({ handle: randomHandle('tcp') }) .on('listening', closeServer()); // Test listen({_handle: tcp}, cb) net.createServer() .listen({ _handle: randomHandle('tcp') }, closeServer()); // Test listen({_handle: tcp}) net.createServer() .listen({ _handle: randomHandle('tcp') }) .on('listening', closeServer()); } if (!common.isWindows) { // Windows doesn't support {fd: <n>} // Test listen({fd: tcp.fd}, cb) net.createServer() .listen({ fd: randomHandle('tcp').fd }, closeServer()); // Test listen({fd: tcp.fd}) net.createServer() .listen({ fd: randomHandle('tcp').fd }) .on('listening', closeServer()); } if (!common.isWindows) { // Windows doesn't support {fd: <n>} const handles = randomPipes(6); // Generate pipes in advance // Test listen({handle: pipe}, cb) net.createServer() .listen({ handle: handles[0] }, closePipeServer(handles[0])); // Test listen({handle: pipe}) net.createServer() .listen({ handle: handles[1] }) .on('listening', closePipeServer(handles[1])); // Test listen({_handle: pipe}, cb) net.createServer() .listen({ _handle: handles[2] }, closePipeServer(handles[2])); // Test listen({_handle: pipe}) net.createServer() .listen({ _handle: handles[3] }) .on('listening', closePipeServer(handles[3])); // Test listen({fd: pipe.fd}, cb) net.createServer() .listen({ fd: handles[4].fd }, closePipeServer(handles[4])); // Test listen({fd: pipe.fd}) net.createServer() .listen({ fd: handles[5].fd }) .on('listening', closePipeServer(handles[5])); } if (!common.isWindows) { // Windows doesn't support {fd: <n>} // Test invalid fd const fd = fs.openSync(__filename, 'r'); net.createServer() .listen({ fd }, common.mustNotCall()) .on('error', common.mustCall(function(err) { assert.strictEqual(String(err), 'Error: listen EINVAL: invalid argument'); this.close(); })); }
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = _default; var _corejs2BuiltIns = _interopRequireDefault(require("../../../data/corejs2-built-ins.json")); var _getPlatformSpecificDefault = _interopRequireDefault(require("./get-platform-specific-default")); var _filterItems = _interopRequireDefault(require("../../filter-items")); var _builtInDefinitions = require("./built-in-definitions"); var _utils = require("../../utils"); var _debug = require("../../debug"); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } const NO_DIRECT_POLYFILL_IMPORT = ` When setting \`useBuiltIns: 'usage'\`, polyfills are automatically imported when needed. Please remove the \`import '@babel/polyfill'\` call or use \`useBuiltIns: 'entry'\` instead.`; function _default({ types: t }, { include, exclude, polyfillTargets, debug }) { const polyfills = (0, _filterItems.default)(_corejs2BuiltIns.default, include, exclude, polyfillTargets, (0, _getPlatformSpecificDefault.default)(polyfillTargets)); const addAndRemovePolyfillImports = { ImportDeclaration(path) { if ((0, _utils.isPolyfillSource)((0, _utils.getImportSource)(path))) { console.warn(NO_DIRECT_POLYFILL_IMPORT); path.remove(); } }, Program(path) { path.get("body").forEach(bodyPath => { if ((0, _utils.isPolyfillSource)((0, _utils.getRequireSource)(bodyPath))) { console.warn(NO_DIRECT_POLYFILL_IMPORT); bodyPath.remove(); } }); }, ReferencedIdentifier({ node: { name }, parent, scope }) { if (t.isMemberExpression(parent)) return; if (!(0, _utils.has)(_builtInDefinitions.BuiltIns, name)) return; if (scope.getBindingIdentifier(name)) return; const BuiltInDependencies = _builtInDefinitions.BuiltIns[name]; this.addUnsupported(BuiltInDependencies); }, CallExpression(path) { if (path.node.arguments.length) return; const callee = path.node.callee; if (!t.isMemberExpression(callee)) return; if (!callee.computed) return; if (!path.get("callee.property").matchesPattern("Symbol.iterator")) { return; } this.addImport("web.dom.iterable"); }, BinaryExpression(path) { if (path.node.operator !== "in") return; if (!path.get("left").matchesPattern("Symbol.iterator")) return; this.addImport("web.dom.iterable"); }, YieldExpression(path) { if (path.node.delegate) { this.addImport("web.dom.iterable"); } }, MemberExpression: { enter(path) { const { node } = path; const { object, property } = node; let evaluatedPropType = object.name; let propertyName = property.name; let instanceType = ""; if (node.computed) { if (t.isStringLiteral(property)) { propertyName = property.value; } else { const result = path.get("property").evaluate(); if (result.confident && result.value) { propertyName = result.value; } } } if (path.scope.getBindingIdentifier(object.name)) { const result = path.get("object").evaluate(); if (result.value) { instanceType = (0, _utils.getType)(result.value); } else if (result.deopt && result.deopt.isIdentifier()) { evaluatedPropType = result.deopt.node.name; } } if ((0, _utils.has)(_builtInDefinitions.StaticProperties, evaluatedPropType)) { const BuiltInProperties = _builtInDefinitions.StaticProperties[evaluatedPropType]; if ((0, _utils.has)(BuiltInProperties, propertyName)) { const StaticPropertyDependencies = BuiltInProperties[propertyName]; this.addUnsupported(StaticPropertyDependencies); } } if ((0, _utils.has)(_builtInDefinitions.InstanceProperties, propertyName)) { let InstancePropertyDependencies = _builtInDefinitions.InstanceProperties[propertyName]; if (instanceType) { InstancePropertyDependencies = InstancePropertyDependencies.filter(module => module.includes(instanceType)); } this.addUnsupported(InstancePropertyDependencies); } }, exit(path) { const { name } = path.node.object; if (!(0, _utils.has)(_builtInDefinitions.BuiltIns, name)) return; if (path.scope.getBindingIdentifier(name)) return; const BuiltInDependencies = _builtInDefinitions.BuiltIns[name]; this.addUnsupported(BuiltInDependencies); } }, VariableDeclarator(path) { const { node } = path; const { id, init } = node; if (!t.isObjectPattern(id)) return; if (init && path.scope.getBindingIdentifier(init.name)) return; for (const _ref of id.properties) { const { key } = _ref; if (!node.computed && t.isIdentifier(key) && (0, _utils.has)(_builtInDefinitions.InstanceProperties, key.name)) { const InstancePropertyDependencies = _builtInDefinitions.InstanceProperties[key.name]; this.addUnsupported(InstancePropertyDependencies); } } } }; return { name: "corejs2-usage", pre({ path }) { this.polyfillsSet = new Set(); this.addImport = function (builtIn) { if (!this.polyfillsSet.has(builtIn)) { this.polyfillsSet.add(builtIn); (0, _utils.createImport)(path, builtIn); } }; this.addUnsupported = function (builtIn) { const modules = Array.isArray(builtIn) ? builtIn : [builtIn]; for (const module of modules) { if (polyfills.has(module)) { this.addImport(module); } } }; }, post() { if (debug) { (0, _debug.logUsagePolyfills)(this.polyfillsSet, this.file.opts.filename, polyfillTargets, _corejs2BuiltIns.default); } }, visitor: addAndRemovePolyfillImports }; }
/** * Copyright 2013 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @providesModule EventPluginRegistry * @typechecks static-only */ "use strict"; var invariant = require("./invariant"); /** * Injectable ordering of event plugins. */ var EventPluginOrder = null; /** * Injectable mapping from names to event plugin modules. */ var namesToPlugins = {}; /** * Recomputes the plugin list using the injected plugins and plugin ordering. * * @private */ function recomputePluginOrdering() { if (!EventPluginOrder) { // Wait until an `EventPluginOrder` is injected. return; } for (var pluginName in namesToPlugins) { var PluginModule = namesToPlugins[pluginName]; var pluginIndex = EventPluginOrder.indexOf(pluginName); invariant(pluginIndex > -1); if (EventPluginRegistry.plugins[pluginIndex]) { continue; } invariant(PluginModule.extractEvents); EventPluginRegistry.plugins[pluginIndex] = PluginModule; var publishedEvents = PluginModule.eventTypes; for (var eventName in publishedEvents) { invariant(publishEventForPlugin(publishedEvents[eventName], PluginModule)); } } } /** * Publishes an event so that it can be dispatched by the supplied plugin. * * @param {object} dispatchConfig Dispatch configuration for the event. * @param {object} PluginModule Plugin publishing the event. * @return {boolean} True if the event was successfully published. * @private */ function publishEventForPlugin(dispatchConfig, PluginModule) { var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames; if (phasedRegistrationNames) { for (var phaseName in phasedRegistrationNames) { if (phasedRegistrationNames.hasOwnProperty(phaseName)) { var phasedRegistrationName = phasedRegistrationNames[phaseName]; publishRegistrationName(phasedRegistrationName, PluginModule); } } return true; } else if (dispatchConfig.registrationName) { publishRegistrationName(dispatchConfig.registrationName, PluginModule); return true; } return false; } /** * Publishes a registration name that is used to identify dispatched events and * can be used with `EventPluginHub.putListener` to register listeners. * * @param {string} registrationName Registration name to add. * @param {object} PluginModule Plugin publishing the event. * @private */ function publishRegistrationName(registrationName, PluginModule) { invariant(!EventPluginRegistry.registrationNames[registrationName]); EventPluginRegistry.registrationNames[registrationName] = PluginModule; EventPluginRegistry.registrationNamesKeys.push(registrationName); } /** * Registers plugins so that they can extract and dispatch events. * * @see {EventPluginHub} */ var EventPluginRegistry = { /** * Ordered list of injected plugins. */ plugins: [], /** * Mapping from registration names to plugin modules. */ registrationNames: {}, /** * The keys of `registrationNames`. */ registrationNamesKeys: [], /** * Injects an ordering of plugins (by plugin name). This allows the ordering * to be decoupled from injection of the actual plugins so that ordering is * always deterministic regardless of packaging, on-the-fly injection, etc. * * @param {array} InjectedEventPluginOrder * @internal * @see {EventPluginHub.injection.injectEventPluginOrder} */ injectEventPluginOrder: function(InjectedEventPluginOrder) { invariant(!EventPluginOrder); // Clone the ordering so it cannot be dynamically mutated. EventPluginOrder = Array.prototype.slice.call(InjectedEventPluginOrder); recomputePluginOrdering(); }, /** * Injects plugins to be used by `EventPluginHub`. The plugin names must be * in the ordering injected by `injectEventPluginOrder`. * * Plugins can be injected as part of page initialization or on-the-fly. * * @param {object} injectedNamesToPlugins Map from names to plugin modules. * @internal * @see {EventPluginHub.injection.injectEventPluginsByName} */ injectEventPluginsByName: function(injectedNamesToPlugins) { var isOrderingDirty = false; for (var pluginName in injectedNamesToPlugins) { if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) { continue; } var PluginModule = injectedNamesToPlugins[pluginName]; if (namesToPlugins[pluginName] !== PluginModule) { invariant(!namesToPlugins[pluginName]); namesToPlugins[pluginName] = PluginModule; isOrderingDirty = true; } } if (isOrderingDirty) { recomputePluginOrdering(); } }, /** * Looks up the plugin for the supplied event. * * @param {object} event A synthetic event. * @return {?object} The plugin that created the supplied event. * @internal */ getPluginModuleForEvent: function(event) { var dispatchConfig = event.dispatchConfig; if (dispatchConfig.registrationName) { return EventPluginRegistry.registrationNames[ dispatchConfig.registrationName ] || null; } for (var phase in dispatchConfig.phasedRegistrationNames) { if (!dispatchConfig.phasedRegistrationNames.hasOwnProperty(phase)) { continue; } var PluginModule = EventPluginRegistry.registrationNames[ dispatchConfig.phasedRegistrationNames[phase] ]; if (PluginModule) { return PluginModule; } } return null; }, /** * Exposed for unit testing. * @private */ _resetEventPlugins: function() { EventPluginOrder = null; for (var pluginName in namesToPlugins) { if (namesToPlugins.hasOwnProperty(pluginName)) { delete namesToPlugins[pluginName]; } } EventPluginRegistry.plugins.length = 0; var registrationNames = EventPluginRegistry.registrationNames; for (var registrationName in registrationNames) { if (registrationNames.hasOwnProperty(registrationName)) { delete registrationNames[registrationName]; } } EventPluginRegistry.registrationNamesKeys.length = 0; } }; module.exports = EventPluginRegistry;
/* @flow */ import type { Scope } from "babel-traverse"; import * as t from "babel-types"; export default function (decorators: Array<Object>, scope: Scope): Array<Object> { for (let decorator of decorators) { let expression = decorator.expression; if (!t.isMemberExpression(expression)) continue; let temp = scope.maybeGenerateMemoised(expression.object); let ref; let nodes = []; if (temp) { ref = temp; nodes.push(t.assignmentExpression("=", temp, expression.object)); } else { ref = expression.object; } nodes.push(t.callExpression( t.memberExpression( t.memberExpression(ref, expression.property, expression.computed), t.identifier("bind") ), [ref] )); if (nodes.length === 1) { decorator.expression = nodes[0]; } else { decorator.expression = t.sequenceExpression(nodes); } } return decorators; }
/** * Comment * * @module :: Model * @description :: A short summary of how this model works and what it represents. * @docs :: http://sailsjs.org/#!documentation/models */ module.exports = { attributes: { author: 'string', text: 'string' } };
(function (angular) { const SECTION_NAME = "overview"; angular .module("BrowserSync") .controller("OverviewController", [ "options", "pagesConfig", OverviewController ]); /** * @param options * @param pagesConfig */ function OverviewController (options, pagesConfig) { var ctrl = this; ctrl.section = pagesConfig[SECTION_NAME]; ctrl.options = options.bs; ctrl.ui = { snippet: !ctrl.options.server && !ctrl.options.proxy }; } /** * Url Info - this handles rendering of each server * info item */ angular .module("BrowserSync") .directive("urlInfo", function () { return { restrict: "E", replace: true, scope: { "options": "=" }, templateUrl: "url-info.html", controller: [ "$scope", "$rootScope", "Clients", urlInfoController ] }; }); /** * @param $scope * @param $rootScope * @param Clients */ function urlInfoController($scope, $rootScope, Clients) { var options = $scope.options; var urls = options.urls; $scope.ui = { server: false, proxy: false }; if ($scope.options.mode === "server") { $scope.ui.server = true; if (!Array.isArray($scope.options.server.baseDir)) { $scope.options.server.baseDir = [$scope.options.server.baseDir]; } } if ($scope.options.mode === "proxy") { $scope.ui.proxy = true; } $scope.urls = []; $scope.urls.push({ title: "Local", tagline: "URL for the machine you are running BrowserSync on", url: urls.local, icon: "imac" }); if (urls.external) { $scope.urls.push({ title: "External", tagline: "Other devices on the same wifi network", url: urls.external, icon: "wifi" }); } if (urls.tunnel) { $scope.urls.push({ title: "Tunnel", tagline: "Secure HTTPS public url", url: urls.tunnel, icon: "globe" }); } /** * */ $scope.sendAllTo = function (path) { Clients.sendAllTo(path); $rootScope.$emit("notify:flash", { heading: "Instruction sent:", message: "Sync all Browsers to: " + path }); }; } /** * Display the snippet when in snippet mode */ angular .module("BrowserSync") .directive("snippetInfo", function () { return { restrict: "E", replace: true, scope: { "options": "=" }, templateUrl: "snippet-info.html", controller: ["$scope", function snippetInfoController($scope) {/*noop*/}] }; }); })(angular);
// The MIT License (MIT) // Typed.js | Copyright (c) 2014 Matt Boldt | www.mattboldt.com // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. !function($){ "use strict"; var Typed = function(el, options){ // chosen element to manipulate text this.el = $(el); // options this.options = $.extend({}, $.fn.typed.defaults, options); // text content of element this.baseText = (this.options.baseText !== undefined) ? this.options.baseText : this.el.text() || this.el.attr('placeholder') || ''; // replace base text on first word this.replaceBaseText = this.options.replaceBaseText; // typing speed this.typeSpeed = this.options.typeSpeed; // add a delay before typing starts this.startDelay = this.options.startDelay; // backspacing speed this.backSpeed = this.options.backSpeed; // amount of time to wait before backspacing this.backDelay = this.options.backDelay; // input strings of text this.strings = this.options.strings; // character number position of current string this.strPos = (this.replaceBaseText) ? this.baseText.length : 0; // current array position this.arrayPos = 0; // number to stop backspacing on. // default 0, can change depending on how many chars // you want to remove at the time this.stopNum = 0; // Looping logic this.loop = this.options.loop; this.loopCount = this.options.loopCount; this.curLoop = 0; // for stopping this.stop = false; // show cursor this.showCursor = this.isInput ? false : this.options.showCursor; // custom cursor this.cursorChar = this.options.cursorChar; // attribute to type this.isInput = this.el.is('input'); this.attr = this.options.attr || (this.isInput ? 'placeholder' : null); // All systems go! this.build(); }; Typed.prototype = { constructor: Typed , init: function(){ // begin the loop w/ first current string (global self.string) // current string will be passed as an argument each time after this var self = this; // Adds base text to strings array if user replace setting enabled if(this.replaceBaseText) { this.strings.unshift(self.baseText); } self.timeout = setTimeout(function() { var currentWord = (self.arrayPos === 0 && self.replaceBaseText) ? (self.baseText) : self.strings[self.arrayPos]; // Start typing self.typewrite(currentWord, self.strPos); }, self.startDelay); } , build: function(){ // Insert cursor if (this.showCursor === true){ this.cursor = $("<span class=\"typed-cursor\">" + this.cursorChar + "</span>"); this.el.after(this.cursor); } this.init(); } // pass current string state to each function, types 1 char per call , typewrite: function(curString, curStrPos){ // exit when stopped if(this.stop === true) return; // varying values for setTimeout during typing // can't be global since number changes each time loop is executed var humanize = Math.round(Math.random() * (100 - 30)) + this.typeSpeed; var self = this; // ------------- optional ------------- // // backpaces a certain string faster // ------------------------------------ // // if (self.arrayPos == 1){ // self.backDelay = 50; // } // else{ self.backDelay = 500; } // contain typing function in a timeout humanize'd delay self.timeout = setTimeout(function() { // check for an escape character before a pause value // format: \^\d+ .. eg: ^1000 .. should be able to print the ^ too using ^^ // single ^ are removed from string var charPause = 0; var substr = curString.substr(curStrPos); // console.log(curString, substr, curStrPos); if (substr.charAt(0) === '^') { var skip = 1; // skip atleast 1 if(/^\^\d+/.test(substr)) { substr = /\d+/.exec(substr)[0]; skip += substr.length; charPause = parseInt(substr); } // strip out the escape character and pause value so they're not printed curString = curString.substring(0,curStrPos)+curString.substring(curStrPos+skip); } // timeout for any pause after a character self.timeout = setTimeout(function() { if(curStrPos === curString.length) { // fires callback function self.options.onStringTyped(self.arrayPos); // is this the final string if(self.arrayPos === self.strings.length-1) { // animation that occurs on the last typed string self.options.callback(); self.curLoop++; // quit if we wont loop back if(self.loop === false || self.curLoop === self.loopCount) return; } self.timeout = setTimeout(function(){ self.backspace(curString, curStrPos); }, self.backDelay); } else { /* call before functions if applicable */ if(curStrPos === 0) self.options.preStringTyped(self.arrayPos); // start typing each new char into existing string // curString: arg, self.baseText: original text inside element var nextSubString = curString.substr(0, curStrPos+1); var nextString = (self.replaceBaseText) ? nextSubString : (self.baseText + nextSubString); if (self.attr) { self.el.attr(self.attr, nextString); } else { self.el.text(nextString); } // add characters one by one curStrPos++; // loop the function self.typewrite(curString, curStrPos); } // end of character pause }, charPause); // humanized value for typing }, humanize); } , backspace: function(curString, curStrPos){ // exit when stopped if (this.stop === true) { return; } // varying values for setTimeout during typing // can't be global since number changes each time loop is executed var humanize = Math.round(Math.random() * (100 - 30)) + this.backSpeed; var self = this; self.timeout = setTimeout(function() { // ----- this part is optional ----- // // check string array position // on the first string, only delete one word // the stopNum actually represents the amount of chars to // keep in the current string. In my case it's 14. // if (self.arrayPos == 1){ // self.stopNum = 14; // } //every other time, delete the whole typed string // else{ // self.stopNum = 0; // } // ----- continue important stuff ----- // // replace text with base text + typed characters var curSubString = curString.substr(0, curStrPos+1); var nextString = (self.replaceBaseText) ? curSubString : (self.baseText + curSubString); if (self.attr) { self.el.attr(self.attr, nextString); } else { self.el.text(nextString); } // if the number (id of character in current string) is // less than the stop number, keep going if (curStrPos > self.stopNum){ // subtract characters one by one curStrPos--; // loop the function self.backspace(curString, curStrPos); } // if the stop number has been reached, increase // array position to next string else if (curStrPos <= self.stopNum) { self.arrayPos++; if(self.arrayPos === self.strings.length) { self.arrayPos = 0; self.init(); } else self.typewrite(self.strings[self.arrayPos], curStrPos); } // humanized value for typing }, humanize); } // Start & Stop currently not working // , stop: function() { // var self = this; // self.stop = true; // clearInterval(self.timeout); // } // , start: function() { // var self = this; // if(self.stop === false) // return; // this.stop = false; // this.init(); // } // Reset and rebuild the element , reset: function(){ var self = this; clearInterval(self.timeout); var id = this.el.attr('id'); this.el.after('<span id="' + id + '"/>') this.el.remove(); this.cursor.remove(); // Send the callback self.options.resetCallback(); } }; $.fn.typed = function (option) { return this.each(function () { var $this = $(this) , data = $this.data('typed') , options = typeof option == 'object' && option; if (!data) $this.data('typed', (data = new Typed(this, options))); if (typeof option == 'string') data[option](); }); }; $.fn.typed.defaults = { // Typewrite away original text on start replaceBaseText: false, strings: ["These are the default values...", "You know what you should do?", "Use your own!", "Have a great day!"], // typing speed typeSpeed: 0, // time before typing starts startDelay: 0, // backspacing speed backSpeed: 0, // time before backspacing backDelay: 500, // loop loop: false, // false = infinite loopCount: false, // show cursor showCursor: true, // character for cursor cursorChar: "|", // attribute to type (null == text) attr: null, // call when done callback function callback: function() {}, // starting callback function before each string preStringTyped: function() {}, //callback for every typed string onStringTyped: function() {}, // callback for reset resetCallback: function() {} }; }(window.jQuery);
var searchData= [ ['kineticenergy',['kineticEnergy',['../interface_chipmunk_body.html#a256172d0da6749233e1018dea931fafb',1,'ChipmunkBody']]] ];
module.exports={A:{A:{"2":"CB","8":"K C G","129":"A B","161":"E"},B:{"129":"D u Y I M H"},C:{"1":"0 2 3 4 5 6 7 M H N O P Q R S T U V W X w Z a b c d e f L h i j k l m n o p q r s t y z v","2":"1 VB","33":"F J K C G E A B D u Y I TB SB"},D:{"1":"0 2 3 4 5 6 7 f L h i j k l m n o p q r s t y z v HB g DB XB EB FB","33":"F J K C G E A B D u Y I M H N O P Q R S T U V W X w Z a b c d e"},E:{"1":"E A B LB MB NB","33":"F J K C G GB AB IB JB KB"},F:{"1":"S T U V W X w Z a b c d e f L h i j k l m n o p q r s t x","2":"E OB PB","33":"8 9 B D I M H N O P Q R QB RB UB"},G:{"1":"cB dB eB fB gB","33":"G AB WB BB YB ZB aB bB"},H:{"2":"hB"},I:{"1":"g","33":"1 F iB jB kB lB BB mB nB"},J:{"33":"C A"},K:{"1":"8 9 B D L x","2":"A"},L:{"1":"g"},M:{"1":"v"},N:{"1":"A B"},O:{"33":"oB"},P:{"1":"F J pB"},Q:{"1":"qB"},R:{"1":"rB"}},B:5,C:"CSS3 2D Transforms"};
var assert = require('assert'); var common = require('../../../common.js'); var MockServer = require('../../../lib/mockserver.js'); var Nightwatch = require('../../../lib/nightwatch.js'); var MochaTest = require('../../../lib/mochatest.js'); module.exports = MochaTest.add('client.screenshot', { beforeEach: function () { this.client = Nightwatch.client(); this.protocol = common.require('api/protocol.js')(this.client); }, testScreenshot: function (done) { var protocol = this.protocol; var command = protocol.screenshot(false, function callback() { done(); }); assert.equal(command.request.method, 'GET'); assert.equal(command.request.path, '/wd/hub/session/1352110219202/screenshot'); } });
'use strict'; exports = module.exports = function(app) { app.utility = {}; app.utility.sendmail = require('./utilities/sendmail'); app.utility.slugify = require('./utilities/slugify'); app.utility.workflow = require('./utilities/workflow'); };
/** * Copyright 2015 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * 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. */ /* jshint maxlen: false */ 'use strict'; var createAPIRequest = require('../../lib/apirequest'); /** * Google Analytics API * * @classdesc View and manage your Google Analytics data * @namespace analytics * @version v2.4 * @variation v2.4 * @this Analytics * @param {object=} options Options for Analytics */ function Analytics(options) { var self = this; this._options = options || {}; this.data = { /** * analytics.data.get * * @desc Returns Analytics report data for a view (profile). * * @alias analytics.data.get * @memberOf! analytics(v2.4) * * @param {object} params - Parameters for request * @param {string=} params.dimensions - A comma-separated list of Analytics dimensions. E.g., 'ga:browser,ga:city'. * @param {string} params.end-date - End date for fetching report data. All requests should specify an end date formatted as YYYY-MM-DD. * @param {string=} params.filters - A comma-separated list of dimension or metric filters to be applied to the report data. * @param {string} params.ids - Unique table ID for retrieving report data. Table ID is of the form ga:XXXX, where XXXX is the Analytics view (profile) ID. * @param {integer=} params.max-results - The maximum number of entries to include in this feed. * @param {string} params.metrics - A comma-separated list of Analytics metrics. E.g., 'ga:sessions,ga:pageviews'. At least one metric must be specified to retrieve a valid Analytics report. * @param {string=} params.segment - An Analytics advanced segment to be applied to the report data. * @param {string=} params.sort - A comma-separated list of dimensions or metrics that determine the sort order for the report data. * @param {string} params.start-date - Start date for fetching report data. All requests should specify a start date formatted as YYYY-MM-DD. * @param {integer=} params.start-index - An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter. * @param {callback} callback - The callback that handles the response. * @return {object} Request object */ get: function(params, callback) { var parameters = { options: { url: 'https://www.googleapis.com/analytics/v2.4/data', method: 'GET' }, params: params, requiredParams: ['ids', 'start-date', 'end-date', 'metrics'], pathParams: [], context: self }; return createAPIRequest(parameters, callback); } }; this.management = { accounts: { /** * analytics.management.accounts.list * * @desc Lists all accounts to which the user has access. * * @alias analytics.management.accounts.list * @memberOf! analytics(v2.4) * * @param {object=} params - Parameters for request * @param {integer=} params.max-results - The maximum number of accounts to include in this response. * @param {integer=} params.start-index - An index of the first account to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter. * @param {callback} callback - The callback that handles the response. * @return {object} Request object */ list: function(params, callback) { var parameters = { options: { url: 'https://www.googleapis.com/analytics/v2.4/management/accounts', method: 'GET' }, params: params, requiredParams: [], pathParams: [], context: self }; return createAPIRequest(parameters, callback); } }, goals: { /** * analytics.management.goals.list * * @desc Lists goals to which the user has access. * * @alias analytics.management.goals.list * @memberOf! analytics(v2.4) * * @param {object} params - Parameters for request * @param {string} params.accountId - Account ID to retrieve goals for. Can either be a specific account ID or '~all', which refers to all the accounts that user has access to. * @param {integer=} params.max-results - The maximum number of goals to include in this response. * @param {string} params.profileId - View (Profile) ID to retrieve goals for. Can either be a specific view (profile) ID or '~all', which refers to all the views (profiles) that user has access to. * @param {integer=} params.start-index - An index of the first goal to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter. * @param {string} params.webPropertyId - Web property ID to retrieve goals for. Can either be a specific web property ID or '~all', which refers to all the web properties that user has access to. * @param {callback} callback - The callback that handles the response. * @return {object} Request object */ list: function(params, callback) { var parameters = { options: { url: 'https://www.googleapis.com/analytics/v2.4/management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/goals', method: 'GET' }, params: params, requiredParams: ['accountId', 'webPropertyId', 'profileId'], pathParams: ['accountId', 'profileId', 'webPropertyId'], context: self }; return createAPIRequest(parameters, callback); } }, profiles: { /** * analytics.management.profiles.list * * @desc Lists views (profiles) to which the user has access. * * @alias analytics.management.profiles.list * @memberOf! analytics(v2.4) * * @param {object} params - Parameters for request * @param {string} params.accountId - Account ID for the views (profiles) to retrieve. Can either be a specific account ID or '~all', which refers to all the accounts to which the user has access. * @param {integer=} params.max-results - The maximum number of views (profiles) to include in this response. * @param {integer=} params.start-index - An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter. * @param {string} params.webPropertyId - Web property ID for the views (profiles) to retrieve. Can either be a specific web property ID or '~all', which refers to all the web properties to which the user has access. * @param {callback} callback - The callback that handles the response. * @return {object} Request object */ list: function(params, callback) { var parameters = { options: { url: 'https://www.googleapis.com/analytics/v2.4/management/accounts/{accountId}/webproperties/{webPropertyId}/profiles', method: 'GET' }, params: params, requiredParams: ['accountId', 'webPropertyId'], pathParams: ['accountId', 'webPropertyId'], context: self }; return createAPIRequest(parameters, callback); } }, segments: { /** * analytics.management.segments.list * * @desc Lists advanced segments to which the user has access. * * @alias analytics.management.segments.list * @memberOf! analytics(v2.4) * * @param {object=} params - Parameters for request * @param {integer=} params.max-results - The maximum number of advanced segments to include in this response. * @param {integer=} params.start-index - An index of the first advanced segment to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter. * @param {callback} callback - The callback that handles the response. * @return {object} Request object */ list: function(params, callback) { var parameters = { options: { url: 'https://www.googleapis.com/analytics/v2.4/management/segments', method: 'GET' }, params: params, requiredParams: [], pathParams: [], context: self }; return createAPIRequest(parameters, callback); } }, webproperties: { /** * analytics.management.webproperties.list * * @desc Lists web properties to which the user has access. * * @alias analytics.management.webproperties.list * @memberOf! analytics(v2.4) * * @param {object} params - Parameters for request * @param {string} params.accountId - Account ID to retrieve web properties for. Can either be a specific account ID or '~all', which refers to all the accounts that user has access to. * @param {integer=} params.max-results - The maximum number of web properties to include in this response. * @param {integer=} params.start-index - An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter. * @param {callback} callback - The callback that handles the response. * @return {object} Request object */ list: function(params, callback) { var parameters = { options: { url: 'https://www.googleapis.com/analytics/v2.4/management/accounts/{accountId}/webproperties', method: 'GET' }, params: params, requiredParams: ['accountId'], pathParams: ['accountId'], context: self }; return createAPIRequest(parameters, callback); } } }; } /** * Exports Analytics object * @type Analytics */ module.exports = Analytics;
Package.describe({ name: "telescope:sitemap", summary: "Sitemap package for Telescope", version: "0.25.7", git: "https://github.com/TelescopeJS/telescope-sitemap.git" }); Package.onUse(function(api) { api.versionsFrom("METEOR@1.0"); api.use([ "telescope:core@0.25.7", "gadicohen:sitemaps@0.0.20" ]); // server api.addFiles([ "lib/server/sitemaps.js" ], ["server"]); });
import { artworkGridRenders } from "../helpers/artworkGridRenders" describe("/collection/:id", () => { before(() => { cy.visit("/collection/emerging-photographers") }) it("renders metadata", () => { cy.title().should("eq", "Emerging Photographers - For Sale on Artsy") cy.get("meta[name='description']") .should("have.attr", "content") .and( "eq", "Buy, bid, and inquire on Emerging Photographers on Artsy. Today’s leading photographers are pushing the medium into new territories&mdash;experimenting with digital manipulation, unleashing the power of new macro …" ) }) it("renders page content", () => { cy.get("h1").should("contain", "Emerging Photographers") artworkGridRenders() }) }) describe("/collection/:id (a collection hub)", () => { before(() => { cy.visit("/collection/contemporary") }) it("renders metadata", () => { cy.title().should("eq", "Contemporary Art - For Sale on Artsy") cy.get("meta[name='description']") .should("have.attr", "content") .and( "eq", "Buy, bid, and inquire on Contemporary Art on Artsy. Spanning from 1970 to the present day, the contemporary period of art history represents the most diverse and widely-collected era of artistic production. …" ) }) it("renders page content", () => { cy.get("h1").should("contain", "Contemporary") artworkGridRenders() }) })
/* See documentation on https://github.com/frankrousseau/americano-cozy/#requests */ var americano = require('americano'); module.exports = { template: { // shortcut for emit doc._id, doc all: americano.defaultRequests.all, /* create all the requests you want! This request will gives you the number of documents that share the same date */ customRequest: { map: function (doc) { return emit(doc.date, doc); }, reduce: function (key, values, rereduce) { return sum(values); } } } };
(function() { 'use strict'; app.controller('addEditUserCtrl', ['$uibModalInstance', 'api', 'constants', 'commonFactory', 'config', 'url', function($uibModalInstance, api, constants, commonFactory, config, url) { var addEditUser = this; commonFactory.getRoles(function(response) { addEditUser.roles = response.data; }); addEditUser.config = config; addEditUser.user = config.user; var profileCallConfig = { url: url.admin.updateUser }; addEditUser.validateAndSave = function() { if(addEditUser.config.type==='add'){ profileCallConfig.url = url.admin.addUser; } profileCallConfig.method = constants.method.post; profileCallConfig.data = addEditUser.user; api.executeCall(profileCallConfig,function(response) { if (response.data.user_id) { addEditUser.user = response.data; $uibModalInstance.close(addEditUser); }else{ addEditUser.addEditUserError = response.data; } },function(err){ addEditUser.error = err.data; }); }; addEditUser.cancel = function() { $uibModalInstance.dismiss('cancel'); }; }]); })();
// Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. /** * @constructor * @implements {WebInspector.Linkifier.LinkHandler} */ WebInspector.FrontendWebSocketAPI = function() { InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Events.DispatchFrontendAPIMessage, this._onFrontendAPIMessage, this); InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Events.FrontendAPIAttached, this._onAttach, this); InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Events.FrontendAPIDetached, this._onDetach, this); } WebInspector.FrontendWebSocketAPI.prototype = { _onAttach: function() { WebInspector.workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeContentCommitted, this._workingCopyCommitted, this); WebInspector.workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeWorkingCopyChanged, this._workingCopyChanged, this); WebInspector.Linkifier.setLinkHandler(this); }, _onDetach: function() { WebInspector.workspace.removeEventListener(WebInspector.Workspace.Events.UISourceCodeContentCommitted, this._workingCopyCommitted, this); WebInspector.workspace.removeEventListener(WebInspector.Workspace.Events.UISourceCodeWorkingCopyChanged, this._workingCopyChanged, this); WebInspector.Linkifier.setLinkHandler(null); }, /** * @override * @param {string} url * @param {number=} lineNumber * @return {boolean} */ handleLink: function(url, lineNumber) { var uiSourceCode = WebInspector.networkMapping.uiSourceCodeForURLForAnyTarget(url); if (uiSourceCode) url = uiSourceCode.originURL(); if (url.startsWith("file://")) { var file = url.substring(7); this._issueFrontendAPINotification("Frontend.revealLocation", { file: file, line: lineNumber }); return true; } return false; }, /** * @param {!WebInspector.Event} event */ _onFrontendAPIMessage: function(event) { var message = JSON.parse(/** @type {string} */ (event.data)); this._dispatchFrontendAPIMessage(message["id"], message["method"], message["params"] || null); }, /** * @param {number} id * @param {string} method * @param {?Object} params */ _dispatchFrontendAPIMessage: function(id, method, params) { this._dispatchingFrontendMessage = true; switch (method) { case "Frontend.updateBuffer": var file = params["file"]; var buffer = params["buffer"]; var saved = params["saved"]; var uiSourceCode = WebInspector.workspace.filesystemUISourceCode("file://" + file); if (uiSourceCode) { if (buffer !== uiSourceCode.workingCopy()) uiSourceCode.setWorkingCopy(buffer); if (saved) uiSourceCode.checkContentUpdated(); } this._issueResponse(id); break; default: WebInspector.console.log("Unhandled API message: " + method); } this._dispatchingFrontendMessage = false; }, /** * @param {!WebInspector.Event} event * @param {boolean=} saved */ _workingCopyChanged: function(event, saved) { if (this._dispatchingFrontendMessage) return; var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data["uiSourceCode"]); var url = uiSourceCode.originURL(); if (url.startsWith("file://")) url = url.substring(7); var params = { file: url, buffer: uiSourceCode.workingCopy() }; if (saved) params.saved = true; this._issueFrontendAPINotification("Frontend.bufferUpdated", params); }, /** * @param {!WebInspector.Event} event */ _workingCopyCommitted: function(event) { this._workingCopyChanged(event, true); }, /** * @param {number} id * @param {!Object=} params */ _issueResponse: function(id, params) { var object = {id: id}; if (params) object.params = params; InspectorFrontendHost.sendFrontendAPINotification(JSON.stringify(object)); }, /** * @param {string} method * @param {?Object} params */ _issueFrontendAPINotification: function(method, params) { InspectorFrontendHost.sendFrontendAPINotification(JSON.stringify({ method: method, params: params })); } }
'use strict'; describe('longStackTraceZone', function () { var log; var lstz = zone.fork(Zone.longStackTraceZone).fork({ reporter: function reporter (trace) { log.push(trace); } }); beforeEach(function () { log = []; }); it('should produce long stack traces', function (done) { lstz.run(function () { setTimeout(function () { setTimeout(function () { setTimeout(function () { expect(log[0]).toBe('Error: hello'); expect(log[1].split('--- ').length).toBe(4); done(); }, 0); throw new Error('hello'); }, 0); }, 0); }); }); it('should filter based on stackFramesFilter', function (done) { lstz.fork({ stackFramesFilter: function (line) { return line.indexOf('jasmine.js') === -1; } }).run(function () { setTimeout(function () { setTimeout(function () { setTimeout(function () { expect(log[1]).not.toContain('jasmine.js'); done(); }, 0); throw new Error('hello'); }, 0); }, 0); }); }); it('should expose LST via getLogStackTrace', function () { expect(lstz.getLongStacktrace()).toBeDefined(); }); it('should honor parent\'s fork()', function () { zone .fork({ '+fork': function() { log.push('fork'); } }) .fork(Zone.longStackTraceZone) .fork(); expect(log).toEqual(['fork', 'fork']); }); });
import Ember from "ember-metal/core"; import { assign } from "ember-metal/merge"; export default { setupState(lastState, env, scope, params, hash) { var type = env.hooks.getValue(hash.type); var componentName = componentNameMap[type] || defaultComponentName; Ember.assert("{{input type='checkbox'}} does not support setting `value=someBooleanValue`;" + " you must use `checked=someBooleanValue` instead.", !(type === 'checkbox' && hash.hasOwnProperty('value'))); return assign({}, lastState, { componentName }); }, render(morph, env, scope, params, hash, template, inverse, visitor) { env.hooks.component(morph, env, scope, morph.state.componentName, params, hash, { default: template, inverse }, visitor); }, rerender(...args) { this.render(...args); } }; var defaultComponentName = "-text-field"; var componentNameMap = { 'checkbox': '-checkbox' };
'use strict'; const shouldSnapshotFilePath = require.resolve('./esm-snapshot.js'); require('./esm-snapshot.js'); require.cache[shouldSnapshotFilePath].exports++;
describe("BASIC CRUD SCENARIOS", function() { require("./basic"); }); describe("CREATE SCENARIOS", function() { require("./create"); });
import configuration from 'torii/configuration'; export default { name: 'torii-walk-providers', initialize: function(appInstance){ // Walk all configured providers and eagerly instantiate // them. This gives providers with initialization side effects // like facebook-connect a chance to load up assets. for (var key in configuration.providers) { if (configuration.providers.hasOwnProperty(key)) { appInstance.container.lookup('torii-provider:'+key); } } } };
// quarantine var path = require('path'); var fs = require('fs'); exports.register = function () { this.register_hook('queue','quarantine'); } // http://unknownerror.net/2011-05/16260-nodejs-mkdirs-recursion-create-directory.html var mkdirs = exports.mkdirs = function(dirpath, mode, callback) { path.exists(dirpath, function(exists) { if (exists) { callback(dirpath); } else { mkdirs(path.dirname(dirpath), mode, function() { fs.mkdir(dirpath, mode, callback); }); } }); } var zeroPad = exports.zeroPad = function (n, digits) { n = n.toString(); while (n.length < digits) { n = '0' + n; } return n; } exports.hook_init_master = function (next) { // At start-up; delete any files in the temporary directory // NOTE: This is deliberately syncronous to ensure that this // is completed prior to any messages being received. var config = this.config.get('quarantine.ini'); var base_dir = (config.main.quarantine_path) ? config.main.quarantine_path : '/var/spool/haraka/quarantine'; var tmp_dir = [ base_dir, 'tmp' ].join('/'); if (path.existsSync(tmp_dir)) { var dirent = fs.readdirSync(tmp_dir); this.loginfo('Removing temporary files from: ' + tmp_dir); for (var i=0; i<dirent.length; i++) { fs.unlinkSync([ tmp_dir, dirent[i] ].join('/')); } } return next(); } exports.quarantine = function (next, connection) { var transaction = connection.transaction; if ((connection.notes.quarantine || transaction.notes.quarantine)) { var lines = transaction.data_lines; // Skip unless we have some data if (lines.length === 0) { return next(); } // Calculate date in YYYYMMDD format var d = new Date(); var yyyymmdd = d.getFullYear() + zeroPad(d.getMonth()+1, 2) + this.zeroPad(d.getDate(), 2); var config = this.config.get('quarantine.ini'); var base_dir = (config.main.quarantine_path) ? config.main.quarantine_path : '/var/spool/haraka/quarantine'; var dir; // Allow either boolean or a sub-directory to be specified if (connection.notes.quarantine) { if (typeof(connection.notes.quarantine) !== 'boolean' && connection.notes.quarantine !== 1) { dir = connection.notes.quarantine; } } else if (transaction.notes.quarantine) { if (typeof(transaction.notes.quarantine) !== 'boolean' && transaction.notes.quarantine !== 1) { dir = transaction.notes.quarantine; } } if (!dir) { dir = yyyymmdd; } else { dir = [ dir, yyyymmdd ].join('/'); } var plugin = this; // Create all the directories recursively if they do not exist first. // Then write the file to a temporary directory first, once this is // successful we hardlink the file to the final destination and then // remove the temporary file to guarantee a complete file in the // final destination. mkdirs([ base_dir, 'tmp' ].join('/'), parseInt('0770', 8), function () { mkdirs([ base_dir, dir ].join('/'), parseInt('0770', 8), function () { fs.writeFile([ base_dir, 'tmp', transaction.uuid ].join('/'), lines.join(''), function(err) { if (err) { connection.logerror(plugin, 'Error writing quarantine file: ' + err); } else { fs.link([ base_dir, 'tmp', transaction.uuid ].join('/'), [ base_dir, dir, transaction.uuid ].join('/'), function (err) { if (err) { connection.logerror(plugin, 'Error writing quarantine file: ' + err); } else { connection.loginfo(plugin, 'Stored copy of message in quarantine: ' + [ base_dir, dir, transaction.uuid ].join('/')); // Now delete the temporary file fs.unlink([ base_dir, 'tmp', transaction.uuid ].join('/')); } return next(); } ); } }); }); }); } else { return next(); } }
import { moduleForComponent, test } from 'ember-qunit'; import Ember from 'ember'; moduleForComponent( 'sl-modal-header', 'Unit | Component | sl modal header', { unit: true }); test( 'Modal header class exists on child element', function( assert ) { assert.equal( this.$().find( '.modal-header' ).length, 1 ); }); test( 'Close button exists', function( assert ) { assert.equal( this.$().find( '.close' ).length, 1 ); }); test( 'Setting title on header works', function( assert ) { const title = 'hello world'; this.subject({ title: title }); assert.equal( this.$().find( '.modal-title' ).text(), title ); }); test( 'Content is yielded', function( assert ) { const content = '<div class="test"></div>'; this.subject({ template: Ember.Handlebars.compile( content ) }); assert.equal( this.$( '.test' ).length, 1 ); }); test( 'Modal title\'s id is set to ariaLabelledBy property value', function( assert ) { const component = this.subject({ title: 'labelTest' }); assert.equal( this.$( '.modal-title' ).prop( 'id' ), component.get( 'ariaLabelledBy' ) ); }); test( 'aria-labelledby can be bound in a custom header', function( assert ) { const template = '<span class="modal-title" id={{ariaLabelledBy}}>Custom Title</span>'; const component = this.subject({ layout: Ember.Handlebars.compile( template ), ariaLabelledBy: 'mockUniqueString' }); assert.equal( this.$( '.modal-title' ).prop( 'id' ), component.get( 'ariaLabelledBy' ) ); });
export default { today: '今天', now: '此刻', backToToday: '返回今天', ok: '确定', timeSelect: '选择时间', dateSelect: '选择日期', clear: '清除', month: '月', year: '年', previousMonth: '上个月 (翻页上键)', nextMonth: '下个月 (翻页下键)', monthSelect: '选择月份', yearSelect: '选择年份', decadeSelect: '选择年代', yearFormat: 'YYYY年', dayFormat: 'D日', dateFormat: 'YYYY年M月D日', dateTimeFormat: 'YYYY年M月D日 HH时mm分ss秒', previousYear: '上一年 (Control键加左方向键)', nextYear: '下一年 (Control键加右方向键)', previousDecade: '上一年代', nextDecade: '下一年代', previousCentury: '上一世纪', nextCentury: '下一世纪' };
describe('Ideas Component', function(){ var TestUtils, idea; beforeEach(function(){ TestUtils = React.addons.TestUtils; idea = React.createElement(app.Idea, null); idea = TestUtils.renderIntoDocument(idea); }); it('should render the body', function(){ expect(idea.refs.body).to.be.ok(); }); });
module.exports = function(hljs) { var IDENT_RE = '[a-zA-Z_$][a-zA-Z0-9_$]*'; var IDENT_FUNC_RETURN_TYPE_RE = '([*]|[a-zA-Z_$][a-zA-Z0-9_$]*)'; var HAXE_BASIC_TYPES = 'Int Float String Bool Dynamic Void Array '; return { aliases: ['hx'], keywords: { keyword: 'break callback case cast catch continue default do dynamic else enum extern ' + 'for function here if import in inline never new override package private get set ' + 'public return static super switch this throw trace try typedef untyped using var while ' + HAXE_BASIC_TYPES, built_in: 'trace this', literal: 'true false null _' }, contains: [ { className: 'string', // interpolate-able strings begin: '\'', end: '\'', contains: [ hljs.BACKSLASH_ESCAPE, { className: 'subst', // interpolation begin: '\\$\\{', end: '\\}' }, { className: 'subst', // interpolation begin: '\\$', end: '\\W}' } ] }, hljs.QUOTE_STRING_MODE, hljs.C_LINE_COMMENT_MODE, hljs.C_BLOCK_COMMENT_MODE, hljs.C_NUMBER_MODE, { className: 'meta', // compiler meta begin: '@:', end: '$' }, { className: 'meta', // compiler conditionals begin: '#', end: '$', keywords: {'meta-keyword': 'if else elseif end error'} }, { className: 'type', // function types begin: ':[ \t]*', end: '[^A-Za-z0-9_ \t\\->]', excludeBegin: true, excludeEnd: true, relevance: 0 }, { className: 'type', // types begin: ':[ \t]*', end: '\\W', excludeBegin: true, excludeEnd: true }, { className: 'type', // instantiation begin: 'new *', end: '\\W', excludeBegin: true, excludeEnd: true }, { className: 'class', // enums beginKeywords: 'enum', end: '\\{', contains: [ hljs.TITLE_MODE ] }, { className: 'class', // abstracts beginKeywords: 'abstract', end: '[\\{$]', contains: [ { className: 'type', begin: '\\(', end: '\\)', excludeBegin: true, excludeEnd: true }, { className: 'type', begin: 'from +', end: '\\W', excludeBegin: true, excludeEnd: true }, { className: 'type', begin: 'to +', end: '\\W', excludeBegin: true, excludeEnd: true }, hljs.TITLE_MODE ], keywords: { keyword: 'abstract from to' } }, { className: 'class', // classes begin: '\\b(class|interface) +', end: '[\\{$]', excludeEnd: true, keywords: 'class interface', contains: [ { className: 'keyword', begin: '\\b(extends|implements) +', keywords: 'extends implements', contains: [ { className: 'type', begin: hljs.IDENT_RE, relevance: 0 } ] }, hljs.TITLE_MODE ] }, { className: 'function', beginKeywords: 'function', end: '\\(', excludeEnd: true, illegal: '\\S', contains: [ hljs.TITLE_MODE ] } ], illegal: /<\// }; };
Clazz.declarePackage ("J.adapter.readers.pymol"); Clazz.load (["J.api.JmolSceneGenerator", "java.util.Hashtable", "JU.BS", "$.Lst", "$.P3"], "J.adapter.readers.pymol.PyMOLScene", ["java.lang.Boolean", "$.Double", "$.Float", "JU.AU", "$.CU", "$.PT", "$.SB", "J.adapter.readers.pymol.JmolObject", "$.PyMOL", "$.PyMOLGroup", "J.atomdata.RadiusData", "J.c.VDW", "JM.Text", "JU.BSUtil", "$.C", "$.Escape", "$.Logger", "$.Point3fi"], function () { c$ = Clazz.decorateAsClass (function () { this.vwr = null; this.pymolVersion = 0; this.bsHidden = null; this.bsNucleic = null; this.bsNonbonded = null; this.bsLabeled = null; this.bsHydrogen = null; this.bsNoSurface = null; this.htSpacefill = null; this.ssMapAtom = null; this.atomColorList = null; this.occludedObjects = null; this.labels = null; this.colixes = null; this.frameObj = null; this.groups = null; this.objectSettings = null; this.bsCartoon = null; this.htCarveSets = null; this.htDefinedAtoms = null; this.htHiddenObjects = null; this.moleculeNames = null; this.jmolObjects = null; this.htAtomMap = null; this.htObjectAtoms = null; this.htObjectGroups = null; this.htMeasures = null; this.htObjectSettings = null; this.objectInfo = null; this.settings = null; this.htStateSettings = null; this.stateSettings = null; this.uniqueSettings = null; this.uniqueList = null; this.bsUniqueBonds = null; this.bgRgb = 0; this.dotColor = 0; this.surfaceMode = 0; this.surfaceColor = 0; this.cartoonColor = 0; this.ribbonColor = 0; this.sphereColor = 0; this.labelFontId = 0; this.labelColor = 0; this.cartoonTranslucency = 0; this.ribbonTranslucency = 0; this.labelSize = 0; this.meshWidth = 0; this.nonbondedSize = 0; this.nonbondedTranslucency = 0; this.sphereScale = 0; this.sphereTranslucency = 0; this.stickTranslucency = 0; this.transparency = 0; this.cartoonLadderMode = false; this.cartoonRockets = false; this.haveNucleicLadder = false; this.labelPosition = null; this.labelPosition0 = null; this.objectName = null; this.objectNameID = null; this.objectJmolName = null; this.objectType = 0; this.bsAtoms = null; this.objectHidden = false; this.reader = null; this.uniqueIDs = null; this.cartoonTypes = null; this.sequenceNumbers = null; this.newChain = null; this.radii = null; this.baseModelIndex = 0; this.baseAtomIndex = 0; this.stateCount = 0; this.mepList = ""; this.doCache = false; this.haveScenes = false; this.bsCarve = null; this.solventAccessible = false; this.bsLineBonds = null; this.bsStickBonds = null; this.thisState = 0; this.currentAtomSetIndex = 0; this.surfaceInfoName = null; Clazz.instantialize (this, arguments); }, J.adapter.readers.pymol, "PyMOLScene", null, J.api.JmolSceneGenerator); Clazz.prepareFields (c$, function () { this.bsHidden = new JU.BS (); this.bsNucleic = new JU.BS (); this.bsNonbonded = new JU.BS (); this.bsLabeled = new JU.BS (); this.bsHydrogen = new JU.BS (); this.bsNoSurface = new JU.BS (); this.htSpacefill = new java.util.Hashtable (); this.ssMapAtom = new java.util.Hashtable (); this.atomColorList = new JU.Lst (); this.occludedObjects = new java.util.Hashtable (); this.labels = new java.util.Hashtable (); this.bsCartoon = new JU.BS (); this.htCarveSets = new java.util.Hashtable (); this.htDefinedAtoms = new java.util.Hashtable (); this.htHiddenObjects = new java.util.Hashtable (); this.moleculeNames = new JU.Lst (); this.jmolObjects = new JU.Lst (); this.htAtomMap = new java.util.Hashtable (); this.htObjectAtoms = new java.util.Hashtable (); this.htObjectGroups = new java.util.Hashtable (); this.htMeasures = new java.util.Hashtable (); this.htObjectSettings = new java.util.Hashtable (); this.objectInfo = new java.util.Hashtable (); this.htStateSettings = new java.util.Hashtable (); this.labelPosition0 = new JU.P3 (); this.bsLineBonds = new JU.BS (); this.bsStickBonds = new JU.BS (); }); Clazz.defineMethod (c$, "clearReaderData", function () { this.reader = null; this.colixes = null; this.atomColorList = null; this.objectSettings = null; this.stateSettings = null; if (this.haveScenes) return; this.settings = null; this.groups = null; this.labels = null; this.ssMapAtom = null; this.htSpacefill = null; this.htAtomMap = null; this.htMeasures = null; this.htObjectGroups = null; this.htObjectAtoms = null; this.htObjectSettings = null; this.htStateSettings = null; this.htHiddenObjects = null; this.objectInfo = null; this.occludedObjects = null; this.bsHidden = this.bsNucleic = this.bsNonbonded = this.bsLabeled = this.bsHydrogen = this.bsNoSurface = this.bsCartoon = null; }); Clazz.defineMethod (c$, "setUniqueBond", function (index, uniqueID) { if (uniqueID < 0) return; if (this.uniqueList == null) { this.uniqueList = new java.util.Hashtable (); this.bsUniqueBonds = new JU.BS (); }this.uniqueList.put (Integer.$valueOf (index), Integer.$valueOf (uniqueID)); this.bsUniqueBonds.set (index); }, "~N,~N"); Clazz.defineMethod (c$, "setStateCount", function (stateCount) { this.stateCount = stateCount; }, "~N"); Clazz.makeConstructor (c$, function (reader, vwr, settings, uniqueSettings, pymolVersion, haveScenes, baseAtomIndex, baseModelIndex, doCache, filePath) { this.reader = reader; this.vwr = vwr; this.settings = settings; this.uniqueSettings = uniqueSettings; this.pymolVersion = pymolVersion; this.haveScenes = haveScenes; this.baseAtomIndex = baseAtomIndex; this.baseModelIndex = baseModelIndex; this.doCache = doCache; this.surfaceInfoName = filePath + "##JmolSurfaceInfo##"; this.setVersionSettings (); settings.trimToSize (); this.bgRgb = J.adapter.readers.pymol.PyMOLScene.colorSetting (J.adapter.readers.pymol.PyMOLScene.listAt (settings, 6)); J.adapter.readers.pymol.PyMOLScene.pointAt (J.adapter.readers.pymol.PyMOLScene.listAt (settings, 471).get (2), 0, this.labelPosition0); }, "J.api.PymolAtomReader,JV.Viewer,JU.Lst,java.util.Map,~N,~B,~N,~N,~B,~S"); Clazz.defineMethod (c$, "setReaderObjectInfo", function (name, type, groupName, isHidden, listObjSettings, listStateSettings, ext) { this.objectName = name; this.objectHidden = isHidden; this.objectNameID = (this.objectName == null ? null : J.adapter.readers.pymol.PyMOLScene.fixName (this.objectName + ext)); this.objectSettings = new java.util.Hashtable (); this.stateSettings = new java.util.Hashtable (); if (this.objectName != null) { this.objectJmolName = J.adapter.readers.pymol.PyMOLScene.getJmolName (name); if (groupName != null) { this.htObjectGroups.put (this.objectName, groupName); this.htObjectGroups.put (this.objectNameID, groupName); }this.objectInfo.put (this.objectName, Clazz.newArray (-1, [this.objectNameID, Integer.$valueOf (type)])); if (this.htObjectSettings.get (this.objectName) == null) { J.adapter.readers.pymol.PyMOLScene.listToSettings (listObjSettings, this.objectSettings); this.htObjectSettings.put (this.objectName, this.objectSettings); }if (this.htStateSettings.get (this.objectNameID) == null) { J.adapter.readers.pymol.PyMOLScene.listToSettings (listStateSettings, this.stateSettings); this.htStateSettings.put (this.objectNameID, this.stateSettings); }}this.getObjectSettings (); }, "~S,~N,~S,~B,JU.Lst,JU.Lst,~S"); c$.listToSettings = Clazz.defineMethod (c$, "listToSettings", function (list, objectSettings) { if (list != null && list.size () != 0) { for (var i = list.size (); --i >= 0; ) { var setting = list.get (i); objectSettings.put (setting.get (0), setting); } }}, "JU.Lst,java.util.Map"); Clazz.defineMethod (c$, "getObjectSettings", function () { this.transparency = this.floatSetting (138); this.dotColor = Clazz.floatToInt (this.floatSetting (210)); this.nonbondedSize = this.floatSetting (65); this.nonbondedTranslucency = this.floatSetting (524); this.sphereScale = this.floatSetting (155); this.cartoonColor = Clazz.floatToInt (this.floatSetting (236)); this.ribbonColor = Clazz.floatToInt (this.floatSetting (235)); this.sphereColor = Clazz.floatToInt (this.floatSetting (173)); this.cartoonTranslucency = this.floatSetting (279); this.ribbonTranslucency = this.floatSetting (666); this.stickTranslucency = this.floatSetting (198); this.sphereTranslucency = this.floatSetting (172); this.cartoonLadderMode = this.booleanSetting (448); this.cartoonRockets = this.booleanSetting (180); this.surfaceMode = Clazz.floatToInt (this.floatSetting (143)); this.surfaceColor = Clazz.floatToInt (this.floatSetting (144)); this.solventAccessible = this.booleanSetting (338); this.meshWidth = this.floatSetting (90); var carveSet = this.stringSetting (342).trim (); if (carveSet.length == 0) { this.bsCarve = null; } else { this.bsCarve = this.htCarveSets.get (carveSet); if (this.bsCarve == null) this.htCarveSets.put (carveSet, this.bsCarve = new JU.BS ()); }this.labelPosition = new JU.P3 (); try { var setting = this.getObjectSetting (471); J.adapter.readers.pymol.PyMOLScene.pointAt (J.adapter.readers.pymol.PyMOLScene.listAt (setting, 2), 0, this.labelPosition); } catch (e) { if (Clazz.exceptionOf (e, Exception)) { } else { throw e; } } this.labelPosition.add (this.labelPosition0); this.labelColor = Clazz.floatToInt (this.floatSetting (66)); this.labelSize = this.floatSetting (453); this.labelFontId = Clazz.floatToInt (this.floatSetting (328)); }); Clazz.defineMethod (c$, "setAtomInfo", function (uniqueIDs, cartoonTypes, sequenceNumbers, newChain, radii) { this.uniqueIDs = uniqueIDs; this.cartoonTypes = cartoonTypes; this.sequenceNumbers = sequenceNumbers; this.newChain = newChain; this.radii = radii; }, "~A,~A,~A,~A,~A"); Clazz.defineMethod (c$, "setSceneObject", function (name, istate) { this.objectName = name; this.objectType = this.getObjectType (name); this.objectJmolName = J.adapter.readers.pymol.PyMOLScene.getJmolName (name); this.objectNameID = (istate == 0 && this.objectType != 0 ? this.getObjectID (name) : this.objectJmolName + "_" + istate); this.bsAtoms = this.htObjectAtoms.get (name); this.objectSettings = this.htObjectSettings.get (name); this.stateSettings = this.htStateSettings.get (name + "_" + istate); var groupName = this.htObjectGroups.get (name); this.objectHidden = (this.htHiddenObjects.containsKey (name) || groupName != null && !this.groups.get (groupName).visible); this.getObjectSettings (); }, "~S,~N"); Clazz.defineMethod (c$, "buildScene", function (name, thisScene, htObjNames, htSecrets) { var frame = thisScene.get (2); var smap = new java.util.Hashtable (); smap.put ("pymolFrame", frame); smap.put ("generator", this); smap.put ("name", name); var view = J.adapter.readers.pymol.PyMOLScene.listAt (thisScene, 0); if (view != null) smap.put ("pymolView", this.getPymolView (view, false)); var visibilities = thisScene.get (1); smap.put ("visibilities", visibilities); var sname = "_scene_" + name + "_"; var reps = new Array (J.adapter.readers.pymol.PyMOL.REP_LIST.length); for (var j = J.adapter.readers.pymol.PyMOL.REP_LIST.length; --j >= 0; ) { var list = htObjNames.get (sname + J.adapter.readers.pymol.PyMOL.REP_LIST[j]); var data = J.adapter.readers.pymol.PyMOLScene.listAt (list, 5); if (data != null && data.size () > 0) reps[j] = J.adapter.readers.pymol.PyMOLScene.listToMap (data); } smap.put ("moleculeReps", reps); sname = "_!c_" + name + "_"; var colorection = J.adapter.readers.pymol.PyMOLScene.listAt (thisScene, 3); var n = colorection.size (); var colors = new Array (Clazz.doubleToInt (n / 2)); for (var j = 0, i = 0; j < n; j += 2) { var color = J.adapter.readers.pymol.PyMOLScene.intAt (colorection, j); var c = htSecrets.get (sname + color); if (c != null && c.size () > 1) colors[i++] = Clazz.newArray (-1, [Integer.$valueOf (color), c.get (1)]); } smap.put ("colors", colors); this.addJmolObject (1073742139, null, smap).jmolName = name; }, "~S,JU.Lst,java.util.Map,java.util.Map"); Clazz.overrideMethod (c$, "generateScene", function (scene) { JU.Logger.info ("PyMOLScene - generateScene " + scene.get ("name")); this.jmolObjects.clear (); this.bsHidden.clearAll (); this.occludedObjects.clear (); this.htHiddenObjects.clear (); var frame = scene.get ("pymolFrame"); this.thisState = frame.intValue (); this.addJmolObject (4115, null, Integer.$valueOf (this.thisState - 1)); try { this.generateVisibilities (scene.get ("visibilities")); this.generateColors (scene.get ("colors")); this.generateShapes (scene.get ("moleculeReps")); this.finalizeVisibility (); this.offsetObjects (); this.finalizeObjects (); } catch (e) { if (Clazz.exceptionOf (e, Exception)) { JU.Logger.info ("PyMOLScene exception " + e); if (!this.vwr.isJS) e.printStackTrace (); } else { throw e; } } }, "java.util.Map"); Clazz.defineMethod (c$, "generateColors", function (colors) { if (colors == null) return; for (var i = colors.length; --i >= 0; ) { var item = colors[i]; var color = (item[0]).intValue (); var icolor = J.adapter.readers.pymol.PyMOL.getRGB (color); var molecules = item[1]; var bs = this.getSelectionAtoms (molecules, this.thisState, new JU.BS ()); this.addJmolObject (1141899265, bs, null).argb = icolor; } }, "~A"); Clazz.defineMethod (c$, "getSelectionAtoms", function (molecules, istate, bs) { if (molecules != null) for (var j = molecules.size (); --j >= 0; ) this.selectAllAtoms (J.adapter.readers.pymol.PyMOLScene.listAt (molecules, j), istate, bs); return bs; }, "JU.Lst,~N,JU.BS"); Clazz.defineMethod (c$, "selectAllAtoms", function (obj, istate, bs) { var name = obj.get (0); this.setSceneObject (name, istate); var atomList = J.adapter.readers.pymol.PyMOLScene.listAt (obj, 1); var k0 = (istate == 0 ? 1 : istate); var k1 = (istate == 0 ? this.stateCount : istate); for (var k = k0; k <= k1; k++) { var atomMap = this.htAtomMap.get (J.adapter.readers.pymol.PyMOLScene.fixName (name + "_" + k)); if (atomMap == null) continue; this.getBsAtoms (atomList, atomMap, bs); } }, "JU.Lst,~N,JU.BS"); Clazz.defineMethod (c$, "generateVisibilities", function (vis) { if (vis == null) return; var bs = new JU.BS (); this.addJmolObject (12294, null, null); for (var e, $e = this.groups.entrySet ().iterator (); $e.hasNext () && ((e = $e.next ()) || true);) e.getValue ().visible = true; for (var e, $e = vis.entrySet ().iterator (); $e.hasNext () && ((e = $e.next ()) || true);) { var name = e.getKey (); if (name.equals ("all")) continue; var list = e.getValue (); var tok = (J.adapter.readers.pymol.PyMOLScene.intAt (list, 0) == 1 ? 1610625028 : 12294); if (tok == 12294) this.htHiddenObjects.put (name, Boolean.TRUE); switch (this.getObjectType (name)) { case 12: var g = this.groups.get (name); if (g != null) g.visible = (tok == 1610625028); break; } } this.setGroupVisibilities (); for (var e, $e = vis.entrySet ().iterator (); $e.hasNext () && ((e = $e.next ()) || true);) { var name = e.getKey (); if (name.equals ("all")) continue; this.setSceneObject (name, this.thisState); if (this.objectHidden) continue; var list = e.getValue (); var tok = (this.objectHidden ? 12294 : 1610625028); bs = null; var info = this.objectJmolName; switch (this.objectType) { case 0: case 12: continue; case 1: bs = this.vwr.getDefinedAtomSet (info); if (bs.nextSetBit (0) < 0) continue; break; case 4: if (tok == 1610625028) { var mdList = this.htMeasures.get (name); if (mdList != null) this.addMeasurements (mdList, mdList[0].points.size (), null, this.getBS (J.adapter.readers.pymol.PyMOLScene.listAt (list, 2)), J.adapter.readers.pymol.PyMOLScene.intAt (list, 3), null, true); }info += "_*"; break; case 6: case 3: case 2: break; } this.addJmolObject (tok, bs, info); } }, "java.util.Map"); Clazz.defineMethod (c$, "generateShapes", function (reps) { if (reps == null) return; this.addJmolObject (12295, null, null).argb = this.thisState - 1; for (var m = 0; m < this.moleculeNames.size (); m++) { this.setSceneObject (this.moleculeNames.get (m), this.thisState); if (this.objectHidden) continue; var molReps = new Array (23); for (var i = 0; i < 23; i++) molReps[i] = new JU.BS (); for (var i = reps.length; --i >= 0; ) { var repMap = reps[i]; var list = (repMap == null ? null : repMap.get (this.objectName)); if (list != null) this.selectAllAtoms (list, this.thisState, molReps[i]); } this.createShapeObjects (molReps, true, -1, -1); } }, "~A"); Clazz.defineMethod (c$, "getBS", function (list) { var bs = new JU.BS (); for (var i = list.size (); --i >= 0; ) bs.set (J.adapter.readers.pymol.PyMOLScene.intAt (list, i)); return bs; }, "JU.Lst"); Clazz.defineMethod (c$, "getBsAtoms", function (list, atomMap, bs) { for (var i = list.size (); --i >= 0; ) bs.set (atomMap[J.adapter.readers.pymol.PyMOLScene.intAt (list, i)]); }, "JU.Lst,~A,JU.BS"); c$.getColorPt = Clazz.defineMethod (c$, "getColorPt", function (o) { return (Clazz.instanceOf (o, Integer) ? (o).intValue () : JU.CU.colorPtToFFRGB (J.adapter.readers.pymol.PyMOLScene.pointAt (o, 0, J.adapter.readers.pymol.PyMOLScene.ptTemp))); }, "~O"); c$.intAt = Clazz.defineMethod (c$, "intAt", function (list, i) { return (list.get (i)).intValue (); }, "JU.Lst,~N"); c$.colorSetting = Clazz.defineMethod (c$, "colorSetting", function (c) { return J.adapter.readers.pymol.PyMOLScene.getColorPt (c.get (2)); }, "JU.Lst"); Clazz.defineMethod (c$, "setReaderObjects", function () { this.clearReaderData (); this.finalizeObjects (); if (!this.haveScenes) { this.uniqueSettings = null; this.bsUniqueBonds = this.bsStickBonds = this.bsLineBonds = null; }}); Clazz.defineMethod (c$, "finalizeObjects", function () { this.vwr.setStringProperty ("defaults", "PyMOL"); for (var i = 0; i < this.jmolObjects.size (); i++) { try { var obj = this.jmolObjects.get (i); obj.finalizeObject (this, this.vwr.ms, this.mepList, this.doCache); } catch (e) { if (Clazz.exceptionOf (e, Exception)) { System.out.println (e); if (!this.vwr.isJS) e.printStackTrace (); } else { throw e; } } } this.finalizeUniqueBonds (); this.jmolObjects.clear (); }); Clazz.defineMethod (c$, "offsetObjects", function () { for (var i = 0; i < this.jmolObjects.size (); i++) this.jmolObjects.get (i).offset (this.baseModelIndex, this.baseAtomIndex); }); Clazz.defineMethod (c$, "getJmolObject", function (id, bsAtoms, info) { if (this.baseAtomIndex > 0) bsAtoms = JU.BSUtil.copy (bsAtoms); return new J.adapter.readers.pymol.JmolObject (id, this.objectNameID, bsAtoms, info); }, "~N,JU.BS,~O"); Clazz.defineMethod (c$, "addJmolObject", function (id, bsAtoms, info) { return this.addObject (this.getJmolObject (id, bsAtoms, info)); }, "~N,JU.BS,~O"); Clazz.defineMethod (c$, "getPymolView", function (view, isViewObj) { var pymolView = Clazz.newFloatArray (21, 0); var depthCue = this.booleanSetting (84); var fog = this.booleanSetting (88); var fog_start = this.floatSetting (192); var pt = 0; var i = 0; for (var j = 0; j < 3; j++) pymolView[pt++] = J.adapter.readers.pymol.PyMOLScene.floatAt (view, i++); if (isViewObj) i++; for (var j = 0; j < 3; j++) pymolView[pt++] = J.adapter.readers.pymol.PyMOLScene.floatAt (view, i++); if (isViewObj) i++; for (var j = 0; j < 3; j++) pymolView[pt++] = J.adapter.readers.pymol.PyMOLScene.floatAt (view, i++); if (isViewObj) i += 5; for (var j = 0; j < 8; j++) pymolView[pt++] = J.adapter.readers.pymol.PyMOLScene.floatAt (view, i++); var isOrtho = this.booleanSetting (23); var fov = this.floatSetting (152); pymolView[pt++] = (isOrtho ? fov : -fov); pymolView[pt++] = (depthCue ? 1 : 0); pymolView[pt++] = (fog ? 1 : 0); pymolView[pt++] = fog_start; return pymolView; }, "JU.Lst,~B"); Clazz.defineMethod (c$, "globalSetting", function (i) { try { var setting = this.settings.get (i); return (setting.get (2)).floatValue (); } catch (e) { if (Clazz.exceptionOf (e, Exception)) { return J.adapter.readers.pymol.PyMOL.getDefaultSetting (i, this.pymolVersion); } else { throw e; } } }, "~N"); Clazz.defineMethod (c$, "addGroup", function (object, parent, type) { if (this.groups == null) this.groups = new java.util.Hashtable (); var myGroup = this.getGroup (this.objectName); myGroup.object = object; myGroup.objectNameID = this.objectNameID; myGroup.visible = !this.objectHidden; myGroup.type = type; if (!myGroup.visible) { this.occludedObjects.put (this.objectNameID, Boolean.TRUE); this.htHiddenObjects.put (this.objectName, Boolean.TRUE); }if (parent != null && parent.length != 0) this.getGroup (parent).addList (myGroup); return myGroup; }, "JU.Lst,~S,~N"); Clazz.defineMethod (c$, "getGroup", function (name) { var g = this.groups.get (name); if (g == null) { this.groups.put (name, (g = new J.adapter.readers.pymol.PyMOLGroup (name))); this.defineAtoms (name, g.bsAtoms); }return g; }, "~S"); Clazz.defineMethod (c$, "finalizeVisibility", function () { this.setGroupVisibilities (); if (this.groups != null) for (var i = this.jmolObjects.size (); --i >= 0; ) { var obj = this.jmolObjects.get (i); if (obj.jmolName != null && this.occludedObjects.containsKey (obj.jmolName)) obj.visible = false; } if (!this.bsHidden.isEmpty ()) this.addJmolObject (3145770, this.bsHidden, null); }); Clazz.defineMethod (c$, "setCarveSets", function (htObjNames) { if (this.htCarveSets.isEmpty ()) return; for (var e, $e = this.htCarveSets.entrySet ().iterator (); $e.hasNext () && ((e = $e.next ()) || true);) this.getSelectionAtoms (J.adapter.readers.pymol.PyMOLScene.listAt (htObjNames.get (e.getKey ()), 5), 0, e.getValue ()); }, "java.util.Map"); Clazz.defineMethod (c$, "setGroupVisibilities", function () { if (this.groups == null) return; var list = this.groups.values (); var bsAll = new JU.BS (); for (var g, $g = list.iterator (); $g.hasNext () && ((g = $g.next ()) || true);) { bsAll.or (g.bsAtoms); if (g.parent == null) this.setGroupVisible (g, true); else if (g.list.isEmpty ()) g.addGroupAtoms ( new JU.BS ()); } this.defineAtoms ("all", bsAll); }); Clazz.defineMethod (c$, "defineAtoms", function (name, bs) { this.htDefinedAtoms.put (J.adapter.readers.pymol.PyMOLScene.getJmolName (name), bs); }, "~S,JU.BS"); c$.getJmolName = Clazz.defineMethod (c$, "getJmolName", function (name) { return "__" + J.adapter.readers.pymol.PyMOLScene.fixName (name); }, "~S"); Clazz.defineMethod (c$, "createShapeObjects", function (reps, allowSurface, ac0, ac) { if (ac >= 0) { this.bsAtoms = JU.BSUtil.newBitSet2 (ac0, ac); var jo; jo = this.addJmolObject (1141899265, this.bsAtoms, null); this.colixes = JU.AU.ensureLengthShort (this.colixes, ac); for (var i = ac; --i >= ac0; ) this.colixes[i] = this.atomColorList.get (i).intValue (); jo.setColors (this.colixes, 0); jo.setSize (0); jo = this.addJmolObject (1, this.bsAtoms, null); jo.setSize (0); }this.createShapeObject (7, reps[7]); this.createShapeObject (0, reps[0]); this.fixReps (reps); this.createSpacefillObjects (); for (var i = 0; i < 23; i++) switch (i) { case 7: case 0: continue; case 8: case 2: if (!allowSurface) continue; switch (this.surfaceMode) { case 0: reps[i].andNot (this.bsNoSurface); break; case 1: case 3: break; case 2: case 4: reps[i].andNot (this.bsHydrogen); break; } default: this.createShapeObject (i, reps[i]); continue; } this.bsAtoms = null; }, "~A,~B,~N,~N"); Clazz.defineMethod (c$, "addLabel", function (atomIndex, uniqueID, atomColor, labelOffset, label) { var icolor = Clazz.floatToInt (this.getUniqueFloatDef (uniqueID, 66, this.labelColor)); if (icolor == -7 || icolor == -6) { } else if (icolor < 0) { icolor = atomColor; }var labelPos = Clazz.newFloatArray (7, 0); if (labelOffset == null) { var offset = this.getUniquePoint (uniqueID, 471, null); if (offset == null) offset = this.labelPosition; else offset.add (this.labelPosition); J.adapter.readers.pymol.PyMOLScene.setLabelPosition (offset, labelPos); } else { for (var i = 0; i < 7; i++) labelPos[i] = J.adapter.readers.pymol.PyMOLScene.floatAt (labelOffset, i); }this.labels.put (Integer.$valueOf (atomIndex), this.newTextLabel (label, labelPos, icolor, this.labelFontId, this.labelSize)); }, "~N,~N,~N,JU.Lst,~S"); Clazz.defineMethod (c$, "getUniqueFloatDef", function (id, key, defaultValue) { var setting; if (id <= 0 || (setting = this.uniqueSettings.get (Integer.$valueOf ((id << 10) + key))) == null) return defaultValue; var v = (setting.get (2)).floatValue (); if (JU.Logger.debugging) JU.Logger.debug ("Pymol unique setting for " + id + ": [" + key + "] = " + v); return v; }, "~N,~N,~N"); Clazz.defineMethod (c$, "getUniquePoint", function (id, key, pt) { var setting; if (id <= 0 || (setting = this.uniqueSettings.get (Integer.$valueOf ((id << 10) + key))) == null) return pt; pt = new JU.P3 (); J.adapter.readers.pymol.PyMOLScene.pointAt (setting.get (2), 0, pt); JU.Logger.info ("Pymol unique setting for " + id + ": " + key + " = " + pt); return pt; }, "~N,~N,JU.P3"); Clazz.defineMethod (c$, "getObjectSetting", function (i) { return this.objectSettings.get (Integer.$valueOf (i)); }, "~N"); Clazz.defineMethod (c$, "booleanSetting", function (i) { return (this.floatSetting (i) != 0); }, "~N"); Clazz.defineMethod (c$, "floatSetting", function (i) { try { var setting = this.getSetting (i); return (setting.get (2)).floatValue (); } catch (e) { if (Clazz.exceptionOf (e, Exception)) { return J.adapter.readers.pymol.PyMOL.getDefaultSetting (i, this.pymolVersion); } else { throw e; } } }, "~N"); Clazz.defineMethod (c$, "stringSetting", function (i) { try { var setting = this.getSetting (i); return setting.get (2).toString (); } catch (e) { if (Clazz.exceptionOf (e, Exception)) { return null; } else { throw e; } } }, "~N"); Clazz.defineMethod (c$, "getSetting", function (i) { var setting = null; if (this.stateSettings != null) setting = this.stateSettings.get (Integer.$valueOf (i)); if (setting == null && this.objectSettings != null) setting = this.objectSettings.get (Integer.$valueOf (i)); if (setting == null) setting = this.settings.get (i); return setting; }, "~N"); c$.pointAt = Clazz.defineMethod (c$, "pointAt", function (list, i, pt) { pt.set (J.adapter.readers.pymol.PyMOLScene.floatAt (list, i++), J.adapter.readers.pymol.PyMOLScene.floatAt (list, i++), J.adapter.readers.pymol.PyMOLScene.floatAt (list, i)); return pt; }, "JU.Lst,~N,JU.P3"); c$.floatAt = Clazz.defineMethod (c$, "floatAt", function (list, i) { return (list == null ? 0 : (list.get (i)).floatValue ()); }, "JU.Lst,~N"); c$.floatsAt = Clazz.defineMethod (c$, "floatsAt", function (a, pt, data, len) { if (a == null) return null; for (var i = 0; i < len; i++) data[i] = J.adapter.readers.pymol.PyMOLScene.floatAt (a, pt++); return data; }, "JU.Lst,~N,~A,~N"); c$.listAt = Clazz.defineMethod (c$, "listAt", function (list, i) { if (list == null || i >= list.size ()) return null; var o = list.get (i); return (Clazz.instanceOf (o, JU.Lst) ? o : null); }, "JU.Lst,~N"); c$.setLabelPosition = Clazz.defineMethod (c$, "setLabelPosition", function (offset, labelPos) { labelPos[0] = 1; labelPos[1] = offset.x; labelPos[2] = offset.y; labelPos[3] = offset.z; return labelPos; }, "JU.P3,~A"); Clazz.defineMethod (c$, "addCGO", function (data, color) { data.addLast (this.objectName); var jo = this.addJmolObject (23, null, data); jo.argb = color; jo.translucency = this.floatSetting (441); return J.adapter.readers.pymol.PyMOLScene.fixName (this.objectName); }, "JU.Lst,~N"); Clazz.defineMethod (c$, "addMeasurements", function (mdList, nCoord, list, bsReps, color, offsets, haveLabels) { var isNew = (mdList == null); var n = (isNew ? Clazz.doubleToInt (Clazz.doubleToInt (list.size () / 3) / nCoord) : mdList.length); if (n == 0) return false; var drawLabel = haveLabels && bsReps.get (3); var drawDashes = bsReps.get (10); var rad = this.floatSetting (107) / 20; if (rad == 0) rad = 0.05; if (!drawDashes) rad = -5.0E-4; if (color < 0) color = Clazz.floatToInt (this.floatSetting (574)); var c = J.adapter.readers.pymol.PyMOL.getRGB (color); var colix = JU.C.getColix (c); var clabel = (this.labelColor < 0 ? color : this.labelColor); if (isNew) { mdList = new Array (n); this.htMeasures.put (this.objectName, mdList); }var bs = JU.BSUtil.newAndSetBit (0); for (var index = 0, p = 0; index < n; index++) { var md; var offset; if (isNew) { var points = new JU.Lst (); for (var i = 0; i < nCoord; i++, p += 3) points.addLast (J.adapter.readers.pymol.PyMOLScene.pointAt (list, p, new JU.Point3fi ())); offset = J.adapter.readers.pymol.PyMOLScene.floatsAt (J.adapter.readers.pymol.PyMOLScene.listAt (offsets, index), 0, Clazz.newFloatArray (7, 0), 7); if (offset == null) offset = J.adapter.readers.pymol.PyMOLScene.setLabelPosition (this.labelPosition, Clazz.newFloatArray (7, 0)); md = mdList[index] = this.vwr.newMeasurementData (this.objectNameID + "_" + (index + 1), points); md.note = this.objectName; } else { md = mdList[index]; offset = md.text.pymolOffset; }var nDigits = Clazz.floatToInt (this.floatSetting (J.adapter.readers.pymol.PyMOLScene.MEAS_DIGITS[nCoord - 2])); var strFormat = nCoord + ": " + (drawLabel ? "%0." + (nDigits < 0 ? 1 : nDigits) + "VALUE" : ""); var text = this.newTextLabel (strFormat, offset, clabel, Clazz.floatToInt (this.floatSetting (328)), this.floatSetting (453)); md.set (1060866, null, null, strFormat, "angstroms", null, false, false, null, false, Clazz.floatToInt (rad * 2000), colix, text); this.addJmolObject (6, bs, md); } return true; }, "~A,~N,JU.Lst,JU.BS,~N,JU.Lst,~B"); Clazz.defineMethod (c$, "getViewScript", function (view) { var sb = new JU.SB (); var pymolView = this.getPymolView (view, true); sb.append (";set translucent " + (this.globalSetting (213) != 2) + ";set zshadePower 1;set traceAlpha " + (this.globalSetting (111) != 0)); var rockets = this.cartoonRockets; sb.append (";set cartoonRockets " + rockets); if (rockets) sb.append (";set rocketBarrels " + rockets); sb.append (";set cartoonLadders " + this.haveNucleicLadder); sb.append (";set ribbonBorder " + (this.globalSetting (118) != 0)); sb.append (";set cartoonFancy " + (this.globalSetting (118) == 0)); var s = "000000" + Integer.toHexString (this.bgRgb & 0xFFFFFF); s = "[x" + s.substring (s.length - 6) + "]"; sb.append (";background " + s); sb.append (";moveto 0 PyMOL " + JU.Escape.eAF (pymolView)); sb.append (";save orientation 'default';"); return sb; }, "JU.Lst"); Clazz.defineMethod (c$, "getColix", function (colorIndex, translucency) { var colix = (colorIndex == -7 ? (JU.C.getBgContrast (this.bgRgb) == 8 ? 4 : 8) : colorIndex == -6 ? JU.C.getBgContrast (this.bgRgb) : JU.C.getColixO (Integer.$valueOf (J.adapter.readers.pymol.PyMOL.getRGB (colorIndex)))); return JU.C.getColixTranslucent3 (colix, translucency > 0, translucency); }, "~N,~N"); c$.colorSettingClamped = Clazz.defineMethod (c$, "colorSettingClamped", function (c) { return (c.size () < 6 || J.adapter.readers.pymol.PyMOLScene.intAt (c, 4) == 0 ? J.adapter.readers.pymol.PyMOLScene.colorSetting (c) : J.adapter.readers.pymol.PyMOLScene.getColorPt (c.get (5))); }, "JU.Lst"); Clazz.defineMethod (c$, "setAtomColor", function (atomColor) { this.atomColorList.addLast (Integer.$valueOf (this.getColix (atomColor, 0))); }, "~N"); Clazz.defineMethod (c$, "setFrameObject", function (type, info) { if (info != null) { this.frameObj = this.getJmolObject (type, null, info); return; }if (this.frameObj == null) return; this.frameObj.finalizeObject (this, this.vwr.ms, null, false); this.frameObj = null; }, "~N,~O"); c$.fixName = Clazz.defineMethod (c$, "fixName", function (name) { var chars = name.toLowerCase ().toCharArray (); for (var i = chars.length; --i >= 0; ) if (!JU.PT.isLetterOrDigit (chars[i])) chars[i] = '_'; return String.valueOf (chars); }, "~S"); Clazz.defineMethod (c$, "getObjectID", function (name) { return this.objectInfo.get (name)[0]; }, "~S"); Clazz.defineMethod (c$, "getObjectType", function (name) { var o = this.objectInfo.get (name); return (o == null ? 0 : (o[1]).intValue ()); }, "~S"); Clazz.defineMethod (c$, "setAtomMap", function (atomMap, ac0) { this.htAtomMap.put (this.objectNameID, atomMap); var bsAtoms = this.htDefinedAtoms.get (this.objectJmolName); if (bsAtoms == null) { bsAtoms = JU.BS.newN (ac0 + atomMap.length); JU.Logger.info ("PyMOL molecule " + this.objectName); this.htDefinedAtoms.put (this.objectJmolName, bsAtoms); this.htObjectAtoms.put (this.objectName, bsAtoms); this.moleculeNames.addLast (this.objectName); }return bsAtoms; }, "~A,~N"); Clazz.defineMethod (c$, "newTextLabel", function (label, labelOffset, colorIndex, fontID, fontSize) { var face; var factor = 1; switch (fontID) { default: case 11: case 12: case 13: case 14: face = "SansSerif"; break; case 0: case 1: face = "Monospaced"; break; case 9: case 10: case 15: case 16: case 17: case 18: face = "Serif"; break; } var style; switch (fontID) { default: style = "Plain"; break; case 6: case 12: case 16: case 17: style = "Italic"; break; case 7: case 10: case 13: style = "Bold"; break; case 8: case 14: case 18: style = "BoldItalic"; break; } var font = this.vwr.getFont3D (face, style, fontSize == 0 ? 12 : fontSize * factor); var t = JM.Text.newLabel (this.vwr, font, label, this.getColix (colorIndex, 0), 0, 0, 0, labelOffset); return t; }, "~S,~A,~N,~N,~N"); Clazz.defineMethod (c$, "setVersionSettings", function () { if (this.pymolVersion < 100) { this.addSetting (550, 2, Integer.$valueOf (0)); this.addSetting (529, 2, Integer.$valueOf (2)); this.addSetting (471, 4, Clazz.newDoubleArray (-1, [1, 1, 0])); if (this.pymolVersion < 99) { this.addSetting (448, 2, Integer.$valueOf (0)); this.addSetting (431, 2, Integer.$valueOf (0)); this.addSetting (361, 2, Integer.$valueOf (1)); }}}); Clazz.defineMethod (c$, "addSetting", function (key, type, val) { var settingCount = this.settings.size (); if (settingCount <= key) for (var i = key + 1; --i >= settingCount; ) this.settings.addLast (null); if (type == 4) { var d = val; var list; val = list = new JU.Lst (); for (var i = 0; i < 3; i++) list.addLast (Double.$valueOf (d[i])); }var setting = new JU.Lst (); setting.addLast (Integer.$valueOf (key)); setting.addLast (Integer.$valueOf (type)); setting.addLast (val); this.settings.set (key, setting); }, "~N,~N,~O"); Clazz.defineMethod (c$, "fixReps", function (reps) { this.htSpacefill.clear (); this.bsCartoon.clearAll (); for (var iAtom = this.bsAtoms.nextSetBit (0); iAtom >= 0; iAtom = this.bsAtoms.nextSetBit (iAtom + 1)) { var rad = 0; var uniqueID = (this.reader == null ? this.uniqueIDs[iAtom] : this.reader.getUniqueID (iAtom)); if (reps[1].get (iAtom)) { rad = (this.reader == null ? this.radii[iAtom] : this.reader.getVDW (iAtom)) * this.getUniqueFloatDef (uniqueID, 155, this.sphereScale); } else if (reps[4].get (iAtom)) { rad = this.nonbondedSize; }if (rad != 0) { var r = Float.$valueOf (rad); var bsr = this.htSpacefill.get (r); if (bsr == null) this.htSpacefill.put (r, bsr = new JU.BS ()); bsr.set (iAtom); }var cartoonType = (this.reader == null ? this.cartoonTypes[iAtom] : this.reader.getCartoonType (iAtom)); if (reps[5].get (iAtom)) { switch (cartoonType) { case 1: case 4: reps[21].set (iAtom); case -1: reps[5].clear (iAtom); this.bsCartoon.clear (iAtom); break; case 7: reps[22].set (iAtom); reps[5].clear (iAtom); this.bsCartoon.clear (iAtom); break; default: this.bsCartoon.set (iAtom); } }} reps[5].and (this.bsCartoon); this.cleanSingletons (reps[5]); this.cleanSingletons (reps[6]); this.cleanSingletons (reps[21]); this.cleanSingletons (reps[22]); this.bsCartoon.and (reps[5]); }, "~A"); Clazz.defineMethod (c$, "cleanSingletons", function (bs) { if (bs.isEmpty ()) return; bs.and (this.bsAtoms); var bsr = new JU.BS (); var n = bs.length (); var pass = 0; while (true) { for (var i = 0, offset = 0, iPrev = -2147483648, iSeqLast = -2147483648, iSeq = -2147483648; i < n; i++) { if (iPrev < 0 || (this.reader == null ? this.newChain[i] : this.reader.compareAtoms (iPrev, i))) offset++; iSeq = (this.reader == null ? this.sequenceNumbers[i] : this.reader.getSequenceNumber (i)); if (iSeq != iSeqLast) { iSeqLast = iSeq; offset++; }if (pass == 0) { if (bs.get (i)) bsr.set (offset); } else if (!bsr.get (offset)) bs.clear (i); iPrev = i; } if (++pass == 2) break; var bsnot = new JU.BS (); for (var i = bsr.nextSetBit (0); i >= 0; i = bsr.nextSetBit (i + 1)) if (!bsr.get (i - 1) && !bsr.get (i + 1)) bsnot.set (i); bsr.andNot (bsnot); } }, "JU.BS"); Clazz.defineMethod (c$, "createShapeObject", function (shapeID, bs) { if (bs.isEmpty ()) return; var jo = null; switch (shapeID) { case 11: bs.and (this.bsNonbonded); if (bs.isEmpty ()) return; this.setUniqueObjects (7, bs, 0, 0, 524, this.nonbondedTranslucency, 0, this.nonbondedSize, 0.5); break; case 4: case 1: this.setUniqueObjects (0, bs, 173, this.sphereColor, 172, this.sphereTranslucency, 155, this.sphereScale, 1); break; case 19: var ellipsoidTranslucency = this.floatSetting (571); var ellipsoidColor = Clazz.floatToInt (this.floatSetting (570)); var ellipsoidScale = this.floatSetting (569); this.setUniqueObjects (20, bs, 570, ellipsoidColor, 571, ellipsoidTranslucency, 569, ellipsoidScale, 50); break; case 9: this.setUniqueObjects (16, bs, 210, this.dotColor, 0, 0, 155, this.sphereScale, 1); break; case 2: var withinDistance = this.floatSetting (344); jo = this.addJmolObject (135180, bs, Clazz.newArray (-1, [this.booleanSetting (156) ? "FULLYLIT" : "FRONTLIT", (this.surfaceMode == 3 || this.surfaceMode == 4) ? " only" : "", this.bsCarve, Float.$valueOf (withinDistance)])); jo.setSize (this.floatSetting (4) * (this.solventAccessible ? -1 : 1)); jo.translucency = this.transparency; if (this.surfaceColor >= 0) jo.argb = J.adapter.readers.pymol.PyMOL.getRGB (this.surfaceColor); jo.modelIndex = this.currentAtomSetIndex; jo.cacheID = this.surfaceInfoName; this.setUniqueObjects (24, bs, 144, this.surfaceColor, 138, this.transparency, 0, 0, 0); break; case 8: jo = this.addJmolObject (135180, bs, null); jo.setSize (this.floatSetting (4)); jo.translucency = this.transparency; this.setUniqueObjects (24, bs, 144, this.surfaceColor, 138, this.transparency, 0, 0, 0); break; case 3: bs.and (this.bsLabeled); if (bs.isEmpty ()) return; jo = this.addJmolObject (5, bs, this.labels); break; case 7: jo = this.addJmolObject (659488, bs, null); jo.setSize (this.floatSetting (44) / 15); var color = Clazz.floatToInt (this.floatSetting (526)); if (color >= 0) jo.argb = J.adapter.readers.pymol.PyMOL.getRGB (color); break; case 0: jo = this.addJmolObject (1, bs, null); jo.setSize (this.floatSetting (21) * 2); jo.translucency = this.stickTranslucency; var col = Clazz.floatToInt (this.floatSetting (376)); if (col >= 0) jo.argb = J.adapter.readers.pymol.PyMOL.getRGB (col); break; case 5: this.createCartoonObject ("H", (this.cartoonRockets ? 181 : 100)); this.createCartoonObject ("S", 96); this.createCartoonObject ("L", 92); this.createCartoonObject (" ", 92); break; case 22: this.createPuttyObject (bs); break; case 21: this.createTraceObject (bs); break; case 6: this.createRibbonObject (bs); break; default: JU.Logger.error ("Unprocessed representation type " + shapeID); } }, "~N,JU.BS"); Clazz.defineMethod (c$, "setUniqueObjects", function (shape, bs, setColor, color, setTrans, trans, setSize, size, f) { var n = bs.cardinality (); var colixes = (setColor == 0 ? null : Clazz.newShortArray (n, 0)); var atrans = (setTrans == 0 ? null : Clazz.newFloatArray (n, 0)); var sizes = Clazz.newFloatArray (n, 0); for (var pt = 0, i = bs.nextSetBit (0); i >= 0; i = bs.nextSetBit (i + 1), pt++) { var id = (this.reader == null ? this.uniqueIDs[i] : this.reader.getUniqueID (i)); if (colixes != null) { var c = Clazz.floatToInt (this.getUniqueFloatDef (id, setColor, color)); if (c > 0) colixes[pt] = this.getColix (c, 0); }if (atrans != null) { atrans[pt] = this.getUniqueFloatDef (id, setTrans, trans); }sizes[pt] = this.getUniqueFloatDef (id, setSize, size) * f; } return this.addJmolObject (shape, bs, Clazz.newArray (-1, [colixes, atrans, sizes])); }, "~N,JU.BS,~N,~N,~N,~N,~N,~N,~N"); Clazz.defineMethod (c$, "createSpacefillObjects", function () { for (var e, $e = this.htSpacefill.entrySet ().iterator (); $e.hasNext () && ((e = $e.next ()) || true);) { var r = e.getKey ().floatValue (); var bs = e.getValue (); this.addJmolObject (1141899265, bs, null).rd = new J.atomdata.RadiusData (null, r, J.atomdata.RadiusData.EnumType.ABSOLUTE, J.c.VDW.AUTO); } this.htSpacefill.clear (); }); Clazz.defineMethod (c$, "createTraceObject", function (bs) { this.checkNucleicObject (bs, true); if (bs.isEmpty ()) return; var r = this.floatSetting (103); var jo = this.setUniqueObjects (10, bs, 236, this.cartoonColor, 0, 0, 0, 0, 0); jo.setSize (r * 2); jo.translucency = this.cartoonTranslucency; }, "JU.BS"); Clazz.defineMethod (c$, "checkNucleicObject", function (bs, isTrace) { var jo; var bsNuc = JU.BSUtil.copy (this.bsNucleic); bsNuc.and (bs); if (!bsNuc.isEmpty ()) { if (isTrace && this.cartoonLadderMode) this.haveNucleicLadder = true; jo = this.addJmolObject (11, bsNuc, null); jo.translucency = this.cartoonTranslucency; jo.setSize (this.floatSetting (103) * 2); bs.andNot (bsNuc); }}, "JU.BS,~B"); Clazz.defineMethod (c$, "createPuttyObject", function (bs) { var info = Clazz.newFloatArray (-1, [this.floatSetting (378), this.floatSetting (377), this.floatSetting (382), this.floatSetting (379), this.floatSetting (380), this.floatSetting (381), this.floatSetting (581)]); this.addJmolObject (1113200654, bs, info).translucency = this.cartoonTranslucency; }, "JU.BS"); Clazz.defineMethod (c$, "createRibbonObject", function (bs) { var isTrace = (this.floatSetting (19) > 1); var r = this.floatSetting (20) * 2; var rayScale = this.floatSetting (327); if (r == 0) r = this.floatSetting (106) * (isTrace ? 1 : (rayScale <= 1 ? 0.5 : rayScale)) * 0.1; var jo = this.setUniqueObjects ((isTrace ? 10 : 9), bs, 235, this.ribbonColor, 0, 0, 0, 0, 0); jo.setSize (r); jo.translucency = this.ribbonTranslucency; }, "JU.BS"); Clazz.defineMethod (c$, "createCartoonObject", function (key, sizeID) { var bs = JU.BSUtil.copy (this.ssMapAtom.get (key)); if (bs == null) return; bs.and (this.bsCartoon); if (bs.isEmpty ()) return; if (key.equals (" ")) { this.checkNucleicObject (bs, false); if (bs.isEmpty ()) return; }var jo = this.setUniqueObjects (11, bs, 236, this.cartoonColor, 0, 0, 0, 0, 0); jo.setSize (this.floatSetting (sizeID) * 2); jo.translucency = this.cartoonTranslucency; }, "~S,~N"); Clazz.defineMethod (c$, "addObject", function (obj) { this.jmolObjects.addLast (obj); return obj; }, "J.adapter.readers.pymol.JmolObject"); Clazz.defineMethod (c$, "setGroupVisible", function (g, parentVis) { var vis = parentVis && g.visible; if (vis) return; g.visible = false; this.occludedObjects.put (g.objectNameID, Boolean.TRUE); this.htHiddenObjects.put (g.name, Boolean.TRUE); switch (g.type) { case 1: this.bsHidden.or (g.bsAtoms); break; default: g.occluded = true; break; } for (var gg, $gg = g.list.values ().iterator (); $gg.hasNext () && ((gg = $gg.next ()) || true);) { this.setGroupVisible (gg, vis); } }, "J.adapter.readers.pymol.PyMOLGroup,~B"); Clazz.defineMethod (c$, "getSSMapAtom", function (ssType) { var bs = this.ssMapAtom.get (ssType); if (bs == null) this.ssMapAtom.put (ssType, bs = new JU.BS ()); return bs; }, "~S"); c$.listToMap = Clazz.defineMethod (c$, "listToMap", function (list) { var map = new java.util.Hashtable (); for (var i = list.size (); --i >= 0; ) { var item = J.adapter.readers.pymol.PyMOLScene.listAt (list, i); if (item != null && item.size () > 0) map.put (item.get (0), item); } return map; }, "JU.Lst"); Clazz.defineMethod (c$, "setAtomDefs", function () { this.setGroupVisibilities (); var defs = new java.util.Hashtable (); for (var e, $e = this.htDefinedAtoms.entrySet ().iterator (); $e.hasNext () && ((e = $e.next ()) || true);) { var bs = e.getValue (); if (!bs.isEmpty ()) defs.put (e.getKey (), bs); } this.addJmolObject (1060866, null, defs); return defs; }); Clazz.defineMethod (c$, "needSelections", function () { return this.haveScenes || !this.htCarveSets.isEmpty (); }); Clazz.defineMethod (c$, "setUniqueBonds", function (bsBonds, isSticks) { if (isSticks) { this.bsStickBonds.or (bsBonds); this.bsStickBonds.andNot (this.bsLineBonds); } else { this.bsLineBonds.or (bsBonds); this.bsLineBonds.andNot (this.bsStickBonds); }}, "JU.BS,~B"); Clazz.defineMethod (c$, "finalizeUniqueBonds", function () { if (this.uniqueList == null) return; var bondCount = this.vwr.ms.bondCount; var bonds = this.vwr.ms.bo; for (var i = this.bsUniqueBonds.nextSetBit (0); i >= 0; i = this.bsUniqueBonds.nextSetBit (i + 1)) { var rad = NaN; var id = this.uniqueList.get (Integer.$valueOf (i)).intValue (); if (this.bsLineBonds.get (i)) { rad = this.getUniqueFloatDef (id, 44, NaN) / 30; } else if (this.bsStickBonds.get (i)) { rad = this.getUniqueFloatDef (id, 21, NaN); }var c = Clazz.floatToInt (this.getUniqueFloatDef (id, 376, 2147483647)); if (c != 2147483647) c = J.adapter.readers.pymol.PyMOL.getRGB (c); var valence = this.getUniqueFloatDef (id, 64, NaN); var t = this.getUniqueFloatDef (id, 198, NaN); if (i < 0 || i >= bondCount) return; var b = bonds[i]; this.setBondParameters (b, this.thisState - 1, rad, valence, c, t); } }); Clazz.defineMethod (c$, "setBondParameters", function (b, modelIndex, rad, pymolValence, argb, trans) { if (modelIndex >= 0 && b.atom1.mi != modelIndex) return; if (!Float.isNaN (rad)) b.mad = Clazz.floatToShort (rad * 2000); var colix = b.colix; if (argb != 2147483647) colix = JU.C.getColix (argb); if (!Float.isNaN (trans)) b.colix = JU.C.getColixTranslucent3 (colix, trans != 0, trans); else if (b.colix != colix) b.colix = JU.C.copyColixTranslucency (b.colix, colix); if (pymolValence == 1) b.order |= 98304; else if (pymolValence == 0) b.order |= 65536; }, "JM.Bond,~N,~N,~N,~N,~N"); Clazz.defineMethod (c$, "addMesh", function (tok, obj, objName, isMep) { var jo = this.addJmolObject (tok, null, obj); this.setSceneObject (objName, -1); var meshColor = Clazz.floatToInt (this.floatSetting (146)); if (meshColor < 0) meshColor = J.adapter.readers.pymol.PyMOLScene.intAt (J.adapter.readers.pymol.PyMOLScene.listAt (obj, 0), 2); if (!isMep) { jo.setSize (this.meshWidth); jo.argb = J.adapter.readers.pymol.PyMOL.getRGB (meshColor); }jo.translucency = this.transparency; jo.cacheID = this.surfaceInfoName; }, "~N,JU.Lst,~S,~B"); Clazz.defineMethod (c$, "addIsosurface", function (objectName) { var jo = this.addJmolObject (135180, null, objectName); jo.cacheID = this.surfaceInfoName; return jo; }, "~S"); c$.ptTemp = c$.prototype.ptTemp = new JU.P3 (); Clazz.defineStatics (c$, "MEAS_DIGITS", Clazz.newIntArray (-1, [530, 531, 532])); });
var config = require('./webpack.build.js') var webpack = require('webpack') config.output.filename = config.output.filename.replace(/\.js$/, '.min.js') delete config.devtool config.plugins = [ new webpack.optimize.UglifyJsPlugin({ sourceMap: false, drop_console: true, compress: { warnings: false } }) ] module.exports = config
module.exports={title:"Keras",slug:"keras",get svg(){return'<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Keras</title><path d="'+this.path+'"/></svg>'},path:"M24 0H0v24h24V0zM8.45 5.16l.2.17v6.24l6.46-6.45h1.96l.2.4-5.14 5.1 5.47 7.94-.2.3h-1.94l-4.65-6.88-2.16 2.08v4.6l-.19.2H7l-.2-.2V5.33l.17-.17h1.48z",source:"https://keras.io/",hex:"D00000",guidelines:void 0,license:void 0};
/* version: 0.1.12 */ var Absurd = (function(w) { var lib = { api: {}, helpers: {}, plugins: {}, processors: { css: { plugins: {}}, html: { plugins: {}, helpers: {} }, component: { plugins: {}} } }; var require = function(v) { // css preprocessor if(v.indexOf('css/CSS.js') > 0) { return lib.processors.css.CSS; } else if(v.indexOf('html/HTML.js') > 0) { return lib.processors.html.HTML; } else if(v.indexOf('component/Component.js') > 0) { return lib.processors.component.Component; } else if(v == 'js-beautify') { return { html: function(html) { return html; } } } else if(v == './helpers/PropAnalyzer') { return lib.processors.html.helpers.PropAnalyzer; } else if(v == '../../helpers/TransformUppercase') { return lib.helpers.TransformUppercase; } else if(v == './helpers/TemplateEngine') { return lib.processors.html.helpers.TemplateEngine; } else { return function() {} } }; var __dirname = ""; var client = function() { return function(arg) { /******************************************* Copied directly from /lib/API.js */ var extend = function(destination, source) { for (var key in source) { if (hasOwnProperty.call(source, key)) { destination[key] = source[key]; } } return destination; }; var _api = { defaultProcessor: lib.processors.css.CSS() }, _rules = {}, _storage = {}, _plugins = {}, _hooks = {}; _api.getRules = function(stylesheet) { if(typeof stylesheet === 'undefined') { return _rules; } else { if(typeof _rules[stylesheet] === 'undefined') { _rules[stylesheet] = []; } return _rules[stylesheet]; } } _api.getPlugins = function() { return _plugins; } _api.getStorage = function() { return _storage; } _api.flush = function() { _rules = {}; _storage = []; _hooks = {}; _api.defaultProcessor = lib.processors.css.CSS(); return _api; } _api.import = function() { if(_api.callHooks("import", arguments)) return _api; return _api; } // hooks _api.addHook = function(method, callback) { if(!_hooks[method]) _hooks[method] = []; var isAlreadyAdded = false; for(var i=0; c=_hooks[method][i]; i++) { if(c === callback) { isAlreadyAdded = true; } } isAlreadyAdded === false ? _hooks[method].push(callback) : null; } _api.callHooks = function(method, args) { if(_hooks[method]) { for(var i=0; c=_hooks[method][i]; i++) { if(c.apply(_api, args) === true) return true; } } return false; } // internal variables _api.numOfAddedRules = 0; /******************************************* Copied directly from /lib/API.js */ // client side specific methods _api.compile = function(callback, options) { if(_api.callHooks("compile", arguments)) return _api; var defaultOptions = { combineSelectors: true, minify: false, processor: _api.defaultProcessor, keepCamelCase: false, api: _api }; options = extend(defaultOptions, options || {}); options.processor( _api.getRules(), callback || function() {}, options ); _api.flush(); } // registering api methods for(var method in lib.api) { if(method !== "compile") { _api[method] = lib.api[method](_api); _api[method] = (function(method) { return function() { var f = lib.api[method](_api); if(_api.callHooks(method, arguments)) return _api; return f.apply(_api, arguments); } })(method); } } // registering plugins for(var pluginName in lib.plugins) { _api.plugin(pluginName, lib.plugins[pluginName]()); } // accept function if(typeof arg === "function") { arg(_api); } return _api; } } lib.api.add = function(API) { var checkAndExecutePlugin = function(selector, prop, value, stylesheet) { var plugin = API.getPlugins()[prop]; if(typeof plugin !== 'undefined') { var pluginResponse = plugin(API, value); if(pluginResponse) { addRule(selector, pluginResponse, stylesheet); } return true; } else { return false; } } var clearing = function(props) { // plugins var plugins = API.getPlugins(); for(var prop in props) { if(typeof plugins[prop] !== 'undefined') { props[prop] = false; } } // pseudo classes for(var prop in props) { if(prop.charAt(0) === ":") { props[prop] = false; } } // ampersand for(var prop in props) { if(/&/g.test(prop)) { props[prop] = false; } } } var checkForNesting = function(selector, props, stylesheet) { for(var prop in props) { if(typeof props[prop] === 'object') { // check for pseudo classes if(prop.charAt(0) === ":") { addRule(selector + prop, props[prop], stylesheet); // check for ampersand operator } else if(/&/g.test(prop)) { addRule(prop.replace(/&/g, selector), props[prop], stylesheet); // check for media query } else if(prop.indexOf("@media") === 0 || prop.indexOf("@supports") === 0) { addRule(selector, props[prop], prop); // check for plugins } else if(checkAndExecutePlugin(selector, prop, props[prop], stylesheet) === false) { addRule(selector + " " + prop, props[prop], stylesheet); } props[prop] = false; } else if(typeof props[prop] === 'function') { props[prop] = props[prop](); checkForNesting(selector, props, stylesheet); } else { if(checkAndExecutePlugin(selector, prop, props[prop], stylesheet)) { props[prop] = false; } } } } var addRule = function(selector, props, stylesheet) { // if array is passed as props if(typeof props.length !== 'undefined' && typeof props === "object") { for(var i=0; prop=props[i]; i++) { addRule(selector, prop, stylesheet); } return; } // check for plugin if(checkAndExecutePlugin(null, selector, props, stylesheet)) { return; } // if the selector is already there if(typeof API.getRules(stylesheet || "mainstream")[selector] == 'object') { var current = API.getRules(stylesheet || "mainstream")[selector]; for(var propNew in props) { // overwrite already added value current[propNew] = props[propNew]; } // no, the selector is still not added } else { API.getRules(stylesheet || "mainstream")[selector] = props; } checkForNesting(selector, props, stylesheet || "mainstream"); clearing(props); } var add = function(rules, stylesheet) { API.numOfAddedRules += 1; for(var selector in rules) { if(typeof rules[selector].length !== 'undefined' && typeof rules[selector] === "object") { for(var i=0; r=rules[selector][i]; i++) { addRule(selector, r, stylesheet || "mainstream"); } } else { addRule(selector, rules[selector], stylesheet || "mainstream"); } } return API; } return add; } var extend = function(destination, source) { for (var key in source) { if (hasOwnProperty.call(source, key)) { destination[key] = source[key]; } } return destination; }; lib.api.compile = function(api) { return function() { var path = null, callback = null, options = null; for(var i=0; i<arguments.length; i++) { switch(typeof arguments[i]) { case "function": callback = arguments[i]; break; case "string": path = arguments[i]; break; case "object": options = arguments[i]; break; } } var _defaultOptions = { combineSelectors: true, minify: false, keepCamelCase: false, processor: api.defaultProcessor, api: api }; options = extend(_defaultOptions, options || {}); options.processor( api.getRules(), function(err, result) { if(path != null) { try { fs.writeFile(path, result, function (err) { callback(err, result); }); } catch(err) { callback.apply({}, arguments); } } else { callback.apply({}, arguments); } api.flush(); }, options ); } } lib.api.compileFile = function(api) { return api.compile; } var ColorLuminance = function (hex, lum) { // validate hex string hex = String(hex).replace(/[^0-9a-f]/gi, ''); if (hex.length < 6) { hex = hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[2]; } lum = lum || 0; // convert to decimal and change luminosity var rgb = "#", c, i; for (i = 0; i < 3; i++) { c = parseInt(hex.substr(i*2,2), 16); c = Math.round(Math.min(Math.max(0, c + (c * lum)), 255)).toString(16); rgb += ("00"+c).substr(c.length); } return rgb; }; lib.api.darken = function(api) { return function(color, percents) { return ColorLuminance(color, -(percents/100)); } } lib.api.hook = function(api) { return function(method, callback) { api.addHook(method, callback); return api; } } var ColorLuminance = function (hex, lum) { // validate hex string hex = String(hex).replace(/[^0-9a-f]/gi, ''); if (hex.length < 6) { hex = hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[2]; } lum = lum || 0; // convert to decimal and change luminosity var rgb = "#", c, i; for (i = 0; i < 3; i++) { c = parseInt(hex.substr(i*2,2), 16); c = Math.round(Math.min(Math.max(0, c + (c * lum)), 255)).toString(16); rgb += ("00"+c).substr(c.length); } return rgb; }; lib.api.lighten = function(api) { return function(color, percents) { return ColorLuminance(color, percents/100); } } var metamorphosis = { html: function(api) { api.defaultProcessor = require(__dirname + "/../processors/html/HTML.js")(); api.hook("add", function(tags, template) { api.getRules(template || "mainstream").push(tags); return true; }); }, component: function(api) { api.defaultProcessor = require(__dirname + "/../processors/component/Component.js")(); api.hook("add", function(component) { if(!(component instanceof Array)) component = [component]; for(var i=0; i<component.length, c = component[i]; i++) { api.getRules("mainstream").push(c); } return true; }); } } lib.api.morph = function(api) { return function(type) { if(metamorphosis[type]) { api.flush(); metamorphosis[type](api); } return api; } } lib.api.plugin = function(api) { var plugin = function(name, func) { api.getPlugins()[name] = func; return api; } return plugin; } lib.api.raw = function(api) { return function(raw) { var o = {}, v = {}; var id = "____raw_" + api.numOfAddedRules; v[id] = raw; o[id] = v; api.add(o); return api; } } lib.api.register = function(api) { return function(method, func) { api[method] = func; return api; } } lib.api.storage = function(API) { var _s = API.getStorage(); var storage = function(name, value) { if(typeof value !== "undefined") { _s[name] = value; } else if(typeof name === "object") { for(var _name in name) { if(Object.prototype.hasOwnProperty.call(name, _name)) { storage(_name, name[_name]); } } } else { if(_s[name]) { return _s[name]; } else { throw new Error("There is no data in the storage associated with '" + name + "'"); } } return API; } return storage; } // credits: http://www.sitepoint.com/javascript-generate-lighter-darker-color/ lib.helpers.ColorLuminance = function (hex, lum) { // validate hex string hex = String(hex).replace(/[^0-9a-f]/gi, ''); if (hex.length < 6) { hex = hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[2]; } lum = lum || 0; // convert to decimal and change luminosity var rgb = "#", c, i; for (i = 0; i < 3; i++) { c = parseInt(hex.substr(i*2,2), 16); c = Math.round(Math.min(Math.max(0, c + (c * lum)), 255)).toString(16); rgb += ("00"+c).substr(c.length); } return rgb; } lib.helpers.RequireUncached = function(module) { delete require.cache[require.resolve(module)] return require(module); } lib.helpers.TransformUppercase = function(prop) { var transformed = ""; for(var i=0; c=prop.charAt(i); i++) { if(c === c.toUpperCase() && c.toLowerCase() !== c.toUpperCase()) { transformed += "-" + c.toLowerCase(); } else { transformed += c; } } return transformed; } var compileComponent = function(input, callback, options) { var css = "", html = "", all = [], api = options.api; cssPreprocessor = require(__dirname + "/../css/CSS.js")(), htmlPreprocessor = require(__dirname + "/../html/HTML.js")(); var processCSS = function(clb) { for(var i=0; i<all.length, component=all[i]; i++) { if(typeof component === "function") { component = component(); } api.add(component.css ? component.css : {}); } cssPreprocessor(api.getRules(), function(err, result) { css += result; clb(err); }, options); } var processHTML = function(clb) { var index = 0; var error = null; var processComponent = function() { if(index > input.length-1) { clb(error); return; } var c = input[index]; if(typeof c === "function") { c = c(); } api.morph("html").add(c.html ? c.html : {}); htmlPreprocessor(api.getRules(), function(err, result) { html += result; index += 1; error = err; processComponent(); }, options); } processComponent(); } var checkForNesting = function(o) { for(var key in o) { if(key === "_include") { if(o[key] instanceof Array) { for(var i=0; i<o[key].length, c=o[key][i]; i++) { if(typeof c === "function") { c = c(); } all.push(c); checkForNesting(c); } } else { if(typeof o[key] === "function") { o[key] = o[key](); } all.push(o[key]); checkForNesting(o[key]); } } else if(typeof o[key] === "object") { checkForNesting(o[key]); } } } // Checking for nesting. I.e. collecting the css and html. for(var i=0; i<input.length, c=input[i]; i++) { if(typeof c === "function") { c = c(); } all.push(c); checkForNesting(c); } api.flush(); processCSS(function(errCSS) { api.morph("html"); processHTML(function(errHTML) { callback( errCSS || errHTML ? {error: {css: errCSS, html: errHTML }} : null, css, html ) }); }); } lib.processors.component.Component = function() { var processor = function(rules, callback, options) { compileComponent(rules.mainstream, callback, options); } processor.type = "component"; return processor; } var cleanCSS = require('clean-css'), newline = '\n', defaultOptions = { combineSelectors: true, minify: false, keepCamelCase: false }, transformUppercase = require("../../helpers/TransformUppercase"); // transform uppercase to [-lowercase] var transformUppercase = function(prop) { var transformed = ""; for(var i=0; c=prop.charAt(i); i++) { if(c === c.toUpperCase() && c.toLowerCase() !== c.toUpperCase()) { transformed += "-" + c.toLowerCase(); } else { transformed += c; } } return transformed; } var toCSS = function(rules, options) { var css = ''; for(var selector in rules) { // handling raw content if(selector.indexOf("____raw") === 0) { css += rules[selector][selector] + newline; // handling normal styles } else { var entity = selector + ' {' + newline; for(var prop in rules[selector]) { var value = rules[selector][prop]; if(value === "") { value = '""'; } entity += ' ' + (options.keepCamelCase == false ? transformUppercase(prop) : prop) + ': ' + value + ';' + newline; } entity += '}' + newline; css += entity; } } return css; } // dealing with false values var filterRules = function(rules) { var arr = {}; for(var selector in rules) { var areThereAnyProps = false; var props = {}; for(var prop in rules[selector]) { var value = rules[selector][prop]; if(value !== false) { areThereAnyProps = true; props[prop] = value; } } if(areThereAnyProps) { arr[selector] = props; } } return arr; } // combining selectors var combineSelectors = function(rules) { var map = {}, arr = {}; // creating the map for(var selector in rules) { var props = rules[selector]; for(var prop in props) { var value = props[prop]; if(!map[prop]) map[prop] = {}; if(!map[prop][value]) map[prop][value] = []; map[prop][value].push(selector); } } // converting the map to usual rules object for(var prop in map) { var values = map[prop]; for(var value in values) { var selectors = values[value]; if(!arr[selectors.join(", ")]) arr[selectors.join(", ")] = {} var selector = arr[selectors.join(", ")]; selector[prop] = value; } } return arr; } var minimize = function(content) { content = content.replace( /\/\*(?:(?!\*\/)[\s\S])*\*\/|[\r\n\t]+/g, '' ); // now all comments, newlines and tabs have been removed content = content.replace( / {2,}/g, ' ' ); // now there are no more than single adjacent spaces left // now unnecessary: content = content.replace( /(\s)+\./g, ' .' ); content = content.replace( / ([{:}]) /g, '$1' ); content = content.replace( /([;,]) /g, '$1' ); content = content.replace( / !/g, '!' ); return content; } lib.processors.css.CSS = function() { var processor = function(rules, callback, options) { options = options || defaultOptions; var css = ''; for(var stylesheet in rules) { var r = filterRules(rules[stylesheet]); r = options.combineSelectors ? combineSelectors(r) : r; if(stylesheet === "mainstream") { css += toCSS(r, options); } else { css += stylesheet + " {" + newline + toCSS(r, options) + "}" + newline; } } // Minification if(options.minify) { css = minimize(css); if(callback) callback(null, css); } else { if(callback) callback(null, css); } return css; } processor.type = "css"; return processor; } lib.processors.css.plugins.charset = function() { return function(api, charsetValue) { if(typeof charsetValue === "string") { api.raw("@charset: \"" + charsetValue + "\";"); } else if(typeof charsetValue === "object") { charsetValue = charsetValue.charset.replace(/:/g, '').replace(/'/g, '').replace(/"/g, '').replace(/ /g, ''); api.raw("@charset: \"" + charsetValue + "\";"); } } } lib.processors.css.plugins.document = function() { return function(api, value) { if(typeof value === "object") { var stylesheet = ''; stylesheet += '@' + value.vendor + 'document'; stylesheet += ' ' + value.document; if(value.rules && value.rules.length) { for(var i=0; rule=value.rules[i]; i++) { api.handlecssrule(rule, stylesheet); } } else if(typeof value.styles != "undefined") { api.add(value.styles, stylesheet); } } } } lib.processors.css.plugins.keyframes = function() { return function(api, value) { var processor = require(__dirname + "/../CSS.js")(); if(typeof value === "object") { // js or json if(typeof value.frames != "undefined") { var content = '@keyframes ' + value.name + " {\n"; content += processor({mainstream: value.frames}); content += "}"; api.raw(content + "\n" + content.replace("@keyframes", "@-webkit-keyframes")); // css } else if(typeof value.keyframes != "undefined") { var content = '@keyframes ' + value.name + " {\n"; var frames = {}; for(var i=0; rule=value.keyframes[i]; i++) { if(rule.type === "keyframe") { var f = frames[rule.values] = {}; for(var j=0; declaration=rule.declarations[j]; j++) { if(declaration.type === "declaration") { f[declaration.property] = declaration.value; } } } } content += processor({mainstream: frames}); content += "}"; api.raw(content + "\n" + content.replace("@keyframes", "@-webkit-keyframes")); } } } } lib.processors.css.plugins.media = function() { return function(api, value) { var processor = require(__dirname + "/../CSS.js")(); if(typeof value === "object") { var content = '@media ' + value.media + " {\n"; var rules = {}; for(var i=0; rule=value.rules[i]; i++) { var r = rules[rule.selectors.toString()] = {}; if(rule.type === "rule") { for(var j=0; declaration=rule.declarations[j]; j++) { if(declaration.type === "declaration") { r[declaration.property] = declaration.value; } } } } content += processor({mainstream: rules}); content += "}"; api.raw(content); } } } lib.processors.css.plugins.namespace = function() { return function(api, value) { if(typeof value === "string") { api.raw("@namespace: \"" + value + "\";"); } else if(typeof value === "object") { value = value.namespace.replace(/: /g, '').replace(/'/g, '').replace(/"/g, '').replace(/ /g, '').replace(/:h/g, 'h'); api.raw("@namespace: \"" + value + "\";"); } } } lib.processors.css.plugins.page = function() { return function(api, value) { if(typeof value === "object") { var content = ""; if(value.selectors.length > 0) { content += "@page " + value.selectors.join(", ") + " {\n"; } else { content += "@page {\n"; } for(var i=0; declaration=value.declarations[i]; i++) { if(declaration.type == "declaration") { content += " " + declaration.property + ": " + declaration.value + ";\n"; } } content += "}"; api.raw(content); } } } lib.processors.css.plugins.supports = function() { return function(api, value) { var processor = require(__dirname + "/../CSS.js")(); if(typeof value === "object") { var content = '@supports ' + value.supports + " {\n"; var rules = {}; for(var i=0; rule=value.rules[i]; i++) { var r = rules[rule.selectors.toString()] = {}; if(rule.type === "rule") { for(var j=0; declaration=rule.declarations[j]; j++) { if(declaration.type === "declaration") { r[declaration.property] = declaration.value; } } } } content += processor({mainstream: rules}); content += "}"; api.raw(content); } } } var data = null, newline = '\n', defaultOptions = {}, tags = [], beautifyHTML = require('js-beautify').html, transformUppercase = require("../../helpers/TransformUppercase"); var processTemplate = function(templateName) { var html = ''; for(var template in data) { if(template == templateName) { var numOfRules = data[template].length; for(var i=0; i<numOfRules; i++) { html += process('', data[template][i]); } } } return html; } var process = function(tagName, obj) { // console.log("------------------------\n", tagName, ">", obj); var html = '', attrs = '', childs = ''; var tagAnalized = require("./helpers/PropAnalyzer")(tagName); tagName = tagAnalized.tag; if(tagAnalized.attrs != "") { attrs += " " + tagAnalized.attrs; } if(typeof obj === "string") { return packTag(tagName, attrs, obj); } var addToChilds = function(value) { if(childs != '') { childs += newline; } childs += value; } // process directives for(var directiveName in obj) { var value = obj[directiveName]; switch(directiveName) { case "_attrs": for(var attrName in value) { if(typeof value[attrName] === "function") { attrs += " " + transformUppercase(attrName) + "=\"" + value[attrName]() + "\""; } else { attrs += " " + transformUppercase(attrName) + "=\"" + value[attrName] + "\""; } } obj[directiveName] = false; break; case "_": addToChilds(value); obj[directiveName] = false; break; case "_tpl": if(typeof value == "string") { addToChilds(processTemplate(value)); } else if(value instanceof Array) { var tmp = ''; for(var i=0; tpl=value[i]; i++) { tmp += processTemplate(tpl) if(i < value.length-1) tmp += newline; } addToChilds(tmp); } obj[directiveName] = false; break; case "_include": var tmp = ''; var add = function(o) { if(typeof o === "function") { o = o(); } if(o.css && o.html) { o = o.html; } // catching a component tmp += process('', o); } if(value instanceof Array) { for(var i=0; i<value.length, o=value[i]; i++) { add(o); } } else if(typeof value === "object"){ add(value); } addToChilds(tmp); obj[directiveName] = false; break; } } for(var prop in obj) { var value = obj[prop]; if(value !== false) { var name = prop; switch(typeof value) { case "string": addToChilds(process(name, value)); break; case "object": if(value.length && value.length > 0) { var tmp = ''; for(var i=0; v=value[i]; i++) { tmp += process('', typeof v == "function" ? v() : v); if(i < value.length-1) tmp += newline; } addToChilds(process(name, tmp)); } else { addToChilds(process(name, value)); } break; case "function": addToChilds(process(name, value())); break; } } } if(tagName != '') { html += packTag(tagName, attrs, childs); } else { html += childs; } return html; } var packTag = function(tagName, attrs, childs) { var html = ''; if(tagName == '' && attrs == '' && childs != '') { return childs; } tagName = tagName == '' ? 'div' : tagName; if(childs !== '') { html += '<' + transformUppercase(tagName) + attrs + '>' + newline + childs + newline + '</' + transformUppercase(tagName) + '>'; } else { html += '<' + transformUppercase(tagName) + attrs + '/>'; } return html; } var prepareHTML = function(html, options) { html = require("./helpers/TemplateEngine")(html.replace(/[\r\t\n]/g, ''), options); if(options.minify) { return html; } else { return beautifyHTML(html, {indent_size: options.indentSize || 4}); } } lib.processors.html.HTML = function() { var processor = function(rules, callback, options) { data = rules; callback = callback || function() {}; options = options || defaultOptions; var html = prepareHTML(processTemplate("mainstream"), options); callback(null, html); return html; } processor.type = "html"; return processor; } lib.processors.html.helpers.PropAnalyzer = function(prop) { var res = { tag: '', attrs: '' }, numOfChars = prop.length, tagName = "", className = "", readingClass = false, classes = [], idName = "", readingId = false, ids = [], attributes = "", readingAttributes = false; for(var i=0; c=prop[i]; i++) { if(c === "[" && !readingAttributes) { readingAttributes = true; } else if(readingAttributes) { if(c != "]") { attributes += c; } else { readingAttributes = false; i -= 1; } } else if(c === "." && !readingClass) { readingClass = true; } else if(readingClass) { if(c != "." && c != "#" && c != "[" && c != "]") { className += c; } else { classes.push(className); readingClass = false; className = ""; i -= 1; } } else if(c === "#" && !readingId) { readingId = true; } else if(readingId) { if(c != "." && c != "#" && c != "[" && c != "]") { idName += c; } else { readingId = false; i -= 1; } } else if(c != "." && c != "#" && c != "[" && c != "]") { res.tag += c; } } // if ends with a class if(className != "") classes.push(className); // collecting classes var clsStr = ''; for(var i=0; cls=classes[i]; i++) { clsStr += clsStr === "" ? cls : " " + cls; } res.attrs += clsStr != "" ? 'class="' + clsStr + '"' : ''; // if ends on id if(idName != "") { res.attrs += (res.attrs != "" ? " " : "") + 'id="' + idName + '"'; } // if div tag name is skipped if(res.tag === "" && res.attrs != "") res.tag = "div"; // collecting attributes if(attributes != "") { res.attrs += (res.attrs != "" ? " " : "") + attributes; } return res; } lib.processors.html.helpers.TemplateEngine = function(html, options) { var re = /<%([^%>]+)?%>/g, reExp = /(^( )?if|^( )?for|^( )?else|^( )?switch|^( )?case|^( )?break|^( )?{|^( )?})(.*)?/g, matches = [], code = 'var r=[];\n', cursor = 0; var compile = function(code) { return (new Function("data", code.replace(/[\r\t\n]/g, ''))).apply(options); } var add = function(line, js) { js? (code += line.match(reExp) ? line + '\n' : 'r.push(' + line + ');\n') : (code += line != '' ? 'r.push("' + line.replace(/"/g, '\\"') + '");\n' : ''); return add; } while(match = re.exec(html)) matches.push(match); for(var i=0; i<matches, m=matches[i]; i++) { add(html.slice(cursor, m.index))(m[1], true); cursor = m.index + m[0].length; } add(html.substr(cursor, html.length - cursor)); code += 'return r.join("");'; return compile(code); }; return client(); })(window);
/** * Test hooks */ import expect from 'expect'; import configureStore from '../../store'; import { memoryHistory } from 'react-router'; import { put } from 'redux-saga/effects'; import { fromJS } from 'immutable'; import { injectAsyncReducer, injectAsyncSagas, getHooks, } from '../hooks'; // Fixtures const initialState = fromJS({ reduced: 'soon' }); const reducer = (state = initialState, action) => { switch (action.type) { case 'TEST': return state.set('reduced', action.payload); default: return state; } }; const sagas = [ function* testSaga() { yield put({ type: 'TEST', payload: 'yup' }); }, ]; describe('hooks', () => { let store; describe('getHooks', () => { before(() => { store = configureStore({}, memoryHistory); }); it('given a store, should return all hooks', () => { const { injectReducer, injectSagas } = getHooks(store); injectReducer('test', reducer); injectSagas(sagas); const actual = store.getState().get('test'); const expected = initialState.merge({ reduced: 'yup' }); expect(actual.toJS()).toEqual(expected.toJS()); }); }); describe('helpers', () => { before(() => { store = configureStore({}, memoryHistory); }); describe('injectAsyncReducer', () => { it('given a store, it should provide a function to inject a reducer', () => { const injectReducer = injectAsyncReducer(store); injectReducer('test', reducer); const actual = store.getState().get('test'); const expected = initialState; expect(actual.toJS()).toEqual(expected.toJS()); }); }); describe('injectAsyncSagas', () => { it('given a store, it should provide a function to inject a saga', () => { const injectSagas = injectAsyncSagas(store); injectSagas(sagas); const actual = store.getState().get('test'); const expected = initialState.merge({ reduced: 'yup' }); expect(actual.toJS()).toEqual(expected.toJS()); }); }); }); });
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _asyncToGenerator2; function _load_asyncToGenerator() { return _asyncToGenerator2 = _interopRequireDefault(require('babel-runtime/helpers/asyncToGenerator')); } var _constants; function _load_constants() { return _constants = _interopRequireWildcard(require('../constants.js')); } var _fs; function _load_fs() { return _fs = _interopRequireWildcard(require('../util/fs.js')); } function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /* eslint no-unused-vars: 0 */ const path = require('path'); class BaseFetcher { constructor(dest, remote, config) { this.reporter = config.reporter; this.reference = remote.reference; this.registry = remote.registry; this.hash = remote.hash; this.remote = remote; this.config = config; this.dest = dest; } getResolvedFromCached(hash) { // fetcher subclasses may use this to perform actions such as copying over a cached tarball to the offline // mirror etc return Promise.resolve(); } _fetch() { return Promise.reject(new Error('Not implemented')); } fetch() { var _this = this; const dest = this.dest; return (_fs || _load_fs()).lockQueue.push(dest, (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { yield (_fs || _load_fs()).mkdirp(dest); // fetch package and get the hash var _ref2 = yield _this._fetch(); const hash = _ref2.hash, resolved = _ref2.resolved; // load the new normalized manifest const pkg = yield _this.config.readManifest(dest, _this.registry); yield (_fs || _load_fs()).writeFile(path.join(dest, (_constants || _load_constants()).METADATA_FILENAME), JSON.stringify({ artifacts: [], remote: _this.remote, registry: _this.registry, hash }, null, ' ')); return { resolved, hash, dest, package: pkg, cached: false }; })); } } exports.default = BaseFetcher;
// Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /** * @name: S8.8_A2_T3; * @section: 8.8; * @assertion: Values of the List type are simply ordered sequences of values; * @description: Call function, that concatenate all it`s arguments; */ function __mFunc(){var __accum=""; for (var i = 0; i < arguments.length; ++i){__accum += arguments[i]};return __accum;}; ////////////////////////////////////////////////////////////////////////////// //CHECK#1 if (__mFunc("A","B","C","D","E","F") !== "ABCDEF"){ $ERROR('#1: function __mFunc(){var __accum=""; for (var i = 0; i < arguments.length; ++i){__accum += arguments[i]};return __accum;}; __mFunc("A","B","C","D","E","F") === "ABCDEF". Actual: ' + (__mFunc("A","B","C","D","E","F"))); } // //////////////////////////////////////////////////////////////////////////////
(function (factory) { if (typeof module === 'object' && typeof module.exports === 'object') { var v = factory(require, exports); if (v !== undefined) module.exports = v; } else if (typeof define === 'function' && define.amd) { define(["require", "exports", '@angular/core'], factory); } })(function (require, exports) { "use strict"; var core_1 = require('@angular/core'); /** * @private * @name Grid * @module ionic * @description */ var Grid = (function () { function Grid() { } Grid.decorators = [ { type: core_1.Directive, args: [{ selector: 'ion-grid' },] }, ]; /** @nocollapse */ Grid.ctorParameters = []; return Grid; }()); exports.Grid = Grid; /** * @private * @name Row * @module ionic * @description */ var Row = (function () { function Row() { } Row.decorators = [ { type: core_1.Directive, args: [{ selector: 'ion-row' },] }, ]; /** @nocollapse */ Row.ctorParameters = []; return Row; }()); exports.Row = Row; /** * @private * @name Column * @module ionic * @description */ var Col = (function () { function Col() { } Col.decorators = [ { type: core_1.Directive, args: [{ selector: 'ion-col' },] }, ]; /** @nocollapse */ Col.ctorParameters = []; return Col; }()); exports.Col = Col; }); //# sourceMappingURL=grid.js.map
angular.module('merchello.providers').controller('Merchello.Providers.Dialogs.PayPalProviderSettingsController', ['$scope', 'payPalProviderSettingsBuilder', function($scope, payPalProviderSettingsBuilder) { $scope.providerSettings = {}; function init() { var json = JSON.parse($scope.dialogData.provider.extendedData.getValue('paypalprovidersettings')); $scope.providerSettings = payPalProviderSettingsBuilder.transform(json); console.info($scope.providerSettings); $scope.$watch(function () { return $scope.providerSettings; }, function (newValue, oldValue) { $scope.dialogData.provider.extendedData.setValue('paypalprovidersettings', angular.toJson(newValue)); }, true); } // initialize the controller init(); }]);
import app from 'flarum/app'; import FacebookSettingsModal from 'flarum/auth/facebook/components/FacebookSettingsModal'; app.initializers.add('flarum-auth-facebook', () => { app.extensionSettings['flarum-auth-facebook'] = () => app.modal.show(new FacebookSettingsModal()); });
'use strict'; var util = require('util'); /** * A collection of properties related to deferrable constraints. It can be used to * make foreign key constraints deferrable and to set the constraints within a * transaction. This is only supported in PostgreSQL. * * The foreign keys can be configured like this. It will create a foreign key * that will check the constraints immediately when the data was inserted. * * ```js * sequelize.define('Model', { * foreign_id: { * type: Sequelize.INTEGER, * references: { * model: OtherModel, * key: 'id', * deferrable: Sequelize.Deferrable.INITIALLY_IMMEDIATE * } * } * }); * ``` * * The constraints can be configured in a transaction like this. It will * trigger a query once the transaction has been started and set the constraints * to be checked at the very end of the transaction. * * ```js * sequelize.transaction({ * deferrable: Sequelize.Deferrable.SET_DEFERRED * }); * ``` * * @namespace Deferrable * @memberof Sequelize * * @property INITIALLY_DEFERRED Defer constraints checks to the end of transactions. * @property INITIALLY_IMMEDIATE Trigger the constraint checks immediately * @property NOT Set the constraints to not deferred. This is the default in PostgreSQL and it make it impossible to dynamically defer the constraints within a transaction. * @property SET_DEFERRED * @property SET_IMMEDIATE */ var Deferrable = module.exports = { INITIALLY_DEFERRED, INITIALLY_IMMEDIATE, NOT, SET_DEFERRED, SET_IMMEDIATE }; function ABSTRACT() {} ABSTRACT.prototype.toString = function() { return this.toSql.apply(this, arguments); }; function INITIALLY_DEFERRED() { if (!(this instanceof INITIALLY_DEFERRED)) { return new INITIALLY_DEFERRED(); } } util.inherits(INITIALLY_DEFERRED, ABSTRACT); INITIALLY_DEFERRED.prototype.toSql = function() { return 'DEFERRABLE INITIALLY DEFERRED'; }; function INITIALLY_IMMEDIATE() { if (!(this instanceof INITIALLY_IMMEDIATE)) { return new INITIALLY_IMMEDIATE(); } } util.inherits(INITIALLY_IMMEDIATE, ABSTRACT); INITIALLY_IMMEDIATE.prototype.toSql = function() { return 'DEFERRABLE INITIALLY IMMEDIATE'; }; function NOT() { if (!(this instanceof NOT)) { return new NOT(); } } util.inherits(NOT, ABSTRACT); NOT.prototype.toSql = function() { return 'NOT DEFERRABLE'; }; function SET_DEFERRED(constraints) { if (!(this instanceof SET_DEFERRED)) { return new SET_DEFERRED(constraints); } this.constraints = constraints; } util.inherits(SET_DEFERRED, ABSTRACT); SET_DEFERRED.prototype.toSql = function(queryGenerator) { return queryGenerator.setDeferredQuery(this.constraints); }; function SET_IMMEDIATE(constraints) { if (!(this instanceof SET_IMMEDIATE)) { return new SET_IMMEDIATE(constraints); } this.constraints = constraints; } util.inherits(SET_IMMEDIATE, ABSTRACT); SET_IMMEDIATE.prototype.toSql = function(queryGenerator) { return queryGenerator.setImmediateQuery(this.constraints); }; Object.keys(Deferrable).forEach(function(key) { var DeferrableType = Deferrable[key]; DeferrableType.toString = function() { var instance = new DeferrableType(); return instance.toString.apply(instance, arguments); }; });
'use strict'; /* jasmine specs for directives go here */
var utils = require('./utils'), dateFormatter = require('./dateformatter'); /** * Helper method to recursively run a filter across an object/array and apply it to all of the object/array's values. * @param {*} input * @return {*} * @private */ function iterateFilter(input) { var self = this, out = {}; if (utils.isArray(input)) { return utils.map(input, function (value) { return self.apply(null, arguments); }); } if (typeof input === 'object') { utils.each(input, function (value, key) { out[key] = self.apply(null, arguments); }); return out; } return; } /** * Backslash-escape characters that need to be escaped. * * @example * {{ "\"quoted string\""|addslashes }} * // => \"quoted string\" * * @param {*} input * @return {*} Backslash-escaped string. */ exports.addslashes = function (input) { var out = iterateFilter.apply(exports.addslashes, arguments); if (out !== undefined) { return out; } return input.replace(/\\/g, '\\\\').replace(/\'/g, "\\'").replace(/\"/g, '\\"'); }; /** * Upper-case the first letter of the input and lower-case the rest. * * @example * {{ "i like Burritos"|capitalize }} * // => I like burritos * * @param {*} input If given an array or object, each string member will be run through the filter individually. * @return {*} Returns the same type as the input. */ exports.capitalize = function (input) { var out = iterateFilter.apply(exports.capitalize, arguments); if (out !== undefined) { return out; } return input.toString().charAt(0).toUpperCase() + input.toString().substr(1).toLowerCase(); }; /** * Format a date or Date-compatible string. * * @example * // now = new Date(); * {{ now|date('Y-m-d') }} * // => 2013-08-14 * * @param {?(string|date)} input * @param {string} format PHP-style date format compatible string. * @param {number=} offset Timezone offset from GMT in minutes. * @param {string=} abbr Timezone abbreviation. Used for output only. * @return {string} Formatted date string. */ exports.date = function (input, format, offset, abbr) { var l = format.length, date = new dateFormatter.DateZ(input), cur, i = 0, out = ''; if (offset) { date.setTimezoneOffset(offset, abbr); } for (i; i < l; i += 1) { cur = format.charAt(i); if (dateFormatter.hasOwnProperty(cur)) { out += dateFormatter[cur](date, offset, abbr); } else { out += cur; } } return out; }; /** * If the input is `undefined`, `null`, or `false`, a default return value can be specified. * * @example * {{ null_value|default('Tacos') }} * // => Tacos * * @example * {{ "Burritos"|default("Tacos") }} * // => Burritos * * @param {*} input * @param {*} def Value to return if `input` is `undefined`, `null`, or `false`. * @return {*} `input` or `def` value. */ exports.default = function (input, def) { return (typeof input !== 'undefined' && (input || typeof input === 'number')) ? input : def; }; /** * Force escape the output of the variable. Optionally use `e` as a shortcut filter name. This filter will be applied by default if autoescape is turned on. * * @example * {{ "<blah>"|escape }} * // => &lt;blah&gt; * * @example * {{ "<blah>"|e("js") }} * // => \u003Cblah\u003E * * @param {*} input * @param {string} [type='html'] If you pass the string js in as the type, output will be escaped so that it is safe for JavaScript execution. * @return {string} Escaped string. */ exports.escape = function (input, type) { var out = iterateFilter.apply(exports.escape, arguments), inp = input, i = 0, code; if (out !== undefined) { return out; } if (typeof input !== 'string') { return input; } out = ''; switch (type) { case 'js': inp = inp.replace(/\\/g, '\\u005C'); for (i; i < inp.length; i += 1) { code = inp.charCodeAt(i); if (code < 32) { code = code.toString(16).toUpperCase(); code = (code.length < 2) ? '0' + code : code; out += '\\u00' + code; } else { out += inp[i]; } } return out.replace(/&/g, '\\u0026') .replace(/</g, '\\u003C') .replace(/>/g, '\\u003E') .replace(/\'/g, '\\u0027') .replace(/"/g, '\\u0022') .replace(/\=/g, '\\u003D') .replace(/-/g, '\\u002D') .replace(/;/g, '\\u003B'); default: return inp.replace(/&(?!amp;|lt;|gt;|quot;|#39;)/g, '&amp;') .replace(/</g, '&lt;') .replace(/>/g, '&gt;') .replace(/"/g, '&quot;') .replace(/'/g, '&#39;'); } }; exports.e = exports.escape; /** * Get the first item in an array or character in a string. All other objects will attempt to return the first value available. * * @example * // my_arr = ['a', 'b', 'c'] * {{ my_arr|first }} * // => a * * @example * // my_val = 'Tacos' * {{ my_val|first }} * // T * * @param {*} input * @return {*} The first item of the array or first character of the string input. */ exports.first = function (input) { if (typeof input === 'object' && !utils.isArray(input)) { var keys = utils.keys(input); return input[keys[0]]; } if (typeof input === 'string') { return input.substr(0, 1); } return input[0]; }; /** * Join the input with a string. * * @example * // my_array = ['foo', 'bar', 'baz'] * {{ my_array|join(', ') }} * // => foo, bar, baz * * @example * // my_key_object = { a: 'foo', b: 'bar', c: 'baz' } * {{ my_key_object|join(' and ') }} * // => foo and bar and baz * * @param {*} input * @param {string} glue String value to join items together. * @return {string} */ exports.join = function (input, glue) { if (utils.isArray(input)) { return input.join(glue); } if (typeof input === 'object') { var out = []; utils.each(input, function (value) { out.push(value); }); return out.join(glue); } return input; }; /** * Return a string representation of an JavaScript object. * * Backwards compatible with swig@0.x.x using `json_encode`. * * @example * // val = { a: 'b' } * {{ val|json }} * // => {"a":"b"} * * @example * // val = { a: 'b' } * {{ val|json(4) }} * // => { * // "a": "b" * // } * * @param {*} input * @param {number} [indent] Number of spaces to indent for pretty-formatting. * @return {string} A valid JSON string. */ exports.json = function (input, indent) { return JSON.stringify(input, null, indent || 0); }; exports.json_encode = exports.json; /** * Get the last item in an array or character in a string. All other objects will attempt to return the last value available. * * @example * // my_arr = ['a', 'b', 'c'] * {{ my_arr|last }} * // => c * * @example * // my_val = 'Tacos' * {{ my_val|last }} * // s * * @param {*} input * @return {*} The last item of the array or last character of the string.input. */ exports.last = function (input) { if (typeof input === 'object' && !utils.isArray(input)) { var keys = utils.keys(input); return input[keys[keys.length - 1]]; } if (typeof input === 'string') { return input.charAt(input.length - 1); } return input[input.length - 1]; }; /** * Return the input in all lowercase letters. * * @example * {{ "FOOBAR"|lower }} * // => foobar * * @example * // myObj = { a: 'FOO', b: 'BAR' } * {{ myObj|lower|join('') }} * // => foobar * * @param {*} input * @return {*} Returns the same type as the input. */ exports.lower = function (input) { var out = iterateFilter.apply(exports.lower, arguments); if (out !== undefined) { return out; } return input.toString().toLowerCase(); }; /** * Deprecated in favor of <a href="#safe">safe</a>. */ exports.raw = function (input) { return exports.safe(input); }; exports.raw.safe = true; /** * Returns a new string with the matched search pattern replaced by the given replacement string. Uses JavaScript's built-in String.replace() method. * * @example * // my_var = 'foobar'; * {{ my_var|replace('o', 'e', 'g') }} * // => feebar * * @example * // my_var = "farfegnugen"; * {{ my_var|replace('^f', 'p') }} * // => parfegnugen * * @example * // my_var = 'a1b2c3'; * {{ my_var|replace('\w', '0', 'g') }} * // => 010203 * * @param {string} input * @param {string} search String or pattern to replace from the input. * @param {string} replacement String to replace matched pattern. * @param {string} [flags] Regular Expression flags. 'g': global match, 'i': ignore case, 'm': match over multiple lines * @return {string} Replaced string. */ exports.replace = function (input, search, replacement, flags) { var r = new RegExp(search, flags); return input.replace(r, replacement); }; /** * Reverse sort the input. This is an alias for <code data-language="swig">{{ input|sort(true) }}</code>. * * @example * // val = [1, 2, 3]; * {{ val|reverse }} * // => 3,2,1 * * @param {array} input * @return {array} Reversed array. The original input object is returned if it was not an array. */ exports.reverse = function (input) { return exports.sort(input, true); }; /** * Forces the input to not be auto-escaped. Use this only on content that you know is safe to be rendered on your page. * * @example * // my_var = "<p>Stuff</p>"; * {{ my_var|safe }} * // => <p>Stuff</p> * * @param {*} input * @return {*} The input exactly how it was given, regardless of autoescaping status. */ exports.safe = function (input) { // This is a magic filter. Its logic is hard-coded into Swig's parser. return input; }; exports.safe.safe = true; /** * Sort the input in an ascending direction. * If given an object, will return the keys as a sorted array. * If given a string, each character will be sorted individually. * * @example * // val = [2, 6, 4]; * {{ val|sort }} * // => 2,4,6 * * @example * // val = 'zaq'; * {{ val|sort }} * // => aqz * * @example * // val = { bar: 1, foo: 2 } * {{ val|sort(true) }} * // => foo,bar * * @param {*} input * @param {boolean} [reverse=false] Output is given reverse-sorted if true. * @return {*} Sorted array; */ exports.sort = function (input, reverse) { var out; if (utils.isArray(input)) { out = input.sort(); } else { switch (typeof input) { case 'object': out = utils.keys(input).sort(); break; case 'string': out = input.split(''); if (reverse) { return out.reverse().join(''); } return out.sort().join(''); } } if (out && reverse) { return out.reverse(); } return out || input; }; /** * Strip HTML tags. * * @example * // stuff = '<p>foobar</p>'; * {{ stuff|striptags }} * // => foobar * * @param {*} input * @return {*} Returns the same object as the input, but with all string values stripped of tags. */ exports.striptags = function (input) { var out = iterateFilter.apply(exports.striptags, arguments); if (out !== undefined) { return out; } return input.toString().replace(/(<([^>]+)>)/ig, ''); }; /** * Capitalizes every word given and lower-cases all other letters. * * @example * // my_str = 'this is soMe text'; * {{ my_str|title }} * // => This Is Some Text * * @example * // my_arr = ['hi', 'this', 'is', 'an', 'array']; * {{ my_arr|title|join(' ') }} * // => Hi This Is An Array * * @param {*} input * @return {*} Returns the same object as the input, but with all words in strings title-cased. */ exports.title = function (input) { var out = iterateFilter.apply(exports.title, arguments); if (out !== undefined) { return out; } return input.toString().replace(/\w\S*/g, function (str) { return str.charAt(0).toUpperCase() + str.substr(1).toLowerCase(); }); }; /** * Remove all duplicate items from an array. * * @example * // my_arr = [1, 2, 3, 4, 4, 3, 2, 1]; * {{ my_arr|uniq|join(',') }} * // => 1,2,3,4 * * @param {array} input * @return {array} Array with unique items. If input was not an array, the original item is returned untouched. */ exports.uniq = function (input) { var result; if (!input || !utils.isArray(input)) { return ''; } result = []; utils.each(input, function (v) { if (result.indexOf(v) === -1) { result.push(v); } }); return result; }; /** * Convert the input to all uppercase letters. If an object or array is provided, all values will be uppercased. * * @example * // my_str = 'tacos'; * {{ my_str|upper }} * // => TACOS * * @example * // my_arr = ['tacos', 'burritos']; * {{ my_arr|upper|join(' & ') }} * // => TACOS & BURRITOS * * @param {*} input * @return {*} Returns the same type as the input, with all strings upper-cased. */ exports.upper = function (input) { var out = iterateFilter.apply(exports.upper, arguments); if (out !== undefined) { return out; } return input.toString().toUpperCase(); }; /** * URL-encode a string. If an object or array is passed, all values will be URL-encoded. * * @example * // my_str = 'param=1&anotherParam=2'; * {{ my_str|url_encode }} * // => param%3D1%26anotherParam%3D2 * * @param {*} input * @return {*} URL-encoded string. */ exports.url_encode = function (input) { var out = iterateFilter.apply(exports.url_encode, arguments); if (out !== undefined) { return out; } return encodeURIComponent(input); }; /** * URL-decode a string. If an object or array is passed, all values will be URL-decoded. * * @example * // my_str = 'param%3D1%26anotherParam%3D2'; * {{ my_str|url_decode }} * // => param=1&anotherParam=2 * * @param {*} input * @return {*} URL-decoded string. */ exports.url_decode = function (input) { var out = iterateFilter.apply(exports.url_decode, arguments); if (out !== undefined) { return out; } return decodeURIComponent(input); };
/* Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ CKEDITOR.plugins.setLang( 'newpage', 'km', { toolbar: 'ទំព័រថ្មី' });
require('../../../support/spec_helper'); describe("Cucumber.Ast.Filter.ElementMatchingTagSpec", function() { var Cucumber = requireLib('cucumber'); var spec, tagName; beforeEach(function() { tagName = "tag"; spec = Cucumber.Ast.Filter.ElementMatchingTagSpec(tagName); }); describe("isMatching()", function() { var _ = require('underscore'); var element, elementTags, matchingElement; beforeEach(function() { elementTags = createSpy("element tags"); element = createSpyWithStubs("element", {getTags: elementTags}); matchingElement = createSpy("whether the element is matching or not"); spyOn(spec, 'isExpectingTag'); }); it("gets the element tags", function() { spec.isMatching(element); expect(element.getTags).toHaveBeenCalled(); }); it("checks whether the spec tag is expected or not", function() { spec.isMatching(element); expect(spec.isExpectingTag).toHaveBeenCalled(); }); describe("when the spec tag is expected on the element", function() { beforeEach(function() { spec.isExpectingTag.andReturn(true); spyOn(_, 'any').andReturn(matchingElement); }); it("checks whether any of the element tags match the spec tag", function() { spec.isMatching(element); expect(_.any).toHaveBeenCalledWith(elementTags, spec.isTagSatisfying); }); it("returns whether the element matched or not", function() { expect(spec.isMatching(element)).toBe(matchingElement); }); }); describe("when the spec tag is not expected on the element", function() { beforeEach(function() { spec.isExpectingTag.andReturn(false); spyOn(_, 'all').andReturn(matchingElement); }); it("checks whether any of the element tags match the spec tag", function() { spec.isMatching(element); expect(_.all).toHaveBeenCalledWith(elementTags, spec.isTagSatisfying); }); it("returns whether the element matched or not", function() { expect(spec.isMatching(element)).toBe(matchingElement); }); }); }); describe("isTagSatisfying()", function() { var checkedTag; beforeEach(function() { checkedTag = createSpyWithStubs("element tag", {getName: null}); spyOn(spec, 'isExpectingTag'); }); it("gets the name of the tag", function() { spec.isTagSatisfying(checkedTag); expect(checkedTag.getName).toHaveBeenCalled(); }); it("checks whether the spec tag is expected or not on the element", function() { spec.isTagSatisfying(checkedTag); expect(spec.isExpectingTag).toHaveBeenCalled(); }); describe("when the spec expects the tag to be present on the element", function() { beforeEach(function() { spec.isExpectingTag.andReturn(true); }); describe("when the tag names are identical", function() { beforeEach(function() { checkedTag.getName.andReturn(tagName); }); it("is truthy", function() { expect(spec.isTagSatisfying(checkedTag)).toBeTruthy(); }); }); describe("when the tag names are different", function() { beforeEach(function() { checkedTag.getName.andReturn("@obscure_tag"); }); it("is falsy", function() { expect(spec.isTagSatisfying(checkedTag)).toBeFalsy(); }); }); }); describe("when the spec expects the tag to be absent on the element", function() { beforeEach(function() { tagName = "tag"; spec = Cucumber.Ast.Filter.ElementMatchingTagSpec("~" + tagName); spyOn(spec, 'isExpectingTag').andReturn(false); }); describe("when the tag names are identical", function() { beforeEach(function() { checkedTag.getName.andReturn(tagName); }); it("is truthy", function() { expect(spec.isTagSatisfying(checkedTag)).toBeFalsy(); }); }); describe("when the tag names are different", function() { beforeEach(function() { checkedTag.getName.andReturn("@obscure_tag"); }); it("is falsy", function() { expect(spec.isTagSatisfying(checkedTag)).toBeTruthy(); }); }); }); }); describe("isExpectingTag()", function() { it("is truthy when the tag does not start with a tilde (~)", function() { tagName = "tag"; spec = Cucumber.Ast.Filter.ElementMatchingTagSpec(tagName); expect(spec.isExpectingTag()).toBeTruthy(); }); it("is falsy when the tag starts with a tilde (~)", function() { tagName = "~tag"; spec = Cucumber.Ast.Filter.ElementMatchingTagSpec(tagName); expect(spec.isExpectingTag()).toBeFalsy(); }); }); });
require('../../modules/es6.object.is-sealed'); module.exports = require('../../modules/$.core').Object.isSealed;
/*! * Angular Material Design * https://github.com/angular/material * @license MIT * v1.1.3-master-4413f14 */ !function(e,t,o){"use strict";function n(e){function t(e,t){this.$scope=e,this.$element=t}return{restrict:"E",controller:["$scope","$element",t],link:function(t,o){o.addClass("_md"),e(o),t.$broadcast("$mdContentLoaded",o),l(o[0])}}}function l(e){t.element(e).on("$md.pressdown",function(t){"t"===t.pointer.type&&(t.$materialScrollFixed||(t.$materialScrollFixed=!0,0===e.scrollTop?e.scrollTop=1:e.scrollHeight===e.scrollTop+e.offsetHeight&&(e.scrollTop-=1)))})}n.$inject=["$mdTheming"],t.module("material.components.content",["material.core"]).directive("mdContent",n)}(window,window.angular);
import * as types from './mutation_types'; export default { [types.SHOW](state) { state.isVisible = true; }, [types.HIDE](state) { state.isVisible = false; }, [types.OPEN](state, data) { state.data = data; state.isVisible = true; }, [types.CLOSE](state) { state.data = null; state.isVisible = false; }, };
OC.L10N.register( "files_versions", { "Versions" : "Phiên bản", "Failed to revert {file} to revision {timestamp}." : "Thất bại khi trở lại {file} khi sử đổi {timestamp}.", "Restore" : "Khôi phục", "No other versions available" : "Không có các phiên bản khác có sẵn" }, "nplurals=1; plural=0;");
class DialogController { constructor(mdPanelRef, loomApi, recruitUnitUtil) { "ngInject"; this._mdPanelRef = mdPanelRef; this.loomApi = loomApi; this.recruitUnitUtil = recruitUnitUtil; } toggleContactMe(docId, repeatScope) { console.log("confirmContactMe docId:" + docId); var panelRef = this._mdPanelRef; var localToken = this.recruitUnitUtil.Util.getLocalUser().token; this.loomApi.Article.toggleDevEmailDisplay(docId, localToken).then(angular.bind(this,function(result){ console.log("toggleDevEmailDisplay result:"); console.log(result); repeatScope.item.document.displayDevEmail = result.displayDevEmail; })); panelRef.close() } copyUnitTestFormUrl(testFormUrl) { console.log("copyUnitTestFormUrl testFormUrl:" + testFormUrl); var panelRef = this._mdPanelRef; // Copies a string to the clipboard. Must be called from within an // event handler such as click. May return false if it failed, but // this is not always possible. Browser support for Chrome 43+, // Firefox 42+, Safari 10+, Edge and IE 10+. // IE: The clipboard feature may be disabled by an administrator. By // default a prompt is shown the first time the clipboard is // used (per session). var text = testFormUrl; if (window.clipboardData && window.clipboardData.setData) { // IE specific code path to prevent textarea being shown while dialog is visible. return clipboardData.setData("Text", text); } else if (document.queryCommandSupported && document.queryCommandSupported("copy")) { var textarea = document.createElement("textarea"); textarea.textContent = text; textarea.style.position = "fixed"; // Prevent scrolling to bottom of page in MS Edge. document.body.appendChild(textarea); textarea.select(); try { return document.execCommand("copy"); // Security exception may be thrown by some browsers. } catch (ex) { console.warn("Copy to clipboard failed.", ex); return false; } finally { document.body.removeChild(textarea); panelRef.close() } } } closePanel() { console.log("close panel"); var panelRef = this._mdPanelRef; panelRef.close() } } export default DialogController
Meteor.publish('currentRelease', function() { if(Users.is.adminById(this.userId)){ return Releases.find({}, {sort: {createdAt: -1}, limit: 1}); } return []; });
/** * ag-grid - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components * @version v18.0.0 * @link http://www.ag-grid.com/ * @license MIT */ "use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; Object.defineProperty(exports, "__esModule", { value: true }); var context_1 = require("../context/context"); var column_1 = require("../entities/column"); var gridOptionsWrapper_1 = require("../gridOptionsWrapper"); var utils_1 = require("../utils"); var columnController_1 = require("./columnController"); var balancedColumnTreeBuilder_1 = require("./balancedColumnTreeBuilder"); var AutoGroupColService = (function () { function AutoGroupColService() { } AutoGroupColService_1 = AutoGroupColService; AutoGroupColService.prototype.createAutoGroupColumns = function (rowGroupColumns) { var _this = this; var groupAutoColumns = []; var doingTreeData = this.gridOptionsWrapper.isTreeData(); var doingMultiAutoColumn = this.gridOptionsWrapper.isGroupMultiAutoColumn(); if (doingTreeData && doingMultiAutoColumn) { console.log('ag-Grid: you cannot mix groupMultiAutoColumn with treeData, only one column can be used to display groups when doing tree data'); doingMultiAutoColumn = false; } // if doing groupMultiAutoColumn, then we call the method multiple times, once // for each column we are grouping by if (doingMultiAutoColumn) { rowGroupColumns.forEach(function (rowGroupCol, index) { groupAutoColumns.push(_this.createOneAutoGroupColumn(rowGroupCol, index)); }); } else { groupAutoColumns.push(this.createOneAutoGroupColumn(null)); } return groupAutoColumns; }; // rowGroupCol and index are missing if groupMultiAutoColumn=false AutoGroupColService.prototype.createOneAutoGroupColumn = function (rowGroupCol, index) { // if one provided by user, use it, otherwise create one var defaultAutoColDef = this.generateDefaultColDef(rowGroupCol); // if doing multi, set the field var colId; if (rowGroupCol) { colId = AutoGroupColService_1.GROUP_AUTO_COLUMN_ID + "-" + rowGroupCol.getId(); } else { colId = AutoGroupColService_1.GROUP_AUTO_COLUMN_BUNDLE_ID; } var userAutoColDef = this.gridOptionsWrapper.getAutoGroupColumnDef(); utils_1._.mergeDeep(defaultAutoColDef, userAutoColDef); defaultAutoColDef = this.balancedColumnTreeBuilder.mergeColDefs(defaultAutoColDef); defaultAutoColDef.colId = colId; // For tree data the filter is always allowed if (!this.gridOptionsWrapper.isTreeData()) { // we would only allow filter if the user has provided field or value getter. otherwise the filter // would not be able to work. var noFieldOrValueGetter = utils_1._.missing(defaultAutoColDef.field) && utils_1._.missing(defaultAutoColDef.valueGetter) && utils_1._.missing(defaultAutoColDef.filterValueGetter); if (noFieldOrValueGetter) { defaultAutoColDef.suppressFilter = true; } } // if showing many cols, we don't want to show more than one with a checkbox for selection if (index > 0) { defaultAutoColDef.headerCheckboxSelection = false; } var newCol = new column_1.Column(defaultAutoColDef, colId, true); this.context.wireBean(newCol); return newCol; }; AutoGroupColService.prototype.generateDefaultColDef = function (rowGroupCol) { var localeTextFunc = this.gridOptionsWrapper.getLocaleTextFunc(); var defaultAutoColDef = { headerName: localeTextFunc('group', 'Group'), cellRenderer: 'agGroupCellRenderer' }; // we never allow moving the group column // defaultAutoColDef.suppressMovable = true; if (rowGroupCol) { var rowGroupColDef = rowGroupCol.getColDef(); utils_1._.assign(defaultAutoColDef, { // cellRendererParams.groupKey: colDefToCopy.field; headerName: this.columnController.getDisplayNameForColumn(rowGroupCol, 'header'), headerValueGetter: rowGroupColDef.headerValueGetter }); if (rowGroupColDef.cellRenderer) { utils_1._.assign(defaultAutoColDef, { cellRendererParams: { innerRenderer: rowGroupColDef.cellRenderer, innerRendererParams: rowGroupColDef.cellRendererParams } }); } defaultAutoColDef.showRowGroup = rowGroupCol.getColId(); } else { defaultAutoColDef.showRowGroup = true; } return defaultAutoColDef; }; AutoGroupColService.GROUP_AUTO_COLUMN_ID = 'ag-Grid-AutoColumn'; AutoGroupColService.GROUP_AUTO_COLUMN_BUNDLE_ID = AutoGroupColService_1.GROUP_AUTO_COLUMN_ID; __decorate([ context_1.Autowired('gridOptionsWrapper'), __metadata("design:type", gridOptionsWrapper_1.GridOptionsWrapper) ], AutoGroupColService.prototype, "gridOptionsWrapper", void 0); __decorate([ context_1.Autowired('context'), __metadata("design:type", context_1.Context) ], AutoGroupColService.prototype, "context", void 0); __decorate([ context_1.Autowired('columnController'), __metadata("design:type", columnController_1.ColumnController) ], AutoGroupColService.prototype, "columnController", void 0); __decorate([ context_1.Autowired('balancedColumnTreeBuilder'), __metadata("design:type", balancedColumnTreeBuilder_1.BalancedColumnTreeBuilder) ], AutoGroupColService.prototype, "balancedColumnTreeBuilder", void 0); AutoGroupColService = AutoGroupColService_1 = __decorate([ context_1.Bean('autoGroupColService') ], AutoGroupColService); return AutoGroupColService; var AutoGroupColService_1; }()); exports.AutoGroupColService = AutoGroupColService;
function new_buf(len) { /* jshint -W056 */ return new (typeof Buffer !== 'undefined' ? Buffer : Array)(len); /* jshint +W056 */ } var Base64 = (function make_b64(){ var map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; return { /* (will need this for writing) encode: function(input, utf8) { var o = ""; var c1, c2, c3, e1, e2, e3, e4; for(var i = 0; i < input.length; ) { c1 = input.charCodeAt(i++); c2 = input.charCodeAt(i++); c3 = input.charCodeAt(i++); e1 = c1 >> 2; e2 = (c1 & 3) << 4 | c2 >> 4; e3 = (c2 & 15) << 2 | c3 >> 6; e4 = c3 & 63; if (isNaN(c2)) { e3 = e4 = 64; } else if (isNaN(c3)) { e4 = 64; } o += map.charAt(e1) + map.charAt(e2) + map.charAt(e3) + map.charAt(e4); } return o; },*/ decode: function b64_decode(input, utf8) { var o = ""; var c1, c2, c3; var e1, e2, e3, e4; input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); for(var i = 0; i < input.length;) { e1 = map.indexOf(input.charAt(i++)); e2 = map.indexOf(input.charAt(i++)); e3 = map.indexOf(input.charAt(i++)); e4 = map.indexOf(input.charAt(i++)); c1 = e1 << 2 | e2 >> 4; c2 = (e2 & 15) << 4 | e3 >> 2; c3 = (e3 & 3) << 6 | e4; o += String.fromCharCode(c1); if (e3 != 64) { o += String.fromCharCode(c2); } if (e4 != 64) { o += String.fromCharCode(c3); } } return o; } }; })(); function s2a(s) { if(typeof Buffer !== 'undefined') return new Buffer(s, "binary"); var w = s.split("").map(function(x){ return x.charCodeAt(0) & 0xff; }); return w; }
/*! * ui-grid - v4.5.0 - 2018-06-15 * Copyright (c) 2018 ; License: MIT */ (function () { angular.module('ui.grid').config(['$provide', function($provide) { $provide.decorator('i18nService', ['$delegate', function($delegate) { $delegate.add('pl', { headerCell: { aria: { defaultFilterLabel: 'Filtr dla kolumny', removeFilter: 'Usuń filtr', columnMenuButtonLabel: 'Opcje kolumny', column: 'Kolumna' }, priority: 'Priorytet:', filterLabel: "Filtr dla kolumny: " }, aggregate: { label: 'pozycji' }, groupPanel: { description: 'Przeciągnij nagłówek kolumny tutaj, aby pogrupować według niej.' }, search: { aria: { selected: 'Wiersz zaznaczony', notSelected: 'Wiersz niezaznaczony' }, placeholder: 'Szukaj...', showingItems: 'Widoczne pozycje:', selectedItems: 'Zaznaczone pozycje:', totalItems: 'Wszystkich pozycji:', size: 'Rozmiar strony:', first: 'Pierwsza strona', next: 'Następna strona', previous: 'Poprzednia strona', last: 'Ostatnia strona' }, menu: { text: 'Wybierz kolumny:' }, sort: { ascending: 'Sortuj rosnąco', descending: 'Sortuj malejąco', none: 'Brak sortowania', remove: 'Wyłącz sortowanie' }, column: { hide: 'Ukryj kolumnę' }, aggregation: { count: 'Razem pozycji: ', sum: 'Razem: ', avg: 'Średnia: ', min: 'Min: ', max: 'Max: ' }, pinning: { pinLeft: 'Przypnij do lewej', pinRight: 'Przypnij do prawej', unpin: 'Odepnij' }, columnMenu: { close: 'Zamknij' }, gridMenu: { aria: { buttonLabel: 'Opcje tabeli' }, columns: 'Kolumny:', importerTitle: 'Importuj plik', exporterAllAsCsv: 'Eksportuj wszystkie dane do csv', exporterVisibleAsCsv: 'Eksportuj widoczne dane do csv', exporterSelectedAsCsv: 'Eksportuj zaznaczone dane do csv', exporterAllAsPdf: 'Eksportuj wszystkie dane do pdf', exporterVisibleAsPdf: 'Eksportuj widoczne dane do pdf', exporterSelectedAsPdf: 'Eksportuj zaznaczone dane do pdf', exporterAllAsExcel: 'Eksportuj wszystkie dane do excel', exporterVisibleAsExcel: 'Eksportuj widoczne dane do excel', exporterSelectedAsExcel: 'Eksportuj zaznaczone dane do excel', clearAllFilters: 'Wyczyść filtry' }, importer: { noHeaders: 'Nie udało się wczytać nazw kolumn. Czy plik posiada nagłówek?', noObjects: 'Nie udalo się wczytać pozycji. Czy plik zawiera dane?', invalidCsv: 'Nie udało się przetworzyć pliku. Czy to prawidłowy plik CSV?', invalidJson: 'Nie udało się przetworzyć pliku. Czy to prawidłowy plik JSON?', jsonNotArray: 'Importowany plik JSON musi zawierać tablicę. Importowanie przerwane.' }, pagination: { aria: { pageToFirst: 'Pierwsza strona', pageBack: 'Poprzednia strona', pageSelected: 'Wybrana strona', pageForward: 'Następna strona', pageToLast: 'Ostatnia strona' }, sizes: 'pozycji na stronę', totalItems: 'pozycji', through: 'do', of: 'z' }, grouping: { group: 'Grupuj', ungroup: 'Rozgrupuj', aggregate_count: 'Zbiorczo: Razem', aggregate_sum: 'Zbiorczo: Suma', aggregate_max: 'Zbiorczo: Max', aggregate_min: 'Zbiorczo: Min', aggregate_avg: 'Zbiorczo: Średnia', aggregate_remove: 'Zbiorczo: Usuń' }, validate: { error: 'Błąd:', minLength: 'Wartość powinna składać się z co najmniej THRESHOLD znaków.', maxLength: 'Wartość powinna składać się z przynajmniej THRESHOLD znaków.', required: 'Wartość jest wymagana.' } }); return $delegate; }]); }]); })();
/* * Test the second finalizer argument, a boolean which is true if we're in * heap destruction and cannot rescue the object. */ /*--- { "custom": true } ---*/ /*=== finalizer 2: object boolean false finalizer 1: object boolean true ===*/ var obj1 = {}; Duktape.fin(obj1, function myFinalizer(o, heapDestruct) { print('finalizer 1:', typeof o, typeof heapDestruct, heapDestruct); }); var obj2 = {}; Duktape.fin(obj2, function myFinalizer(o, heapDestruct) { print('finalizer 2:', typeof o, typeof heapDestruct, heapDestruct); }); obj2 = null; Duktape.gc(); // Force obj2 collection before heap destruct // Let heap destruction handle obj1.
define( //begin v1.x content { "field-tue-relative+-1": "letzten Dienstag", "field-year": "Jahr", "dateFormatItem-Hm": "HH:mm", "field-wed-relative+0": "diesen Mittwoch", "field-wed-relative+1": "nächsten Mittwoch", "dateFormatItem-ms": "mm:ss", "field-minute": "Minute", "field-month-narrow-relative+-1": "letzten Monat", "field-tue-narrow-relative+0": "diesen Di.", "field-tue-narrow-relative+1": "nächsten Di.", "field-day-short-relative+-1": "gestern", "field-thu-short-relative+0": "diesen Do.", "field-day-relative+0": "heute", "field-day-short-relative+-2": "vorgestern", "field-thu-short-relative+1": "nächsten Do.", "field-day-relative+1": "morgen", "field-week-narrow-relative+0": "diese Woche", "field-day-relative+2": "übermorgen", "field-week-narrow-relative+1": "nächste Woche", "field-wed-narrow-relative+-1": "letzten Mi.", "field-year-narrow": "J", "field-era-short": "Epoche", "field-year-narrow-relative+0": "dieses Jahr", "field-tue-relative+0": "diesen Dienstag", "field-year-narrow-relative+1": "nächstes Jahr", "field-tue-relative+1": "nächsten Dienstag", "field-weekdayOfMonth": "Wochentag", "field-second-short": "Sek.", "dateFormatItem-MMMd": "d. MMM", "field-weekdayOfMonth-narrow": "WT", "field-week-relative+0": "diese Woche", "field-month-relative+0": "diesen Monat", "field-week-relative+1": "nächste Woche", "field-month-relative+1": "nächsten Monat", "field-sun-narrow-relative+0": "diesen So.", "field-mon-short-relative+0": "diesen Mo.", "field-sun-narrow-relative+1": "nächsten So.", "field-mon-short-relative+1": "nächsten Mo.", "field-second-relative+0": "jetzt", "dateFormatItem-yyyyQQQ": "QQQ U", "field-weekOfMonth": "Woche des Monats", "field-month-short": "Monat", "dateFormatItem-GyMMMEd": "E, d. MMM U", "dateFormatItem-yyyyMd": "d.M.y", "field-day": "Tag", "field-dayOfYear-short": "Tag des Jahres", "field-year-relative+-1": "letztes Jahr", "field-sat-short-relative+-1": "letzten Sa.", "field-hour-relative+0": "in dieser Stunde", "dateFormatItem-yyyyMEd": "E, d.M.y", "field-wed-relative+-1": "letzten Mittwoch", "field-sat-narrow-relative+-1": "letzten Sa.", "field-second": "Sekunde", "dateFormat-long": "d. MMMM U", "dateFormatItem-GyMMMd": "d. MMM U", "field-hour-short-relative+0": "in dieser Stunde", "field-quarter": "Quartal", "field-week-short": "Woche", "field-day-narrow-relative+0": "heute", "field-day-narrow-relative+1": "morgen", "field-day-narrow-relative+2": "übermorgen", "field-tue-short-relative+0": "diesen Di.", "field-tue-short-relative+1": "nächsten Di.", "field-month-short-relative+-1": "letzten Monat", "field-mon-relative+-1": "letzten Montag", "dateFormatItem-GyMMM": "MMM U", "field-month": "Monat", "field-day-narrow": "Tag", "dateFormatItem-MMM": "LLL", "field-minute-short": "Min.", "field-dayperiod": "Tageshälfte", "field-sat-short-relative+0": "diesen Sa.", "field-sat-short-relative+1": "nächsten Sa.", "dateFormat-medium": "dd.MM U", "dateFormatItem-yyyyMMMM": "MMMM U", "dateFormatItem-yyyyM": "M.y", "field-second-narrow": "Sek.", "field-mon-relative+0": "diesen Montag", "field-mon-relative+1": "nächsten Montag", "field-day-narrow-relative+-1": "gestern", "field-year-short": "Jahr", "field-day-narrow-relative+-2": "vorgestern", "field-quarter-relative+-1": "letztes Quartal", "dateFormatItem-yyyyMMMd": "d. MMM U", "field-dayperiod-narrow": "Tagesh.", "field-week-narrow-relative+-1": "letzte Woche", "field-dayOfYear": "Tag des Jahres", "field-sat-relative+-1": "letzten Samstag", "dateFormatItem-Md": "d.M.", "field-hour": "Stunde", "field-minute-narrow-relative+0": "in dieser Minute", "dateFormat-full": "EEEE, d. MMMM U", "field-month-relative+-1": "letzten Monat", "dateFormatItem-Hms": "HH:mm:ss", "field-quarter-short": "Quart.", "field-sat-narrow-relative+0": "diesen Sa.", "field-fri-relative+0": "diesen Freitag", "field-sat-narrow-relative+1": "nächsten Sa.", "field-fri-relative+1": "nächsten Freitag", "field-month-narrow-relative+0": "diesen Monat", "field-month-narrow-relative+1": "nächsten Monat", "field-sun-short-relative+0": "diesen So.", "field-sun-short-relative+1": "nächsten So.", "field-week-relative+-1": "letzte Woche", "field-minute-short-relative+0": "in dieser Minute", "field-quarter-relative+0": "dieses Quartal", "field-minute-relative+0": "in dieser Minute", "field-quarter-relative+1": "nächstes Quartal", "field-wed-short-relative+-1": "letzten Mi.", "dateFormat-short": "dd.MM.yy", "field-year-narrow-relative+-1": "letztes Jahr", "field-thu-short-relative+-1": "letzten Do.", "dateFormatItem-yyyyMMMEd": "E, d. MMM U", "field-mon-narrow-relative+-1": "letzten Mo.", "dateFormatItem-MMMMd": "d. MMMM", "field-thu-narrow-relative+-1": "letzten Do.", "field-tue-narrow-relative+-1": "letzten Di.", "dateFormatItem-H": "HH 'Uhr'", "field-weekOfMonth-short": "W/M", "dateFormatItem-yyyy": "U", "dateFormatItem-M": "L", "field-wed-short-relative+0": "diesen Mi.", "field-wed-short-relative+1": "nächsten Mi.", "field-sun-relative+-1": "letzten Sonntag", "dateFormatItem-hm": "h:mm a", "dateFormatItem-d": "d", "field-weekday": "Wochentag", "field-day-short-relative+0": "heute", "field-quarter-narrow-relative+0": "dieses Quartal", "field-day-short-relative+1": "morgen", "field-sat-relative+0": "diesen Samstag", "field-quarter-narrow-relative+1": "nächstes Quartal", "dateFormatItem-h": "h a", "field-day-short-relative+2": "übermorgen", "field-sat-relative+1": "nächsten Samstag", "field-week-short-relative+0": "diese Woche", "field-week-short-relative+1": "nächste Woche", "field-dayOfYear-narrow": "T/J", "field-month-short-relative+0": "diesen Monat", "field-month-short-relative+1": "nächsten Monat", "field-weekdayOfMonth-short": "Wochentag", "dateFormatItem-MEd": "E, d.M.", "field-zone-narrow": "Zeitz.", "dateFormatItem-y": "U", "field-thu-narrow-relative+0": "diesen Do.", "field-sun-narrow-relative+-1": "letzten So.", "field-mon-short-relative+-1": "letzten Mo.", "field-thu-narrow-relative+1": "nächsten Do.", "field-thu-relative+0": "diesen Donnerstag", "field-thu-relative+1": "nächsten Donnerstag", "dateFormatItem-hms": "h:mm:ss a", "field-fri-short-relative+-1": "letzten Fr.", "field-thu-relative+-1": "letzten Donnerstag", "field-week": "Woche", "dateFormatItem-Ed": "E, d.", "field-wed-narrow-relative+0": "diesen Mi.", "field-wed-narrow-relative+1": "nächsten Mi.", "field-quarter-narrow-relative+-1": "letztes Quartal", "field-year-short-relative+0": "dieses Jahr", "dateFormatItem-yyyyMMM": "MMM U", "field-dayperiod-short": "Tageshälfte", "field-year-short-relative+1": "nächstes Jahr", "field-fri-short-relative+0": "diesen Fr.", "field-fri-short-relative+1": "nächsten Fr.", "field-week-short-relative+-1": "letzte Woche", "field-hour-narrow-relative+0": "in dieser Stunde", "dateFormatItem-yyyyQQQQ": "QQQQ U", "field-hour-short": "Std.", "field-zone-short": "Zeitzone", "field-month-narrow": "M", "field-hour-narrow": "Std.", "field-fri-narrow-relative+-1": "letzten Fr.", "field-year-relative+0": "dieses Jahr", "field-year-relative+1": "nächstes Jahr", "field-era-narrow": "E", "field-fri-relative+-1": "letzten Freitag", "field-tue-short-relative+-1": "letzten Di.", "field-minute-narrow": "Min.", "field-mon-narrow-relative+0": "diesen Mo.", "field-mon-narrow-relative+1": "nächsten Mo.", "field-year-short-relative+-1": "letztes Jahr", "field-zone": "Zeitzone", "dateFormatItem-MMMEd": "E, d. MMM", "field-weekOfMonth-narrow": "Wo. des Monats", "field-weekday-narrow": "Wochent.", "field-quarter-narrow": "Q", "field-sun-short-relative+-1": "letzten So.", "field-day-relative+-1": "gestern", "field-day-relative+-2": "vorgestern", "field-weekday-short": "Wochentag", "field-sun-relative+0": "diesen Sonntag", "field-sun-relative+1": "nächsten Sonntag", "dateFormatItem-Gy": "U", "field-day-short": "Tag", "field-week-narrow": "W", "field-era": "Epoche", "field-fri-narrow-relative+0": "diesen Fr.", "field-fri-narrow-relative+1": "nächsten Fr." } //end v1.x content );
/*! * Copyright (c) 2017 NAVER Corp. * @egjs/infinitegrid project is licensed under the MIT license * * @egjs/infinitegrid JavaScript library * https://github.com/naver/egjs-infinitegrid * * @version 3.3.0 */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); else if(typeof define === 'function' && define.amd) define([], factory); else if(typeof exports === 'object') exports["Parallax"] = factory(); else root["eg"] = root["eg"] || {}, root["eg"]["Parallax"] = factory(); })(typeof self !== 'undefined' ? self : this, function() { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { /******/ configurable: false, /******/ enumerable: true, /******/ get: getter /******/ }); /******/ } /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 2); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; exports.DEFENSE_BROWSER = exports.WEBKIT_VERSION = exports.PROCESSING = exports.LOADING_PREPEND = exports.LOADING_APPEND = exports.IDLE = exports.ALIGN = exports.isMobile = exports.agent = exports.DEFAULT_OPTIONS = exports.GROUPKEY_ATT = exports.DUMMY_POSITION = exports.SINGLE = exports.MULTI = exports.NO_TRUSTED = exports.TRUSTED = exports.NO_CACHE = exports.CACHE = exports.HORIZONTAL = exports.VERTICAL = exports.PREPEND = exports.APPEND = exports.IGNORE_CLASSNAME = exports.CONTAINER_CLASSNAME = exports.RETRY = exports.IS_ANDROID2 = exports.IS_IOS = exports.IS_IE = exports.SUPPORT_PASSIVE = exports.SUPPORT_ADDEVENTLISTENER = exports.SUPPORT_COMPUTEDSTYLE = undefined; var _browser = __webpack_require__(1); var ua = _browser.window.navigator.userAgent; var SUPPORT_COMPUTEDSTYLE = exports.SUPPORT_COMPUTEDSTYLE = !!("getComputedStyle" in _browser.window); var SUPPORT_ADDEVENTLISTENER = exports.SUPPORT_ADDEVENTLISTENER = !!("addEventListener" in document); var SUPPORT_PASSIVE = exports.SUPPORT_PASSIVE = function () { var supportsPassiveOption = false; try { if (SUPPORT_ADDEVENTLISTENER && Object.defineProperty) { document.addEventListener("test", null, Object.defineProperty({}, "passive", { get: function get() { supportsPassiveOption = true; } })); } } catch (e) {} return supportsPassiveOption; }(); var IS_IE = exports.IS_IE = /MSIE|Trident|Windows Phone|Edge/.test(ua); var IS_IOS = exports.IS_IOS = /iPhone|iPad/.test(ua); var IS_ANDROID2 = exports.IS_ANDROID2 = /Android 2\./.test(ua); var RETRY = exports.RETRY = 3; var CONTAINER_CLASSNAME = exports.CONTAINER_CLASSNAME = "_eg-infinitegrid-container_"; var IGNORE_CLASSNAME = exports.IGNORE_CLASSNAME = "_eg-infinitegrid-ignore_"; var APPEND = exports.APPEND = true; var PREPEND = exports.PREPEND = false; var VERTICAL = exports.VERTICAL = "vertical"; var HORIZONTAL = exports.HORIZONTAL = "horizontal"; var CACHE = exports.CACHE = true; var NO_CACHE = exports.NO_CACHE = false; var TRUSTED = exports.TRUSTED = true; var NO_TRUSTED = exports.NO_TRUSTED = false; var MULTI = exports.MULTI = true; var SINGLE = exports.SINGLE = false; var DUMMY_POSITION = exports.DUMMY_POSITION = -100000; var GROUPKEY_ATT = exports.GROUPKEY_ATT = "data-groupkey"; var DEFAULT_OPTIONS = exports.DEFAULT_OPTIONS = { horizontal: false, margin: 0 }; var agent = exports.agent = ua.toLowerCase(); var isMobile = exports.isMobile = /mobi|ios|android/.test(agent); var ALIGN = exports.ALIGN = { START: "start", CENTER: "center", END: "end", JUSTIFY: "justify" }; var IDLE = exports.IDLE = 0; var LOADING_APPEND = exports.LOADING_APPEND = 1; var LOADING_PREPEND = exports.LOADING_PREPEND = 2; var PROCESSING = exports.PROCESSING = 4; var webkit = /applewebkit\/([\d|.]*)/g.exec(agent); var WEBKIT_VERSION = exports.WEBKIT_VERSION = webkit && parseInt(webkit[1], 10) || 0; var DEFENSE_BROWSER = exports.DEFENSE_BROWSER = WEBKIT_VERSION && WEBKIT_VERSION < 537; /***/ }), /* 1 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; /* eslint-disable no-new-func, no-nested-ternary */ var win = window; /* eslint-enable no-new-func, no-nested-ternary */ exports.window = win; var document = exports.document = win.document; /***/ }), /* 2 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; 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 _consts = __webpack_require__(0); var _utils = __webpack_require__(3); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var style = { "vertical": { position: "top", size: "height", cammelSize: "Height", coordinate: "Y" }, "horizontal": { position: "left", size: "width", cammelSize: "Width", coordinate: "X" } }; var START = _consts.ALIGN.START, CENTER = _consts.ALIGN.CENTER; var TRANSFORM = function () { var bodyStyle = (document.head || document.getElementsByTagName("head")[0]).style; var target = ["transform", "webkitTransform", "msTransform", "mozTransform"]; for (var i = 0, len = target.length; i < len; i++) { if (target[i] in bodyStyle) { return target[i]; } } return ""; }(); /** * @classdesc Parallax is a displacement or difference in the apparent position of an object viewed along two different lines of sight. You can apply parallax by scrolling the image and speed of the item. * @ko Parallax는 서로 다른 두 개의 시선에서 바라본 물체의 외관상 위치의 변위 또는 차이입니다. 스크롤에 따라 이미지와 아이템의 속도를 차이를 줌으로써 parallax을 적용할 수 있습니다. * @class eg.Parallax * @param {Element|String} [root=window] Scrolling target. If you scroll in the body, set window. 스크롤하는 대상. 만약 body에서 스크롤하면 window로 설정한다. * @param {Object} [options] The option object of eg.Parallax module <ko>eg.Parallax 모듈의 옵션 객체</ko> * @param {Boolean} [options.horizontal=false] Direction of the scroll movement (false: vertical, true: horizontal) <ko>스크롤 이동 방향 (false: 세로방향, true: 가로방향)</ko> * @param {Element|String} [options.container=null] Container wrapping items. If root and container have no gaps, do not set option. <ko> 아이템들을 감싸고 있는 컨테이너. 만약 root와 container간의 차이가 없으면, 옵션을 설정하지 않아도 된다.</ko> * @param {String} [options.selector="img"] The selector of the image to apply the parallax in the item <ko> 아이템안에 있는 parallax를 적용할 이미지의 selector </ko> * @param {Boolean} [options.strength=1] Dimensions that indicate the sensitivity of parallax. The higher the strength, the faster. * @param {Boolean} [options.center=0] The middle point of parallax. The top is 1 and the bottom is -1. <ko> parallax가 가운데로 오는 점. 상단이 1이고 하단이 -1이다. </ko> * @param {Boolean} [options.range=[-1, 1]] Range to apply the parallax. The top is 1 and the bottom is -1. <ko> parallax가 적용되는 범위, 상단이 1이고 하단이 -1이다. </ko> * @param {Boolean} [options.align="start"] The alignment of the image in the item. ("start" : top or left, "center": middle) <ko> 아이템안의 이미지의 정렬 </ko> * @example ``` <script> // isOverflowScroll: false var parallax = new eg.Parallax(window, { container: ".container", selector: "img.parallax", strength: 0.8, center: 0, range: [-1, 1], align: "center", horizontal: true, }); // isOverflowScroll: ture var parallax = new eg.Parallax(".container", { selector: "img.parallax", strength: 0.8, center: 0, range: [-1, 1], align: "center", horizontal: true, }); // item interface var item = { // original size size: { width: 100, height: 100, }, // view size rect: { top: 100, left: 100, width: 100, height: 100, } }; </script> ``` **/ var Parallax = function () { function Parallax() { var root = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window; var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; _classCallCheck(this, Parallax); this.options = _extends({ container: null, selector: "img", strength: 1, center: 0, range: [-1, 1], align: START, horizontal: false }, options); this._root = (0, _utils.$)(root); this._container = this.options.container && (0, _utils.$)(this.options.container); this._rootSize = 0; this._containerPosition = 0; this._style = style[this.options.horizontal ? "horizontal" : "vertical"]; this.resize(); } Parallax.prototype._checkParallaxItem = function _checkParallaxItem(element) { if (!element) { return; } var selector = this.options.selector; if (!element.__IMAGE__) { var img = element.querySelector(selector); element.__IMAGE__ = img || -1; if (element.__IMAGE__ === -1) { return; } element.__BOX__ = img.parentNode; } if (element.__IMAGE__ === -1) { return; } var sizeName = this._style.cammelSize; element.__IMAGE__.__SIZE__ = element.__IMAGE__["offset" + sizeName]; element.__BOX__.__SIZE__ = element.__BOX__["offset" + sizeName]; }; /** * As the browser is resized, the gaps between the root and the container and the size of the items are updated. * @ko 브라우저의 크기가 변경됨으로 써 root와 container의 간격과 아이템들의 크기를 갱신한다. * @method eg.Parallax#resize * @param {Array} [items = []] Items to apply parallax. It does not apply if it is not in visible range. <ko>parallax를 적용할 아이템들. 가시거리에 존재하지 않으면 적용이 안된다.</ko> * @return {eg.Parallax} An instance of a module itself<ko>모듈 자신의 인스턴스</ko> * @example ```js window.addEventListener("resize", function (e) { parallax.resize(items); }); ``` */ Parallax.prototype.resize = function resize() { var _this = this; var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; var root = this._root; var container = this._container; var positionName = this._style.position; var sizeName = this._style.cammelSize; if (!container || root === container) { this._containerPosition = 0; } else { var rootRect = ((0, _utils.isWindow)(root) ? document.body : root).getBoundingClientRect(); var containertRect = container.getBoundingClientRect(); this._containerPosition = containertRect[positionName] - rootRect[positionName]; } this._rootSize = (0, _utils.isWindow)(root) ? window["inner" + sizeName] || document.documentElement["client" + sizeName] : root["client" + sizeName]; if (_consts.isMobile & (0, _utils.isWindow)(root)) { var bodyWidth = document.body.offsetWidth || document.documentElement.offsetWidth; var windowWidth = window.innerWidth; this._rootSize = this._rootSize / (bodyWidth / windowWidth); } items.forEach(function (item) { _this._checkParallaxItem(item.el); }); return this; }; /** * Scrolls the image in the item by a parallax. * @ko 스크롤하면 아이템안의 이미지를 시차적용시킨다. * @method eg.Parallax#refresh * @param {Array} [items = []] Items to apply parallax. It does not apply if it is not in visible range. <ko>parallax를 적용할 아이템들. 가시거리에 존재하지 않으면 적용이 안된다.</ko> * @param {Number} [scrollPositionStart = 0] The scroll position. * @return {eg.Parallax} An instance of a module itself<ko>모듈 자신의 인스턴스</ko> * @example ```js document.body.addEventListener("scroll", function (e) { parallax.refresh(items, e.scrollTop); }); ``` */ Parallax.prototype.refresh = function refresh() { var _this2 = this; var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; var scrollPositionStart = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; var styleNames = this._style; var positionName = styleNames.position; var coordinateName = styleNames.coordinate; var sizeName = styleNames.size; var options = this.options; var strength = options.strength, center = options.center, range = options.range, align = options.align; var rootSize = this._rootSize; var scrollPositionEnd = scrollPositionStart + rootSize; var containerPosition = this._containerPosition; items.forEach(function (item) { if (!item.rect || !item.size || !item.el) { return; } var position = containerPosition + item.rect[positionName]; var itemSize = item.rect[sizeName] || item.size[sizeName]; // check item is in container. if (scrollPositionStart > position + itemSize || scrollPositionEnd < position) { return; } var el = item.el; if (!el.__IMAGE__) { _this2._checkParallaxItem(el); } if (el.__IMAGE__ === -1) { return; } var imageElement = el.__IMAGE__; var boxElement = el.__BOX__; var boxSize = boxElement.__SIZE__; var imageSize = imageElement.__SIZE__; // no parallax if (boxSize >= imageSize) { // remove transform style imageElement.style[TRANSFORM] = ""; return; } // if area's position is center, ratio is 0. // if area is hidden at the top, ratio is 1. // if area is hidden at the bottom, ratio is -1. var imagePosition = position + boxSize / 2; var ratio = (scrollPositionStart + rootSize / 2 - (rootSize + boxSize) / 2 * center - imagePosition) / (rootSize + boxSize) * 2 * strength; // if ratio is out of the range of -1 and 1, show empty space. ratio = Math.max(Math.min(ratio, range[1]), range[0]); // dist is the position when thumnail's image is centered. var dist = (boxSize - imageSize) / 2; var translate = dist * (1 - ratio); if (align === CENTER) { translate -= dist; } imageElement.__TRANSLATE__ = translate; imageElement.__RATIO__ = ratio; imageElement.style[TRANSFORM] = "translate" + coordinateName + "(" + translate + "px)"; }); return this; }; return Parallax; }(); module.exports = Parallax; /***/ }), /* 3 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; exports.STYLE = undefined; 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 _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; exports.toArray = toArray; exports.matchHTML = matchHTML; exports.$ = $; exports.addEvent = addEvent; exports.removeEvent = removeEvent; exports.scroll = scroll; exports.scrollTo = scrollTo; exports.scrollBy = scrollBy; exports.getStyles = getStyles; exports.innerWidth = innerWidth; exports.innerHeight = innerHeight; exports.getStyleNames = getStyleNames; exports.assignOptions = assignOptions; exports.toZeroArray = toZeroArray; exports.isWindow = isWindow; exports.fill = fill; var _browser = __webpack_require__(1); var _consts = __webpack_require__(0); function toArray(nodes) { // SCRIPT5014 in IE8 var array = []; if (nodes) { for (var i = 0, len = nodes.length; i < len; i++) { array.push(nodes[i]); } } return array; } function matchHTML(html) { return html.match(/^<([A-z]+)\s*([^>]*)>/); } /** * Select or create element * @param {String|HTMLElement|jQuery} param * when string given is as HTML tag, then create element * otherwise it returns selected elements * @param {Boolean} multi * @returns {HTMLElement} */ function $(param) { var multi = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; var el = void 0; if (typeof param === "string") { // String (HTML, Selector) // check if string is HTML tag format var match = matchHTML(param); // creating element if (match) { // HTML var dummy = _browser.document.createElement("div"); dummy.innerHTML = param; el = dummy.childNodes; } else { // Selector el = _browser.document.querySelectorAll(param); } if (multi) { el = toArray(el); } else { el = el && el.length > 0 && el[0] || undefined; } } else if (param === _browser.window) { // window el = param; } else if (param.nodeName && (param.nodeType === 1 || param.nodeType === 9)) { // HTMLElement, Document el = param; } else if ("jQuery" in _browser.window && param instanceof _browser.window.jQuery || param.constructor.prototype.jquery) { // jQuery el = $(multi ? param.toArray() : param.get(0), multi); } else if (Array.isArray(param)) { el = param.map(function (v) { return $(v); }); if (!multi) { el = el.length >= 1 ? el[0] : undefined; } } return el; } function addEvent(element, type, handler, eventListenerOptions) { if (_consts.SUPPORT_ADDEVENTLISTENER) { var options = eventListenerOptions || false; if ((typeof eventListenerOptions === "undefined" ? "undefined" : _typeof(eventListenerOptions)) === "object") { options = _consts.SUPPORT_PASSIVE ? eventListenerOptions : false; } element.addEventListener(type, handler, options); } else if (element.attachEvent) { element.attachEvent("on" + type, handler); } else { element["on" + type] = handler; } } function removeEvent(element, type, handler) { if (element.removeEventListener) { element.removeEventListener(type, handler, false); } else if (element.detachEvent) { element.detachEvent("on" + type, handler); } else { element["on" + type] = null; } } function scroll(el) { var horizontal = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; var prop = "scroll" + (horizontal ? "Left" : "Top"); if (el === _browser.window) { return _browser.window[horizontal ? "pageXOffset" : "pageYOffset"] || _browser.document.body[prop] || _browser.document.documentElement[prop]; } else { return el[prop]; } } function scrollTo(el, x, y) { if (el === _browser.window) { el.scroll(x, y); } else { el.scrollLeft = x; el.scrollTop = y; } } function scrollBy(el, x, y) { if (el === _browser.window) { el.scrollBy(x, y); } else { el.scrollLeft += x; el.scrollTop += y; } } function getStyles(el) { return _consts.SUPPORT_COMPUTEDSTYLE ? _browser.window.getComputedStyle(el) : el.currentStyle; } function _getSize(el, name) { if (el === _browser.window) { // WINDOW return _browser.window["inner" + name] || _browser.document.body["client" + name]; } else if (el.nodeType === 9) { // DOCUMENT_NODE var doc = el.documentElement; return Math.max(el.body["scroll" + name], doc["scroll" + name], el.body["offset" + name], doc["offset" + name], doc["client" + name]); } else { // NODE var style = getStyles(el); var value = style[name.toLowerCase()]; return parseFloat(/auto|%/.test(value) ? el["offset" + name] : style[name.toLowerCase()]); } } function innerWidth(el) { return _getSize(el, "Width"); } function innerHeight(el) { return _getSize(el, "Height"); } var STYLE = exports.STYLE = { vertical: { pos1: "top", endPos1: "bottom", size1: "height", pos2: "left", endPos2: "right", size2: "width" }, horizontal: { pos1: "left", endPos1: "right", size1: "width", pos2: "top", endPos2: "bottom", size2: "height" } }; function getStyleNames(isHorizontal) { return STYLE[isHorizontal ? _consts.HORIZONTAL : _consts.VERTICAL]; } function assignOptions(defaultOptions, options) { return _extends({}, _consts.DEFAULT_OPTIONS, defaultOptions, options); } function toZeroArray(outline) { if (!outline || !outline.length) { return [0]; } return outline; } function isWindow(el) { return el === _browser.window; } function fill(arr, value) { var length = arr.length; for (var i = length - 1; i >= 0; --i) { arr[i] = value; } return arr; } /***/ }) /******/ ]); }); //# sourceMappingURL=parallax.js.map
var Checker = require('../lib/checker'); var assert = require('assert'); describe('rules/disallow-right-sticked-operators', function() { var checker; beforeEach(function() { checker = new Checker(); checker.registerDefaultRules(); }); it('should report sticky operator', function() { checker.configure({ disallowRightStickedOperators: ['!'] }); assert(checker.checkString('var x = !y;').getErrorCount() === 1); }); it('should not report separated operator', function() { checker.configure({ disallowRightStickedOperators: ['!'] }); assert(checker.checkString('var x = ! y;').isEmpty()); }); });
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('react-dom')) : typeof define === 'function' && define.amd ? define(['exports', 'react', 'react-dom'], factory) : (factory((global.Reactstrap = global.Reactstrap || {}),global.React,global.ReactDOM)); }(this, (function (exports,React,ReactDOM) { 'use strict'; var React__default = 'default' in React ? React['default'] : React; ReactDOM = ReactDOM && 'default' in ReactDOM ? ReactDOM['default'] : ReactDOM; var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; function unwrapExports (x) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; } function createCommonjsModule(fn, module) { return module = { exports: {} }, fn(module, module.exports), module.exports; } /** * Copyright (c) 2013-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. * * */ function makeEmptyFunction(arg) { return function () { return arg; }; } /** * This function accepts and discards inputs; it has no side effects. This is * primarily useful idiomatically for overridable function endpoints which * always need to be callable, since JS lacks a null-call idiom ala Cocoa. */ var emptyFunction = function emptyFunction() {}; emptyFunction.thatReturns = makeEmptyFunction; emptyFunction.thatReturnsFalse = makeEmptyFunction(false); emptyFunction.thatReturnsTrue = makeEmptyFunction(true); emptyFunction.thatReturnsNull = makeEmptyFunction(null); emptyFunction.thatReturnsThis = function () { return this; }; emptyFunction.thatReturnsArgument = function (arg) { return arg; }; var emptyFunction_1 = emptyFunction; /** * Copyright (c) 2013-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. * */ /** * Use invariant() to assert state which your program assumes to be true. * * Provide sprintf-style format (only %s is supported) and arguments * to provide information about what broke and what you were * expecting. * * The invariant message will be stripped in production, but the invariant * will remain to ensure logic does not differ in production. */ var validateFormat = function validateFormat(format) {}; function invariant(condition, format, a, b, c, d, e, f) { validateFormat(format); if (!condition) { var error; if (format === undefined) { error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.'); } else { var args = [a, b, c, d, e, f]; var argIndex = 0; error = new Error(format.replace(/%s/g, function () { return args[argIndex++]; })); error.name = 'Invariant Violation'; } error.framesToPop = 1; // we don't care about invariant's own frame throw error; } } var invariant_1 = invariant; /* object-assign (c) Sindre Sorhus @license MIT */ /* eslint-disable no-unused-vars */ var getOwnPropertySymbols = Object.getOwnPropertySymbols; var hasOwnProperty = Object.prototype.hasOwnProperty; var propIsEnumerable = Object.prototype.propertyIsEnumerable; function toObject(val) { if (val === null || val === undefined) { throw new TypeError('Object.assign cannot be called with null or undefined'); } return Object(val); } function shouldUseNative() { try { if (!Object.assign) { return false; } // Detect buggy property enumeration order in older V8 versions. // https://bugs.chromium.org/p/v8/issues/detail?id=4118 var test1 = new String('abc'); // eslint-disable-line no-new-wrappers test1[5] = 'de'; if (Object.getOwnPropertyNames(test1)[0] === '5') { return false; } // https://bugs.chromium.org/p/v8/issues/detail?id=3056 var test2 = {}; for (var i = 0; i < 10; i++) { test2['_' + String.fromCharCode(i)] = i; } var order2 = Object.getOwnPropertyNames(test2).map(function (n) { return test2[n]; }); if (order2.join('') !== '0123456789') { return false; } // https://bugs.chromium.org/p/v8/issues/detail?id=3056 var test3 = {}; 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { test3[letter] = letter; }); if (Object.keys(Object.assign({}, test3)).join('') !== 'abcdefghijklmnopqrst') { return false; } return true; } catch (err) { // We don't expect any of the above to throw, but better to be safe. return false; } } var objectAssign = shouldUseNative() ? Object.assign : function (target, source) { var from; var to = toObject(target); var symbols; for (var s = 1; s < arguments.length; s++) { from = Object(arguments[s]); for (var key in from) { if (hasOwnProperty.call(from, key)) { to[key] = from[key]; } } if (getOwnPropertySymbols) { symbols = getOwnPropertySymbols(from); for (var i = 0; i < symbols.length; i++) { if (propIsEnumerable.call(from, symbols[i])) { to[symbols[i]] = from[symbols[i]]; } } } } return to; }; /** * Copyright (c) 2013-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. */ var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; var ReactPropTypesSecret_1 = ReactPropTypesSecret; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; var classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }; 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; }; }(); var defineProperty = function (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; }; 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 inherits = function (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 objectWithoutProperties = function (obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }; var possibleConstructorReturn = function (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; }; var factoryWithThrowingShims = function factoryWithThrowingShims() { function shim(props, propName, componentName, location, propFullName, secret) { if (secret === ReactPropTypesSecret_1) { // It is still safe when called from React. return; } invariant_1(false, 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 'Use PropTypes.checkPropTypes() to call them. ' + 'Read more at http://fb.me/use-check-prop-types'); } shim.isRequired = shim; function getShim() { return shim; } // Important! // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. var ReactPropTypes = { array: shim, bool: shim, func: shim, number: shim, object: shim, string: shim, symbol: shim, any: shim, arrayOf: getShim, element: shim, instanceOf: getShim, node: shim, objectOf: getShim, oneOf: getShim, oneOfType: getShim, shape: getShim, exact: getShim }; ReactPropTypes.checkPropTypes = emptyFunction_1; ReactPropTypes.PropTypes = ReactPropTypes; return ReactPropTypes; }; var propTypes$1 = createCommonjsModule(function (module) { /** * Copyright (c) 2013-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. */ { // By explicitly using `prop-types` you are opting into new production behavior. // http://fb.me/prop-types-in-prod module.exports = factoryWithThrowingShims(); } }); var classnames = createCommonjsModule(function (module) { /*! Copyright (c) 2016 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */ /* global define */ (function () { 'use strict'; var hasOwn = {}.hasOwnProperty; function classNames() { var classes = []; for (var i = 0; i < arguments.length; i++) { var arg = arguments[i]; if (!arg) continue; var argType = typeof arg === 'undefined' ? 'undefined' : _typeof(arg); if (argType === 'string' || argType === 'number') { classes.push(arg); } else if (Array.isArray(arg)) { classes.push(classNames.apply(null, arg)); } else if (argType === 'object') { for (var key in arg) { if (hasOwn.call(arg, key) && arg[key]) { classes.push(key); } } } } return classes.join(' '); } if ('object' !== 'undefined' && module.exports) { module.exports = classNames; } else if (typeof undefined === 'function' && _typeof(undefined.amd) === 'object' && undefined.amd) { // register as 'classnames', consistent with npm package name undefined('classnames', [], function () { return classNames; }); } else { window.classNames = classNames; } })(); }); /** * Lodash (Custom Build) <https://lodash.com/> * Build: `lodash modularize exports="npm" -o ./` * Copyright JS Foundation and other contributors <https://js.foundation/> * Released under MIT license <https://lodash.com/license> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ /** `Object#toString` result references. */ var asyncTag = '[object AsyncFunction]'; var funcTag = '[object Function]'; var genTag = '[object GeneratorFunction]'; var nullTag = '[object Null]'; var proxyTag = '[object Proxy]'; var undefinedTag = '[object Undefined]'; /** Detect free variable `global` from Node.js. */ var freeGlobal = _typeof(commonjsGlobal) == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal; /** Detect free variable `self`. */ var freeSelf = (typeof self === 'undefined' ? 'undefined' : _typeof(self)) == 'object' && self && self.Object === Object && self; /** Used as a reference to the global object. */ var root = freeGlobal || freeSelf || Function('return this')(); /** Used for built-in method references. */ var objectProto = Object.prototype; /** Used to check objects for own properties. */ var hasOwnProperty$1 = objectProto.hasOwnProperty; /** * Used to resolve the * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var nativeObjectToString = objectProto.toString; /** Built-in value references. */ var _Symbol = root.Symbol; var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined; /** * The base implementation of `getTag` without fallbacks for buggy environments. * * @private * @param {*} value The value to query. * @returns {string} Returns the `toStringTag`. */ function baseGetTag(value) { if (value == null) { return value === undefined ? undefinedTag : nullTag; } return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value); } /** * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. * * @private * @param {*} value The value to query. * @returns {string} Returns the raw `toStringTag`. */ function getRawTag(value) { var isOwn = hasOwnProperty$1.call(value, symToStringTag), tag = value[symToStringTag]; try { value[symToStringTag] = undefined; var unmasked = true; } catch (e) {} var result = nativeObjectToString.call(value); if (unmasked) { if (isOwn) { value[symToStringTag] = tag; } else { delete value[symToStringTag]; } } return result; } /** * Converts `value` to a string using `Object.prototype.toString`. * * @private * @param {*} value The value to convert. * @returns {string} Returns the converted string. */ function objectToString(value) { return nativeObjectToString.call(value); } /** * Checks if `value` is classified as a `Function` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a function, else `false`. * @example * * _.isFunction(_); * // => true * * _.isFunction(/abc/); * // => false */ function isFunction(value) { if (!isObject(value)) { return false; } // The use of `Object#toString` avoids issues with the `typeof` operator // in Safari 9 which returns 'object' for typed arrays and other constructors. var tag = baseGetTag(value); return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; } /** * Checks if `value` is the * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. * @example * * _.isObject({}); * // => true * * _.isObject([1, 2, 3]); * // => true * * _.isObject(_.noop); * // => true * * _.isObject(null); * // => false */ function isObject(value) { var type = typeof value === 'undefined' ? 'undefined' : _typeof(value); return value != null && (type == 'object' || type == 'function'); } var lodash_isfunction = isFunction; // https://github.com/twbs/bootstrap/blob/v4.0.0-alpha.4/js/src/modal.js#L436-L443 function getScrollbarWidth() { var scrollDiv = document.createElement('div'); // .modal-scrollbar-measure styles // https://github.com/twbs/bootstrap/blob/v4.0.0-alpha.4/scss/_modal.scss#L106-L113 scrollDiv.style.position = 'absolute'; scrollDiv.style.top = '-9999px'; scrollDiv.style.width = '50px'; scrollDiv.style.height = '50px'; scrollDiv.style.overflow = 'scroll'; document.body.appendChild(scrollDiv); var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth; document.body.removeChild(scrollDiv); return scrollbarWidth; } function setScrollbarWidth(padding) { document.body.style.paddingRight = padding > 0 ? padding + 'px' : null; } function isBodyOverflowing() { return document.body.clientWidth < window.innerWidth; } function getOriginalBodyPadding() { var style = window.getComputedStyle(document.body, null); return parseInt(style && style.getPropertyValue('padding-right') || 0, 10); } function conditionallyUpdateScrollbar() { var scrollbarWidth = getScrollbarWidth(); // https://github.com/twbs/bootstrap/blob/v4.0.0-alpha.6/js/src/modal.js#L433 var fixedContent = document.querySelectorAll('.fixed-top, .fixed-bottom, .is-fixed, .sticky-top')[0]; var bodyPadding = fixedContent ? parseInt(fixedContent.style.paddingRight || 0, 10) : 0; if (isBodyOverflowing()) { setScrollbarWidth(bodyPadding + scrollbarWidth); } } var globalCssModule = void 0; function setGlobalCssModule(cssModule) { globalCssModule = cssModule; } function mapToCssModules() { var className = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; var cssModule = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : globalCssModule; if (!cssModule) return className; return className.split(' ').map(function (c) { return cssModule[c] || c; }).join(' '); } /** * Returns a new object with the key/value pairs from `obj` that are not in the array `omitKeys`. */ function omit(obj, omitKeys) { var result = {}; Object.keys(obj).forEach(function (key) { if (omitKeys.indexOf(key) === -1) { result[key] = obj[key]; } }); return result; } /** * Returns a filtered copy of an object with only the specified keys. */ function pick(obj, keys) { var pickKeys = Array.isArray(keys) ? keys : [keys]; var length = pickKeys.length; var key = void 0; var result = {}; while (length > 0) { length -= 1; key = pickKeys[length]; result[key] = obj[key]; } return result; } var warned = {}; function warnOnce(message) { if (!warned[message]) { /* istanbul ignore else */ if (typeof console !== 'undefined') { console.error(message); // eslint-disable-line no-console } warned[message] = true; } } function deprecated(propType, explanation) { return function validate(props, propName, componentName) { if (props[propName] !== null && typeof props[propName] !== 'undefined') { warnOnce('"' + propName + '" property of "' + componentName + '" has been deprecated.\n' + explanation); } for (var _len = arguments.length, rest = Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) { rest[_key - 3] = arguments[_key]; } return propType.apply(undefined, [props, propName, componentName].concat(rest)); }; } function DOMElement(props, propName, componentName) { if (!(props[propName] instanceof Element)) { return new Error('Invalid prop `' + propName + '` supplied to `' + componentName + '`. Expected prop to be an instance of Element. Validation failed.'); } } function getTarget(target) { if (lodash_isfunction(target)) { return target(); } if (typeof target === 'string' && document) { var selection = document.querySelector(target); if (selection === null) { selection = document.querySelector('#' + target); } if (selection === null) { throw new Error('The target \'' + target + '\' could not be identified in the dom, tip: check spelling'); } return selection; } return target; } /* eslint key-spacing: ["error", { afterColon: true, align: "value" }] */ // These are all setup to match what is in the bootstrap _variables.scss // https://github.com/twbs/bootstrap/blob/v4-dev/scss/_variables.scss var TransitionTimeouts = { Fade: 150, // $transition-fade Collapse: 350, // $transition-collapse Modal: 300, // $modal-transition Carousel: 600 // $carousel-transition }; // Duplicated Transition.propType keys to ensure that Reactstrap builds // for distribution properly exclude these keys for nested child HTML attributes // since `react-transition-group` removes propTypes in production builds. var TransitionPropTypeKeys = ['in', 'mountOnEnter', 'unmountOnExit', 'appear', 'enter', 'exit', 'timeout', 'onEnter', 'onEntering', 'onEntered', 'onExit', 'onExiting', 'onExited']; var TransitionStatuses = { ENTERING: 'entering', ENTERED: 'entered', EXITING: 'exiting', EXITED: 'exited' }; var keyCodes = { esc: 27, space: 32, tab: 9, up: 38, down: 40 }; var PopperPlacements = ['auto-start', 'auto', 'auto-end', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start']; var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement); var utils = Object.freeze({ getScrollbarWidth: getScrollbarWidth, setScrollbarWidth: setScrollbarWidth, isBodyOverflowing: isBodyOverflowing, getOriginalBodyPadding: getOriginalBodyPadding, conditionallyUpdateScrollbar: conditionallyUpdateScrollbar, setGlobalCssModule: setGlobalCssModule, mapToCssModules: mapToCssModules, omit: omit, pick: pick, warnOnce: warnOnce, deprecated: deprecated, DOMElement: DOMElement, getTarget: getTarget, TransitionTimeouts: TransitionTimeouts, TransitionPropTypeKeys: TransitionPropTypeKeys, TransitionStatuses: TransitionStatuses, keyCodes: keyCodes, PopperPlacements: PopperPlacements, canUseDOM: canUseDOM }); var propTypes = { tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), fluid: propTypes$1.bool, className: propTypes$1.string, cssModule: propTypes$1.object }; var defaultProps = { tag: 'div' }; var Container = function Container(props) { var className = props.className, cssModule = props.cssModule, fluid = props.fluid, Tag = props.tag, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'fluid', 'tag']); var classes = mapToCssModules(classnames(className, fluid ? 'container-fluid' : 'container'), cssModule); return React__default.createElement(Tag, _extends({}, attributes, { className: classes })); }; Container.propTypes = propTypes; Container.defaultProps = defaultProps; var propTypes$2 = { tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), noGutters: propTypes$1.bool, className: propTypes$1.string, cssModule: propTypes$1.object }; var defaultProps$1 = { tag: 'div' }; var Row = function Row(props) { var className = props.className, cssModule = props.cssModule, noGutters = props.noGutters, Tag = props.tag, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'noGutters', 'tag']); var classes = mapToCssModules(classnames(className, noGutters ? 'no-gutters' : null, 'row'), cssModule); return React__default.createElement(Tag, _extends({}, attributes, { className: classes })); }; Row.propTypes = propTypes$2; Row.defaultProps = defaultProps$1; /** * lodash 3.0.2 (Custom Build) <https://lodash.com/> * Build: `lodash modern modularize exports="npm" -o ./` * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors * Available under MIT license <https://lodash.com/license> */ /** * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. * @example * * _.isObject({}); * // => true * * _.isObject([1, 2, 3]); * // => true * * _.isObject(1); * // => false */ function isObject$1(value) { // Avoid a V8 JIT bug in Chrome 19-20. // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. var type = typeof value === 'undefined' ? 'undefined' : _typeof(value); return !!value && (type == 'object' || type == 'function'); } var lodash_isobject = isObject$1; var colWidths = ['xs', 'sm', 'md', 'lg', 'xl']; var stringOrNumberProp = propTypes$1.oneOfType([propTypes$1.number, propTypes$1.string]); var columnProps = propTypes$1.oneOfType([propTypes$1.bool, propTypes$1.number, propTypes$1.string, propTypes$1.shape({ size: propTypes$1.oneOfType([propTypes$1.bool, propTypes$1.number, propTypes$1.string]), push: deprecated(stringOrNumberProp, 'Please use the prop "order"'), pull: deprecated(stringOrNumberProp, 'Please use the prop "order"'), order: stringOrNumberProp, offset: stringOrNumberProp })]); var propTypes$3 = { tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), xs: columnProps, sm: columnProps, md: columnProps, lg: columnProps, xl: columnProps, className: propTypes$1.string, cssModule: propTypes$1.object, widths: propTypes$1.array }; var defaultProps$2 = { tag: 'div', widths: colWidths }; var getColumnSizeClass = function getColumnSizeClass(isXs, colWidth, colSize) { if (colSize === true || colSize === '') { return isXs ? 'col' : 'col-' + colWidth; } else if (colSize === 'auto') { return isXs ? 'col-auto' : 'col-' + colWidth + '-auto'; } return isXs ? 'col-' + colSize : 'col-' + colWidth + '-' + colSize; }; var Col = function Col(props) { var className = props.className, cssModule = props.cssModule, widths = props.widths, Tag = props.tag, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'widths', 'tag']); var colClasses = []; widths.forEach(function (colWidth, i) { var columnProp = props[colWidth]; delete attributes[colWidth]; if (!columnProp && columnProp !== '') { return; } var isXs = !i; if (lodash_isobject(columnProp)) { var _classNames; var colSizeInterfix = isXs ? '-' : '-' + colWidth + '-'; var colClass = getColumnSizeClass(isXs, colWidth, columnProp.size); colClasses.push(mapToCssModules(classnames((_classNames = {}, defineProperty(_classNames, colClass, columnProp.size || columnProp.size === ''), defineProperty(_classNames, 'order' + colSizeInterfix + columnProp.order, columnProp.order || columnProp.order === 0), defineProperty(_classNames, 'offset' + colSizeInterfix + columnProp.offset, columnProp.offset || columnProp.offset === 0), _classNames)), cssModule)); } else { var _colClass = getColumnSizeClass(isXs, colWidth, columnProp); colClasses.push(_colClass); } }); if (!colClasses.length) { colClasses.push('col'); } var classes = mapToCssModules(classnames(className, colClasses), cssModule); return React__default.createElement(Tag, _extends({}, attributes, { className: classes })); }; Col.propTypes = propTypes$3; Col.defaultProps = defaultProps$2; var propTypes$4 = { light: propTypes$1.bool, dark: propTypes$1.bool, inverse: deprecated(propTypes$1.bool, 'Please use the prop "dark"'), full: propTypes$1.bool, fixed: propTypes$1.string, sticky: propTypes$1.string, color: propTypes$1.string, role: propTypes$1.string, tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), className: propTypes$1.string, cssModule: propTypes$1.object, toggleable: deprecated(propTypes$1.oneOfType([propTypes$1.bool, propTypes$1.string]), 'Please use the prop "expand"'), expand: propTypes$1.oneOfType([propTypes$1.bool, propTypes$1.string]) }; var defaultProps$3 = { tag: 'nav', expand: false }; var getExpandClass = function getExpandClass(expand) { if (expand === false) { return false; } else if (expand === true || expand === 'xs') { return 'navbar-expand'; } return 'navbar-expand-' + expand; }; // To better maintain backwards compatibility while toggleable is deprecated. // We must map breakpoints to the next breakpoint so that toggleable and expand do the same things at the same breakpoint. var toggleableToExpand = { xs: 'sm', sm: 'md', md: 'lg', lg: 'xl' }; var getToggleableClass = function getToggleableClass(toggleable) { if (toggleable === undefined || toggleable === 'xl') { return false; } else if (toggleable === false) { return 'navbar-expand'; } return 'navbar-expand-' + (toggleable === true ? 'sm' : toggleableToExpand[toggleable] || toggleable); }; var Navbar = function Navbar(props) { var _classNames; var toggleable = props.toggleable, expand = props.expand, className = props.className, cssModule = props.cssModule, light = props.light, dark = props.dark, inverse = props.inverse, fixed = props.fixed, sticky = props.sticky, color = props.color, Tag = props.tag, attributes = objectWithoutProperties(props, ['toggleable', 'expand', 'className', 'cssModule', 'light', 'dark', 'inverse', 'fixed', 'sticky', 'color', 'tag']); var classes = mapToCssModules(classnames(className, 'navbar', getExpandClass(expand) || getToggleableClass(toggleable), (_classNames = { 'navbar-light': light, 'navbar-dark': inverse || dark }, defineProperty(_classNames, 'bg-' + color, color), defineProperty(_classNames, 'fixed-' + fixed, fixed), defineProperty(_classNames, 'sticky-' + sticky, sticky), _classNames)), cssModule); return React__default.createElement(Tag, _extends({}, attributes, { className: classes })); }; Navbar.propTypes = propTypes$4; Navbar.defaultProps = defaultProps$3; var propTypes$5 = { tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), className: propTypes$1.string, cssModule: propTypes$1.object }; var defaultProps$4 = { tag: 'a' }; var NavbarBrand = function NavbarBrand(props) { var className = props.className, cssModule = props.cssModule, Tag = props.tag, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'tag']); var classes = mapToCssModules(classnames(className, 'navbar-brand'), cssModule); return React__default.createElement(Tag, _extends({}, attributes, { className: classes })); }; NavbarBrand.propTypes = propTypes$5; NavbarBrand.defaultProps = defaultProps$4; var propTypes$6 = { tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), type: propTypes$1.string, className: propTypes$1.string, cssModule: propTypes$1.object, children: propTypes$1.node }; var defaultProps$5 = { tag: 'button', type: 'button' }; var NavbarToggler = function NavbarToggler(props) { var className = props.className, cssModule = props.cssModule, children = props.children, Tag = props.tag, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'children', 'tag']); var classes = mapToCssModules(classnames(className, 'navbar-toggler'), cssModule); return React__default.createElement( Tag, _extends({}, attributes, { className: classes }), children || React__default.createElement('span', { className: mapToCssModules('navbar-toggler-icon', cssModule) }) ); }; NavbarToggler.propTypes = propTypes$6; NavbarToggler.defaultProps = defaultProps$5; var propTypes$7 = { tabs: propTypes$1.bool, pills: propTypes$1.bool, vertical: propTypes$1.oneOfType([propTypes$1.bool, propTypes$1.string]), horizontal: propTypes$1.string, justified: propTypes$1.bool, fill: propTypes$1.bool, navbar: propTypes$1.bool, card: propTypes$1.bool, tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), className: propTypes$1.string, cssModule: propTypes$1.object }; var defaultProps$6 = { tag: 'ul', vertical: false }; var getVerticalClass = function getVerticalClass(vertical) { if (vertical === false) { return false; } else if (vertical === true || vertical === 'xs') { return 'flex-column'; } return 'flex-' + vertical + '-column'; }; var Nav = function Nav(props) { var className = props.className, cssModule = props.cssModule, tabs = props.tabs, pills = props.pills, vertical = props.vertical, horizontal = props.horizontal, justified = props.justified, fill = props.fill, navbar = props.navbar, card = props.card, Tag = props.tag, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'tabs', 'pills', 'vertical', 'horizontal', 'justified', 'fill', 'navbar', 'card', 'tag']); var classes = mapToCssModules(classnames(className, navbar ? 'navbar-nav' : 'nav', horizontal ? 'justify-content-' + horizontal : false, getVerticalClass(vertical), { 'nav-tabs': tabs, 'card-header-tabs': card && tabs, 'nav-pills': pills, 'card-header-pills': card && pills, 'nav-justified': justified, 'nav-fill': fill }), cssModule); return React__default.createElement(Tag, _extends({}, attributes, { className: classes })); }; Nav.propTypes = propTypes$7; Nav.defaultProps = defaultProps$6; var propTypes$8 = { tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), active: propTypes$1.bool, className: propTypes$1.string, cssModule: propTypes$1.object }; var defaultProps$7 = { tag: 'li' }; var NavItem = function NavItem(props) { var className = props.className, cssModule = props.cssModule, active = props.active, Tag = props.tag, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'active', 'tag']); var classes = mapToCssModules(classnames(className, 'nav-item', active ? 'active' : false), cssModule); return React__default.createElement(Tag, _extends({}, attributes, { className: classes })); }; NavItem.propTypes = propTypes$8; NavItem.defaultProps = defaultProps$7; var Manager_1 = createCommonjsModule(function (module, exports) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); 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; }; }(); var _propTypes2 = _interopRequireDefault(propTypes$1); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _objectWithoutProperties(obj, keys) { var target = {};for (var i in obj) { if (keys.indexOf(i) >= 0) continue;if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;target[i] = obj[i]; }return target; } 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 === 'undefined' ? 'undefined' : _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 === 'undefined' ? 'undefined' : _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 Manager = function (_Component) { _inherits(Manager, _Component); function Manager() { var _ref; var _temp, _this, _ret; _classCallCheck(this, Manager); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Manager.__proto__ || Object.getPrototypeOf(Manager)).call.apply(_ref, [this].concat(args))), _this), _this._setTargetNode = function (node) { _this._targetNode = node; }, _this._getTargetNode = function () { return _this._targetNode; }, _temp), _possibleConstructorReturn(_this, _ret); } _createClass(Manager, [{ key: 'getChildContext', value: function getChildContext() { return { popperManager: { setTargetNode: this._setTargetNode, getTargetNode: this._getTargetNode } }; } }, { key: 'render', value: function render() { var _props = this.props, tag = _props.tag, children = _props.children, restProps = _objectWithoutProperties(_props, ['tag', 'children']); if (tag !== false) { return (0, React__default.createElement)(tag, restProps, children); } else { return children; } } }]); return Manager; }(React__default.Component); Manager.childContextTypes = { popperManager: _propTypes2.default.object.isRequired }; Manager.propTypes = { tag: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.bool]), children: _propTypes2.default.oneOfType([_propTypes2.default.node, _propTypes2.default.func]) }; Manager.defaultProps = { tag: 'div' }; exports.default = Manager; }); unwrapExports(Manager_1); var Target_1 = createCommonjsModule(function (module, exports) { '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 _propTypes2 = _interopRequireDefault(propTypes$1); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _objectWithoutProperties(obj, keys) { var target = {};for (var i in obj) { if (keys.indexOf(i) >= 0) continue;if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;target[i] = obj[i]; }return target; } var Target = function Target(props, context) { var _props$component = props.component, component = _props$component === undefined ? 'div' : _props$component, innerRef = props.innerRef, children = props.children, restProps = _objectWithoutProperties(props, ['component', 'innerRef', 'children']); var popperManager = context.popperManager; var targetRef = function targetRef(node) { popperManager.setTargetNode(node); if (typeof innerRef === 'function') { innerRef(node); } }; if (typeof children === 'function') { var targetProps = { ref: targetRef }; return children({ targetProps: targetProps, restProps: restProps }); } var componentProps = _extends({}, restProps); if (typeof component === 'string') { componentProps.ref = targetRef; } else { componentProps.innerRef = targetRef; } return (0, React__default.createElement)(component, componentProps, children); }; Target.contextTypes = { popperManager: _propTypes2.default.object.isRequired }; Target.propTypes = { component: _propTypes2.default.oneOfType([_propTypes2.default.node, _propTypes2.default.func]), innerRef: _propTypes2.default.func, children: _propTypes2.default.oneOfType([_propTypes2.default.node, _propTypes2.default.func]) }; exports.default = Target; }); unwrapExports(Target_1); /**! * @fileOverview Kickass library to create and place poppers near their reference elements. * @version 1.12.9 * @license * Copyright (c) 2016 Federico Zivolo 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. */ var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined'; var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox']; var timeoutDuration = 0; for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) { if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) { timeoutDuration = 1; break; } } function microtaskDebounce(fn) { var called = false; return function () { if (called) { return; } called = true; window.Promise.resolve().then(function () { called = false; fn(); }); }; } function taskDebounce(fn) { var scheduled = false; return function () { if (!scheduled) { scheduled = true; setTimeout(function () { scheduled = false; fn(); }, timeoutDuration); } }; } var supportsMicroTasks = isBrowser && window.Promise; /** * Create a debounced version of a method, that's asynchronously deferred * but called in the minimum time possible. * * @method * @memberof Popper.Utils * @argument {Function} fn * @returns {Function} */ var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce; /** * Check if the given variable is a function * @method * @memberof Popper.Utils * @argument {Any} functionToCheck - variable to check * @returns {Boolean} answer to: is a function? */ function isFunction$2(functionToCheck) { var getType = {}; return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]'; } /** * Get CSS computed property of the given element * @method * @memberof Popper.Utils * @argument {Eement} element * @argument {String} property */ function getStyleComputedProperty(element, property) { if (element.nodeType !== 1) { return []; } // NOTE: 1 DOM access here var css = getComputedStyle(element, null); return property ? css[property] : css; } /** * Returns the parentNode or the host of the element * @method * @memberof Popper.Utils * @argument {Element} element * @returns {Element} parent */ function getParentNode(element) { if (element.nodeName === 'HTML') { return element; } return element.parentNode || element.host; } /** * Returns the scrolling parent of the given element * @method * @memberof Popper.Utils * @argument {Element} element * @returns {Element} scroll parent */ function getScrollParent(element) { // Return body, `getScroll` will take care to get the correct `scrollTop` from it if (!element) { return document.body; } switch (element.nodeName) { case 'HTML': case 'BODY': return element.ownerDocument.body; case '#document': return element.body; } // Firefox want us to check `-x` and `-y` variations as well var _getStyleComputedProp = getStyleComputedProperty(element), overflow = _getStyleComputedProp.overflow, overflowX = _getStyleComputedProp.overflowX, overflowY = _getStyleComputedProp.overflowY; if (/(auto|scroll)/.test(overflow + overflowY + overflowX)) { return element; } return getScrollParent(getParentNode(element)); } /** * Returns the offset parent of the given element * @method * @memberof Popper.Utils * @argument {Element} element * @returns {Element} offset parent */ function getOffsetParent(element) { // NOTE: 1 DOM access here var offsetParent = element && element.offsetParent; var nodeName = offsetParent && offsetParent.nodeName; if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') { if (element) { return element.ownerDocument.documentElement; } return document.documentElement; } // .offsetParent will return the closest TD or TABLE in case // no offsetParent is present, I hate this job... if (['TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') { return getOffsetParent(offsetParent); } return offsetParent; } function isOffsetContainer(element) { var nodeName = element.nodeName; if (nodeName === 'BODY') { return false; } return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element; } /** * Finds the root node (document, shadowDOM root) of the given element * @method * @memberof Popper.Utils * @argument {Element} node * @returns {Element} root node */ function getRoot(node) { if (node.parentNode !== null) { return getRoot(node.parentNode); } return node; } /** * Finds the offset parent common to the two provided nodes * @method * @memberof Popper.Utils * @argument {Element} element1 * @argument {Element} element2 * @returns {Element} common offset parent */ function findCommonOffsetParent(element1, element2) { // This check is needed to avoid errors in case one of the elements isn't defined for any reason if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) { return document.documentElement; } // Here we make sure to give as "start" the element that comes first in the DOM var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING; var start = order ? element1 : element2; var end = order ? element2 : element1; // Get common ancestor container var range = document.createRange(); range.setStart(start, 0); range.setEnd(end, 0); var commonAncestorContainer = range.commonAncestorContainer; // Both nodes are inside #document if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) { if (isOffsetContainer(commonAncestorContainer)) { return commonAncestorContainer; } return getOffsetParent(commonAncestorContainer); } // one of the nodes is inside shadowDOM, find which one var element1root = getRoot(element1); if (element1root.host) { return findCommonOffsetParent(element1root.host, element2); } else { return findCommonOffsetParent(element1, getRoot(element2).host); } } /** * Gets the scroll value of the given element in the given side (top and left) * @method * @memberof Popper.Utils * @argument {Element} element * @argument {String} side `top` or `left` * @returns {number} amount of scrolled pixels */ function getScroll(element) { var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top'; var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft'; var nodeName = element.nodeName; if (nodeName === 'BODY' || nodeName === 'HTML') { var html = element.ownerDocument.documentElement; var scrollingElement = element.ownerDocument.scrollingElement || html; return scrollingElement[upperSide]; } return element[upperSide]; } /* * Sum or subtract the element scroll values (left and top) from a given rect object * @method * @memberof Popper.Utils * @param {Object} rect - Rect object you want to change * @param {HTMLElement} element - The element from the function reads the scroll values * @param {Boolean} subtract - set to true if you want to subtract the scroll values * @return {Object} rect - The modifier rect object */ function includeScroll(rect, element) { var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; var scrollTop = getScroll(element, 'top'); var scrollLeft = getScroll(element, 'left'); var modifier = subtract ? -1 : 1; rect.top += scrollTop * modifier; rect.bottom += scrollTop * modifier; rect.left += scrollLeft * modifier; rect.right += scrollLeft * modifier; return rect; } /* * Helper to detect borders of a given element * @method * @memberof Popper.Utils * @param {CSSStyleDeclaration} styles * Result of `getStyleComputedProperty` on the given element * @param {String} axis - `x` or `y` * @return {number} borders - The borders size of the given axis */ function getBordersSize(styles, axis) { var sideA = axis === 'x' ? 'Left' : 'Top'; var sideB = sideA === 'Left' ? 'Right' : 'Bottom'; return parseFloat(styles['border' + sideA + 'Width'], 10) + parseFloat(styles['border' + sideB + 'Width'], 10); } /** * Tells if you are running Internet Explorer 10 * @method * @memberof Popper.Utils * @returns {Boolean} isIE10 */ var isIE10 = undefined; var isIE10$1 = function isIE10$1() { if (isIE10 === undefined) { isIE10 = navigator.appVersion.indexOf('MSIE 10') !== -1; } return isIE10; }; function getSize(axis, body, html, computedStyle) { return Math.max(body['offset' + axis], body['scroll' + axis], html['client' + axis], html['offset' + axis], html['scroll' + axis], isIE10$1() ? html['offset' + axis] + computedStyle['margin' + (axis === 'Height' ? 'Top' : 'Left')] + computedStyle['margin' + (axis === 'Height' ? 'Bottom' : 'Right')] : 0); } function getWindowSizes() { var body = document.body; var html = document.documentElement; var computedStyle = isIE10$1() && getComputedStyle(html); return { height: getSize('Height', body, html, computedStyle), width: getSize('Width', body, html, computedStyle) }; } var classCallCheck$1 = function classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }; var createClass$1 = 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; }; }(); var defineProperty$1 = 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; }; var _extends$1 = 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; }; /** * Given element offsets, generate an output similar to getBoundingClientRect * @method * @memberof Popper.Utils * @argument {Object} offsets * @returns {Object} ClientRect like output */ function getClientRect(offsets) { return _extends$1({}, offsets, { right: offsets.left + offsets.width, bottom: offsets.top + offsets.height }); } /** * Get bounding client rect of given element * @method * @memberof Popper.Utils * @param {HTMLElement} element * @return {Object} client rect */ function getBoundingClientRect(element) { var rect = {}; // IE10 10 FIX: Please, don't ask, the element isn't // considered in DOM in some circumstances... // This isn't reproducible in IE10 compatibility mode of IE11 if (isIE10$1()) { try { rect = element.getBoundingClientRect(); var scrollTop = getScroll(element, 'top'); var scrollLeft = getScroll(element, 'left'); rect.top += scrollTop; rect.left += scrollLeft; rect.bottom += scrollTop; rect.right += scrollLeft; } catch (err) {} } else { rect = element.getBoundingClientRect(); } var result = { left: rect.left, top: rect.top, width: rect.right - rect.left, height: rect.bottom - rect.top }; // subtract scrollbar size from sizes var sizes = element.nodeName === 'HTML' ? getWindowSizes() : {}; var width = sizes.width || element.clientWidth || result.right - result.left; var height = sizes.height || element.clientHeight || result.bottom - result.top; var horizScrollbar = element.offsetWidth - width; var vertScrollbar = element.offsetHeight - height; // if an hypothetical scrollbar is detected, we must be sure it's not a `border` // we make this check conditional for performance reasons if (horizScrollbar || vertScrollbar) { var styles = getStyleComputedProperty(element); horizScrollbar -= getBordersSize(styles, 'x'); vertScrollbar -= getBordersSize(styles, 'y'); result.width -= horizScrollbar; result.height -= vertScrollbar; } return getClientRect(result); } function getOffsetRectRelativeToArbitraryNode(children, parent) { var isIE10 = isIE10$1(); var isHTML = parent.nodeName === 'HTML'; var childrenRect = getBoundingClientRect(children); var parentRect = getBoundingClientRect(parent); var scrollParent = getScrollParent(children); var styles = getStyleComputedProperty(parent); var borderTopWidth = parseFloat(styles.borderTopWidth, 10); var borderLeftWidth = parseFloat(styles.borderLeftWidth, 10); var offsets = getClientRect({ top: childrenRect.top - parentRect.top - borderTopWidth, left: childrenRect.left - parentRect.left - borderLeftWidth, width: childrenRect.width, height: childrenRect.height }); offsets.marginTop = 0; offsets.marginLeft = 0; // Subtract margins of documentElement in case it's being used as parent // we do this only on HTML because it's the only element that behaves // differently when margins are applied to it. The margins are included in // the box of the documentElement, in the other cases not. if (!isIE10 && isHTML) { var marginTop = parseFloat(styles.marginTop, 10); var marginLeft = parseFloat(styles.marginLeft, 10); offsets.top -= borderTopWidth - marginTop; offsets.bottom -= borderTopWidth - marginTop; offsets.left -= borderLeftWidth - marginLeft; offsets.right -= borderLeftWidth - marginLeft; // Attach marginTop and marginLeft because in some circumstances we may need them offsets.marginTop = marginTop; offsets.marginLeft = marginLeft; } if (isIE10 ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') { offsets = includeScroll(offsets, parent); } return offsets; } function getViewportOffsetRectRelativeToArtbitraryNode(element) { var html = element.ownerDocument.documentElement; var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html); var width = Math.max(html.clientWidth, window.innerWidth || 0); var height = Math.max(html.clientHeight, window.innerHeight || 0); var scrollTop = getScroll(html); var scrollLeft = getScroll(html, 'left'); var offset = { top: scrollTop - relativeOffset.top + relativeOffset.marginTop, left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft, width: width, height: height }; return getClientRect(offset); } /** * Check if the given element is fixed or is inside a fixed parent * @method * @memberof Popper.Utils * @argument {Element} element * @argument {Element} customContainer * @returns {Boolean} answer to "isFixed?" */ function isFixed(element) { var nodeName = element.nodeName; if (nodeName === 'BODY' || nodeName === 'HTML') { return false; } if (getStyleComputedProperty(element, 'position') === 'fixed') { return true; } return isFixed(getParentNode(element)); } /** * Computed the boundaries limits and return them * @method * @memberof Popper.Utils * @param {HTMLElement} popper * @param {HTMLElement} reference * @param {number} padding * @param {HTMLElement} boundariesElement - Element used to define the boundaries * @returns {Object} Coordinates of the boundaries */ function getBoundaries(popper, reference, padding, boundariesElement) { // NOTE: 1 DOM access here var boundaries = { top: 0, left: 0 }; var offsetParent = findCommonOffsetParent(popper, reference); // Handle viewport case if (boundariesElement === 'viewport') { boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent); } else { // Handle other cases based on DOM element used as boundaries var boundariesNode = void 0; if (boundariesElement === 'scrollParent') { boundariesNode = getScrollParent(getParentNode(reference)); if (boundariesNode.nodeName === 'BODY') { boundariesNode = popper.ownerDocument.documentElement; } } else if (boundariesElement === 'window') { boundariesNode = popper.ownerDocument.documentElement; } else { boundariesNode = boundariesElement; } var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent); // In case of HTML, we need a different computation if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) { var _getWindowSizes = getWindowSizes(), height = _getWindowSizes.height, width = _getWindowSizes.width; boundaries.top += offsets.top - offsets.marginTop; boundaries.bottom = height + offsets.top; boundaries.left += offsets.left - offsets.marginLeft; boundaries.right = width + offsets.left; } else { // for all the other DOM elements, this one is good boundaries = offsets; } } // Add paddings boundaries.left += padding; boundaries.top += padding; boundaries.right -= padding; boundaries.bottom -= padding; return boundaries; } function getArea(_ref) { var width = _ref.width, height = _ref.height; return width * height; } /** * Utility used to transform the `auto` placement to the placement with more * available space. * @method * @memberof Popper.Utils * @argument {Object} data - The data object generated by update method * @argument {Object} options - Modifiers configuration and options * @returns {Object} The data object, properly modified */ function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) { var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0; if (placement.indexOf('auto') === -1) { return placement; } var boundaries = getBoundaries(popper, reference, padding, boundariesElement); var rects = { top: { width: boundaries.width, height: refRect.top - boundaries.top }, right: { width: boundaries.right - refRect.right, height: boundaries.height }, bottom: { width: boundaries.width, height: boundaries.bottom - refRect.bottom }, left: { width: refRect.left - boundaries.left, height: boundaries.height } }; var sortedAreas = Object.keys(rects).map(function (key) { return _extends$1({ key: key }, rects[key], { area: getArea(rects[key]) }); }).sort(function (a, b) { return b.area - a.area; }); var filteredAreas = sortedAreas.filter(function (_ref2) { var width = _ref2.width, height = _ref2.height; return width >= popper.clientWidth && height >= popper.clientHeight; }); var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key; var variation = placement.split('-')[1]; return computedPlacement + (variation ? '-' + variation : ''); } /** * Get offsets to the reference element * @method * @memberof Popper.Utils * @param {Object} state * @param {Element} popper - the popper element * @param {Element} reference - the reference element (the popper will be relative to this) * @returns {Object} An object containing the offsets which will be applied to the popper */ function getReferenceOffsets(state, popper, reference) { var commonOffsetParent = findCommonOffsetParent(popper, reference); return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent); } /** * Get the outer sizes of the given element (offset size + margins) * @method * @memberof Popper.Utils * @argument {Element} element * @returns {Object} object containing width and height properties */ function getOuterSizes(element) { var styles = getComputedStyle(element); var x = parseFloat(styles.marginTop) + parseFloat(styles.marginBottom); var y = parseFloat(styles.marginLeft) + parseFloat(styles.marginRight); var result = { width: element.offsetWidth + y, height: element.offsetHeight + x }; return result; } /** * Get the opposite placement of the given one * @method * @memberof Popper.Utils * @argument {String} placement * @returns {String} flipped placement */ function getOppositePlacement(placement) { var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' }; return placement.replace(/left|right|bottom|top/g, function (matched) { return hash[matched]; }); } /** * Get offsets to the popper * @method * @memberof Popper.Utils * @param {Object} position - CSS position the Popper will get applied * @param {HTMLElement} popper - the popper element * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this) * @param {String} placement - one of the valid placement options * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper */ function getPopperOffsets(popper, referenceOffsets, placement) { placement = placement.split('-')[0]; // Get popper node sizes var popperRect = getOuterSizes(popper); // Add position, width and height to our offsets object var popperOffsets = { width: popperRect.width, height: popperRect.height }; // depending by the popper placement we have to compute its offsets slightly differently var isHoriz = ['right', 'left'].indexOf(placement) !== -1; var mainSide = isHoriz ? 'top' : 'left'; var secondarySide = isHoriz ? 'left' : 'top'; var measurement = isHoriz ? 'height' : 'width'; var secondaryMeasurement = !isHoriz ? 'height' : 'width'; popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2; if (placement === secondarySide) { popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement]; } else { popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)]; } return popperOffsets; } /** * Mimics the `find` method of Array * @method * @memberof Popper.Utils * @argument {Array} arr * @argument prop * @argument value * @returns index or -1 */ function find(arr, check) { // use native find if supported if (Array.prototype.find) { return arr.find(check); } // use `filter` to obtain the same behavior of `find` return arr.filter(check)[0]; } /** * Return the index of the matching object * @method * @memberof Popper.Utils * @argument {Array} arr * @argument prop * @argument value * @returns index or -1 */ function findIndex(arr, prop, value) { // use native findIndex if supported if (Array.prototype.findIndex) { return arr.findIndex(function (cur) { return cur[prop] === value; }); } // use `find` + `indexOf` if `findIndex` isn't supported var match = find(arr, function (obj) { return obj[prop] === value; }); return arr.indexOf(match); } /** * Loop trough the list of modifiers and run them in order, * each of them will then edit the data object. * @method * @memberof Popper.Utils * @param {dataObject} data * @param {Array} modifiers * @param {String} ends - Optional modifier name used as stopper * @returns {dataObject} */ function runModifiers(modifiers, data, ends) { var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends)); modifiersToRun.forEach(function (modifier) { if (modifier['function']) { // eslint-disable-line dot-notation console.warn('`modifier.function` is deprecated, use `modifier.fn`!'); } var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation if (modifier.enabled && isFunction$2(fn)) { // Add properties to offsets to make them a complete clientRect object // we do this before each modifier to make sure the previous one doesn't // mess with these values data.offsets.popper = getClientRect(data.offsets.popper); data.offsets.reference = getClientRect(data.offsets.reference); data = fn(data, modifier); } }); return data; } /** * Updates the position of the popper, computing the new offsets and applying * the new style.<br /> * Prefer `scheduleUpdate` over `update` because of performance reasons. * @method * @memberof Popper */ function update() { // if popper is destroyed, don't perform any further update if (this.state.isDestroyed) { return; } var data = { instance: this, styles: {}, arrowStyles: {}, attributes: {}, flipped: false, offsets: {} }; // compute reference element offsets data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference); // compute auto placement, store placement inside the data object, // modifiers will be able to edit `placement` if needed // and refer to originalPlacement to know the original value data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding); // store the computed placement inside `originalPlacement` data.originalPlacement = data.placement; // compute the popper offsets data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement); data.offsets.popper.position = 'absolute'; // run the modifiers data = runModifiers(this.modifiers, data); // the first `update` will call `onCreate` callback // the other ones will call `onUpdate` callback if (!this.state.isCreated) { this.state.isCreated = true; this.options.onCreate(data); } else { this.options.onUpdate(data); } } /** * Helper used to know if the given modifier is enabled. * @method * @memberof Popper.Utils * @returns {Boolean} */ function isModifierEnabled(modifiers, modifierName) { return modifiers.some(function (_ref) { var name = _ref.name, enabled = _ref.enabled; return enabled && name === modifierName; }); } /** * Get the prefixed supported property name * @method * @memberof Popper.Utils * @argument {String} property (camelCase) * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix) */ function getSupportedPropertyName(property) { var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O']; var upperProp = property.charAt(0).toUpperCase() + property.slice(1); for (var i = 0; i < prefixes.length - 1; i++) { var prefix = prefixes[i]; var toCheck = prefix ? '' + prefix + upperProp : property; if (typeof document.body.style[toCheck] !== 'undefined') { return toCheck; } } return null; } /** * Destroy the popper * @method * @memberof Popper */ function destroy() { this.state.isDestroyed = true; // touch DOM only if `applyStyle` modifier is enabled if (isModifierEnabled(this.modifiers, 'applyStyle')) { this.popper.removeAttribute('x-placement'); this.popper.style.left = ''; this.popper.style.position = ''; this.popper.style.top = ''; this.popper.style[getSupportedPropertyName('transform')] = ''; } this.disableEventListeners(); // remove the popper if user explicity asked for the deletion on destroy // do not use `remove` because IE11 doesn't support it if (this.options.removeOnDestroy) { this.popper.parentNode.removeChild(this.popper); } return this; } /** * Get the window associated with the element * @argument {Element} element * @returns {Window} */ function getWindow(element) { var ownerDocument = element.ownerDocument; return ownerDocument ? ownerDocument.defaultView : window; } function attachToScrollParents(scrollParent, event, callback, scrollParents) { var isBody = scrollParent.nodeName === 'BODY'; var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent; target.addEventListener(event, callback, { passive: true }); if (!isBody) { attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents); } scrollParents.push(target); } /** * Setup needed event listeners used to update the popper position * @method * @memberof Popper.Utils * @private */ function setupEventListeners(reference, options, state, updateBound) { // Resize event listener on window state.updateBound = updateBound; getWindow(reference).addEventListener('resize', state.updateBound, { passive: true }); // Scroll event listener on scroll parents var scrollElement = getScrollParent(reference); attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents); state.scrollElement = scrollElement; state.eventsEnabled = true; return state; } /** * It will add resize/scroll events and start recalculating * position of the popper element when they are triggered. * @method * @memberof Popper */ function enableEventListeners() { if (!this.state.eventsEnabled) { this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate); } } /** * Remove event listeners used to update the popper position * @method * @memberof Popper.Utils * @private */ function removeEventListeners(reference, state) { // Remove resize event listener on window getWindow(reference).removeEventListener('resize', state.updateBound); // Remove scroll event listener on scroll parents state.scrollParents.forEach(function (target) { target.removeEventListener('scroll', state.updateBound); }); // Reset state state.updateBound = null; state.scrollParents = []; state.scrollElement = null; state.eventsEnabled = false; return state; } /** * It will remove resize/scroll events and won't recalculate popper position * when they are triggered. It also won't trigger onUpdate callback anymore, * unless you call `update` method manually. * @method * @memberof Popper */ function disableEventListeners() { if (this.state.eventsEnabled) { cancelAnimationFrame(this.scheduleUpdate); this.state = removeEventListeners(this.reference, this.state); } } /** * Tells if a given input is a number * @method * @memberof Popper.Utils * @param {*} input to check * @return {Boolean} */ function isNumeric(n) { return n !== '' && !isNaN(parseFloat(n)) && isFinite(n); } /** * Set the style to the given popper * @method * @memberof Popper.Utils * @argument {Element} element - Element to apply the style to * @argument {Object} styles * Object with a list of properties and values which will be applied to the element */ function setStyles(element, styles) { Object.keys(styles).forEach(function (prop) { var unit = ''; // add unit if the value is numeric and is one of the following if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) { unit = 'px'; } element.style[prop] = styles[prop] + unit; }); } /** * Set the attributes to the given popper * @method * @memberof Popper.Utils * @argument {Element} element - Element to apply the attributes to * @argument {Object} styles * Object with a list of properties and values which will be applied to the element */ function setAttributes(element, attributes) { Object.keys(attributes).forEach(function (prop) { var value = attributes[prop]; if (value !== false) { element.setAttribute(prop, attributes[prop]); } else { element.removeAttribute(prop); } }); } /** * @function * @memberof Modifiers * @argument {Object} data - The data object generated by `update` method * @argument {Object} data.styles - List of style properties - values to apply to popper element * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element * @argument {Object} options - Modifiers configuration and options * @returns {Object} The same data object */ function applyStyle(data) { // any property present in `data.styles` will be applied to the popper, // in this way we can make the 3rd party modifiers add custom styles to it // Be aware, modifiers could override the properties defined in the previous // lines of this modifier! setStyles(data.instance.popper, data.styles); // any property present in `data.attributes` will be applied to the popper, // they will be set as HTML attributes of the element setAttributes(data.instance.popper, data.attributes); // if arrowElement is defined and arrowStyles has some properties if (data.arrowElement && Object.keys(data.arrowStyles).length) { setStyles(data.arrowElement, data.arrowStyles); } return data; } /** * Set the x-placement attribute before everything else because it could be used * to add margins to the popper margins needs to be calculated to get the * correct popper offsets. * @method * @memberof Popper.modifiers * @param {HTMLElement} reference - The reference element used to position the popper * @param {HTMLElement} popper - The HTML element used as popper. * @param {Object} options - Popper.js options */ function applyStyleOnLoad(reference, popper, options, modifierOptions, state) { // compute reference element offsets var referenceOffsets = getReferenceOffsets(state, popper, reference); // compute auto placement, store placement inside the data object, // modifiers will be able to edit `placement` if needed // and refer to originalPlacement to know the original value var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding); popper.setAttribute('x-placement', placement); // Apply `position` to popper before anything else because // without the position applied we can't guarantee correct computations setStyles(popper, { position: 'absolute' }); return options; } /** * @function * @memberof Modifiers * @argument {Object} data - The data object generated by `update` method * @argument {Object} options - Modifiers configuration and options * @returns {Object} The data object, properly modified */ function computeStyle(data, options) { var x = options.x, y = options.y; var popper = data.offsets.popper; // Remove this legacy support in Popper.js v2 var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) { return modifier.name === 'applyStyle'; }).gpuAcceleration; if (legacyGpuAccelerationOption !== undefined) { console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!'); } var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration; var offsetParent = getOffsetParent(data.instance.popper); var offsetParentRect = getBoundingClientRect(offsetParent); // Styles var styles = { position: popper.position }; // floor sides to avoid blurry text var offsets = { left: Math.floor(popper.left), top: Math.floor(popper.top), bottom: Math.floor(popper.bottom), right: Math.floor(popper.right) }; var sideA = x === 'bottom' ? 'top' : 'bottom'; var sideB = y === 'right' ? 'left' : 'right'; // if gpuAcceleration is set to `true` and transform is supported, // we use `translate3d` to apply the position to the popper we // automatically use the supported prefixed version if needed var prefixedProperty = getSupportedPropertyName('transform'); // now, let's make a step back and look at this code closely (wtf?) // If the content of the popper grows once it's been positioned, it // may happen that the popper gets misplaced because of the new content // overflowing its reference element // To avoid this problem, we provide two options (x and y), which allow // the consumer to define the offset origin. // If we position a popper on top of a reference element, we can set // `x` to `top` to make the popper grow towards its top instead of // its bottom. var left = void 0, top = void 0; if (sideA === 'bottom') { top = -offsetParentRect.height + offsets.bottom; } else { top = offsets.top; } if (sideB === 'right') { left = -offsetParentRect.width + offsets.right; } else { left = offsets.left; } if (gpuAcceleration && prefixedProperty) { styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)'; styles[sideA] = 0; styles[sideB] = 0; styles.willChange = 'transform'; } else { // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties var invertTop = sideA === 'bottom' ? -1 : 1; var invertLeft = sideB === 'right' ? -1 : 1; styles[sideA] = top * invertTop; styles[sideB] = left * invertLeft; styles.willChange = sideA + ', ' + sideB; } // Attributes var attributes = { 'x-placement': data.placement }; // Update `data` attributes, styles and arrowStyles data.attributes = _extends$1({}, attributes, data.attributes); data.styles = _extends$1({}, styles, data.styles); data.arrowStyles = _extends$1({}, data.offsets.arrow, data.arrowStyles); return data; } /** * Helper used to know if the given modifier depends from another one.<br /> * It checks if the needed modifier is listed and enabled. * @method * @memberof Popper.Utils * @param {Array} modifiers - list of modifiers * @param {String} requestingName - name of requesting modifier * @param {String} requestedName - name of requested modifier * @returns {Boolean} */ function isModifierRequired(modifiers, requestingName, requestedName) { var requesting = find(modifiers, function (_ref) { var name = _ref.name; return name === requestingName; }); var isRequired = !!requesting && modifiers.some(function (modifier) { return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order; }); if (!isRequired) { var _requesting = '`' + requestingName + '`'; var requested = '`' + requestedName + '`'; console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!'); } return isRequired; } /** * @function * @memberof Modifiers * @argument {Object} data - The data object generated by update method * @argument {Object} options - Modifiers configuration and options * @returns {Object} The data object, properly modified */ function arrow(data, options) { var _data$offsets$arrow; // arrow depends on keepTogether in order to work if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) { return data; } var arrowElement = options.element; // if arrowElement is a string, suppose it's a CSS selector if (typeof arrowElement === 'string') { arrowElement = data.instance.popper.querySelector(arrowElement); // if arrowElement is not found, don't run the modifier if (!arrowElement) { return data; } } else { // if the arrowElement isn't a query selector we must check that the // provided DOM node is child of its popper node if (!data.instance.popper.contains(arrowElement)) { console.warn('WARNING: `arrow.element` must be child of its popper element!'); return data; } } var placement = data.placement.split('-')[0]; var _data$offsets = data.offsets, popper = _data$offsets.popper, reference = _data$offsets.reference; var isVertical = ['left', 'right'].indexOf(placement) !== -1; var len = isVertical ? 'height' : 'width'; var sideCapitalized = isVertical ? 'Top' : 'Left'; var side = sideCapitalized.toLowerCase(); var altSide = isVertical ? 'left' : 'top'; var opSide = isVertical ? 'bottom' : 'right'; var arrowElementSize = getOuterSizes(arrowElement)[len]; // // extends keepTogether behavior making sure the popper and its // reference have enough pixels in conjuction // // top/left side if (reference[opSide] - arrowElementSize < popper[side]) { data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize); } // bottom/right side if (reference[side] + arrowElementSize > popper[opSide]) { data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide]; } data.offsets.popper = getClientRect(data.offsets.popper); // compute center of the popper var center = reference[side] + reference[len] / 2 - arrowElementSize / 2; // Compute the sideValue using the updated popper offsets // take popper margin in account because we don't have this info available var css = getStyleComputedProperty(data.instance.popper); var popperMarginSide = parseFloat(css['margin' + sideCapitalized], 10); var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width'], 10); var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide; // prevent arrowElement from being placed not contiguously to its popper sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0); data.arrowElement = arrowElement; data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty$1(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty$1(_data$offsets$arrow, altSide, ''), _data$offsets$arrow); return data; } /** * Get the opposite placement variation of the given one * @method * @memberof Popper.Utils * @argument {String} placement variation * @returns {String} flipped placement variation */ function getOppositeVariation(variation) { if (variation === 'end') { return 'start'; } else if (variation === 'start') { return 'end'; } return variation; } /** * List of accepted placements to use as values of the `placement` option.<br /> * Valid placements are: * - `auto` * - `top` * - `right` * - `bottom` * - `left` * * Each placement can have a variation from this list: * - `-start` * - `-end` * * Variations are interpreted easily if you think of them as the left to right * written languages. Horizontally (`top` and `bottom`), `start` is left and `end` * is right.<br /> * Vertically (`left` and `right`), `start` is top and `end` is bottom. * * Some valid examples are: * - `top-end` (on top of reference, right aligned) * - `right-start` (on right of reference, top aligned) * - `bottom` (on bottom, centered) * - `auto-right` (on the side with more space available, alignment depends by placement) * * @static * @type {Array} * @enum {String} * @readonly * @method placements * @memberof Popper */ var placements = ['auto-start', 'auto', 'auto-end', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start']; // Get rid of `auto` `auto-start` and `auto-end` var validPlacements = placements.slice(3); /** * Given an initial placement, returns all the subsequent placements * clockwise (or counter-clockwise). * * @method * @memberof Popper.Utils * @argument {String} placement - A valid placement (it accepts variations) * @argument {Boolean} counter - Set to true to walk the placements counterclockwise * @returns {Array} placements including their variations */ function clockwise(placement) { var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; var index = validPlacements.indexOf(placement); var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index)); return counter ? arr.reverse() : arr; } var BEHAVIORS = { FLIP: 'flip', CLOCKWISE: 'clockwise', COUNTERCLOCKWISE: 'counterclockwise' }; /** * @function * @memberof Modifiers * @argument {Object} data - The data object generated by update method * @argument {Object} options - Modifiers configuration and options * @returns {Object} The data object, properly modified */ function flip(data, options) { // if `inner` modifier is enabled, we can't use the `flip` modifier if (isModifierEnabled(data.instance.modifiers, 'inner')) { return data; } if (data.flipped && data.placement === data.originalPlacement) { // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides return data; } var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement); var placement = data.placement.split('-')[0]; var placementOpposite = getOppositePlacement(placement); var variation = data.placement.split('-')[1] || ''; var flipOrder = []; switch (options.behavior) { case BEHAVIORS.FLIP: flipOrder = [placement, placementOpposite]; break; case BEHAVIORS.CLOCKWISE: flipOrder = clockwise(placement); break; case BEHAVIORS.COUNTERCLOCKWISE: flipOrder = clockwise(placement, true); break; default: flipOrder = options.behavior; } flipOrder.forEach(function (step, index) { if (placement !== step || flipOrder.length === index + 1) { return data; } placement = data.placement.split('-')[0]; placementOpposite = getOppositePlacement(placement); var popperOffsets = data.offsets.popper; var refOffsets = data.offsets.reference; // using floor because the reference offsets may contain decimals we are not going to consider here var floor = Math.floor; var overlapsRef = placement === 'left' && floor(popperOffsets.right) > floor(refOffsets.left) || placement === 'right' && floor(popperOffsets.left) < floor(refOffsets.right) || placement === 'top' && floor(popperOffsets.bottom) > floor(refOffsets.top) || placement === 'bottom' && floor(popperOffsets.top) < floor(refOffsets.bottom); var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left); var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right); var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top); var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom); var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom; // flip the variation if required var isVertical = ['top', 'bottom'].indexOf(placement) !== -1; var flippedVariation = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom); if (overlapsRef || overflowsBoundaries || flippedVariation) { // this boolean to detect any flip loop data.flipped = true; if (overlapsRef || overflowsBoundaries) { placement = flipOrder[index + 1]; } if (flippedVariation) { variation = getOppositeVariation(variation); } data.placement = placement + (variation ? '-' + variation : ''); // this object contains `position`, we want to preserve it along with // any additional property we may add in the future data.offsets.popper = _extends$1({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement)); data = runModifiers(data.instance.modifiers, data, 'flip'); } }); return data; } /** * @function * @memberof Modifiers * @argument {Object} data - The data object generated by update method * @argument {Object} options - Modifiers configuration and options * @returns {Object} The data object, properly modified */ function keepTogether(data) { var _data$offsets = data.offsets, popper = _data$offsets.popper, reference = _data$offsets.reference; var placement = data.placement.split('-')[0]; var floor = Math.floor; var isVertical = ['top', 'bottom'].indexOf(placement) !== -1; var side = isVertical ? 'right' : 'bottom'; var opSide = isVertical ? 'left' : 'top'; var measurement = isVertical ? 'width' : 'height'; if (popper[side] < floor(reference[opSide])) { data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement]; } if (popper[opSide] > floor(reference[side])) { data.offsets.popper[opSide] = floor(reference[side]); } return data; } /** * Converts a string containing value + unit into a px value number * @function * @memberof {modifiers~offset} * @private * @argument {String} str - Value + unit string * @argument {String} measurement - `height` or `width` * @argument {Object} popperOffsets * @argument {Object} referenceOffsets * @returns {Number|String} * Value in pixels, or original string if no values were extracted */ function toValue(str, measurement, popperOffsets, referenceOffsets) { // separate value from unit var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/); var value = +split[1]; var unit = split[2]; // If it's not a number it's an operator, I guess if (!value) { return str; } if (unit.indexOf('%') === 0) { var element = void 0; switch (unit) { case '%p': element = popperOffsets; break; case '%': case '%r': default: element = referenceOffsets; } var rect = getClientRect(element); return rect[measurement] / 100 * value; } else if (unit === 'vh' || unit === 'vw') { // if is a vh or vw, we calculate the size based on the viewport var size = void 0; if (unit === 'vh') { size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); } else { size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); } return size / 100 * value; } else { // if is an explicit pixel unit, we get rid of the unit and keep the value // if is an implicit unit, it's px, and we return just the value return value; } } /** * Parse an `offset` string to extrapolate `x` and `y` numeric offsets. * @function * @memberof {modifiers~offset} * @private * @argument {String} offset * @argument {Object} popperOffsets * @argument {Object} referenceOffsets * @argument {String} basePlacement * @returns {Array} a two cells array with x and y offsets in numbers */ function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) { var offsets = [0, 0]; // Use height if placement is left or right and index is 0 otherwise use width // in this way the first offset will use an axis and the second one // will use the other one var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1; // Split the offset string to obtain a list of values and operands // The regex addresses values with the plus or minus sign in front (+10, -20, etc) var fragments = offset.split(/(\+|\-)/).map(function (frag) { return frag.trim(); }); // Detect if the offset string contains a pair of values or a single one // they could be separated by comma or space var divider = fragments.indexOf(find(fragments, function (frag) { return frag.search(/,|\s/) !== -1; })); if (fragments[divider] && fragments[divider].indexOf(',') === -1) { console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.'); } // If divider is found, we divide the list of values and operands to divide // them by ofset X and Y. var splitRegex = /\s*,\s*|\s+/; var ops = divider !== -1 ? [fragments.slice(0, divider).concat([fragments[divider].split(splitRegex)[0]]), [fragments[divider].split(splitRegex)[1]].concat(fragments.slice(divider + 1))] : [fragments]; // Convert the values with units to absolute pixels to allow our computations ops = ops.map(function (op, index) { // Most of the units rely on the orientation of the popper var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width'; var mergeWithPrevious = false; return op // This aggregates any `+` or `-` sign that aren't considered operators // e.g.: 10 + +5 => [10, +, +5] .reduce(function (a, b) { if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) { a[a.length - 1] = b; mergeWithPrevious = true; return a; } else if (mergeWithPrevious) { a[a.length - 1] += b; mergeWithPrevious = false; return a; } else { return a.concat(b); } }, []) // Here we convert the string values into number values (in px) .map(function (str) { return toValue(str, measurement, popperOffsets, referenceOffsets); }); }); // Loop trough the offsets arrays and execute the operations ops.forEach(function (op, index) { op.forEach(function (frag, index2) { if (isNumeric(frag)) { offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1); } }); }); return offsets; } /** * @function * @memberof Modifiers * @argument {Object} data - The data object generated by update method * @argument {Object} options - Modifiers configuration and options * @argument {Number|String} options.offset=0 * The offset value as described in the modifier description * @returns {Object} The data object, properly modified */ function offset(data, _ref) { var offset = _ref.offset; var placement = data.placement, _data$offsets = data.offsets, popper = _data$offsets.popper, reference = _data$offsets.reference; var basePlacement = placement.split('-')[0]; var offsets = void 0; if (isNumeric(+offset)) { offsets = [+offset, 0]; } else { offsets = parseOffset(offset, popper, reference, basePlacement); } if (basePlacement === 'left') { popper.top += offsets[0]; popper.left -= offsets[1]; } else if (basePlacement === 'right') { popper.top += offsets[0]; popper.left += offsets[1]; } else if (basePlacement === 'top') { popper.left += offsets[0]; popper.top -= offsets[1]; } else if (basePlacement === 'bottom') { popper.left += offsets[0]; popper.top += offsets[1]; } data.popper = popper; return data; } /** * @function * @memberof Modifiers * @argument {Object} data - The data object generated by `update` method * @argument {Object} options - Modifiers configuration and options * @returns {Object} The data object, properly modified */ function preventOverflow(data, options) { var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper); // If offsetParent is the reference element, we really want to // go one step up and use the next offsetParent as reference to // avoid to make this modifier completely useless and look like broken if (data.instance.reference === boundariesElement) { boundariesElement = getOffsetParent(boundariesElement); } var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement); options.boundaries = boundaries; var order = options.priority; var popper = data.offsets.popper; var check = { primary: function primary(placement) { var value = popper[placement]; if (popper[placement] < boundaries[placement] && !options.escapeWithReference) { value = Math.max(popper[placement], boundaries[placement]); } return defineProperty$1({}, placement, value); }, secondary: function secondary(placement) { var mainSide = placement === 'right' ? 'left' : 'top'; var value = popper[mainSide]; if (popper[placement] > boundaries[placement] && !options.escapeWithReference) { value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height)); } return defineProperty$1({}, mainSide, value); } }; order.forEach(function (placement) { var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary'; popper = _extends$1({}, popper, check[side](placement)); }); data.offsets.popper = popper; return data; } /** * @function * @memberof Modifiers * @argument {Object} data - The data object generated by `update` method * @argument {Object} options - Modifiers configuration and options * @returns {Object} The data object, properly modified */ function shift(data) { var placement = data.placement; var basePlacement = placement.split('-')[0]; var shiftvariation = placement.split('-')[1]; // if shift shiftvariation is specified, run the modifier if (shiftvariation) { var _data$offsets = data.offsets, reference = _data$offsets.reference, popper = _data$offsets.popper; var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1; var side = isVertical ? 'left' : 'top'; var measurement = isVertical ? 'width' : 'height'; var shiftOffsets = { start: defineProperty$1({}, side, reference[side]), end: defineProperty$1({}, side, reference[side] + reference[measurement] - popper[measurement]) }; data.offsets.popper = _extends$1({}, popper, shiftOffsets[shiftvariation]); } return data; } /** * @function * @memberof Modifiers * @argument {Object} data - The data object generated by update method * @argument {Object} options - Modifiers configuration and options * @returns {Object} The data object, properly modified */ function hide(data) { if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) { return data; } var refRect = data.offsets.reference; var bound = find(data.instance.modifiers, function (modifier) { return modifier.name === 'preventOverflow'; }).boundaries; if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) { // Avoid unnecessary DOM access if visibility hasn't changed if (data.hide === true) { return data; } data.hide = true; data.attributes['x-out-of-boundaries'] = ''; } else { // Avoid unnecessary DOM access if visibility hasn't changed if (data.hide === false) { return data; } data.hide = false; data.attributes['x-out-of-boundaries'] = false; } return data; } /** * @function * @memberof Modifiers * @argument {Object} data - The data object generated by `update` method * @argument {Object} options - Modifiers configuration and options * @returns {Object} The data object, properly modified */ function inner(data) { var placement = data.placement; var basePlacement = placement.split('-')[0]; var _data$offsets = data.offsets, popper = _data$offsets.popper, reference = _data$offsets.reference; var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1; var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1; popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0); data.placement = getOppositePlacement(placement); data.offsets.popper = getClientRect(popper); return data; } /** * Modifier function, each modifier can have a function of this type assigned * to its `fn` property.<br /> * These functions will be called on each update, this means that you must * make sure they are performant enough to avoid performance bottlenecks. * * @function ModifierFn * @argument {dataObject} data - The data object generated by `update` method * @argument {Object} options - Modifiers configuration and options * @returns {dataObject} The data object, properly modified */ /** * Modifiers are plugins used to alter the behavior of your poppers.<br /> * Popper.js uses a set of 9 modifiers to provide all the basic functionalities * needed by the library. * * Usually you don't want to override the `order`, `fn` and `onLoad` props. * All the other properties are configurations that could be tweaked. * @namespace modifiers */ var modifiers = { /** * Modifier used to shift the popper on the start or end of its reference * element.<br /> * It will read the variation of the `placement` property.<br /> * It can be one either `-end` or `-start`. * @memberof modifiers * @inner */ shift: { /** @prop {number} order=100 - Index used to define the order of execution */ order: 100, /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ enabled: true, /** @prop {ModifierFn} */ fn: shift }, /** * The `offset` modifier can shift your popper on both its axis. * * It accepts the following units: * - `px` or unitless, interpreted as pixels * - `%` or `%r`, percentage relative to the length of the reference element * - `%p`, percentage relative to the length of the popper element * - `vw`, CSS viewport width unit * - `vh`, CSS viewport height unit * * For length is intended the main axis relative to the placement of the popper.<br /> * This means that if the placement is `top` or `bottom`, the length will be the * `width`. In case of `left` or `right`, it will be the height. * * You can provide a single value (as `Number` or `String`), or a pair of values * as `String` divided by a comma or one (or more) white spaces.<br /> * The latter is a deprecated method because it leads to confusion and will be * removed in v2.<br /> * Additionally, it accepts additions and subtractions between different units. * Note that multiplications and divisions aren't supported. * * Valid examples are: * ``` * 10 * '10%' * '10, 10' * '10%, 10' * '10 + 10%' * '10 - 5vh + 3%' * '-10px + 5vh, 5px - 6%' * ``` * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap * > with their reference element, unfortunately, you will have to disable the `flip` modifier. * > More on this [reading this issue](https://github.com/FezVrasta/popper.js/issues/373) * * @memberof modifiers * @inner */ offset: { /** @prop {number} order=200 - Index used to define the order of execution */ order: 200, /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ enabled: true, /** @prop {ModifierFn} */ fn: offset, /** @prop {Number|String} offset=0 * The offset value as described in the modifier description */ offset: 0 }, /** * Modifier used to prevent the popper from being positioned outside the boundary. * * An scenario exists where the reference itself is not within the boundaries.<br /> * We can say it has "escaped the boundaries" — or just "escaped".<br /> * In this case we need to decide whether the popper should either: * * - detach from the reference and remain "trapped" in the boundaries, or * - if it should ignore the boundary and "escape with its reference" * * When `escapeWithReference` is set to`true` and reference is completely * outside its boundaries, the popper will overflow (or completely leave) * the boundaries in order to remain attached to the edge of the reference. * * @memberof modifiers * @inner */ preventOverflow: { /** @prop {number} order=300 - Index used to define the order of execution */ order: 300, /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ enabled: true, /** @prop {ModifierFn} */ fn: preventOverflow, /** * @prop {Array} [priority=['left','right','top','bottom']] * Popper will try to prevent overflow following these priorities by default, * then, it could overflow on the left and on top of the `boundariesElement` */ priority: ['left', 'right', 'top', 'bottom'], /** * @prop {number} padding=5 * Amount of pixel used to define a minimum distance between the boundaries * and the popper this makes sure the popper has always a little padding * between the edges of its container */ padding: 5, /** * @prop {String|HTMLElement} boundariesElement='scrollParent' * Boundaries used by the modifier, can be `scrollParent`, `window`, * `viewport` or any DOM element. */ boundariesElement: 'scrollParent' }, /** * Modifier used to make sure the reference and its popper stay near eachothers * without leaving any gap between the two. Expecially useful when the arrow is * enabled and you want to assure it to point to its reference element. * It cares only about the first axis, you can still have poppers with margin * between the popper and its reference element. * @memberof modifiers * @inner */ keepTogether: { /** @prop {number} order=400 - Index used to define the order of execution */ order: 400, /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ enabled: true, /** @prop {ModifierFn} */ fn: keepTogether }, /** * This modifier is used to move the `arrowElement` of the popper to make * sure it is positioned between the reference element and its popper element. * It will read the outer size of the `arrowElement` node to detect how many * pixels of conjuction are needed. * * It has no effect if no `arrowElement` is provided. * @memberof modifiers * @inner */ arrow: { /** @prop {number} order=500 - Index used to define the order of execution */ order: 500, /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ enabled: true, /** @prop {ModifierFn} */ fn: arrow, /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */ element: '[x-arrow]' }, /** * Modifier used to flip the popper's placement when it starts to overlap its * reference element. * * Requires the `preventOverflow` modifier before it in order to work. * * **NOTE:** this modifier will interrupt the current update cycle and will * restart it if it detects the need to flip the placement. * @memberof modifiers * @inner */ flip: { /** @prop {number} order=600 - Index used to define the order of execution */ order: 600, /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ enabled: true, /** @prop {ModifierFn} */ fn: flip, /** * @prop {String|Array} behavior='flip' * The behavior used to change the popper's placement. It can be one of * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid * placements (with optional variations). */ behavior: 'flip', /** * @prop {number} padding=5 * The popper will flip if it hits the edges of the `boundariesElement` */ padding: 5, /** * @prop {String|HTMLElement} boundariesElement='viewport' * The element which will define the boundaries of the popper position, * the popper will never be placed outside of the defined boundaries * (except if keepTogether is enabled) */ boundariesElement: 'viewport' }, /** * Modifier used to make the popper flow toward the inner of the reference element. * By default, when this modifier is disabled, the popper will be placed outside * the reference element. * @memberof modifiers * @inner */ inner: { /** @prop {number} order=700 - Index used to define the order of execution */ order: 700, /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */ enabled: false, /** @prop {ModifierFn} */ fn: inner }, /** * Modifier used to hide the popper when its reference element is outside of the * popper boundaries. It will set a `x-out-of-boundaries` attribute which can * be used to hide with a CSS selector the popper when its reference is * out of boundaries. * * Requires the `preventOverflow` modifier before it in order to work. * @memberof modifiers * @inner */ hide: { /** @prop {number} order=800 - Index used to define the order of execution */ order: 800, /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ enabled: true, /** @prop {ModifierFn} */ fn: hide }, /** * Computes the style that will be applied to the popper element to gets * properly positioned. * * Note that this modifier will not touch the DOM, it just prepares the styles * so that `applyStyle` modifier can apply it. This separation is useful * in case you need to replace `applyStyle` with a custom implementation. * * This modifier has `850` as `order` value to maintain backward compatibility * with previous versions of Popper.js. Expect the modifiers ordering method * to change in future major versions of the library. * * @memberof modifiers * @inner */ computeStyle: { /** @prop {number} order=850 - Index used to define the order of execution */ order: 850, /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ enabled: true, /** @prop {ModifierFn} */ fn: computeStyle, /** * @prop {Boolean} gpuAcceleration=true * If true, it uses the CSS 3d transformation to position the popper. * Otherwise, it will use the `top` and `left` properties. */ gpuAcceleration: true, /** * @prop {string} [x='bottom'] * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin. * Change this if your popper should grow in a direction different from `bottom` */ x: 'bottom', /** * @prop {string} [x='left'] * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin. * Change this if your popper should grow in a direction different from `right` */ y: 'right' }, /** * Applies the computed styles to the popper element. * * All the DOM manipulations are limited to this modifier. This is useful in case * you want to integrate Popper.js inside a framework or view library and you * want to delegate all the DOM manipulations to it. * * Note that if you disable this modifier, you must make sure the popper element * has its position set to `absolute` before Popper.js can do its work! * * Just disable this modifier and define you own to achieve the desired effect. * * @memberof modifiers * @inner */ applyStyle: { /** @prop {number} order=900 - Index used to define the order of execution */ order: 900, /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ enabled: true, /** @prop {ModifierFn} */ fn: applyStyle, /** @prop {Function} */ onLoad: applyStyleOnLoad, /** * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier * @prop {Boolean} gpuAcceleration=true * If true, it uses the CSS 3d transformation to position the popper. * Otherwise, it will use the `top` and `left` properties. */ gpuAcceleration: undefined } }; /** * The `dataObject` is an object containing all the informations used by Popper.js * this object get passed to modifiers and to the `onCreate` and `onUpdate` callbacks. * @name dataObject * @property {Object} data.instance The Popper.js instance * @property {String} data.placement Placement applied to popper * @property {String} data.originalPlacement Placement originally defined on init * @property {Boolean} data.flipped True if popper has been flipped by flip modifier * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier * @property {Object} data.styles Any CSS property defined here will be applied to the popper, it expects the JavaScript nomenclature (eg. `marginBottom`) * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow, it expects the JavaScript nomenclature (eg. `marginBottom`) * @property {Object} data.boundaries Offsets of the popper boundaries * @property {Object} data.offsets The measurements of popper, reference and arrow elements. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0 */ /** * Default options provided to Popper.js constructor.<br /> * These can be overriden using the `options` argument of Popper.js.<br /> * To override an option, simply pass as 3rd argument an object with the same * structure of this object, example: * ``` * new Popper(ref, pop, { * modifiers: { * preventOverflow: { enabled: false } * } * }) * ``` * @type {Object} * @static * @memberof Popper */ var Defaults = { /** * Popper's placement * @prop {Popper.placements} placement='bottom' */ placement: 'bottom', /** * Whether events (resize, scroll) are initially enabled * @prop {Boolean} eventsEnabled=true */ eventsEnabled: true, /** * Set to true if you want to automatically remove the popper when * you call the `destroy` method. * @prop {Boolean} removeOnDestroy=false */ removeOnDestroy: false, /** * Callback called when the popper is created.<br /> * By default, is set to no-op.<br /> * Access Popper.js instance with `data.instance`. * @prop {onCreate} */ onCreate: function onCreate() {}, /** * Callback called when the popper is updated, this callback is not called * on the initialization/creation of the popper, but only on subsequent * updates.<br /> * By default, is set to no-op.<br /> * Access Popper.js instance with `data.instance`. * @prop {onUpdate} */ onUpdate: function onUpdate() {}, /** * List of modifiers used to modify the offsets before they are applied to the popper. * They provide most of the functionalities of Popper.js * @prop {modifiers} */ modifiers: modifiers }; /** * @callback onCreate * @param {dataObject} data */ /** * @callback onUpdate * @param {dataObject} data */ // Utils // Methods var Popper$1 = function () { /** * Create a new Popper.js instance * @class Popper * @param {HTMLElement|referenceObject} reference - The reference element used to position the popper * @param {HTMLElement} popper - The HTML element used as popper. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults) * @return {Object} instance - The generated Popper.js instance */ function Popper(reference, popper) { var _this = this; var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; classCallCheck$1(this, Popper); this.scheduleUpdate = function () { return requestAnimationFrame(_this.update); }; // make update() debounced, so that it only runs at most once-per-tick this.update = debounce(this.update.bind(this)); // with {} we create a new object with the options inside it this.options = _extends$1({}, Popper.Defaults, options); // init state this.state = { isDestroyed: false, isCreated: false, scrollParents: [] }; // get reference and popper elements (allow jQuery wrappers) this.reference = reference && reference.jquery ? reference[0] : reference; this.popper = popper && popper.jquery ? popper[0] : popper; // Deep merge modifiers options this.options.modifiers = {}; Object.keys(_extends$1({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) { _this.options.modifiers[name] = _extends$1({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {}); }); // Refactoring modifiers' list (Object => Array) this.modifiers = Object.keys(this.options.modifiers).map(function (name) { return _extends$1({ name: name }, _this.options.modifiers[name]); }) // sort the modifiers by order .sort(function (a, b) { return a.order - b.order; }); // modifiers have the ability to execute arbitrary code when Popper.js get inited // such code is executed in the same order of its modifier // they could add new properties to their options configuration // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`! this.modifiers.forEach(function (modifierOptions) { if (modifierOptions.enabled && isFunction$2(modifierOptions.onLoad)) { modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state); } }); // fire the first update to position the popper in the right place this.update(); var eventsEnabled = this.options.eventsEnabled; if (eventsEnabled) { // setup event listeners, they will take care of update the position in specific situations this.enableEventListeners(); } this.state.eventsEnabled = eventsEnabled; } // We can't use class properties because they don't get listed in the // class prototype and break stuff like Sinon stubs createClass$1(Popper, [{ key: 'update', value: function update$$1() { return update.call(this); } }, { key: 'destroy', value: function destroy$$1() { return destroy.call(this); } }, { key: 'enableEventListeners', value: function enableEventListeners$$1() { return enableEventListeners.call(this); } }, { key: 'disableEventListeners', value: function disableEventListeners$$1() { return disableEventListeners.call(this); } /** * Schedule an update, it will run on the next UI update available * @method scheduleUpdate * @memberof Popper */ /** * Collection of utilities useful when writing custom modifiers. * Starting from version 1.7, this method is available only if you * include `popper-utils.js` before `popper.js`. * * **DEPRECATION**: This way to access PopperUtils is deprecated * and will be removed in v2! Use the PopperUtils module directly instead. * Due to the high instability of the methods contained in Utils, we can't * guarantee them to follow semver. Use them at your own risk! * @static * @private * @type {Object} * @deprecated since version 1.8 * @member Utils * @memberof Popper */ }]); return Popper; }(); /** * The `referenceObject` is an object that provides an interface compatible with Popper.js * and lets you use it as replacement of a real DOM node.<br /> * You can use this method to position a popper relatively to a set of coordinates * in case you don't have a DOM node to use as reference. * * ``` * new Popper(referenceObject, popperNode); * ``` * * NB: This feature isn't supported in Internet Explorer 10 * @name referenceObject * @property {Function} data.getBoundingClientRect * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method. * @property {number} data.clientWidth * An ES6 getter that will return the width of the virtual reference element. * @property {number} data.clientHeight * An ES6 getter that will return the height of the virtual reference element. */ Popper$1.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils; Popper$1.placements = placements; Popper$1.Defaults = Defaults; var popper = Object.freeze({ default: Popper$1 }); var _popper = ( popper && Popper$1 ) || popper; var Popper_1 = createCommonjsModule(function (module, exports) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends$$1 = 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 _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; }; }(); var _propTypes2 = _interopRequireDefault(propTypes$1); var _popper2 = _interopRequireDefault(_popper); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _objectWithoutProperties(obj, keys) { var target = {};for (var i in obj) { if (keys.indexOf(i) >= 0) continue;if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;target[i] = obj[i]; }return target; } 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 === 'undefined' ? 'undefined' : _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 === 'undefined' ? 'undefined' : _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 Popper = function (_Component) { _inherits(Popper, _Component); function Popper() { var _ref; var _temp, _this, _ret; _classCallCheck(this, Popper); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Popper.__proto__ || Object.getPrototypeOf(Popper)).call.apply(_ref, [this].concat(args))), _this), _this.state = {}, _this._setArrowNode = function (node) { _this._arrowNode = node; }, _this._getTargetNode = function () { return _this.context.popperManager.getTargetNode(); }, _this._getOffsets = function (data) { return Object.keys(data.offsets).map(function (key) { return data.offsets[key]; }); }, _this._isDataDirty = function (data) { if (_this.state.data) { return JSON.stringify(_this._getOffsets(_this.state.data)) !== JSON.stringify(_this._getOffsets(data)); } else { return true; } }, _this._updateStateModifier = { enabled: true, order: 900, fn: function fn(data) { if (_this._isDataDirty(data)) { _this.setState({ data: data }); } return data; } }, _this._getPopperStyle = function () { var data = _this.state.data; if (!_this._popper || !data) { return { position: 'absolute', pointerEvents: 'none', opacity: 0 }; } return _extends$$1({ position: data.offsets.popper.position }, data.styles); }, _this._getPopperPlacement = function () { return _this.state.data ? _this.state.data.placement : undefined; }, _this._getPopperHide = function () { return !!_this.state.data && _this.state.data.hide ? '' : undefined; }, _this._getArrowStyle = function () { if (!_this.state.data || !_this.state.data.offsets.arrow) { return {}; } else { var _this$state$data$offs = _this.state.data.offsets.arrow, top = _this$state$data$offs.top, left = _this$state$data$offs.left; return { top: top, left: left }; } }, _this._handlePopperRef = function (node) { _this._popperNode = node; if (node) { _this._createPopper(); } else { _this._destroyPopper(); } if (_this.props.innerRef) { _this.props.innerRef(node); } }, _this._scheduleUpdate = function () { _this._popper && _this._popper.scheduleUpdate(); }, _temp), _possibleConstructorReturn(_this, _ret); } _createClass(Popper, [{ key: 'getChildContext', value: function getChildContext() { return { popper: { setArrowNode: this._setArrowNode, getArrowStyle: this._getArrowStyle } }; } }, { key: 'componentDidUpdate', value: function componentDidUpdate(lastProps) { if (lastProps.placement !== this.props.placement || lastProps.eventsEnabled !== this.props.eventsEnabled) { this._destroyPopper(); this._createPopper(); } if (lastProps.children !== this.props.children) { this._scheduleUpdate(); } } }, { key: 'componentWillUnmount', value: function componentWillUnmount() { this._destroyPopper(); } }, { key: '_createPopper', value: function _createPopper() { var _this2 = this; var _props = this.props, placement = _props.placement, eventsEnabled = _props.eventsEnabled; var modifiers = _extends$$1({}, this.props.modifiers, { applyStyle: { enabled: false }, updateState: this._updateStateModifier }); if (this._arrowNode) { modifiers.arrow = { element: this._arrowNode }; } this._popper = new _popper2.default(this._getTargetNode(), this._popperNode, { placement: placement, eventsEnabled: eventsEnabled, modifiers: modifiers }); // TODO: look into setTimeout scheduleUpdate call, without it, the popper will not position properly on creation setTimeout(function () { return _this2._scheduleUpdate(); }); } }, { key: '_destroyPopper', value: function _destroyPopper() { if (this._popper) { this._popper.destroy(); } } }, { key: 'render', value: function render() { var _props2 = this.props, component = _props2.component, innerRef = _props2.innerRef, placement = _props2.placement, eventsEnabled = _props2.eventsEnabled, modifiers = _props2.modifiers, children = _props2.children, restProps = _objectWithoutProperties(_props2, ['component', 'innerRef', 'placement', 'eventsEnabled', 'modifiers', 'children']); var popperStyle = this._getPopperStyle(); var popperPlacement = this._getPopperPlacement(); var popperHide = this._getPopperHide(); if (typeof children === 'function') { var popperProps = { ref: this._handlePopperRef, style: popperStyle, 'data-placement': popperPlacement, 'data-x-out-of-boundaries': popperHide }; return children({ popperProps: popperProps, restProps: restProps, scheduleUpdate: this._scheduleUpdate }); } var componentProps = _extends$$1({}, restProps, { style: _extends$$1({}, restProps.style, popperStyle), 'data-placement': popperPlacement, 'data-x-out-of-boundaries': popperHide }); if (typeof component === 'string') { componentProps.ref = this._handlePopperRef; } else { componentProps.innerRef = this._handlePopperRef; } return (0, React__default.createElement)(component, componentProps, children); } }]); return Popper; }(React__default.Component); Popper.contextTypes = { popperManager: _propTypes2.default.object.isRequired }; Popper.childContextTypes = { popper: _propTypes2.default.object.isRequired }; Popper.propTypes = { component: _propTypes2.default.oneOfType([_propTypes2.default.node, _propTypes2.default.func]), innerRef: _propTypes2.default.func, placement: _propTypes2.default.oneOf(_popper2.default.placements), eventsEnabled: _propTypes2.default.bool, modifiers: _propTypes2.default.object, children: _propTypes2.default.oneOfType([_propTypes2.default.node, _propTypes2.default.func]) }; Popper.defaultProps = { component: 'div', placement: 'bottom', eventsEnabled: true, modifiers: {} }; exports.default = Popper; }); unwrapExports(Popper_1); var Arrow_1 = createCommonjsModule(function (module, exports) { '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 _propTypes2 = _interopRequireDefault(propTypes$1); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _objectWithoutProperties(obj, keys) { var target = {};for (var i in obj) { if (keys.indexOf(i) >= 0) continue;if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;target[i] = obj[i]; }return target; } var Arrow = function Arrow(props, context) { var _props$component = props.component, component = _props$component === undefined ? 'span' : _props$component, innerRef = props.innerRef, children = props.children, restProps = _objectWithoutProperties(props, ['component', 'innerRef', 'children']); var popper = context.popper; var arrowRef = function arrowRef(node) { popper.setArrowNode(node); if (typeof innerRef === 'function') { innerRef(node); } }; var arrowStyle = popper.getArrowStyle(); if (typeof children === 'function') { var arrowProps = { ref: arrowRef, style: arrowStyle }; return children({ arrowProps: arrowProps, restProps: restProps }); } var componentProps = _extends({}, restProps, { style: _extends({}, arrowStyle, restProps.style) }); if (typeof component === 'string') { componentProps.ref = arrowRef; } else { componentProps.innerRef = arrowRef; } return (0, React__default.createElement)(component, componentProps, children); }; Arrow.contextTypes = { popper: _propTypes2.default.object.isRequired }; Arrow.propTypes = { component: _propTypes2.default.oneOfType([_propTypes2.default.node, _propTypes2.default.func]), innerRef: _propTypes2.default.func, children: _propTypes2.default.oneOfType([_propTypes2.default.node, _propTypes2.default.func]) }; exports.default = Arrow; }); unwrapExports(Arrow_1); var reactPopper = createCommonjsModule(function (module, exports) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.Arrow = exports.Popper = exports.Target = exports.Manager = undefined; var _Manager3 = _interopRequireDefault(Manager_1); var _Target3 = _interopRequireDefault(Target_1); var _Popper3 = _interopRequireDefault(Popper_1); var _Arrow3 = _interopRequireDefault(Arrow_1); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } exports.Manager = _Manager3.default; exports.Target = _Target3.default; exports.Popper = _Popper3.default; exports.Arrow = _Arrow3.default; }); unwrapExports(reactPopper); var reactPopper_1 = reactPopper.Arrow; var reactPopper_2 = reactPopper.Popper; var reactPopper_3 = reactPopper.Target; var reactPopper_4 = reactPopper.Manager; /* eslint react/no-find-dom-node: 0 */ // https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/no-find-dom-node.md var propTypes$9 = { disabled: propTypes$1.bool, dropup: deprecated(propTypes$1.bool, 'Please use the prop "direction" with the value "up".'), direction: propTypes$1.oneOf(['up', 'down', 'left', 'right']), group: propTypes$1.bool, isOpen: propTypes$1.bool, nav: propTypes$1.bool, active: propTypes$1.bool, addonType: propTypes$1.oneOfType([propTypes$1.bool, propTypes$1.oneOf(['prepend', 'append'])]), size: propTypes$1.string, tag: propTypes$1.string, toggle: propTypes$1.func, children: propTypes$1.node, className: propTypes$1.string, cssModule: propTypes$1.object, inNavbar: propTypes$1.bool }; var defaultProps$8 = { isOpen: false, direction: 'down', nav: false, active: false, addonType: false, inNavbar: false }; var childContextTypes = { toggle: propTypes$1.func.isRequired, isOpen: propTypes$1.bool.isRequired, direction: propTypes$1.oneOf(['up', 'down', 'left', 'right']).isRequired, inNavbar: propTypes$1.bool.isRequired }; var Dropdown = function (_React$Component) { inherits(Dropdown, _React$Component); function Dropdown(props) { classCallCheck(this, Dropdown); var _this = possibleConstructorReturn(this, (Dropdown.__proto__ || Object.getPrototypeOf(Dropdown)).call(this, props)); _this.addEvents = _this.addEvents.bind(_this); _this.handleDocumentClick = _this.handleDocumentClick.bind(_this); _this.handleKeyDown = _this.handleKeyDown.bind(_this); _this.removeEvents = _this.removeEvents.bind(_this); _this.toggle = _this.toggle.bind(_this); return _this; } createClass(Dropdown, [{ key: 'getChildContext', value: function getChildContext() { return { toggle: this.props.toggle, isOpen: this.props.isOpen, direction: this.props.direction === 'down' && this.props.dropup ? 'up' : this.props.direction, inNavbar: this.props.inNavbar }; } }, { key: 'componentDidMount', value: function componentDidMount() { this.handleProps(); } }, { key: 'componentDidUpdate', value: function componentDidUpdate(prevProps) { if (this.props.isOpen !== prevProps.isOpen) { this.handleProps(); } } }, { key: 'componentWillUnmount', value: function componentWillUnmount() { this.removeEvents(); } }, { key: 'getContainer', value: function getContainer() { return ReactDOM.findDOMNode(this); } }, { key: 'addEvents', value: function addEvents() { var _this2 = this; ['click', 'touchstart', 'keyup'].forEach(function (event) { return document.addEventListener(event, _this2.handleDocumentClick, true); }); } }, { key: 'removeEvents', value: function removeEvents() { var _this3 = this; ['click', 'touchstart', 'keyup'].forEach(function (event) { return document.removeEventListener(event, _this3.handleDocumentClick, true); }); } }, { key: 'handleDocumentClick', value: function handleDocumentClick(e) { if (e && (e.which === 3 || e.type === 'keyup' && e.which !== keyCodes.tab)) return; var container = this.getContainer(); if (container.contains(e.target) && container !== e.target && (e.type !== 'keyup' || e.which === keyCodes.tab)) { return; } this.toggle(e); } }, { key: 'handleKeyDown', value: function handleKeyDown(e) { if ([keyCodes.esc, keyCodes.up, keyCodes.down, keyCodes.space].indexOf(e.which) === -1 || /button/i.test(e.target.tagName) && e.which === keyCodes.space || /input|textarea/i.test(e.target.tagName)) { return; } e.preventDefault(); if (this.props.disabled) return; var container = this.getContainer(); if (e.which === keyCodes.space && this.props.isOpen && container !== e.target) { e.target.click(); } if (e.which === keyCodes.esc || !this.props.isOpen) { this.toggle(e); container.querySelector('[aria-expanded]').focus(); return; } var menuClass = mapToCssModules('dropdown-menu', this.props.cssModule); var itemClass = mapToCssModules('dropdown-item', this.props.cssModule); var disabledClass = mapToCssModules('disabled', this.props.cssModule); var items = container.querySelectorAll('.' + menuClass + ' .' + itemClass + ':not(.' + disabledClass + ')'); if (!items.length) return; var index = -1; for (var i = 0; i < items.length; i += 1) { if (items[i] === e.target) { index = i; break; } } if (e.which === keyCodes.up && index > 0) { index -= 1; } if (e.which === keyCodes.down && index < items.length - 1) { index += 1; } if (index < 0) { index = 0; } items[index].focus(); } }, { key: 'handleProps', value: function handleProps() { if (this.props.isOpen) { this.addEvents(); } else { this.removeEvents(); } } }, { key: 'toggle', value: function toggle(e) { if (this.props.disabled) { return e && e.preventDefault(); } return this.props.toggle(e); } }, { key: 'render', value: function render() { var _classNames; var _omit = omit(this.props, ['toggle', 'disabled', 'inNavbar', 'direction']), className = _omit.className, cssModule = _omit.cssModule, dropup = _omit.dropup, isOpen = _omit.isOpen, group = _omit.group, size = _omit.size, nav = _omit.nav, active = _omit.active, addonType = _omit.addonType, attrs = objectWithoutProperties(_omit, ['className', 'cssModule', 'dropup', 'isOpen', 'group', 'size', 'nav', 'active', 'addonType']); var direction = this.props.direction === 'down' && dropup ? 'up' : this.props.direction; attrs.tag = attrs.tag || (nav ? 'li' : 'div'); var classes = mapToCssModules(classnames(className, direction !== 'down' && 'drop' + direction, nav && active ? 'active' : false, (_classNames = {}, defineProperty(_classNames, 'input-group-' + addonType, addonType), defineProperty(_classNames, 'btn-group', group), defineProperty(_classNames, 'btn-group-' + size, !!size), defineProperty(_classNames, 'dropdown', !group && !addonType), defineProperty(_classNames, 'show', isOpen), defineProperty(_classNames, 'nav-item', nav), _classNames)), cssModule); return React__default.createElement(reactPopper_4, _extends({}, attrs, { className: classes, onKeyDown: this.handleKeyDown })); } }]); return Dropdown; }(React__default.Component); Dropdown.propTypes = propTypes$9; Dropdown.defaultProps = defaultProps$8; Dropdown.childContextTypes = childContextTypes; function NavDropdown(props) { warnOnce('The "NavDropdown" component has been deprecated.\nPlease use component "Dropdown" with nav prop.'); return React__default.createElement(Dropdown, _extends({ nav: true }, props)); } var propTypes$10 = { tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), innerRef: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), disabled: propTypes$1.bool, active: propTypes$1.bool, className: propTypes$1.string, cssModule: propTypes$1.object, onClick: propTypes$1.func, href: propTypes$1.any }; var defaultProps$9 = { tag: 'a' }; var NavLink = function (_React$Component) { inherits(NavLink, _React$Component); function NavLink(props) { classCallCheck(this, NavLink); var _this = possibleConstructorReturn(this, (NavLink.__proto__ || Object.getPrototypeOf(NavLink)).call(this, props)); _this.onClick = _this.onClick.bind(_this); return _this; } createClass(NavLink, [{ key: 'onClick', value: function onClick(e) { if (this.props.disabled) { e.preventDefault(); return; } if (this.props.href === '#') { e.preventDefault(); } if (this.props.onClick) { this.props.onClick(e); } } }, { key: 'render', value: function render() { var _props = this.props, className = _props.className, cssModule = _props.cssModule, active = _props.active, Tag = _props.tag, innerRef = _props.innerRef, attributes = objectWithoutProperties(_props, ['className', 'cssModule', 'active', 'tag', 'innerRef']); var classes = mapToCssModules(classnames(className, 'nav-link', { disabled: attributes.disabled, active: active }), cssModule); return React__default.createElement(Tag, _extends({}, attributes, { ref: innerRef, onClick: this.onClick, className: classes })); } }]); return NavLink; }(React__default.Component); NavLink.propTypes = propTypes$10; NavLink.defaultProps = defaultProps$9; var propTypes$11 = { tag: propTypes$1.string, className: propTypes$1.string, cssModule: propTypes$1.object }; var defaultProps$10 = { tag: 'ol' }; var Breadcrumb = function Breadcrumb(props) { var className = props.className, cssModule = props.cssModule, Tag = props.tag, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'tag']); var classes = mapToCssModules(classnames(className, 'breadcrumb'), cssModule); return React__default.createElement(Tag, _extends({}, attributes, { className: classes })); }; Breadcrumb.propTypes = propTypes$11; Breadcrumb.defaultProps = defaultProps$10; var propTypes$12 = { tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), active: propTypes$1.bool, className: propTypes$1.string, cssModule: propTypes$1.object }; var defaultProps$11 = { tag: 'li' }; var BreadcrumbItem = function BreadcrumbItem(props) { var className = props.className, cssModule = props.cssModule, active = props.active, Tag = props.tag, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'active', 'tag']); var classes = mapToCssModules(classnames(className, active ? 'active' : false, 'breadcrumb-item'), cssModule); return React__default.createElement(Tag, _extends({}, attributes, { className: classes })); }; BreadcrumbItem.propTypes = propTypes$12; BreadcrumbItem.defaultProps = defaultProps$11; var propTypes$13 = { active: propTypes$1.bool, block: propTypes$1.bool, color: propTypes$1.string, disabled: propTypes$1.bool, outline: propTypes$1.bool, tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), innerRef: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), onClick: propTypes$1.func, size: propTypes$1.string, children: propTypes$1.node, className: propTypes$1.string, cssModule: propTypes$1.object }; var defaultProps$12 = { color: 'secondary', tag: 'button' }; var Button = function (_React$Component) { inherits(Button, _React$Component); function Button(props) { classCallCheck(this, Button); var _this = possibleConstructorReturn(this, (Button.__proto__ || Object.getPrototypeOf(Button)).call(this, props)); _this.onClick = _this.onClick.bind(_this); return _this; } createClass(Button, [{ key: 'onClick', value: function onClick(e) { if (this.props.disabled) { e.preventDefault(); return; } if (this.props.onClick) { this.props.onClick(e); } } }, { key: 'render', value: function render() { var _props = this.props, active = _props.active, block = _props.block, className = _props.className, cssModule = _props.cssModule, color = _props.color, outline = _props.outline, size = _props.size, Tag = _props.tag, innerRef = _props.innerRef, attributes = objectWithoutProperties(_props, ['active', 'block', 'className', 'cssModule', 'color', 'outline', 'size', 'tag', 'innerRef']); var classes = mapToCssModules(classnames(className, 'btn', 'btn' + (outline ? '-outline' : '') + '-' + color, size ? 'btn-' + size : false, block ? 'btn-block' : false, { active: active, disabled: this.props.disabled }), cssModule); if (attributes.href && Tag === 'button') { Tag = 'a'; } return React__default.createElement(Tag, _extends({ type: Tag === 'button' && attributes.onClick ? 'button' : undefined }, attributes, { className: classes, ref: innerRef, onClick: this.onClick })); } }]); return Button; }(React__default.Component); Button.propTypes = propTypes$13; Button.defaultProps = defaultProps$12; var propTypes$14 = { children: propTypes$1.node }; var ButtonDropdown = function ButtonDropdown(props) { return React__default.createElement(Dropdown, _extends({ group: true }, props)); }; ButtonDropdown.propTypes = propTypes$14; var propTypes$15 = { tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), 'aria-label': propTypes$1.string, className: propTypes$1.string, cssModule: propTypes$1.object, role: propTypes$1.string, size: propTypes$1.string, vertical: propTypes$1.bool }; var defaultProps$13 = { tag: 'div', role: 'group' }; var ButtonGroup = function ButtonGroup(props) { var className = props.className, cssModule = props.cssModule, size = props.size, vertical = props.vertical, Tag = props.tag, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'size', 'vertical', 'tag']); var classes = mapToCssModules(classnames(className, size ? 'btn-group-' + size : false, vertical ? 'btn-group-vertical' : 'btn-group'), cssModule); return React__default.createElement(Tag, _extends({}, attributes, { className: classes })); }; ButtonGroup.propTypes = propTypes$15; ButtonGroup.defaultProps = defaultProps$13; var propTypes$16 = { tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), 'aria-label': propTypes$1.string, className: propTypes$1.string, cssModule: propTypes$1.object, role: propTypes$1.string }; var defaultProps$14 = { tag: 'div', role: 'toolbar' }; var ButtonToolbar = function ButtonToolbar(props) { var className = props.className, cssModule = props.cssModule, Tag = props.tag, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'tag']); var classes = mapToCssModules(classnames(className, 'btn-toolbar'), cssModule); return React__default.createElement(Tag, _extends({}, attributes, { className: classes })); }; ButtonToolbar.propTypes = propTypes$16; ButtonToolbar.defaultProps = defaultProps$14; var propTypes$17 = { children: propTypes$1.node, active: propTypes$1.bool, disabled: propTypes$1.bool, divider: propTypes$1.bool, tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), header: propTypes$1.bool, onClick: propTypes$1.func, className: propTypes$1.string, cssModule: propTypes$1.object, toggle: propTypes$1.bool }; var contextTypes = { toggle: propTypes$1.func }; var defaultProps$15 = { tag: 'button', toggle: true }; var DropdownItem = function (_React$Component) { inherits(DropdownItem, _React$Component); function DropdownItem(props) { classCallCheck(this, DropdownItem); var _this = possibleConstructorReturn(this, (DropdownItem.__proto__ || Object.getPrototypeOf(DropdownItem)).call(this, props)); _this.onClick = _this.onClick.bind(_this); _this.getTabIndex = _this.getTabIndex.bind(_this); return _this; } createClass(DropdownItem, [{ key: 'onClick', value: function onClick(e) { if (this.props.disabled || this.props.header || this.props.divider) { e.preventDefault(); return; } if (this.props.onClick) { this.props.onClick(e); } if (this.props.toggle) { this.context.toggle(e); } } }, { key: 'getTabIndex', value: function getTabIndex() { if (this.props.disabled || this.props.header || this.props.divider) { return '-1'; } return '0'; } }, { key: 'render', value: function render() { var tabIndex = this.getTabIndex(); var _omit = omit(this.props, ['toggle']), className = _omit.className, cssModule = _omit.cssModule, divider = _omit.divider, Tag = _omit.tag, header = _omit.header, active = _omit.active, props = objectWithoutProperties(_omit, ['className', 'cssModule', 'divider', 'tag', 'header', 'active']); var classes = mapToCssModules(classnames(className, { disabled: props.disabled, 'dropdown-item': !divider && !header, active: active, 'dropdown-header': header, 'dropdown-divider': divider }), cssModule); if (Tag === 'button') { if (header) { Tag = 'h6'; } else if (divider) { Tag = 'div'; } else if (props.href) { Tag = 'a'; } } return React__default.createElement(Tag, _extends({ type: Tag === 'button' && (props.onClick || this.props.toggle) ? 'button' : undefined }, props, { tabIndex: tabIndex, className: classes, onClick: this.onClick })); } }]); return DropdownItem; }(React__default.Component); DropdownItem.propTypes = propTypes$17; DropdownItem.defaultProps = defaultProps$15; DropdownItem.contextTypes = contextTypes; var propTypes$18 = { tag: propTypes$1.string, children: propTypes$1.node.isRequired, right: propTypes$1.bool, flip: propTypes$1.bool, className: propTypes$1.string, cssModule: propTypes$1.object }; var defaultProps$16 = { tag: 'div', flip: true }; var contextTypes$1 = { isOpen: propTypes$1.bool.isRequired, direction: propTypes$1.oneOf(['up', 'down', 'left', 'right']).isRequired, inNavbar: propTypes$1.bool.isRequired }; var noFlipModifier = { flip: { enabled: false } }; var directionPositionMap = { up: 'top', left: 'left', right: 'right', down: 'bottom' }; var DropdownMenu = function DropdownMenu(props, context) { var className = props.className, cssModule = props.cssModule, right = props.right, tag = props.tag, flip = props.flip, attrs = objectWithoutProperties(props, ['className', 'cssModule', 'right', 'tag', 'flip']); var classes = mapToCssModules(classnames(className, 'dropdown-menu', { 'dropdown-menu-right': right, show: context.isOpen }), cssModule); var Tag = tag; if (context.isOpen && !context.inNavbar) { Tag = reactPopper_2; var position1 = directionPositionMap[context.direction] || 'bottom'; var position2 = right ? 'end' : 'start'; attrs.placement = position1 + '-' + position2; attrs.component = tag; attrs.modifiers = !flip ? noFlipModifier : undefined; } return React__default.createElement(Tag, _extends({ tabIndex: '-1', role: 'menu' }, attrs, { 'aria-hidden': !context.isOpen, className: classes })); }; DropdownMenu.propTypes = propTypes$18; DropdownMenu.defaultProps = defaultProps$16; DropdownMenu.contextTypes = contextTypes$1; var propTypes$19 = { caret: propTypes$1.bool, color: propTypes$1.string, children: propTypes$1.node, className: propTypes$1.string, cssModule: propTypes$1.object, disabled: propTypes$1.bool, onClick: propTypes$1.func, 'aria-haspopup': propTypes$1.bool, split: propTypes$1.bool, tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), nav: propTypes$1.bool }; var defaultProps$17 = { 'aria-haspopup': true, color: 'secondary' }; var contextTypes$2 = { isOpen: propTypes$1.bool.isRequired, toggle: propTypes$1.func.isRequired, inNavbar: propTypes$1.bool.isRequired }; var DropdownToggle = function (_React$Component) { inherits(DropdownToggle, _React$Component); function DropdownToggle(props) { classCallCheck(this, DropdownToggle); var _this = possibleConstructorReturn(this, (DropdownToggle.__proto__ || Object.getPrototypeOf(DropdownToggle)).call(this, props)); _this.onClick = _this.onClick.bind(_this); return _this; } createClass(DropdownToggle, [{ key: 'onClick', value: function onClick(e) { if (this.props.disabled) { e.preventDefault(); return; } if (this.props.nav && !this.props.tag) { e.preventDefault(); } if (this.props.onClick) { this.props.onClick(e); } this.context.toggle(e); } }, { key: 'render', value: function render() { var _props = this.props, className = _props.className, color = _props.color, cssModule = _props.cssModule, caret = _props.caret, split = _props.split, nav = _props.nav, tag = _props.tag, props = objectWithoutProperties(_props, ['className', 'color', 'cssModule', 'caret', 'split', 'nav', 'tag']); var ariaLabel = props['aria-label'] || 'Toggle Dropdown'; var classes = mapToCssModules(classnames(className, { 'dropdown-toggle': caret || split, 'dropdown-toggle-split': split, 'nav-link': nav }), cssModule); var children = props.children || React__default.createElement( 'span', { className: 'sr-only' }, ariaLabel ); var Tag = void 0; if (nav && !tag) { Tag = 'a'; props.href = '#'; } else if (!tag) { Tag = Button; props.color = color; props.cssModule = cssModule; } else { Tag = tag; } if (this.context.inNavbar) { return React__default.createElement(Tag, _extends({}, props, { className: classes, onClick: this.onClick, 'aria-expanded': this.context.isOpen, children: children })); } return React__default.createElement(reactPopper_3, _extends({}, props, { className: classes, component: Tag, onClick: this.onClick, 'aria-expanded': this.context.isOpen, children: children })); } }]); return DropdownToggle; }(React__default.Component); DropdownToggle.propTypes = propTypes$19; DropdownToggle.defaultProps = defaultProps$17; DropdownToggle.contextTypes = contextTypes$2; var PropTypes$1 = createCommonjsModule(function (module, exports) { 'use strict'; exports.__esModule = true; exports.classNamesShape = exports.timeoutsShape = undefined; exports.transitionTimeout = transitionTimeout; var _propTypes2 = _interopRequireDefault(propTypes$1); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function transitionTimeout(transitionType) { var timeoutPropName = 'transition' + transitionType + 'Timeout'; var enabledPropName = 'transition' + transitionType; return function (props) { // If the transition is enabled if (props[enabledPropName]) { // If no timeout duration is provided if (props[timeoutPropName] == null) { return new Error(timeoutPropName + ' wasn\'t supplied to CSSTransitionGroup: ' + 'this can cause unreliable animations and won\'t be supported in ' + 'a future version of React. See ' + 'https://fb.me/react-animation-transition-group-timeout for more ' + 'information.'); // If the duration isn't a number } else if (typeof props[timeoutPropName] !== 'number') { return new Error(timeoutPropName + ' must be a number (in milliseconds)'); } } return null; }; } var timeoutsShape = exports.timeoutsShape = _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.shape({ enter: _propTypes2.default.number, exit: _propTypes2.default.number }).isRequired]); var classNamesShape = exports.classNamesShape = _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.shape({ enter: _propTypes2.default.string, exit: _propTypes2.default.string, active: _propTypes2.default.string }), _propTypes2.default.shape({ enter: _propTypes2.default.string, enterActive: _propTypes2.default.string, exit: _propTypes2.default.string, exitActive: _propTypes2.default.string })]); }); unwrapExports(PropTypes$1); var Transition_1 = createCommonjsModule(function (module, exports) { 'use strict'; exports.__esModule = true; exports.EXITING = exports.ENTERED = exports.ENTERING = exports.EXITED = exports.UNMOUNTED = undefined; var PropTypes = _interopRequireWildcard(propTypes$1); var _react2 = _interopRequireDefault(React__default); var _reactDom2 = _interopRequireDefault(ReactDOM); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {};if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } }newObj.default = obj;return newObj; } } function _objectWithoutProperties(obj, keys) { var target = {};for (var i in obj) { if (keys.indexOf(i) >= 0) continue;if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;target[i] = obj[i]; }return target; } 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 === 'undefined' ? 'undefined' : _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 === 'undefined' ? 'undefined' : _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 UNMOUNTED = exports.UNMOUNTED = 'unmounted'; var EXITED = exports.EXITED = 'exited'; var ENTERING = exports.ENTERING = 'entering'; var ENTERED = exports.ENTERED = 'entered'; var EXITING = exports.EXITING = 'exiting'; /** * The Transition component lets you describe a transition from one component * state to another _over time_ with a simple declarative API. Most commonly * it's used to animate the mounting and unmounting of a component, but can also * be used to describe in-place transition states as well. * * By default the `Transition` component does not alter the behavior of the * component it renders, it only tracks "enter" and "exit" states for the components. * It's up to you to give meaning and effect to those states. For example we can * add styles to a component when it enters or exits: * * ```jsx * import Transition from 'react-transition-group/Transition'; * * const duration = 300; * * const defaultStyle = { * transition: `opacity ${duration}ms ease-in-out`, * opacity: 0, * } * * const transitionStyles = { * entering: { opacity: 0 }, * entered: { opacity: 1 }, * }; * * const Fade = ({ in: inProp }) => ( * <Transition in={inProp} timeout={duration}> * {(state) => ( * <div style={{ * ...defaultStyle, * ...transitionStyles[state] * }}> * I'm A fade Transition! * </div> * )} * </Transition> * ); * ``` * * As noted the `Transition` component doesn't _do_ anything by itself to its child component. * What it does do is track transition states over time so you can update the * component (such as by adding styles or classes) when it changes states. * * There are 4 main states a Transition can be in: * - `ENTERING` * - `ENTERED` * - `EXITING` * - `EXITED` * * Transition state is toggled via the `in` prop. When `true` the component begins the * "Enter" stage. During this stage, the component will shift from its current transition state, * to `'entering'` for the duration of the transition and then to the `'entered'` stage once * it's complete. Let's take the following example: * * ```jsx * state= { in: false }; * * toggleEnterState = () => { * this.setState({ in: true }); * } * * render() { * return ( * <div> * <Transition in={this.state.in} timeout={500} /> * <button onClick={this.toggleEnterState}>Click to Enter</button> * </div> * ); * } * ``` * * When the button is clicked the component will shift to the `'entering'` state and * stay there for 500ms (the value of `timeout`) when finally switches to `'entered'`. * * When `in` is `false` the same thing happens except the state moves from `'exiting'` to `'exited'`. */ var Transition = function (_React$Component) { _inherits(Transition, _React$Component); function Transition(props, context) { _classCallCheck(this, Transition); var _this = _possibleConstructorReturn(this, _React$Component.call(this, props, context)); var parentGroup = context.transitionGroup; // In the context of a TransitionGroup all enters are really appears var appear = parentGroup && !parentGroup.isMounting ? props.enter : props.appear; var initialStatus = void 0; _this.nextStatus = null; if (props.in) { if (appear) { initialStatus = EXITED; _this.nextStatus = ENTERING; } else { initialStatus = ENTERED; } } else { if (props.unmountOnExit || props.mountOnEnter) { initialStatus = UNMOUNTED; } else { initialStatus = EXITED; } } _this.state = { status: initialStatus }; _this.nextCallback = null; return _this; } Transition.prototype.getChildContext = function getChildContext() { return { transitionGroup: null }; // allows for nested Transitions }; Transition.prototype.componentDidMount = function componentDidMount() { this.updateStatus(true); }; Transition.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { var _ref = this.pendingState || this.state, status = _ref.status; if (nextProps.in) { if (status === UNMOUNTED) { this.setState({ status: EXITED }); } if (status !== ENTERING && status !== ENTERED) { this.nextStatus = ENTERING; } } else { if (status === ENTERING || status === ENTERED) { this.nextStatus = EXITING; } } }; Transition.prototype.componentDidUpdate = function componentDidUpdate() { this.updateStatus(); }; Transition.prototype.componentWillUnmount = function componentWillUnmount() { this.cancelNextCallback(); }; Transition.prototype.getTimeouts = function getTimeouts() { var timeout = this.props.timeout; var exit = void 0, enter = void 0, appear = void 0; exit = enter = appear = timeout; if (timeout != null && typeof timeout !== 'number') { exit = timeout.exit; enter = timeout.enter; appear = timeout.appear; } return { exit: exit, enter: enter, appear: appear }; }; Transition.prototype.updateStatus = function updateStatus() { var mounting = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; var nextStatus = this.nextStatus; if (nextStatus !== null) { this.nextStatus = null; // nextStatus will always be ENTERING or EXITING. this.cancelNextCallback(); var node = _reactDom2.default.findDOMNode(this); if (nextStatus === ENTERING) { this.performEnter(node, mounting); } else { this.performExit(node); } } else if (this.props.unmountOnExit && this.state.status === EXITED) { this.setState({ status: UNMOUNTED }); } }; Transition.prototype.performEnter = function performEnter(node, mounting) { var _this2 = this; var enter = this.props.enter; var appearing = this.context.transitionGroup ? this.context.transitionGroup.isMounting : mounting; var timeouts = this.getTimeouts(); // no enter animation skip right to ENTERED // if we are mounting and running this it means appear _must_ be set if (!mounting && !enter) { this.safeSetState({ status: ENTERED }, function () { _this2.props.onEntered(node); }); return; } this.props.onEnter(node, appearing); this.safeSetState({ status: ENTERING }, function () { _this2.props.onEntering(node, appearing); // FIXME: appear timeout? _this2.onTransitionEnd(node, timeouts.enter, function () { _this2.safeSetState({ status: ENTERED }, function () { _this2.props.onEntered(node, appearing); }); }); }); }; Transition.prototype.performExit = function performExit(node) { var _this3 = this; var exit = this.props.exit; var timeouts = this.getTimeouts(); // no exit animation skip right to EXITED if (!exit) { this.safeSetState({ status: EXITED }, function () { _this3.props.onExited(node); }); return; } this.props.onExit(node); this.safeSetState({ status: EXITING }, function () { _this3.props.onExiting(node); _this3.onTransitionEnd(node, timeouts.exit, function () { _this3.safeSetState({ status: EXITED }, function () { _this3.props.onExited(node); }); }); }); }; Transition.prototype.cancelNextCallback = function cancelNextCallback() { if (this.nextCallback !== null) { this.nextCallback.cancel(); this.nextCallback = null; } }; Transition.prototype.safeSetState = function safeSetState(nextState, callback) { var _this4 = this; // We need to track pending updates for instances where a cWRP fires quickly // after cDM and before the state flushes, which would double trigger a // transition this.pendingState = nextState; // This shouldn't be necessary, but there are weird race conditions with // setState callbacks and unmounting in testing, so always make sure that // we can cancel any pending setState callbacks after we unmount. callback = this.setNextCallback(callback); this.setState(nextState, function () { _this4.pendingState = null; callback(); }); }; Transition.prototype.setNextCallback = function setNextCallback(callback) { var _this5 = this; var active = true; this.nextCallback = function (event) { if (active) { active = false; _this5.nextCallback = null; callback(event); } }; this.nextCallback.cancel = function () { active = false; }; return this.nextCallback; }; Transition.prototype.onTransitionEnd = function onTransitionEnd(node, timeout, handler) { this.setNextCallback(handler); if (node) { if (this.props.addEndListener) { this.props.addEndListener(node, this.nextCallback); } if (timeout != null) { setTimeout(this.nextCallback, timeout); } } else { setTimeout(this.nextCallback, 0); } }; Transition.prototype.render = function render() { var status = this.state.status; if (status === UNMOUNTED) { return null; } var _props = this.props, children = _props.children, childProps = _objectWithoutProperties(_props, ['children']); // filter props for Transtition delete childProps.in; delete childProps.mountOnEnter; delete childProps.unmountOnExit; delete childProps.appear; delete childProps.enter; delete childProps.exit; delete childProps.timeout; delete childProps.addEndListener; delete childProps.onEnter; delete childProps.onEntering; delete childProps.onEntered; delete childProps.onExit; delete childProps.onExiting; delete childProps.onExited; if (typeof children === 'function') { return children(status, childProps); } var child = _react2.default.Children.only(children); return _react2.default.cloneElement(child, childProps); }; return Transition; }(_react2.default.Component); Transition.contextTypes = { transitionGroup: PropTypes.object }; Transition.childContextTypes = { transitionGroup: function transitionGroup() {} }; Transition.propTypes = {}; // Name the function so it is clearer in the documentation function noop() {} Transition.defaultProps = { in: false, mountOnEnter: false, unmountOnExit: false, appear: false, enter: true, exit: true, onEnter: noop, onEntering: noop, onEntered: noop, onExit: noop, onExiting: noop, onExited: noop }; Transition.UNMOUNTED = 0; Transition.EXITED = 1; Transition.ENTERING = 2; Transition.ENTERED = 3; Transition.EXITING = 4; exports.default = Transition; }); var Transition = unwrapExports(Transition_1); var propTypes$20 = _extends({}, Transition.propTypes, { children: propTypes$1.oneOfType([propTypes$1.arrayOf(propTypes$1.node), propTypes$1.node]), tag: propTypes$1.oneOfType([propTypes$1.string, propTypes$1.func]), baseClass: propTypes$1.string, baseClassActive: propTypes$1.string, className: propTypes$1.string, cssModule: propTypes$1.object }); var defaultProps$18 = _extends({}, Transition.defaultProps, { tag: 'div', baseClass: 'fade', baseClassActive: 'show', timeout: TransitionTimeouts.Fade, appear: true, enter: true, exit: true, in: true }); function Fade(props) { var Tag = props.tag, baseClass = props.baseClass, baseClassActive = props.baseClassActive, className = props.className, cssModule = props.cssModule, children = props.children, otherProps = objectWithoutProperties(props, ['tag', 'baseClass', 'baseClassActive', 'className', 'cssModule', 'children']); // In NODE_ENV=production the Transition.propTypes are wrapped which results in an // empty object "{}". This is the result of the `react-transition-group` babel // configuration settings. Therefore, to ensure that production builds work without // error, we can either explicitly define keys or use the Transition.defaultProps. // Using the Transition.defaultProps excludes any required props. Thus, the best // solution is to explicitly define required props in our utilities and reference these. // This also gives us more flexibility in the future to remove the prop-types // dependency in distribution builds (Similar to how `react-transition-group` does). // Note: Without omitting the `react-transition-group` props, the resulting child // Tag component would inherit the Transition properties as attributes for the HTML // element which results in errors/warnings for non-valid attributes. var transitionProps = pick(otherProps, TransitionPropTypeKeys); var childProps = omit(otherProps, TransitionPropTypeKeys); return React__default.createElement( Transition, transitionProps, function (status) { var isActive = status === 'entered'; var classes = mapToCssModules(classnames(className, baseClass, isActive && baseClassActive), cssModule); return React__default.createElement( Tag, _extends({ className: classes }, childProps), children ); } ); } Fade.propTypes = propTypes$20; Fade.defaultProps = defaultProps$18; var propTypes$21 = { color: propTypes$1.string, pill: propTypes$1.bool, tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), children: propTypes$1.node, className: propTypes$1.string, cssModule: propTypes$1.object }; var defaultProps$19 = { color: 'secondary', pill: false, tag: 'span' }; var Badge = function Badge(props) { var className = props.className, cssModule = props.cssModule, color = props.color, pill = props.pill, Tag = props.tag, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'color', 'pill', 'tag']); var classes = mapToCssModules(classnames(className, 'badge', 'badge-' + color, pill ? 'badge-pill' : false), cssModule); if (attributes.href && Tag === 'span') { Tag = 'a'; } return React__default.createElement(Tag, _extends({}, attributes, { className: classes })); }; Badge.propTypes = propTypes$21; Badge.defaultProps = defaultProps$19; var propTypes$22 = { tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), inverse: propTypes$1.bool, color: propTypes$1.string, block: deprecated(propTypes$1.bool, 'Please use the props "body"'), body: propTypes$1.bool, outline: propTypes$1.bool, className: propTypes$1.string, cssModule: propTypes$1.object }; var defaultProps$20 = { tag: 'div' }; var Card = function Card(props) { var className = props.className, cssModule = props.cssModule, color = props.color, block = props.block, body = props.body, inverse = props.inverse, outline = props.outline, Tag = props.tag, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'color', 'block', 'body', 'inverse', 'outline', 'tag']); var classes = mapToCssModules(classnames(className, 'card', inverse ? 'text-white' : false, block || body ? 'card-body' : false, color ? (outline ? 'border' : 'bg') + '-' + color : false), cssModule); return React__default.createElement(Tag, _extends({}, attributes, { className: classes })); }; Card.propTypes = propTypes$22; Card.defaultProps = defaultProps$20; var propTypes$23 = { tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), className: propTypes$1.string, cssModule: propTypes$1.object }; var defaultProps$21 = { tag: 'div' }; var CardGroup = function CardGroup(props) { var className = props.className, cssModule = props.cssModule, Tag = props.tag, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'tag']); var classes = mapToCssModules(classnames(className, 'card-group'), cssModule); return React__default.createElement(Tag, _extends({}, attributes, { className: classes })); }; CardGroup.propTypes = propTypes$23; CardGroup.defaultProps = defaultProps$21; var propTypes$24 = { tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), className: propTypes$1.string, cssModule: propTypes$1.object }; var defaultProps$22 = { tag: 'div' }; var CardDeck = function CardDeck(props) { var className = props.className, cssModule = props.cssModule, Tag = props.tag, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'tag']); var classes = mapToCssModules(classnames(className, 'card-deck'), cssModule); return React__default.createElement(Tag, _extends({}, attributes, { className: classes })); }; CardDeck.propTypes = propTypes$24; CardDeck.defaultProps = defaultProps$22; var propTypes$25 = { tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), className: propTypes$1.string, cssModule: propTypes$1.object }; var defaultProps$23 = { tag: 'div' }; var CardColumns = function CardColumns(props) { var className = props.className, cssModule = props.cssModule, Tag = props.tag, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'tag']); var classes = mapToCssModules(classnames(className, 'card-columns'), cssModule); return React__default.createElement(Tag, _extends({}, attributes, { className: classes })); }; CardColumns.propTypes = propTypes$25; CardColumns.defaultProps = defaultProps$23; var propTypes$26 = { tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), className: propTypes$1.string, cssModule: propTypes$1.object }; var defaultProps$24 = { tag: 'div' }; var CardBody = function CardBody(props) { var className = props.className, cssModule = props.cssModule, Tag = props.tag, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'tag']); var classes = mapToCssModules(classnames(className, 'card-body'), cssModule); return React__default.createElement(Tag, _extends({}, attributes, { className: classes })); }; CardBody.propTypes = propTypes$26; CardBody.defaultProps = defaultProps$24; function CardBlock(props) { warnOnce('The "CardBlock" component has been deprecated.\nPlease use component "CardBody".'); return React__default.createElement(CardBody, props); } var propTypes$27 = { tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), innerRef: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), className: propTypes$1.string, cssModule: propTypes$1.object }; var defaultProps$25 = { tag: 'a' }; var CardLink = function CardLink(props) { var className = props.className, cssModule = props.cssModule, Tag = props.tag, innerRef = props.innerRef, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'tag', 'innerRef']); var classes = mapToCssModules(classnames(className, 'card-link'), cssModule); return React__default.createElement(Tag, _extends({}, attributes, { ref: innerRef, className: classes })); }; CardLink.propTypes = propTypes$27; CardLink.defaultProps = defaultProps$25; var propTypes$28 = { tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), className: propTypes$1.string, cssModule: propTypes$1.object }; var defaultProps$26 = { tag: 'div' }; var CardFooter = function CardFooter(props) { var className = props.className, cssModule = props.cssModule, Tag = props.tag, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'tag']); var classes = mapToCssModules(classnames(className, 'card-footer'), cssModule); return React__default.createElement(Tag, _extends({}, attributes, { className: classes })); }; CardFooter.propTypes = propTypes$28; CardFooter.defaultProps = defaultProps$26; var propTypes$29 = { tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), className: propTypes$1.string, cssModule: propTypes$1.object }; var defaultProps$27 = { tag: 'div' }; var CardHeader = function CardHeader(props) { var className = props.className, cssModule = props.cssModule, Tag = props.tag, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'tag']); var classes = mapToCssModules(classnames(className, 'card-header'), cssModule); return React__default.createElement(Tag, _extends({}, attributes, { className: classes })); }; CardHeader.propTypes = propTypes$29; CardHeader.defaultProps = defaultProps$27; var propTypes$30 = { tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), top: propTypes$1.bool, bottom: propTypes$1.bool, className: propTypes$1.string, cssModule: propTypes$1.object }; var defaultProps$28 = { tag: 'img' }; var CardImg = function CardImg(props) { var className = props.className, cssModule = props.cssModule, top = props.top, bottom = props.bottom, Tag = props.tag, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'top', 'bottom', 'tag']); var cardImgClassName = 'card-img'; if (top) { cardImgClassName = 'card-img-top'; } if (bottom) { cardImgClassName = 'card-img-bottom'; } var classes = mapToCssModules(classnames(className, cardImgClassName), cssModule); return React__default.createElement(Tag, _extends({}, attributes, { className: classes })); }; CardImg.propTypes = propTypes$30; CardImg.defaultProps = defaultProps$28; var propTypes$31 = { tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), className: propTypes$1.string, cssModule: propTypes$1.object }; var defaultProps$29 = { tag: 'div' }; var CardImgOverlay = function CardImgOverlay(props) { var className = props.className, cssModule = props.cssModule, Tag = props.tag, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'tag']); var classes = mapToCssModules(classnames(className, 'card-img-overlay'), cssModule); return React__default.createElement(Tag, _extends({}, attributes, { className: classes })); }; CardImgOverlay.propTypes = propTypes$31; CardImgOverlay.defaultProps = defaultProps$29; var CarouselItem = function (_React$Component) { inherits(CarouselItem, _React$Component); function CarouselItem(props) { classCallCheck(this, CarouselItem); var _this = possibleConstructorReturn(this, (CarouselItem.__proto__ || Object.getPrototypeOf(CarouselItem)).call(this, props)); _this.state = { startAnimation: false }; _this.onEnter = _this.onEnter.bind(_this); _this.onEntering = _this.onEntering.bind(_this); _this.onExit = _this.onExit.bind(_this); _this.onExiting = _this.onExiting.bind(_this); _this.onExited = _this.onExited.bind(_this); return _this; } createClass(CarouselItem, [{ key: 'onEnter', value: function onEnter(node, isAppearing) { this.setState({ startAnimation: false }); this.props.onEnter(node, isAppearing); } }, { key: 'onEntering', value: function onEntering(node, isAppearing) { // getting this variable triggers a reflow var offsetHeight = node.offsetHeight; this.setState({ startAnimation: true }); this.props.onEntering(node, isAppearing); return offsetHeight; } }, { key: 'onExit', value: function onExit(node) { this.setState({ startAnimation: false }); this.props.onExit(node); } }, { key: 'onExiting', value: function onExiting(node) { this.setState({ startAnimation: true }); node.dispatchEvent(new CustomEvent('slide.bs.carousel')); this.props.onExiting(node); } }, { key: 'onExited', value: function onExited(node) { node.dispatchEvent(new CustomEvent('slid.bs.carousel')); this.props.onExited(node); } }, { key: 'render', value: function render() { var _this2 = this; var _props = this.props, isIn = _props.in, children = _props.children, cssModule = _props.cssModule, slide = _props.slide, Tag = _props.tag, className = _props.className, transitionProps = objectWithoutProperties(_props, ['in', 'children', 'cssModule', 'slide', 'tag', 'className']); return React__default.createElement( Transition, _extends({}, transitionProps, { enter: slide, exit: slide, 'in': isIn, onEnter: this.onEnter, onEntering: this.onEntering, onExit: this.onExit, onExiting: this.onExiting, onExited: this.onExited }), function (status) { var direction = _this2.context.direction; var isActive = status === TransitionStatuses.ENTERED || status === TransitionStatuses.EXITING; var directionClassName = (status === TransitionStatuses.ENTERING || status === TransitionStatuses.EXITING) && _this2.state.startAnimation && (direction === 'right' ? 'carousel-item-left' : 'carousel-item-right'); var orderClassName = status === TransitionStatuses.ENTERING && (direction === 'right' ? 'carousel-item-next' : 'carousel-item-prev'); var itemClasses = mapToCssModules(classnames(className, 'carousel-item', isActive && 'active', directionClassName, orderClassName), cssModule); return React__default.createElement( Tag, { className: itemClasses }, children ); } ); } }]); return CarouselItem; }(React__default.Component); CarouselItem.propTypes = _extends({}, Transition.propTypes, { tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), in: propTypes$1.bool, cssModule: propTypes$1.object, children: propTypes$1.node, slide: propTypes$1.bool, className: propTypes$1.string }); CarouselItem.defaultProps = _extends({}, Transition.defaultProps, { tag: 'div', timeout: TransitionTimeouts.Carousel, slide: true }); CarouselItem.contextTypes = { direction: propTypes$1.string }; var Carousel = function (_React$Component) { inherits(Carousel, _React$Component); function Carousel(props) { classCallCheck(this, Carousel); var _this = possibleConstructorReturn(this, (Carousel.__proto__ || Object.getPrototypeOf(Carousel)).call(this, props)); _this.handleKeyPress = _this.handleKeyPress.bind(_this); _this.renderItems = _this.renderItems.bind(_this); _this.hoverStart = _this.hoverStart.bind(_this); _this.hoverEnd = _this.hoverEnd.bind(_this); _this.state = { direction: 'right', indicatorClicked: false }; return _this; } createClass(Carousel, [{ key: 'getChildContext', value: function getChildContext() { return { direction: this.state.direction }; } }, { key: 'componentDidMount', value: function componentDidMount() { // Set up the cycle if (this.props.ride === 'carousel') { this.setInterval(); } // TODO: move this to the specific carousel like bootstrap. Currently it will trigger ALL carousels on the page. document.addEventListener('keyup', this.handleKeyPress); } }, { key: 'componentWillReceiveProps', value: function componentWillReceiveProps(nextProps) { this.setInterval(nextProps); // Calculate the direction to turn if (this.props.activeIndex + 1 === nextProps.activeIndex) { this.setState({ direction: 'right' }); } else if (this.props.activeIndex - 1 === nextProps.activeIndex) { this.setState({ direction: 'left' }); } else if (this.props.activeIndex > nextProps.activeIndex) { this.setState({ direction: this.state.indicatorClicked ? 'left' : 'right' }); } else if (this.props.activeIndex !== nextProps.activeIndex) { this.setState({ direction: this.state.indicatorClicked ? 'right' : 'left' }); } this.setState({ indicatorClicked: false }); } }, { key: 'componentWillUnmount', value: function componentWillUnmount() { this.clearInterval(); document.removeEventListener('keyup', this.handleKeyPress); } }, { key: 'setInterval', value: function (_setInterval) { function setInterval() { return _setInterval.apply(this, arguments); } setInterval.toString = function () { return _setInterval.toString(); }; return setInterval; }(function () { var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props; // make sure not to have multiple intervals going... this.clearInterval(); if (props.interval) { this.cycleInterval = setInterval(function () { props.next(); }, parseInt(props.interval, 10)); } }) }, { key: 'clearInterval', value: function (_clearInterval) { function clearInterval() { return _clearInterval.apply(this, arguments); } clearInterval.toString = function () { return _clearInterval.toString(); }; return clearInterval; }(function () { clearInterval(this.cycleInterval); }) }, { key: 'hoverStart', value: function hoverStart() { if (this.props.pause === 'hover') { this.clearInterval(); } if (this.props.mouseEnter) { var _props; (_props = this.props).mouseEnter.apply(_props, arguments); } } }, { key: 'hoverEnd', value: function hoverEnd() { if (this.props.pause === 'hover') { this.setInterval(); } if (this.props.mouseLeave) { var _props2; (_props2 = this.props).mouseLeave.apply(_props2, arguments); } } }, { key: 'handleKeyPress', value: function handleKeyPress(evt) { if (this.props.keyboard) { if (evt.keyCode === 37) { this.props.previous(); } else if (evt.keyCode === 39) { this.props.next(); } } } }, { key: 'renderItems', value: function renderItems(carouselItems, className) { var _this2 = this; var slide = this.props.slide; return React__default.createElement( 'div', { role: 'listbox', className: className }, carouselItems.map(function (item, index) { var isIn = index === _this2.props.activeIndex; return React__default.cloneElement(item, { in: isIn, slide: slide }); }) ); } }, { key: 'render', value: function render() { var _this3 = this; var _props3 = this.props, children = _props3.children, cssModule = _props3.cssModule, slide = _props3.slide, className = _props3.className; var outerClasses = mapToCssModules(classnames(className, 'carousel', slide && 'slide'), cssModule); var innerClasses = mapToCssModules(classnames('carousel-inner'), cssModule); var slidesOnly = children.every(function (child) { return child.type === CarouselItem; }); // Rendering only slides if (slidesOnly) { return React__default.createElement( 'div', { className: outerClasses, onMouseEnter: this.hoverStart, onMouseLeave: this.hoverEnd }, this.renderItems(children, innerClasses) ); } // Rendering slides and controls if (children[0] instanceof Array) { var _carouselItems = children[0]; var _controlLeft = children[1]; var _controlRight = children[2]; return React__default.createElement( 'div', { className: outerClasses, onMouseEnter: this.hoverStart, onMouseLeave: this.hoverEnd }, this.renderItems(_carouselItems, innerClasses), _controlLeft, _controlRight ); } // Rendering indicators, slides and controls var indicators = children[0]; var wrappedOnClick = function wrappedOnClick(e) { if (typeof indicators.props.onClickHandler === 'function') { _this3.setState({ indicatorClicked: true }, function () { return indicators.props.onClickHandler(e); }); } }; var wrappedIndicators = React__default.cloneElement(indicators, { onClickHandler: wrappedOnClick }); var carouselItems = children[1]; var controlLeft = children[2]; var controlRight = children[3]; return React__default.createElement( 'div', { className: outerClasses, onMouseEnter: this.hoverStart, onMouseLeave: this.hoverEnd }, wrappedIndicators, this.renderItems(carouselItems, innerClasses), controlLeft, controlRight ); } }]); return Carousel; }(React__default.Component); Carousel.propTypes = { // the current active slide of the carousel activeIndex: propTypes$1.number, // a function which should advance the carousel to the next slide (via activeIndex) next: propTypes$1.func.isRequired, // a function which should advance the carousel to the previous slide (via activeIndex) previous: propTypes$1.func.isRequired, // controls if the left and right arrow keys should control the carousel keyboard: propTypes$1.bool, /* If set to "hover", pauses the cycling of the carousel on mouseenter and resumes the cycling of the carousel on * mouseleave. If set to false, hovering over the carousel won't pause it. (default: "hover") */ pause: propTypes$1.oneOf(['hover', false]), // Autoplays the carousel after the user manually cycles the first item. If "carousel", autoplays the carousel on load. // This is how bootstrap defines it... I would prefer a bool named autoplay or something... ride: propTypes$1.oneOf(['carousel']), // the interval at which the carousel automatically cycles (default: 5000) // eslint-disable-next-line react/no-unused-prop-types interval: propTypes$1.oneOfType([propTypes$1.number, propTypes$1.string, propTypes$1.bool]), children: propTypes$1.array, // called when the mouse enters the Carousel mouseEnter: propTypes$1.func, // called when the mouse exits the Carousel mouseLeave: propTypes$1.func, // controls whether the slide animation on the Carousel works or not slide: propTypes$1.bool, cssModule: propTypes$1.object, className: propTypes$1.string }; Carousel.defaultProps = { interval: 5000, pause: 'hover', keyboard: true, slide: true }; Carousel.childContextTypes = { direction: propTypes$1.string }; var CarouselControl = function CarouselControl(props) { var direction = props.direction, onClickHandler = props.onClickHandler, cssModule = props.cssModule, directionText = props.directionText, className = props.className; var anchorClasses = mapToCssModules(classnames(className, 'carousel-control-' + direction), cssModule); var iconClasses = mapToCssModules(classnames('carousel-control-' + direction + '-icon'), cssModule); var screenReaderClasses = mapToCssModules(classnames('sr-only'), cssModule); return React__default.createElement( 'a', { className: anchorClasses, role: 'button', tabIndex: '0', onClick: function onClick(e) { e.preventDefault(); onClickHandler(); } }, React__default.createElement('span', { className: iconClasses, 'aria-hidden': 'true' }), React__default.createElement( 'span', { className: screenReaderClasses }, directionText || direction ) ); }; CarouselControl.propTypes = { direction: propTypes$1.oneOf(['prev', 'next']).isRequired, onClickHandler: propTypes$1.func.isRequired, cssModule: propTypes$1.object, directionText: propTypes$1.string, className: propTypes$1.string }; var CarouselIndicators = function CarouselIndicators(props) { var items = props.items, activeIndex = props.activeIndex, cssModule = props.cssModule, onClickHandler = props.onClickHandler, className = props.className; var listClasses = mapToCssModules(classnames(className, 'carousel-indicators'), cssModule); var indicators = items.map(function (item, idx) { var indicatorClasses = mapToCssModules(classnames({ active: activeIndex === idx }), cssModule); return React__default.createElement('li', { key: '' + (item.key || item.src) + item.caption + item.altText, onClick: function onClick(e) { e.preventDefault(); onClickHandler(idx); }, className: indicatorClasses }); }); return React__default.createElement( 'ol', { className: listClasses }, indicators ); }; CarouselIndicators.propTypes = { items: propTypes$1.array.isRequired, activeIndex: propTypes$1.number.isRequired, cssModule: propTypes$1.object, onClickHandler: propTypes$1.func.isRequired, className: propTypes$1.string }; var CarouselCaption = function CarouselCaption(props) { var captionHeader = props.captionHeader, captionText = props.captionText, cssModule = props.cssModule, className = props.className; var classes = mapToCssModules(classnames(className, 'carousel-caption', 'd-none', 'd-md-block'), cssModule); return React__default.createElement( 'div', { className: classes }, React__default.createElement( 'h3', null, captionHeader ), React__default.createElement( 'p', null, captionText ) ); }; CarouselCaption.propTypes = { captionHeader: propTypes$1.string, captionText: propTypes$1.string.isRequired, cssModule: propTypes$1.object, className: propTypes$1.string }; var propTypes$32 = { items: propTypes$1.array.isRequired, indicators: propTypes$1.bool, controls: propTypes$1.bool, autoPlay: propTypes$1.bool, activeIndex: propTypes$1.number, next: propTypes$1.func, previous: propTypes$1.func, goToIndex: propTypes$1.func }; var UncontrolledCarousel = function (_Component) { inherits(UncontrolledCarousel, _Component); function UncontrolledCarousel(props) { classCallCheck(this, UncontrolledCarousel); var _this = possibleConstructorReturn(this, (UncontrolledCarousel.__proto__ || Object.getPrototypeOf(UncontrolledCarousel)).call(this, props)); _this.animating = false; _this.state = { activeIndex: 0 }; _this.next = _this.next.bind(_this); _this.previous = _this.previous.bind(_this); _this.goToIndex = _this.goToIndex.bind(_this); _this.onExiting = _this.onExiting.bind(_this); _this.onExited = _this.onExited.bind(_this); return _this; } createClass(UncontrolledCarousel, [{ key: 'onExiting', value: function onExiting() { this.animating = true; } }, { key: 'onExited', value: function onExited() { this.animating = false; } }, { key: 'next', value: function next() { if (this.animating) return; var nextIndex = this.state.activeIndex === this.props.items.length - 1 ? 0 : this.state.activeIndex + 1; this.setState({ activeIndex: nextIndex }); } }, { key: 'previous', value: function previous() { if (this.animating) return; var nextIndex = this.state.activeIndex === 0 ? this.props.items.length - 1 : this.state.activeIndex - 1; this.setState({ activeIndex: nextIndex }); } }, { key: 'goToIndex', value: function goToIndex(newIndex) { if (this.animating) return; this.setState({ activeIndex: newIndex }); } }, { key: 'render', value: function render() { var _this2 = this; var _props = this.props, autoPlay = _props.autoPlay, indicators = _props.indicators, controls = _props.controls, items = _props.items, goToIndex = _props.goToIndex, props = objectWithoutProperties(_props, ['autoPlay', 'indicators', 'controls', 'items', 'goToIndex']); var activeIndex = this.state.activeIndex; var slides = items.map(function (item) { return React__default.createElement( CarouselItem, { onExiting: _this2.onExiting, onExited: _this2.onExited, key: item.src }, React__default.createElement('img', { src: item.src, alt: item.altText }), React__default.createElement(CarouselCaption, { captionText: item.caption, captionHeader: item.caption }) ); }); return React__default.createElement( Carousel, _extends({ activeIndex: activeIndex, next: this.next, previous: this.previous, ride: autoPlay ? 'carousel' : undefined }, props), indicators && React__default.createElement(CarouselIndicators, { items: items, activeIndex: props.activeIndex || activeIndex, onClickHandler: goToIndex || this.goToIndex }), slides, controls && React__default.createElement(CarouselControl, { direction: 'prev', directionText: 'Previous', onClickHandler: props.previous || this.previous }), controls && React__default.createElement(CarouselControl, { direction: 'next', directionText: 'Next', onClickHandler: props.next || this.next }) ); } }]); return UncontrolledCarousel; }(React.Component); UncontrolledCarousel.propTypes = propTypes$32; UncontrolledCarousel.defaultProps = { controls: true, indicators: true, autoPlay: true }; var propTypes$33 = { tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), className: propTypes$1.string, cssModule: propTypes$1.object }; var defaultProps$30 = { tag: 'h6' }; var CardSubtitle = function CardSubtitle(props) { var className = props.className, cssModule = props.cssModule, Tag = props.tag, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'tag']); var classes = mapToCssModules(classnames(className, 'card-subtitle'), cssModule); return React__default.createElement(Tag, _extends({}, attributes, { className: classes })); }; CardSubtitle.propTypes = propTypes$33; CardSubtitle.defaultProps = defaultProps$30; var propTypes$34 = { tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), className: propTypes$1.string, cssModule: propTypes$1.object }; var defaultProps$31 = { tag: 'p' }; var CardText = function CardText(props) { var className = props.className, cssModule = props.cssModule, Tag = props.tag, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'tag']); var classes = mapToCssModules(classnames(className, 'card-text'), cssModule); return React__default.createElement(Tag, _extends({}, attributes, { className: classes })); }; CardText.propTypes = propTypes$34; CardText.defaultProps = defaultProps$31; var propTypes$35 = { tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), className: propTypes$1.string, cssModule: propTypes$1.object }; var defaultProps$32 = { tag: 'h5' }; var CardTitle = function CardTitle(props) { var className = props.className, cssModule = props.cssModule, Tag = props.tag, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'tag']); var classes = mapToCssModules(classnames(className, 'card-title'), cssModule); return React__default.createElement(Tag, _extends({}, attributes, { className: classes })); }; CardTitle.propTypes = propTypes$35; CardTitle.defaultProps = defaultProps$32; var propTypes$36 = { children: propTypes$1.node.isRequired, className: propTypes$1.string, placement: propTypes$1.string, placementPrefix: propTypes$1.string, hideArrow: propTypes$1.bool, tag: propTypes$1.string, isOpen: propTypes$1.bool.isRequired, cssModule: propTypes$1.object, offset: propTypes$1.oneOfType([propTypes$1.string, propTypes$1.number]), fallbackPlacement: propTypes$1.oneOfType([propTypes$1.string, propTypes$1.array]), flip: propTypes$1.bool, container: propTypes$1.oneOfType([propTypes$1.string, propTypes$1.func, DOMElement]), target: propTypes$1.oneOfType([propTypes$1.string, propTypes$1.func, DOMElement]).isRequired, modifiers: propTypes$1.object }; var defaultProps$33 = { placement: 'auto', hideArrow: false, isOpen: false, offset: 0, fallbackPlacement: 'flip', flip: true, container: 'body', modifiers: {} }; var childContextTypes$1 = { popperManager: propTypes$1.object.isRequired }; var PopperContent = function (_React$Component) { inherits(PopperContent, _React$Component); function PopperContent(props) { classCallCheck(this, PopperContent); var _this = possibleConstructorReturn(this, (PopperContent.__proto__ || Object.getPrototypeOf(PopperContent)).call(this, props)); _this.handlePlacementChange = _this.handlePlacementChange.bind(_this); _this.setTargetNode = _this.setTargetNode.bind(_this); _this.getTargetNode = _this.getTargetNode.bind(_this); _this.state = {}; return _this; } createClass(PopperContent, [{ key: 'getChildContext', value: function getChildContext() { return { popperManager: { setTargetNode: this.setTargetNode, getTargetNode: this.getTargetNode } }; } }, { key: 'componentDidMount', value: function componentDidMount() { this.handleProps(); } }, { key: 'componentDidUpdate', value: function componentDidUpdate(prevProps) { if (this.props.isOpen !== prevProps.isOpen) { this.handleProps(); } else if (this._element) { // rerender this.renderIntoSubtree(); } } }, { key: 'componentWillUnmount', value: function componentWillUnmount() { this.hide(); } }, { key: 'setTargetNode', value: function setTargetNode(node) { this.targetNode = node; } }, { key: 'getTargetNode', value: function getTargetNode() { return this.targetNode; } }, { key: 'getContainerNode', value: function getContainerNode() { return getTarget(this.props.container); } }, { key: 'handlePlacementChange', value: function handlePlacementChange(data) { if (this.state.placement !== data.placement) { this.setState({ placement: data.placement }); } return data; } }, { key: 'handleProps', value: function handleProps() { if (this.props.container !== 'inline') { if (this.props.isOpen) { this.show(); } else { this.hide(); } } } }, { key: 'hide', value: function hide() { if (this._element) { this.getContainerNode().removeChild(this._element); ReactDOM.unmountComponentAtNode(this._element); this._element = null; } } }, { key: 'show', value: function show() { this._element = document.createElement('div'); this.getContainerNode().appendChild(this._element); this.renderIntoSubtree(); if (this._element.childNodes && this._element.childNodes[0] && this._element.childNodes[0].focus) { this._element.childNodes[0].focus(); } } }, { key: 'renderIntoSubtree', value: function renderIntoSubtree() { ReactDOM.unstable_renderSubtreeIntoContainer(this, this.renderChildren(), this._element); } }, { key: 'renderChildren', value: function renderChildren() { var _props = this.props, cssModule = _props.cssModule, children = _props.children, isOpen = _props.isOpen, flip = _props.flip, target = _props.target, offset = _props.offset, fallbackPlacement = _props.fallbackPlacement, placementPrefix = _props.placementPrefix, hideArrow = _props.hideArrow, className = _props.className, tag = _props.tag, container = _props.container, modifiers = _props.modifiers, attrs = objectWithoutProperties(_props, ['cssModule', 'children', 'isOpen', 'flip', 'target', 'offset', 'fallbackPlacement', 'placementPrefix', 'hideArrow', 'className', 'tag', 'container', 'modifiers']); var arrowClassName = mapToCssModules('arrow', cssModule); var placement = (this.state.placement || attrs.placement).split('-')[0]; var popperClassName = mapToCssModules(classnames(className, placementPrefix ? placementPrefix + '-' + placement : placement), this.props.cssModule); var extendedModifiers = _extends({ offset: { offset: offset }, flip: { enabled: flip, behavior: fallbackPlacement }, update: { enabled: true, order: 950, fn: this.handlePlacementChange } }, modifiers); return React__default.createElement( reactPopper_2, _extends({ modifiers: extendedModifiers }, attrs, { component: tag, className: popperClassName }), children, !hideArrow && React__default.createElement(reactPopper_1, { className: arrowClassName }) ); } }, { key: 'render', value: function render() { this.setTargetNode(getTarget(this.props.target)); if (this.props.container === 'inline') { return this.props.isOpen ? this.renderChildren() : null; } return null; } }]); return PopperContent; }(React__default.Component); PopperContent.propTypes = propTypes$36; PopperContent.defaultProps = defaultProps$33; PopperContent.childContextTypes = childContextTypes$1; var PopperTargetHelper = function PopperTargetHelper(props, context) { context.popperManager.setTargetNode(getTarget(props.target)); return null; }; PopperTargetHelper.contextTypes = { popperManager: propTypes$1.object.isRequired }; PopperTargetHelper.propTypes = { target: propTypes$1.oneOfType([propTypes$1.string, propTypes$1.func, DOMElement]).isRequired }; var propTypes$37 = { placement: propTypes$1.oneOf(PopperPlacements), target: propTypes$1.oneOfType([propTypes$1.string, propTypes$1.func, DOMElement]).isRequired, container: propTypes$1.oneOfType([propTypes$1.string, propTypes$1.func, DOMElement]), isOpen: propTypes$1.bool, disabled: propTypes$1.bool, hideArrow: propTypes$1.bool, className: propTypes$1.string, innerClassName: propTypes$1.string, placementPrefix: propTypes$1.string, cssModule: propTypes$1.object, toggle: propTypes$1.func, delay: propTypes$1.oneOfType([propTypes$1.shape({ show: propTypes$1.number, hide: propTypes$1.number }), propTypes$1.number]), modifiers: propTypes$1.object }; var DEFAULT_DELAYS = { show: 0, hide: 0 }; var defaultProps$34 = { isOpen: false, hideArrow: false, placement: 'right', placementPrefix: 'bs-popover', delay: DEFAULT_DELAYS, toggle: function toggle() {} }; var Popover = function (_React$Component) { inherits(Popover, _React$Component); function Popover(props) { classCallCheck(this, Popover); var _this = possibleConstructorReturn(this, (Popover.__proto__ || Object.getPrototypeOf(Popover)).call(this, props)); _this.addTargetEvents = _this.addTargetEvents.bind(_this); _this.handleDocumentClick = _this.handleDocumentClick.bind(_this); _this.removeTargetEvents = _this.removeTargetEvents.bind(_this); _this.getRef = _this.getRef.bind(_this); _this.toggle = _this.toggle.bind(_this); _this.show = _this.show.bind(_this); _this.hide = _this.hide.bind(_this); return _this; } createClass(Popover, [{ key: 'componentDidMount', value: function componentDidMount() { this._target = getTarget(this.props.target); this.handleProps(); } }, { key: 'componentDidUpdate', value: function componentDidUpdate() { this.handleProps(); } }, { key: 'componentWillUnmount', value: function componentWillUnmount() { this.clearShowTimeout(); this.clearHideTimeout(); this.removeTargetEvents(); } }, { key: 'getRef', value: function getRef(ref) { this._popover = ref; } }, { key: 'getDelay', value: function getDelay(key) { var delay = this.props.delay; if ((typeof delay === 'undefined' ? 'undefined' : _typeof(delay)) === 'object') { return isNaN(delay[key]) ? DEFAULT_DELAYS[key] : delay[key]; } return delay; } }, { key: 'handleProps', value: function handleProps() { if (this.props.isOpen) { this.show(); } else { this.hide(); } } }, { key: 'show', value: function show() { this.clearHideTimeout(); this.addTargetEvents(); if (!this.props.isOpen) { this.clearShowTimeout(); this._showTimeout = setTimeout(this.toggle, this.getDelay('show')); } } }, { key: 'hide', value: function hide() { this.clearShowTimeout(); this.removeTargetEvents(); if (this.props.isOpen) { this.clearHideTimeout(); this._hideTimeout = setTimeout(this.toggle, this.getDelay('hide')); } } }, { key: 'clearShowTimeout', value: function clearShowTimeout() { clearTimeout(this._showTimeout); this._showTimeout = undefined; } }, { key: 'clearHideTimeout', value: function clearHideTimeout() { clearTimeout(this._hideTimeout); this._hideTimeout = undefined; } }, { key: 'handleDocumentClick', value: function handleDocumentClick(e) { if (e.target !== this._target && !this._target.contains(e.target) && e.target !== this._popover && !(this._popover && this._popover.contains(e.target))) { if (this._hideTimeout) { this.clearHideTimeout(); } if (this.props.isOpen) { this.toggle(e); } } } }, { key: 'addTargetEvents', value: function addTargetEvents() { var _this2 = this; ['click', 'touchstart'].forEach(function (event) { return document.addEventListener(event, _this2.handleDocumentClick, true); }); } }, { key: 'removeTargetEvents', value: function removeTargetEvents() { var _this3 = this; ['click', 'touchstart'].forEach(function (event) { return document.removeEventListener(event, _this3.handleDocumentClick, true); }); } }, { key: 'toggle', value: function toggle(e) { if (this.props.disabled) { return e && e.preventDefault(); } return this.props.toggle(e); } }, { key: 'render', value: function render() { if (!this.props.isOpen) { return null; } var attributes = omit(this.props, Object.keys(propTypes$37)); var classes = mapToCssModules(classnames('popover-inner', this.props.innerClassName), this.props.cssModule); var popperClasses = mapToCssModules(classnames('popover', 'show', this.props.className), this.props.cssModule); return React__default.createElement( PopperContent, { className: popperClasses, target: this.props.target, isOpen: this.props.isOpen, hideArrow: this.props.hideArrow, placement: this.props.placement, placementPrefix: this.props.placementPrefix, container: this.props.container, modifiers: this.props.modifiers }, React__default.createElement('div', _extends({}, attributes, { className: classes, ref: this.getRef })) ); } }]); return Popover; }(React__default.Component); Popover.propTypes = propTypes$37; Popover.defaultProps = defaultProps$34; var propTypes$38 = { tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), className: propTypes$1.string, cssModule: propTypes$1.object }; var defaultProps$35 = { tag: 'h3' }; var PopoverHeader = function PopoverHeader(props) { var className = props.className, cssModule = props.cssModule, Tag = props.tag, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'tag']); var classes = mapToCssModules(classnames(className, 'popover-header'), cssModule); return React__default.createElement(Tag, _extends({}, attributes, { className: classes })); }; PopoverHeader.propTypes = propTypes$38; PopoverHeader.defaultProps = defaultProps$35; function PopoverTitle(props) { warnOnce('The "PopoverTitle" component has been deprecated.\nPlease use component "PopoverHeader".'); return React__default.createElement(PopoverHeader, props); } var propTypes$39 = { tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), className: propTypes$1.string, cssModule: propTypes$1.object }; var defaultProps$36 = { tag: 'div' }; var PopoverBody = function PopoverBody(props) { var className = props.className, cssModule = props.cssModule, Tag = props.tag, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'tag']); var classes = mapToCssModules(classnames(className, 'popover-body'), cssModule); return React__default.createElement(Tag, _extends({}, attributes, { className: classes })); }; PopoverBody.propTypes = propTypes$39; PopoverBody.defaultProps = defaultProps$36; function PopoverContent(props) { warnOnce('The "PopoverContent" component has been deprecated.\nPlease use component "PopoverBody".'); return React__default.createElement(PopoverBody, props); } /** * lodash (Custom Build) <https://lodash.com/> * Build: `lodash modularize exports="npm" -o ./` * Copyright jQuery Foundation and other contributors <https://jquery.org/> * Released under MIT license <https://lodash.com/license> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ /** Used as references for various `Number` constants. */ var NAN = 0 / 0; /** `Object#toString` result references. */ var symbolTag = '[object Symbol]'; /** Used to match leading and trailing whitespace. */ var reTrim = /^\s+|\s+$/g; /** Used to detect bad signed hexadecimal string values. */ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; /** Used to detect binary string values. */ var reIsBinary = /^0b[01]+$/i; /** Used to detect octal string values. */ var reIsOctal = /^0o[0-7]+$/i; /** Built-in method references without a dependency on `root`. */ var freeParseInt = parseInt; /** Used for built-in method references. */ var objectProto$1 = Object.prototype; /** * Used to resolve the * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var objectToString$1 = objectProto$1.toString; /** * Checks if `value` is the * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. * @example * * _.isObject({}); * // => true * * _.isObject([1, 2, 3]); * // => true * * _.isObject(_.noop); * // => true * * _.isObject(null); * // => false */ function isObject$2(value) { var type = typeof value === 'undefined' ? 'undefined' : _typeof(value); return !!value && (type == 'object' || type == 'function'); } /** * Checks if `value` is object-like. A value is object-like if it's not `null` * and has a `typeof` result of "object". * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is object-like, else `false`. * @example * * _.isObjectLike({}); * // => true * * _.isObjectLike([1, 2, 3]); * // => true * * _.isObjectLike(_.noop); * // => false * * _.isObjectLike(null); * // => false */ function isObjectLike(value) { return !!value && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) == 'object'; } /** * Checks if `value` is classified as a `Symbol` primitive or object. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. * @example * * _.isSymbol(Symbol.iterator); * // => true * * _.isSymbol('abc'); * // => false */ function isSymbol(value) { return (typeof value === 'undefined' ? 'undefined' : _typeof(value)) == 'symbol' || isObjectLike(value) && objectToString$1.call(value) == symbolTag; } /** * Converts `value` to a number. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to process. * @returns {number} Returns the number. * @example * * _.toNumber(3.2); * // => 3.2 * * _.toNumber(Number.MIN_VALUE); * // => 5e-324 * * _.toNumber(Infinity); * // => Infinity * * _.toNumber('3.2'); * // => 3.2 */ function toNumber(value) { if (typeof value == 'number') { return value; } if (isSymbol(value)) { return NAN; } if (isObject$2(value)) { var other = typeof value.valueOf == 'function' ? value.valueOf() : value; value = isObject$2(other) ? other + '' : other; } if (typeof value != 'string') { return value === 0 ? value : +value; } value = value.replace(reTrim, ''); var isBinary = reIsBinary.test(value); return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value; } var lodash_tonumber = toNumber; var propTypes$40 = { children: propTypes$1.node, bar: propTypes$1.bool, multi: propTypes$1.bool, tag: propTypes$1.string, value: propTypes$1.oneOfType([propTypes$1.string, propTypes$1.number]), max: propTypes$1.oneOfType([propTypes$1.string, propTypes$1.number]), animated: propTypes$1.bool, striped: propTypes$1.bool, color: propTypes$1.string, className: propTypes$1.string, barClassName: propTypes$1.string, cssModule: propTypes$1.object }; var defaultProps$37 = { tag: 'div', value: 0, max: 100 }; var Progress = function Progress(props) { var children = props.children, className = props.className, barClassName = props.barClassName, cssModule = props.cssModule, value = props.value, max = props.max, animated = props.animated, striped = props.striped, color = props.color, bar = props.bar, multi = props.multi, Tag = props.tag, attributes = objectWithoutProperties(props, ['children', 'className', 'barClassName', 'cssModule', 'value', 'max', 'animated', 'striped', 'color', 'bar', 'multi', 'tag']); var percent = lodash_tonumber(value) / lodash_tonumber(max) * 100; var progressClasses = mapToCssModules(classnames(className, 'progress'), cssModule); var progressBarClasses = mapToCssModules(classnames('progress-bar', bar ? className || barClassName : barClassName, animated ? 'progress-bar-animated' : null, color ? 'bg-' + color : null, striped || animated ? 'progress-bar-striped' : null), cssModule); var ProgressBar = multi ? children : React__default.createElement('div', { className: progressBarClasses, style: { width: percent + '%' }, role: 'progressbar', 'aria-valuenow': value, 'aria-valuemin': '0', 'aria-valuemax': max, children: children }); if (bar) { return ProgressBar; } return React__default.createElement(Tag, _extends({}, attributes, { className: progressClasses, children: ProgressBar })); }; Progress.propTypes = propTypes$40; Progress.defaultProps = defaultProps$37; var propTypes$42 = { children: propTypes$1.node.isRequired, node: propTypes$1.any }; var Portal = function (_React$Component) { inherits(Portal, _React$Component); function Portal() { classCallCheck(this, Portal); return possibleConstructorReturn(this, (Portal.__proto__ || Object.getPrototypeOf(Portal)).apply(this, arguments)); } createClass(Portal, [{ key: 'componentWillUnmount', value: function componentWillUnmount() { if (this.defaultNode) { document.body.removeChild(this.defaultNode); } this.defaultNode = null; } }, { key: 'render', value: function render() { if (!canUseDOM) { return null; } if (!this.props.node && !this.defaultNode) { this.defaultNode = document.createElement('div'); document.body.appendChild(this.defaultNode); } return ReactDOM.createPortal(this.props.children, this.props.node || this.defaultNode); } }]); return Portal; }(React__default.Component); Portal.propTypes = propTypes$42; function noop() {} var FadePropTypes = propTypes$1.shape(Fade.propTypes); var propTypes$41 = { isOpen: propTypes$1.bool, autoFocus: propTypes$1.bool, centered: propTypes$1.bool, size: propTypes$1.string, toggle: propTypes$1.func, keyboard: propTypes$1.bool, role: propTypes$1.string, labelledBy: propTypes$1.string, backdrop: propTypes$1.oneOfType([propTypes$1.bool, propTypes$1.oneOf(['static'])]), onEnter: propTypes$1.func, onExit: propTypes$1.func, onOpened: propTypes$1.func, onClosed: propTypes$1.func, children: propTypes$1.node, className: propTypes$1.string, wrapClassName: propTypes$1.string, modalClassName: propTypes$1.string, backdropClassName: propTypes$1.string, contentClassName: propTypes$1.string, external: propTypes$1.node, fade: propTypes$1.bool, cssModule: propTypes$1.object, zIndex: propTypes$1.oneOfType([propTypes$1.number, propTypes$1.string]), backdropTransition: FadePropTypes, modalTransition: FadePropTypes }; var propsToOmit = Object.keys(propTypes$41); var defaultProps$38 = { isOpen: false, autoFocus: true, centered: false, role: 'dialog', backdrop: true, keyboard: true, zIndex: 1050, fade: true, onOpened: noop, onClosed: noop, modalTransition: { timeout: TransitionTimeouts.Modal }, backdropTransition: { mountOnEnter: true, timeout: TransitionTimeouts.Fade // uses standard fade transition } }; var Modal = function (_React$Component) { inherits(Modal, _React$Component); function Modal(props) { classCallCheck(this, Modal); var _this = possibleConstructorReturn(this, (Modal.__proto__ || Object.getPrototypeOf(Modal)).call(this, props)); _this._element = null; _this._originalBodyPadding = null; _this.handleBackdropClick = _this.handleBackdropClick.bind(_this); _this.handleEscape = _this.handleEscape.bind(_this); _this.onOpened = _this.onOpened.bind(_this); _this.onClosed = _this.onClosed.bind(_this); _this.state = { isOpen: props.isOpen }; if (props.isOpen) { _this.init(); } return _this; } createClass(Modal, [{ key: 'componentDidMount', value: function componentDidMount() { if (this.props.onEnter) { this.props.onEnter(); } if (this.state.isOpen && this.props.autoFocus) { this.setFocus(); } this._isMounted = true; } }, { key: 'componentWillReceiveProps', value: function componentWillReceiveProps(nextProps) { if (nextProps.isOpen && !this.props.isOpen) { this.setState({ isOpen: nextProps.isOpen }); } } }, { key: 'componentWillUpdate', value: function componentWillUpdate(nextProps, nextState) { if (nextState.isOpen && !this.state.isOpen) { this.init(); } } }, { key: 'componentDidUpdate', value: function componentDidUpdate(prevProps, prevState) { if (this.props.autoFocus && this.state.isOpen && !prevState.isOpen) { this.setFocus(); } } }, { key: 'componentWillUnmount', value: function componentWillUnmount() { if (this.props.onExit) { this.props.onExit(); } if (this.state.isOpen) { this.destroy(); } this._isMounted = false; } }, { key: 'onOpened', value: function onOpened(node, isAppearing) { this.props.onOpened(); (this.props.modalTransition.onEntered || noop)(node, isAppearing); } }, { key: 'onClosed', value: function onClosed(node) { // so all methods get called before it is unmounted this.props.onClosed(); (this.props.modalTransition.onExited || noop)(node); this.destroy(); if (this._isMounted) { this.setState({ isOpen: false }); } } }, { key: 'setFocus', value: function setFocus() { if (this._dialog && this._dialog.parentNode && typeof this._dialog.parentNode.focus === 'function') { this._dialog.parentNode.focus(); } } }, { key: 'handleBackdropClick', value: function handleBackdropClick(e) { e.stopPropagation(); if (!this.props.isOpen || this.props.backdrop !== true) return; var container = this._dialog; if (e.target && !container.contains(e.target) && this.props.toggle) { this.props.toggle(e); } } }, { key: 'handleEscape', value: function handleEscape(e) { if (this.props.isOpen && this.props.keyboard && e.keyCode === 27 && this.props.toggle) { this.props.toggle(e); } } }, { key: 'init', value: function init() { this._element = document.createElement('div'); this._element.setAttribute('tabindex', '-1'); this._element.style.position = 'relative'; this._element.style.zIndex = this.props.zIndex; this._originalBodyPadding = getOriginalBodyPadding(); conditionallyUpdateScrollbar(); document.body.appendChild(this._element); if (!this.bodyClassAdded) { document.body.className = classnames(document.body.className, mapToCssModules('modal-open', this.props.cssModule)); this.bodyClassAdded = true; } } }, { key: 'destroy', value: function destroy() { if (this._element) { document.body.removeChild(this._element); this._element = null; } if (this.bodyClassAdded) { var modalOpenClassName = mapToCssModules('modal-open', this.props.cssModule); // Use regex to prevent matching `modal-open` as part of a different class, e.g. `my-modal-opened` var modalOpenClassNameRegex = new RegExp('(^| )' + modalOpenClassName + '( |$)'); document.body.className = document.body.className.replace(modalOpenClassNameRegex, ' ').trim(); this.bodyClassAdded = false; } setScrollbarWidth(this._originalBodyPadding); } }, { key: 'renderModalDialog', value: function renderModalDialog() { var _classNames, _this2 = this; var attributes = omit(this.props, propsToOmit); var dialogBaseClass = 'modal-dialog'; return React__default.createElement( 'div', _extends({}, attributes, { className: mapToCssModules(classnames(dialogBaseClass, this.props.className, (_classNames = {}, defineProperty(_classNames, 'modal-' + this.props.size, this.props.size), defineProperty(_classNames, dialogBaseClass + '-centered', this.props.centered), _classNames)), this.props.cssModule), role: 'document', ref: function ref(c) { _this2._dialog = c; } }), React__default.createElement( 'div', { className: mapToCssModules(classnames('modal-content', this.props.contentClassName), this.props.cssModule) }, this.props.children ) ); } }, { key: 'render', value: function render() { if (this.state.isOpen) { var _props = this.props, wrapClassName = _props.wrapClassName, modalClassName = _props.modalClassName, backdropClassName = _props.backdropClassName, cssModule = _props.cssModule, isOpen = _props.isOpen, backdrop = _props.backdrop, role = _props.role, labelledBy = _props.labelledBy, external = _props.external; var modalAttributes = { onClick: this.handleBackdropClick, onKeyUp: this.handleEscape, style: { display: 'block' }, 'aria-labelledby': labelledBy, role: role, tabIndex: '-1' }; var hasTransition = this.props.fade; var modalTransition = _extends({}, Fade.defaultProps, this.props.modalTransition, { baseClass: hasTransition ? this.props.modalTransition.baseClass : '', timeout: hasTransition ? this.props.modalTransition.timeout : 0 }); var backdropTransition = _extends({}, Fade.defaultProps, this.props.backdropTransition, { baseClass: hasTransition ? this.props.backdropTransition.baseClass : '', timeout: hasTransition ? this.props.backdropTransition.timeout : 0 }); return React__default.createElement( Portal, { node: this._element }, React__default.createElement( 'div', { className: mapToCssModules(wrapClassName) }, React__default.createElement( Fade, _extends({}, modalAttributes, modalTransition, { 'in': isOpen, onEntered: this.onOpened, onExited: this.onClosed, cssModule: cssModule, className: mapToCssModules(classnames('modal', modalClassName), cssModule) }), external, this.renderModalDialog() ), React__default.createElement(Fade, _extends({}, backdropTransition, { 'in': isOpen && !!backdrop, cssModule: cssModule, className: mapToCssModules(classnames('modal-backdrop', backdropClassName), cssModule) })) ) ); } return null; } }]); return Modal; }(React__default.Component); Modal.propTypes = propTypes$41; Modal.defaultProps = defaultProps$38; var propTypes$43 = { tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), wrapTag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), toggle: propTypes$1.func, className: propTypes$1.string, cssModule: propTypes$1.object, children: propTypes$1.node, closeAriaLabel: propTypes$1.string }; var defaultProps$39 = { tag: 'h5', wrapTag: 'div', closeAriaLabel: 'Close' }; var ModalHeader = function ModalHeader(props) { var closeButton = void 0; var className = props.className, cssModule = props.cssModule, children = props.children, toggle = props.toggle, Tag = props.tag, WrapTag = props.wrapTag, closeAriaLabel = props.closeAriaLabel, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'children', 'toggle', 'tag', 'wrapTag', 'closeAriaLabel']); var classes = mapToCssModules(classnames(className, 'modal-header'), cssModule); if (toggle) { closeButton = React__default.createElement( 'button', { type: 'button', onClick: toggle, className: mapToCssModules('close', cssModule), 'aria-label': closeAriaLabel }, React__default.createElement( 'span', { 'aria-hidden': 'true' }, String.fromCharCode(215) ) ); } return React__default.createElement( WrapTag, _extends({}, attributes, { className: classes }), React__default.createElement( Tag, { className: mapToCssModules('modal-title', cssModule) }, children ), closeButton ); }; ModalHeader.propTypes = propTypes$43; ModalHeader.defaultProps = defaultProps$39; var propTypes$44 = { tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), className: propTypes$1.string, cssModule: propTypes$1.object }; var defaultProps$40 = { tag: 'div' }; var ModalBody = function ModalBody(props) { var className = props.className, cssModule = props.cssModule, Tag = props.tag, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'tag']); var classes = mapToCssModules(classnames(className, 'modal-body'), cssModule); return React__default.createElement(Tag, _extends({}, attributes, { className: classes })); }; ModalBody.propTypes = propTypes$44; ModalBody.defaultProps = defaultProps$40; var propTypes$45 = { tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), className: propTypes$1.string, cssModule: propTypes$1.object }; var defaultProps$41 = { tag: 'div' }; var ModalFooter = function ModalFooter(props) { var className = props.className, cssModule = props.cssModule, Tag = props.tag, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'tag']); var classes = mapToCssModules(classnames(className, 'modal-footer'), cssModule); return React__default.createElement(Tag, _extends({}, attributes, { className: classes })); }; ModalFooter.propTypes = propTypes$45; ModalFooter.defaultProps = defaultProps$41; var propTypes$46 = { placement: propTypes$1.oneOf(PopperPlacements), target: propTypes$1.oneOfType([propTypes$1.string, propTypes$1.func, DOMElement]).isRequired, container: propTypes$1.oneOfType([propTypes$1.string, propTypes$1.func, DOMElement]), isOpen: propTypes$1.bool, disabled: propTypes$1.bool, hideArrow: propTypes$1.bool, className: propTypes$1.string, innerClassName: propTypes$1.string, cssModule: propTypes$1.object, toggle: propTypes$1.func, autohide: propTypes$1.bool, placementPrefix: propTypes$1.string, delay: propTypes$1.oneOfType([propTypes$1.shape({ show: propTypes$1.number, hide: propTypes$1.number }), propTypes$1.number]), modifiers: propTypes$1.object }; var DEFAULT_DELAYS$1 = { show: 0, hide: 250 }; var defaultProps$42 = { isOpen: false, hideArrow: false, placement: 'top', placementPrefix: 'bs-tooltip', delay: DEFAULT_DELAYS$1, autohide: true, toggle: function toggle() {} }; var Tooltip = function (_React$Component) { inherits(Tooltip, _React$Component); function Tooltip(props) { classCallCheck(this, Tooltip); var _this = possibleConstructorReturn(this, (Tooltip.__proto__ || Object.getPrototypeOf(Tooltip)).call(this, props)); _this.addTargetEvents = _this.addTargetEvents.bind(_this); _this.handleDocumentClick = _this.handleDocumentClick.bind(_this); _this.removeTargetEvents = _this.removeTargetEvents.bind(_this); _this.toggle = _this.toggle.bind(_this); _this.onMouseOverTooltip = _this.onMouseOverTooltip.bind(_this); _this.onMouseLeaveTooltip = _this.onMouseLeaveTooltip.bind(_this); _this.onMouseOverTooltipContent = _this.onMouseOverTooltipContent.bind(_this); _this.onMouseLeaveTooltipContent = _this.onMouseLeaveTooltipContent.bind(_this); _this.show = _this.show.bind(_this); _this.hide = _this.hide.bind(_this); return _this; } createClass(Tooltip, [{ key: 'componentDidMount', value: function componentDidMount() { this._target = getTarget(this.props.target); this.addTargetEvents(); } }, { key: 'componentWillUnmount', value: function componentWillUnmount() { this.removeTargetEvents(); } }, { key: 'onMouseOverTooltip', value: function onMouseOverTooltip() { if (this._hideTimeout) { this.clearHideTimeout(); } this._showTimeout = setTimeout(this.show, this.getDelay('show')); } }, { key: 'onMouseLeaveTooltip', value: function onMouseLeaveTooltip() { if (this._showTimeout) { this.clearShowTimeout(); } this._hideTimeout = setTimeout(this.hide, this.getDelay('hide')); } }, { key: 'onMouseOverTooltipContent', value: function onMouseOverTooltipContent() { if (this.props.autohide) { return; } if (this._hideTimeout) { this.clearHideTimeout(); } } }, { key: 'onMouseLeaveTooltipContent', value: function onMouseLeaveTooltipContent() { if (this.props.autohide) { return; } if (this._showTimeout) { this.clearShowTimeout(); } this._hideTimeout = setTimeout(this.hide, this.getDelay('hide')); } }, { key: 'getDelay', value: function getDelay(key) { var delay = this.props.delay; if ((typeof delay === 'undefined' ? 'undefined' : _typeof(delay)) === 'object') { return isNaN(delay[key]) ? DEFAULT_DELAYS$1[key] : delay[key]; } return delay; } }, { key: 'show', value: function show() { if (!this.props.isOpen) { this.clearShowTimeout(); this.toggle(); } } }, { key: 'hide', value: function hide() { if (this.props.isOpen) { this.clearHideTimeout(); this.toggle(); } } }, { key: 'clearShowTimeout', value: function clearShowTimeout() { clearTimeout(this._showTimeout); this._showTimeout = undefined; } }, { key: 'clearHideTimeout', value: function clearHideTimeout() { clearTimeout(this._hideTimeout); this._hideTimeout = undefined; } }, { key: 'handleDocumentClick', value: function handleDocumentClick(e) { if (e.target === this._target || this._target.contains(e.target)) { if (this._hideTimeout) { this.clearHideTimeout(); } if (!this.props.isOpen) { this.toggle(); } } } }, { key: 'addTargetEvents', value: function addTargetEvents() { var _this2 = this; this._target.addEventListener('mouseover', this.onMouseOverTooltip, true); this._target.addEventListener('mouseout', this.onMouseLeaveTooltip, true); ['click', 'touchstart'].forEach(function (event) { return document.addEventListener(event, _this2.handleDocumentClick, true); }); } }, { key: 'removeTargetEvents', value: function removeTargetEvents() { var _this3 = this; this._target.removeEventListener('mouseover', this.onMouseOverTooltip, true); this._target.removeEventListener('mouseout', this.onMouseLeaveTooltip, true); ['click', 'touchstart'].forEach(function (event) { return document.removeEventListener(event, _this3.handleDocumentClick, true); }); } }, { key: 'toggle', value: function toggle(e) { if (this.props.disabled) { return e && e.preventDefault(); } return this.props.toggle(); } }, { key: 'render', value: function render() { if (!this.props.isOpen) { return null; } var attributes = omit(this.props, Object.keys(propTypes$46)); var classes = mapToCssModules(classnames('tooltip-inner', this.props.innerClassName), this.props.cssModule); var popperClasses = mapToCssModules(classnames('tooltip', 'show', this.props.className), this.props.cssModule); return React__default.createElement( PopperContent, { className: popperClasses, target: this.props.target, isOpen: this.props.isOpen, hideArrow: this.props.hideArrow, placement: this.props.placement, placementPrefix: this.props.placementPrefix, container: this.props.container, modifiers: this.props.modifiers }, React__default.createElement('div', _extends({}, attributes, { className: classes, onMouseOver: this.onMouseOverTooltipContent, onMouseLeave: this.onMouseLeaveTooltipContent })) ); } }]); return Tooltip; }(React__default.Component); Tooltip.propTypes = propTypes$46; Tooltip.defaultProps = defaultProps$42; var propTypes$47 = { className: propTypes$1.string, cssModule: propTypes$1.object, size: propTypes$1.string, bordered: propTypes$1.bool, striped: propTypes$1.bool, inverse: deprecated(propTypes$1.bool, 'Please use the prop "dark"'), dark: propTypes$1.bool, hover: propTypes$1.bool, responsive: propTypes$1.oneOfType([propTypes$1.bool, propTypes$1.string]), tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), responsiveTag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]) }; var defaultProps$43 = { tag: 'table', responsiveTag: 'div' }; var Table = function Table(props) { var className = props.className, cssModule = props.cssModule, size = props.size, bordered = props.bordered, striped = props.striped, inverse = props.inverse, dark = props.dark, hover = props.hover, responsive = props.responsive, Tag = props.tag, ResponsiveTag = props.responsiveTag, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'size', 'bordered', 'striped', 'inverse', 'dark', 'hover', 'responsive', 'tag', 'responsiveTag']); var classes = mapToCssModules(classnames(className, 'table', size ? 'table-' + size : false, bordered ? 'table-bordered' : false, striped ? 'table-striped' : false, dark || inverse ? 'table-dark' : false, hover ? 'table-hover' : false), cssModule); var table = React__default.createElement(Tag, _extends({}, attributes, { className: classes })); if (responsive) { var responsiveClassName = responsive === true ? 'table-responsive' : 'table-responsive-' + responsive; return React__default.createElement( ResponsiveTag, { className: responsiveClassName }, table ); } return table; }; Table.propTypes = propTypes$47; Table.defaultProps = defaultProps$43; var propTypes$48 = { tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), flush: propTypes$1.bool, className: propTypes$1.string, cssModule: propTypes$1.object }; var defaultProps$44 = { tag: 'ul' }; var ListGroup = function ListGroup(props) { var className = props.className, cssModule = props.cssModule, Tag = props.tag, flush = props.flush, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'tag', 'flush']); var classes = mapToCssModules(classnames(className, 'list-group', flush ? 'list-group-flush' : false), cssModule); return React__default.createElement(Tag, _extends({}, attributes, { className: classes })); }; ListGroup.propTypes = propTypes$48; ListGroup.defaultProps = defaultProps$44; var propTypes$49 = { children: propTypes$1.node, inline: propTypes$1.bool, tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), innerRef: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), className: propTypes$1.string, cssModule: propTypes$1.object }; var defaultProps$45 = { tag: 'form' }; var Form = function Form(props) { var className = props.className, cssModule = props.cssModule, inline = props.inline, Tag = props.tag, innerRef = props.innerRef, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'inline', 'tag', 'innerRef']); var classes = mapToCssModules(classnames(className, inline ? 'form-inline' : false), cssModule); return React__default.createElement(Tag, _extends({}, attributes, { ref: innerRef, className: classes })); }; Form.propTypes = propTypes$49; Form.defaultProps = defaultProps$45; var propTypes$50 = { children: propTypes$1.node, tag: propTypes$1.string, className: propTypes$1.string, cssModule: propTypes$1.object, valid: propTypes$1.bool }; var defaultProps$46 = { tag: 'div', valid: undefined }; var FormFeedback = function FormFeedback(props) { var className = props.className, cssModule = props.cssModule, valid = props.valid, Tag = props.tag, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'valid', 'tag']); var classes = mapToCssModules(classnames(className, valid ? 'valid-feedback' : 'invalid-feedback'), cssModule); return React__default.createElement(Tag, _extends({}, attributes, { className: classes })); }; FormFeedback.propTypes = propTypes$50; FormFeedback.defaultProps = defaultProps$46; var propTypes$51 = { children: propTypes$1.node, row: propTypes$1.bool, check: propTypes$1.bool, inline: propTypes$1.bool, disabled: propTypes$1.bool, tag: propTypes$1.string, className: propTypes$1.string, cssModule: propTypes$1.object }; var defaultProps$47 = { tag: 'div' }; var FormGroup = function FormGroup(props) { var className = props.className, cssModule = props.cssModule, row = props.row, disabled = props.disabled, check = props.check, inline = props.inline, Tag = props.tag, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'row', 'disabled', 'check', 'inline', 'tag']); var classes = mapToCssModules(classnames(className, row ? 'row' : false, check ? 'form-check' : 'form-group', check && inline ? 'form-check-inline' : false, check && disabled ? 'disabled' : false), cssModule); return React__default.createElement(Tag, _extends({}, attributes, { className: classes })); }; FormGroup.propTypes = propTypes$51; FormGroup.defaultProps = defaultProps$47; var propTypes$52 = { children: propTypes$1.node, inline: propTypes$1.bool, tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), color: propTypes$1.string, className: propTypes$1.string, cssModule: propTypes$1.object }; var defaultProps$48 = { tag: 'small', color: 'muted' }; var FormText = function FormText(props) { var className = props.className, cssModule = props.cssModule, inline = props.inline, color = props.color, Tag = props.tag, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'inline', 'color', 'tag']); var classes = mapToCssModules(classnames(className, !inline ? 'form-text' : false, color ? 'text-' + color : false), cssModule); return React__default.createElement(Tag, _extends({}, attributes, { className: classes })); }; FormText.propTypes = propTypes$52; FormText.defaultProps = defaultProps$48; /* eslint react/prefer-stateless-function: 0 */ var propTypes$53 = { children: propTypes$1.node, type: propTypes$1.string, size: propTypes$1.string, bsSize: propTypes$1.string, state: deprecated(propTypes$1.string, 'Please use the props "valid" and "invalid" to indicate the state.'), valid: propTypes$1.bool, invalid: propTypes$1.bool, tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), innerRef: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), static: deprecated(propTypes$1.bool, 'Please use the prop "plaintext"'), plaintext: propTypes$1.bool, addon: propTypes$1.bool, className: propTypes$1.string, cssModule: propTypes$1.object }; var defaultProps$49 = { type: 'text' }; var Input = function (_React$Component) { inherits(Input, _React$Component); function Input() { classCallCheck(this, Input); return possibleConstructorReturn(this, (Input.__proto__ || Object.getPrototypeOf(Input)).apply(this, arguments)); } createClass(Input, [{ key: 'render', value: function render() { var _props = this.props, className = _props.className, cssModule = _props.cssModule, type = _props.type, bsSize = _props.bsSize, state = _props.state, valid = _props.valid, invalid = _props.invalid, tag = _props.tag, addon = _props.addon, staticInput = _props.static, plaintext = _props.plaintext, innerRef = _props.innerRef, attributes = objectWithoutProperties(_props, ['className', 'cssModule', 'type', 'bsSize', 'state', 'valid', 'invalid', 'tag', 'addon', 'static', 'plaintext', 'innerRef']); var checkInput = ['radio', 'checkbox'].indexOf(type) > -1; var isNotaNumber = new RegExp('\\D', 'g'); var fileInput = type === 'file'; var textareaInput = type === 'textarea'; var selectInput = type === 'select'; var Tag = tag || (selectInput || textareaInput ? type : 'input'); var formControlClass = 'form-control'; if (plaintext || staticInput) { formControlClass = formControlClass + '-plaintext'; Tag = tag || 'p'; } else if (fileInput) { formControlClass = formControlClass + '-file'; } else if (checkInput) { if (addon) { formControlClass = null; } else { formControlClass = 'form-check-input'; } } if (state && typeof valid === 'undefined' && typeof invalid === 'undefined') { if (state === 'danger') { invalid = true; } else if (state === 'success') { valid = true; } } if (attributes.size && isNotaNumber.test(attributes.size)) { warnOnce('Please use the prop "bsSize" instead of the "size" to bootstrap\'s input sizing.'); bsSize = attributes.size; delete attributes.size; } var classes = mapToCssModules(classnames(className, invalid && 'is-invalid', valid && 'is-valid', bsSize ? 'form-control-' + bsSize : false, formControlClass), cssModule); if (Tag === 'input' || typeof tag !== 'string') { attributes.type = type; } return React__default.createElement(Tag, _extends({}, attributes, { ref: innerRef, className: classes })); } }]); return Input; }(React__default.Component); Input.propTypes = propTypes$53; Input.defaultProps = defaultProps$49; var propTypes$54 = { tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), size: propTypes$1.string, className: propTypes$1.string, cssModule: propTypes$1.object }; var defaultProps$50 = { tag: 'div' }; var InputGroup = function InputGroup(props) { var className = props.className, cssModule = props.cssModule, Tag = props.tag, size = props.size, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'tag', 'size']); var classes = mapToCssModules(classnames(className, 'input-group', size ? 'input-group-' + size : null), cssModule); return React__default.createElement(Tag, _extends({}, attributes, { className: classes })); }; InputGroup.propTypes = propTypes$54; InputGroup.defaultProps = defaultProps$50; var propTypes$56 = { tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), className: propTypes$1.string, cssModule: propTypes$1.object }; var defaultProps$52 = { tag: 'span' }; var InputGroupText = function InputGroupText(props) { var className = props.className, cssModule = props.cssModule, Tag = props.tag, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'tag']); var classes = mapToCssModules(classnames(className, 'input-group-text'), cssModule); return React__default.createElement(Tag, _extends({}, attributes, { className: classes })); }; InputGroupText.propTypes = propTypes$56; InputGroupText.defaultProps = defaultProps$52; var propTypes$55 = { tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), addonType: propTypes$1.oneOf(['prepend', 'append']).isRequired, children: propTypes$1.node, className: propTypes$1.string, cssModule: propTypes$1.object }; var defaultProps$51 = { tag: 'div' }; var InputGroupAddon = function InputGroupAddon(props) { var className = props.className, cssModule = props.cssModule, Tag = props.tag, addonType = props.addonType, children = props.children, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'tag', 'addonType', 'children']); var classes = mapToCssModules(classnames(className, 'input-group-' + addonType), cssModule); // Convenience to assist with transition if (typeof children === 'string') { return React__default.createElement( Tag, _extends({}, attributes, { className: classes }), React__default.createElement(InputGroupText, { children: children }) ); } return React__default.createElement(Tag, _extends({}, attributes, { className: classes, children: children })); }; InputGroupAddon.propTypes = propTypes$55; InputGroupAddon.defaultProps = defaultProps$51; var propTypes$57 = { tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), addonType: propTypes$1.oneOf(['prepend', 'append']).isRequired, children: propTypes$1.node, groupClassName: propTypes$1.string, groupAttributes: propTypes$1.object, className: propTypes$1.string, cssModule: propTypes$1.object }; var InputGroupButton = function InputGroupButton(props) { warnOnce('The "InputGroupButton" component has been deprecated.\nPlease use component "InputGroupAddon".'); var children = props.children, groupClassName = props.groupClassName, groupAttributes = props.groupAttributes, propsWithoutGroup = objectWithoutProperties(props, ['children', 'groupClassName', 'groupAttributes']); if (typeof children === 'string') { var cssModule = propsWithoutGroup.cssModule, tag = propsWithoutGroup.tag, addonType = propsWithoutGroup.addonType, attributes = objectWithoutProperties(propsWithoutGroup, ['cssModule', 'tag', 'addonType']); var allGroupAttributes = _extends({}, groupAttributes, { cssModule: cssModule, tag: tag, addonType: addonType }); return React__default.createElement( InputGroupAddon, _extends({}, allGroupAttributes, { className: groupClassName }), React__default.createElement(Button, _extends({}, attributes, { children: children })) ); } return React__default.createElement(InputGroupAddon, _extends({}, props, { children: children })); }; InputGroupButton.propTypes = propTypes$57; var propTypes$58 = { addonType: propTypes$1.oneOf(['prepend', 'append']).isRequired, children: propTypes$1.node }; var InputGroupButtonDropdown = function InputGroupButtonDropdown(props) { return React__default.createElement(Dropdown, props); }; InputGroupButtonDropdown.propTypes = propTypes$58; var colWidths$1 = ['xs', 'sm', 'md', 'lg', 'xl']; var stringOrNumberProp$1 = propTypes$1.oneOfType([propTypes$1.number, propTypes$1.string]); var columnProps$1 = propTypes$1.oneOfType([propTypes$1.string, propTypes$1.number, propTypes$1.shape({ size: stringOrNumberProp$1, push: deprecated(stringOrNumberProp$1, 'Please use the prop "order"'), pull: deprecated(stringOrNumberProp$1, 'Please use the prop "order"'), order: stringOrNumberProp$1, offset: stringOrNumberProp$1 })]); var propTypes$59 = { children: propTypes$1.node, hidden: propTypes$1.bool, check: propTypes$1.bool, size: propTypes$1.string, for: propTypes$1.string, tag: propTypes$1.string, className: propTypes$1.string, cssModule: propTypes$1.object, xs: columnProps$1, sm: columnProps$1, md: columnProps$1, lg: columnProps$1, xl: columnProps$1, widths: propTypes$1.array }; var defaultProps$53 = { tag: 'label', widths: colWidths$1 }; var getColumnSizeClass$1 = function getColumnSizeClass(isXs, colWidth, colSize) { if (colSize === true || colSize === '') { return isXs ? 'col' : 'col-' + colWidth; } else if (colSize === 'auto') { return isXs ? 'col-auto' : 'col-' + colWidth + '-auto'; } return isXs ? 'col-' + colSize : 'col-' + colWidth + '-' + colSize; }; var Label = function Label(props) { var className = props.className, cssModule = props.cssModule, hidden = props.hidden, widths = props.widths, Tag = props.tag, check = props.check, size = props.size, htmlFor = props.for, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'hidden', 'widths', 'tag', 'check', 'size', 'for']); var colClasses = []; widths.forEach(function (colWidth, i) { var columnProp = props[colWidth]; delete attributes[colWidth]; if (!columnProp && columnProp !== '') { return; } var isXs = !i; var colClass = void 0; if (lodash_isobject(columnProp)) { var _classNames; var colSizeInterfix = isXs ? '-' : '-' + colWidth + '-'; colClass = getColumnSizeClass$1(isXs, colWidth, columnProp.size); colClasses.push(mapToCssModules(classnames((_classNames = {}, defineProperty(_classNames, colClass, columnProp.size || columnProp.size === ''), defineProperty(_classNames, 'order' + colSizeInterfix + columnProp.order, columnProp.order || columnProp.order === 0), defineProperty(_classNames, 'offset' + colSizeInterfix + columnProp.offset, columnProp.offset || columnProp.offset === 0), _classNames))), cssModule); } else { colClass = getColumnSizeClass$1(isXs, colWidth, columnProp); colClasses.push(colClass); } }); var classes = mapToCssModules(classnames(className, hidden ? 'sr-only' : false, check ? 'form-check-label' : false, size ? 'col-form-label-' + size : false, colClasses, colClasses.length ? 'col-form-label' : false), cssModule); return React__default.createElement(Tag, _extends({ htmlFor: htmlFor }, attributes, { className: classes })); }; Label.propTypes = propTypes$59; Label.defaultProps = defaultProps$53; var propTypes$60 = { body: propTypes$1.bool, bottom: propTypes$1.bool, children: propTypes$1.node, className: propTypes$1.string, cssModule: propTypes$1.object, heading: propTypes$1.bool, left: propTypes$1.bool, list: propTypes$1.bool, middle: propTypes$1.bool, object: propTypes$1.bool, right: propTypes$1.bool, tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), top: propTypes$1.bool }; var Media = function Media(props) { var body = props.body, bottom = props.bottom, className = props.className, cssModule = props.cssModule, heading = props.heading, left = props.left, list = props.list, middle = props.middle, object = props.object, right = props.right, tag = props.tag, top = props.top, attributes = objectWithoutProperties(props, ['body', 'bottom', 'className', 'cssModule', 'heading', 'left', 'list', 'middle', 'object', 'right', 'tag', 'top']); var defaultTag = void 0; if (heading) { defaultTag = 'h4'; } else if (left || right) { defaultTag = 'a'; } else if (object) { defaultTag = 'img'; } else if (list) { defaultTag = 'ul'; } else { defaultTag = 'div'; } var Tag = tag || defaultTag; var classes = mapToCssModules(classnames(className, { 'media-body': body, 'media-heading': heading, 'media-left': left, 'media-right': right, 'media-top': top, 'media-bottom': bottom, 'media-middle': middle, 'media-object': object, 'media-list': list, media: !body && !heading && !left && !right && !top && !bottom && !middle && !object && !list }), cssModule); return React__default.createElement(Tag, _extends({}, attributes, { className: classes })); }; Media.propTypes = propTypes$60; var propTypes$61 = { children: propTypes$1.node, className: propTypes$1.string, cssModule: propTypes$1.object, size: propTypes$1.string, tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]) }; var defaultProps$54 = { tag: 'ul' }; var Pagination = function Pagination(props) { var className = props.className, cssModule = props.cssModule, size = props.size, Tag = props.tag, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'size', 'tag']); var classes = mapToCssModules(classnames(className, 'pagination', defineProperty({}, 'pagination-' + size, !!size)), cssModule); return React__default.createElement(Tag, _extends({}, attributes, { className: classes })); }; Pagination.propTypes = propTypes$61; Pagination.defaultProps = defaultProps$54; var propTypes$62 = { active: propTypes$1.bool, children: propTypes$1.node, className: propTypes$1.string, cssModule: propTypes$1.object, disabled: propTypes$1.bool, tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]) }; var defaultProps$55 = { tag: 'li' }; var PaginationItem = function PaginationItem(props) { var active = props.active, className = props.className, cssModule = props.cssModule, disabled = props.disabled, Tag = props.tag, attributes = objectWithoutProperties(props, ['active', 'className', 'cssModule', 'disabled', 'tag']); var classes = mapToCssModules(classnames(className, 'page-item', { active: active, disabled: disabled }), cssModule); return React__default.createElement(Tag, _extends({}, attributes, { className: classes })); }; PaginationItem.propTypes = propTypes$62; PaginationItem.defaultProps = defaultProps$55; var propTypes$63 = { 'aria-label': propTypes$1.string, children: propTypes$1.node, className: propTypes$1.string, cssModule: propTypes$1.object, next: propTypes$1.bool, previous: propTypes$1.bool, tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]) }; var defaultProps$56 = { tag: 'a' }; var PaginationLink = function PaginationLink(props) { var className = props.className, cssModule = props.cssModule, next = props.next, previous = props.previous, Tag = props.tag, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'next', 'previous', 'tag']); var classes = mapToCssModules(classnames(className, 'page-link'), cssModule); var defaultAriaLabel = void 0; if (previous) { defaultAriaLabel = 'Previous'; } else if (next) { defaultAriaLabel = 'Next'; } var ariaLabel = props['aria-label'] || defaultAriaLabel; var defaultCaret = void 0; if (previous) { defaultCaret = '\xAB'; } else if (next) { defaultCaret = '\xBB'; } var children = props.children; if (children && Array.isArray(children) && children.length === 0) { children = null; } if (previous || next) { children = [React__default.createElement( 'span', { 'aria-hidden': 'true', key: 'caret' }, children || defaultCaret ), React__default.createElement( 'span', { className: 'sr-only', key: 'sr' }, ariaLabel )]; } return React__default.createElement( Tag, _extends({}, attributes, { className: classes, 'aria-label': ariaLabel }), children ); }; PaginationLink.propTypes = propTypes$63; PaginationLink.defaultProps = defaultProps$56; var propTypes$64 = { tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), activeTab: propTypes$1.any, className: propTypes$1.string, cssModule: propTypes$1.object }; var defaultProps$57 = { tag: 'div' }; var childContextTypes$2 = { activeTabId: propTypes$1.any }; var TabContent = function (_Component) { inherits(TabContent, _Component); function TabContent(props) { classCallCheck(this, TabContent); var _this = possibleConstructorReturn(this, (TabContent.__proto__ || Object.getPrototypeOf(TabContent)).call(this, props)); _this.state = { activeTab: _this.props.activeTab }; return _this; } createClass(TabContent, [{ key: 'getChildContext', value: function getChildContext() { return { activeTabId: this.state.activeTab }; } }, { key: 'componentWillReceiveProps', value: function componentWillReceiveProps(nextProps) { if (this.state.activeTab !== nextProps.activeTab) { this.setState({ activeTab: nextProps.activeTab }); } } }, { key: 'render', value: function render() { var _props = this.props, className = _props.className, cssModule = _props.cssModule, Tag = _props.tag; var attributes = omit(this.props, Object.keys(propTypes$64)); var classes = mapToCssModules(classnames('tab-content', className), cssModule); return React__default.createElement(Tag, _extends({}, attributes, { className: classes })); } }]); return TabContent; }(React.Component); TabContent.propTypes = propTypes$64; TabContent.defaultProps = defaultProps$57; TabContent.childContextTypes = childContextTypes$2; var propTypes$65 = { tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), className: propTypes$1.string, cssModule: propTypes$1.object, tabId: propTypes$1.any }; var defaultProps$58 = { tag: 'div' }; var contextTypes$3 = { activeTabId: propTypes$1.any }; function TabPane(props, context) { var className = props.className, cssModule = props.cssModule, tabId = props.tabId, Tag = props.tag, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'tabId', 'tag']); var classes = mapToCssModules(classnames('tab-pane', className, { active: tabId === context.activeTabId }), cssModule); return React__default.createElement(Tag, _extends({}, attributes, { className: classes })); } TabPane.propTypes = propTypes$65; TabPane.defaultProps = defaultProps$58; TabPane.contextTypes = contextTypes$3; var propTypes$66 = { tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), fluid: propTypes$1.bool, className: propTypes$1.string, cssModule: propTypes$1.object }; var defaultProps$59 = { tag: 'div' }; var Jumbotron = function Jumbotron(props) { var className = props.className, cssModule = props.cssModule, Tag = props.tag, fluid = props.fluid, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'tag', 'fluid']); var classes = mapToCssModules(classnames(className, 'jumbotron', fluid ? 'jumbotron-fluid' : false), cssModule); return React__default.createElement(Tag, _extends({}, attributes, { className: classes })); }; Jumbotron.propTypes = propTypes$66; Jumbotron.defaultProps = defaultProps$59; var propTypes$67 = { children: propTypes$1.node, className: propTypes$1.string, closeClassName: propTypes$1.string, closeAriaLabel: propTypes$1.string, cssModule: propTypes$1.object, color: propTypes$1.string, isOpen: propTypes$1.bool, toggle: propTypes$1.func, tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), transition: propTypes$1.shape(Fade.propTypes) }; var defaultProps$60 = { color: 'success', isOpen: true, tag: 'div', closeAriaLabel: 'Close', transition: _extends({}, Fade.defaultProps, { unmountOnExit: true }) }; function Alert(props) { var className = props.className, closeClassName = props.closeClassName, closeAriaLabel = props.closeAriaLabel, cssModule = props.cssModule, Tag = props.tag, color = props.color, isOpen = props.isOpen, toggle = props.toggle, children = props.children, transition = props.transition, attributes = objectWithoutProperties(props, ['className', 'closeClassName', 'closeAriaLabel', 'cssModule', 'tag', 'color', 'isOpen', 'toggle', 'children', 'transition']); var classes = mapToCssModules(classnames(className, 'alert', 'alert-' + color, { 'alert-dismissible': toggle }), cssModule); var closeClasses = mapToCssModules(classnames('close', closeClassName), cssModule); return React__default.createElement( Fade, _extends({}, attributes, transition, { tag: Tag, className: classes, 'in': isOpen, role: 'alert' }), toggle ? React__default.createElement( 'button', { type: 'button', className: closeClasses, 'aria-label': closeAriaLabel, onClick: toggle }, React__default.createElement( 'span', { 'aria-hidden': 'true' }, '\xD7' ) ) : null, children ); } Alert.propTypes = propTypes$67; Alert.defaultProps = defaultProps$60; var _transitionStatusToCl; var propTypes$68 = _extends({}, Transition.propTypes, { isOpen: propTypes$1.bool, children: propTypes$1.oneOfType([propTypes$1.arrayOf(propTypes$1.node), propTypes$1.node]), tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), className: propTypes$1.node, navbar: propTypes$1.bool, cssModule: propTypes$1.object }); var defaultProps$61 = _extends({}, Transition.defaultProps, { isOpen: false, appear: false, enter: true, exit: true, tag: 'div', timeout: TransitionTimeouts.Collapse }); var transitionStatusToClassHash = (_transitionStatusToCl = {}, defineProperty(_transitionStatusToCl, TransitionStatuses.ENTERING, 'collapsing'), defineProperty(_transitionStatusToCl, TransitionStatuses.ENTERED, 'collapse show'), defineProperty(_transitionStatusToCl, TransitionStatuses.EXITING, 'collapsing'), defineProperty(_transitionStatusToCl, TransitionStatuses.EXITED, 'collapse'), _transitionStatusToCl); function getTransitionClass(status) { return transitionStatusToClassHash[status] || 'collapse'; } function getHeight(node) { return node.scrollHeight; } var Collapse = function (_Component) { inherits(Collapse, _Component); function Collapse(props) { classCallCheck(this, Collapse); var _this = possibleConstructorReturn(this, (Collapse.__proto__ || Object.getPrototypeOf(Collapse)).call(this, props)); _this.state = { height: null }; ['onEntering', 'onEntered', 'onExit', 'onExiting', 'onExited'].forEach(function (name) { _this[name] = _this[name].bind(_this); }); return _this; } createClass(Collapse, [{ key: 'onEntering', value: function onEntering(node, isAppearing) { this.setState({ height: getHeight(node) }); this.props.onEntering(node, isAppearing); } }, { key: 'onEntered', value: function onEntered(node, isAppearing) { this.setState({ height: null }); this.props.onEntered(node, isAppearing); } }, { key: 'onExit', value: function onExit(node) { this.setState({ height: getHeight(node) }); this.props.onExit(node); } }, { key: 'onExiting', value: function onExiting(node) { // getting this variable triggers a reflow var _unused = node.offsetHeight; // eslint-disable-line no-unused-vars this.setState({ height: 0 }); this.props.onExiting(node); } }, { key: 'onExited', value: function onExited(node) { this.setState({ height: null }); this.props.onExited(node); } }, { key: 'render', value: function render() { var _props = this.props, Tag = _props.tag, isOpen = _props.isOpen, className = _props.className, navbar = _props.navbar, cssModule = _props.cssModule, children = _props.children, otherProps = objectWithoutProperties(_props, ['tag', 'isOpen', 'className', 'navbar', 'cssModule', 'children']); var height = this.state.height; // In NODE_ENV=production the Transition.propTypes are wrapped which results in an // empty object "{}". This is the result of the `react-transition-group` babel // configuration settings. Therefore, to ensure that production builds work without // error, we can either explicitly define keys or use the Transition.defaultProps. // Using the Transition.defaultProps excludes any required props. Thus, the best // solution is to explicitly define required props in our utilities and reference these. // This also gives us more flexibility in the future to remove the prop-types // dependency in distribution builds (Similar to how `react-transition-group` does). // Note: Without omitting the `react-transition-group` props, the resulting child // Tag component would inherit the Transition properties as attributes for the HTML // element which results in errors/warnings for non-valid attributes. var transitionProps = pick(otherProps, TransitionPropTypeKeys); var childProps = omit(otherProps, TransitionPropTypeKeys); return React__default.createElement( Transition, _extends({}, transitionProps, { 'in': isOpen, onEntering: this.onEntering, onEntered: this.onEntered, onExit: this.onExit, onExiting: this.onExiting, onExited: this.onExited }), function (status) { var collapseClass = getTransitionClass(status); var classes = mapToCssModules(classnames(className, collapseClass, navbar && 'navbar-collapse'), cssModule); var style = height === null ? null : { height: height }; return React__default.createElement( Tag, _extends({}, childProps, { style: _extends({}, childProps.style, style), className: classes }), children ); } ); } }]); return Collapse; }(React.Component); Collapse.propTypes = propTypes$68; Collapse.defaultProps = defaultProps$61; var propTypes$69 = { tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), active: propTypes$1.bool, disabled: propTypes$1.bool, color: propTypes$1.string, action: propTypes$1.bool, className: propTypes$1.any, cssModule: propTypes$1.object }; var defaultProps$62 = { tag: 'li' }; var handleDisabledOnClick = function handleDisabledOnClick(e) { e.preventDefault(); }; var ListGroupItem = function ListGroupItem(props) { var className = props.className, cssModule = props.cssModule, Tag = props.tag, active = props.active, disabled = props.disabled, action = props.action, color = props.color, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'tag', 'active', 'disabled', 'action', 'color']); var classes = mapToCssModules(classnames(className, active ? 'active' : false, disabled ? 'disabled' : false, action ? 'list-group-item-action' : false, color ? 'list-group-item-' + color : false, 'list-group-item'), cssModule); // Prevent click event when disabled. if (disabled) { attributes.onClick = handleDisabledOnClick; } return React__default.createElement(Tag, _extends({}, attributes, { className: classes })); }; ListGroupItem.propTypes = propTypes$69; ListGroupItem.defaultProps = defaultProps$62; var propTypes$70 = { tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), className: propTypes$1.any, cssModule: propTypes$1.object }; var defaultProps$63 = { tag: 'h5' }; var ListGroupItemHeading = function ListGroupItemHeading(props) { var className = props.className, cssModule = props.cssModule, Tag = props.tag, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'tag']); var classes = mapToCssModules(classnames(className, 'list-group-item-heading'), cssModule); return React__default.createElement(Tag, _extends({}, attributes, { className: classes })); }; ListGroupItemHeading.propTypes = propTypes$70; ListGroupItemHeading.defaultProps = defaultProps$63; var propTypes$71 = { tag: propTypes$1.oneOfType([propTypes$1.func, propTypes$1.string]), className: propTypes$1.any, cssModule: propTypes$1.object }; var defaultProps$64 = { tag: 'p' }; var ListGroupItemText = function ListGroupItemText(props) { var className = props.className, cssModule = props.cssModule, Tag = props.tag, attributes = objectWithoutProperties(props, ['className', 'cssModule', 'tag']); var classes = mapToCssModules(classnames(className, 'list-group-item-text'), cssModule); return React__default.createElement(Tag, _extends({}, attributes, { className: classes })); }; ListGroupItemText.propTypes = propTypes$71; ListGroupItemText.defaultProps = defaultProps$64; var UncontrolledAlert = function (_Component) { inherits(UncontrolledAlert, _Component); function UncontrolledAlert(props) { classCallCheck(this, UncontrolledAlert); var _this = possibleConstructorReturn(this, (UncontrolledAlert.__proto__ || Object.getPrototypeOf(UncontrolledAlert)).call(this, props)); _this.state = { isOpen: true }; _this.toggle = _this.toggle.bind(_this); return _this; } createClass(UncontrolledAlert, [{ key: 'toggle', value: function toggle() { this.setState({ isOpen: !this.state.isOpen }); } }, { key: 'render', value: function render() { return React__default.createElement(Alert, _extends({ isOpen: this.state.isOpen, toggle: this.toggle }, this.props)); } }]); return UncontrolledAlert; }(React.Component); var UncontrolledButtonDropdown = function (_Component) { inherits(UncontrolledButtonDropdown, _Component); function UncontrolledButtonDropdown(props) { classCallCheck(this, UncontrolledButtonDropdown); var _this = possibleConstructorReturn(this, (UncontrolledButtonDropdown.__proto__ || Object.getPrototypeOf(UncontrolledButtonDropdown)).call(this, props)); _this.state = { isOpen: false }; _this.toggle = _this.toggle.bind(_this); return _this; } createClass(UncontrolledButtonDropdown, [{ key: 'toggle', value: function toggle() { this.setState({ isOpen: !this.state.isOpen }); } }, { key: 'render', value: function render() { return React__default.createElement(ButtonDropdown, _extends({ isOpen: this.state.isOpen, toggle: this.toggle }, this.props)); } }]); return UncontrolledButtonDropdown; }(React.Component); var UncontrolledDropdown = function (_Component) { inherits(UncontrolledDropdown, _Component); function UncontrolledDropdown(props) { classCallCheck(this, UncontrolledDropdown); var _this = possibleConstructorReturn(this, (UncontrolledDropdown.__proto__ || Object.getPrototypeOf(UncontrolledDropdown)).call(this, props)); _this.state = { isOpen: false }; _this.toggle = _this.toggle.bind(_this); return _this; } createClass(UncontrolledDropdown, [{ key: 'toggle', value: function toggle() { this.setState({ isOpen: !this.state.isOpen }); } }, { key: 'render', value: function render() { return React__default.createElement(Dropdown, _extends({ isOpen: this.state.isOpen, toggle: this.toggle }, this.props)); } }]); return UncontrolledDropdown; }(React.Component); var UncontrolledNavDropdown = function UncontrolledNavDropdown(props) { warnOnce('The "UncontrolledNavDropdown" component has been deprecated.\nPlease use component "UncontrolledDropdown" with nav prop.'); return React__default.createElement(UncontrolledDropdown, _extends({ nav: true }, props)); }; var UncontrolledTooltip = function (_Component) { inherits(UncontrolledTooltip, _Component); function UncontrolledTooltip(props) { classCallCheck(this, UncontrolledTooltip); var _this = possibleConstructorReturn(this, (UncontrolledTooltip.__proto__ || Object.getPrototypeOf(UncontrolledTooltip)).call(this, props)); _this.state = { isOpen: false }; _this.toggle = _this.toggle.bind(_this); return _this; } createClass(UncontrolledTooltip, [{ key: 'toggle', value: function toggle() { this.setState({ isOpen: !this.state.isOpen }); } }, { key: 'render', value: function render() { return React__default.createElement(Tooltip, _extends({ isOpen: this.state.isOpen, toggle: this.toggle }, this.props)); } }]); return UncontrolledTooltip; }(React.Component); exports.Alert = Alert; exports.Container = Container; exports.Row = Row; exports.Col = Col; exports.Navbar = Navbar; exports.NavbarBrand = NavbarBrand; exports.NavbarToggler = NavbarToggler; exports.Nav = Nav; exports.NavItem = NavItem; exports.NavDropdown = NavDropdown; exports.NavLink = NavLink; exports.Breadcrumb = Breadcrumb; exports.BreadcrumbItem = BreadcrumbItem; exports.Button = Button; exports.ButtonDropdown = ButtonDropdown; exports.ButtonGroup = ButtonGroup; exports.ButtonToolbar = ButtonToolbar; exports.Dropdown = Dropdown; exports.DropdownItem = DropdownItem; exports.DropdownMenu = DropdownMenu; exports.DropdownToggle = DropdownToggle; exports.Fade = Fade; exports.Badge = Badge; exports.Card = Card; exports.CardLink = CardLink; exports.CardGroup = CardGroup; exports.CardDeck = CardDeck; exports.CardColumns = CardColumns; exports.CardBody = CardBody; exports.CardBlock = CardBlock; exports.CardFooter = CardFooter; exports.CardHeader = CardHeader; exports.CardImg = CardImg; exports.CardImgOverlay = CardImgOverlay; exports.Carousel = Carousel; exports.UncontrolledCarousel = UncontrolledCarousel; exports.CarouselControl = CarouselControl; exports.CarouselItem = CarouselItem; exports.CarouselIndicators = CarouselIndicators; exports.CarouselCaption = CarouselCaption; exports.CardSubtitle = CardSubtitle; exports.CardText = CardText; exports.CardTitle = CardTitle; exports.Popover = Popover; exports.PopoverContent = PopoverContent; exports.PopoverBody = PopoverBody; exports.PopoverTitle = PopoverTitle; exports.PopoverHeader = PopoverHeader; exports.Progress = Progress; exports.Modal = Modal; exports.ModalHeader = ModalHeader; exports.ModalBody = ModalBody; exports.ModalFooter = ModalFooter; exports.PopperContent = PopperContent; exports.PopperTargetHelper = PopperTargetHelper; exports.Tooltip = Tooltip; exports.Table = Table; exports.ListGroup = ListGroup; exports.Form = Form; exports.FormFeedback = FormFeedback; exports.FormGroup = FormGroup; exports.FormText = FormText; exports.Input = Input; exports.InputGroup = InputGroup; exports.InputGroupAddon = InputGroupAddon; exports.InputGroupButton = InputGroupButton; exports.InputGroupButtonDropdown = InputGroupButtonDropdown; exports.InputGroupText = InputGroupText; exports.Label = Label; exports.Media = Media; exports.Pagination = Pagination; exports.PaginationItem = PaginationItem; exports.PaginationLink = PaginationLink; exports.TabContent = TabContent; exports.TabPane = TabPane; exports.Jumbotron = Jumbotron; exports.Collapse = Collapse; exports.ListGroupItem = ListGroupItem; exports.ListGroupItemText = ListGroupItemText; exports.ListGroupItemHeading = ListGroupItemHeading; exports.UncontrolledAlert = UncontrolledAlert; exports.UncontrolledButtonDropdown = UncontrolledButtonDropdown; exports.UncontrolledDropdown = UncontrolledDropdown; exports.UncontrolledNavDropdown = UncontrolledNavDropdown; exports.UncontrolledTooltip = UncontrolledTooltip; exports.Util = utils; Object.defineProperty(exports, '__esModule', { value: true }); }))); //# sourceMappingURL=reactstrap.full.js.map
/* Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.md or http://ckeditor.com/license */ CKEDITOR.plugins.setLang( 'liststyle', 'fa', { armenian: 'شماره‌گذاری ارمنی', bulletedTitle: 'خصوصیات فهرست نقطه‌ای', circle: 'دایره', decimal: 'ده‌دهی (۱، ۲، ۳، ...)', decimalLeadingZero: 'دهدهی همراه با صفر (۰۱، ۰۲، ۰۳، ...)', disc: 'صفحه گرد', georgian: 'شمارهگذاری گریگورین (an, ban, gan, etc.)', lowerAlpha: 'پانویس الفبایی (a, b, c, d, e, etc.)', lowerGreek: 'پانویس یونانی (alpha, beta, gamma, etc.)', lowerRoman: 'پانویس رومی (i, ii, iii, iv, v, etc.)', none: 'هیچ', notset: '<تنظیم نشده>', numberedTitle: 'ویژگیهای فهرست شمارهدار', square: 'چهارگوش', start: 'شروع', type: 'نوع', upperAlpha: 'بالانویس الفبایی (A, B, C, D, E, etc.)', upperRoman: 'بالانویس رومی (I, II, III, IV, V, etc.)', validateStartNumber: 'فهرست شماره شروع باید یک عدد صحیح باشد.' } );
import './views/mentionsFlexTab.html'; import './views/mentionsFlexTab'; import './actionButton'; import './tabBar';
/*! * Bootstrap-select v1.9.4 (http://silviomoreto.github.io/bootstrap-select) * * Copyright 2013-2016 bootstrap-select * Licensed under MIT (https://github.com/silviomoreto/bootstrap-select/blob/master/LICENSE) */ !function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(a){return b(a)}):"object"==typeof exports?module.exports=b(require("jquery")):b(jQuery)}(this,function(a){!function(a){a.fn.selectpicker.defaults={noneSelectedText:"Nessuna selezione",noneResultsText:"Nessun risultato per {0}",countSelectedText:"Selezionati {0} di {1}",maxOptionsText:["Limite raggiunto ({n} {var} max)","Limite del gruppo raggiunto ({n} {var} max)",["elementi","elemento"]],multipleSeparator:", "}}(a)});
/* global define, require */ (function (root, factory) { 'use strict'; if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. define(['seriously'], factory); } else if (typeof exports === 'object') { // Node/CommonJS factory(require('seriously')); } else { if (!root.Seriously) { root.Seriously = { plugin: function (name, opt) { this[name] = opt; } }; } factory(root.Seriously); } }(window, function (Seriously) { 'use strict'; Seriously.plugin('invert', { commonShader: true, shader: function (inputs, shaderSource) { shaderSource.fragment = [ 'precision mediump float;', 'varying vec2 vTexCoord;', 'uniform sampler2D source;', 'void main(void) {', ' gl_FragColor = texture2D(source, vTexCoord);', ' gl_FragColor = vec4(1.0 - gl_FragColor.rgb, gl_FragColor.a);', '}' ].join('\n'); return shaderSource; }, inPlace: true, inputs: { source: { type: 'image', uniform: 'source', shaderDirty: false } }, title: 'Invert', description: 'Invert image color' }); }));
/** * ag-grid - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components * @version v16.0.1 * @link http://www.ag-grid.com/ * @license MIT */ "use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; Object.defineProperty(exports, "__esModule", { value: true }); var context_1 = require("../context/context"); var gridOptionsWrapper_1 = require("../gridOptionsWrapper"); var expressionService_1 = require("../valueService/expressionService"); var ValueFormatterService = (function () { function ValueFormatterService() { } ValueFormatterService.prototype.formatValue = function (column, rowNode, $scope, value) { var formatter; var colDef = column.getColDef(); // if floating, give preference to the floating formatter if (rowNode && rowNode.rowPinned) { formatter = colDef.pinnedRowValueFormatter ? colDef.pinnedRowValueFormatter : colDef.valueFormatter; } else { formatter = colDef.valueFormatter; } var result = null; if (formatter) { var params = { value: value, node: rowNode, data: rowNode ? rowNode.data : null, colDef: column.getColDef(), column: column, api: this.gridOptionsWrapper.getApi(), columnApi: this.gridOptionsWrapper.getColumnApi(), context: this.gridOptionsWrapper.getContext() }; // originally we put the angular 1 scope here, but we don't want the scope // in the params interface, as other frameworks will see the interface, and // angular 1 is not cool any more. so we hack the scope in here (we cannot // include it above, as it's not in the interface, so would cause a compile error). // in the future, when we stop supporting angular 1, we can take this out. params.$scope = $scope; result = this.expressionService.evaluate(formatter, params); } else if (colDef.refData) { return colDef.refData[value]; } // if we don't do this, then arrays get displayed as 1,2,3, but we want 1, 2, 3 (ie with spaces) if ((result === null || result === undefined) && Array.isArray(value)) { result = value.join(', '); } return result; }; __decorate([ context_1.Autowired('gridOptionsWrapper'), __metadata("design:type", gridOptionsWrapper_1.GridOptionsWrapper) ], ValueFormatterService.prototype, "gridOptionsWrapper", void 0); __decorate([ context_1.Autowired('expressionService'), __metadata("design:type", expressionService_1.ExpressionService) ], ValueFormatterService.prototype, "expressionService", void 0); ValueFormatterService = __decorate([ context_1.Bean('valueFormatterService') ], ValueFormatterService); return ValueFormatterService; }()); exports.ValueFormatterService = ValueFormatterService;
App = window.App || {}; App.Search = (function () { var searchInput, searchResults, doSearch, limit = 25, paginationContainer; var handleKeyEvent = function (event) { App.InlineSearch.delay(function () { searchResults.empty(); doSearch(searchInput.val()); }, 200); }; var paginate = function (event) { var active = $(event.target); var page = active.attr('page'); event.preventDefault(); App.InlineSearch.executeSearch(searchInput.val(), searchResults, undefined, page); }; var createPagination = function (event, results) { var element, i; var total = results.total; var page = results.page; var pages = Math.floor(total / limit); paginationContainer.empty(); for (i = 1; i <= pages; i++) { element = $('<a href="#"></a>'); element.text(i); element.attr('page', i); if (i == page) { element.addClass('active'); } paginationContainer.append(element); } }; var init = function () { searchInput = $('.standalone-search .search-input'); searchResults = $('#search-results'); paginationContainer = $('#search-pagination'); searchInput.bind('keyup', handleKeyEvent); $(document).bind('search.complete', createPagination); paginationContainer.delegate('a', 'click', paginate); doSearch = App.InlineSearch.createSearch(searchResults); var params = $.getQueryParameters(); if (params.q) { searchInput.val(params.q).trigger('keyup'); } }; return { init: init }; })(); $(App.Search.init);
'use strict'; var lib = require('./lib'); var arrayFrom = Array.from; var supportsIterators = typeof Symbol === 'function' && Symbol.iterator && typeof arrayFrom === 'function'; // Frames keep track of scoping both at compile-time and run-time so // we know how to access variables. Block tags can introduce special // variables, for example. var Frame = /*#__PURE__*/ function () { function Frame(parent, isolateWrites) { this.variables = {}; this.parent = parent; this.topLevel = false; // if this is true, writes (set) should never propagate upwards past // this frame to its parent (though reads may). this.isolateWrites = isolateWrites; } var _proto = Frame.prototype; _proto.set = function set(name, val, resolveUp) { // Allow variables with dots by automatically creating the // nested structure var parts = name.split('.'); var obj = this.variables; var frame = this; if (resolveUp) { if (frame = this.resolve(parts[0], true)) { frame.set(name, val); return; } } for (var i = 0; i < parts.length - 1; i++) { var id = parts[i]; if (!obj[id]) { obj[id] = {}; } obj = obj[id]; } obj[parts[parts.length - 1]] = val; }; _proto.get = function get(name) { var val = this.variables[name]; if (val !== undefined) { return val; } return null; }; _proto.lookup = function lookup(name) { var p = this.parent; var val = this.variables[name]; if (val !== undefined) { return val; } return p && p.lookup(name); }; _proto.resolve = function resolve(name, forWrite) { var p = forWrite && this.isolateWrites ? undefined : this.parent; var val = this.variables[name]; if (val !== undefined) { return this; } return p && p.resolve(name); }; _proto.push = function push(isolateWrites) { return new Frame(this, isolateWrites); }; _proto.pop = function pop() { return this.parent; }; return Frame; }(); function makeMacro(argNames, kwargNames, func) { var _this = this; return function () { for (var _len = arguments.length, macroArgs = new Array(_len), _key = 0; _key < _len; _key++) { macroArgs[_key] = arguments[_key]; } var argCount = numArgs(macroArgs); var args; var kwargs = getKeywordArgs(macroArgs); if (argCount > argNames.length) { args = macroArgs.slice(0, argNames.length); // Positional arguments that should be passed in as // keyword arguments (essentially default values) macroArgs.slice(args.length, argCount).forEach(function (val, i) { if (i < kwargNames.length) { kwargs[kwargNames[i]] = val; } }); args.push(kwargs); } else if (argCount < argNames.length) { args = macroArgs.slice(0, argCount); for (var i = argCount; i < argNames.length; i++) { var arg = argNames[i]; // Keyword arguments that should be passed as // positional arguments, i.e. the caller explicitly // used the name of a positional arg args.push(kwargs[arg]); delete kwargs[arg]; } args.push(kwargs); } else { args = macroArgs; } return func.apply(_this, args); }; } function makeKeywordArgs(obj) { obj.__keywords = true; return obj; } function isKeywordArgs(obj) { return obj && Object.prototype.hasOwnProperty.call(obj, '__keywords'); } function getKeywordArgs(args) { var len = args.length; if (len) { var lastArg = args[len - 1]; if (isKeywordArgs(lastArg)) { return lastArg; } } return {}; } function numArgs(args) { var len = args.length; if (len === 0) { return 0; } var lastArg = args[len - 1]; if (isKeywordArgs(lastArg)) { return len - 1; } else { return len; } } // A SafeString object indicates that the string should not be // autoescaped. This happens magically because autoescaping only // occurs on primitive string objects. function SafeString(val) { if (typeof val !== 'string') { return val; } this.val = val; this.length = val.length; } SafeString.prototype = Object.create(String.prototype, { length: { writable: true, configurable: true, value: 0 } }); SafeString.prototype.valueOf = function valueOf() { return this.val; }; SafeString.prototype.toString = function toString() { return this.val; }; function copySafeness(dest, target) { if (dest instanceof SafeString) { return new SafeString(target); } return target.toString(); } function markSafe(val) { var type = typeof val; if (type === 'string') { return new SafeString(val); } else if (type !== 'function') { return val; } else { return function wrapSafe(args) { var ret = val.apply(this, arguments); if (typeof ret === 'string') { return new SafeString(ret); } return ret; }; } } function suppressValue(val, autoescape) { val = val !== undefined && val !== null ? val : ''; if (autoescape && !(val instanceof SafeString)) { val = lib.escape(val.toString()); } return val; } function ensureDefined(val, lineno, colno) { if (val === null || val === undefined) { throw new lib.TemplateError('attempted to output null or undefined value', lineno + 1, colno + 1); } return val; } function memberLookup(obj, val) { if (obj === undefined || obj === null) { return undefined; } if (typeof obj[val] === 'function') { return function () { for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { args[_key2] = arguments[_key2]; } return obj[val].apply(obj, args); }; } return obj[val]; } function callWrap(obj, name, context, args) { if (!obj) { throw new Error('Unable to call `' + name + '`, which is undefined or falsey'); } else if (typeof obj !== 'function') { throw new Error('Unable to call `' + name + '`, which is not a function'); } return obj.apply(context, args); } function contextOrFrameLookup(context, frame, name) { var val = frame.lookup(name); return val !== undefined ? val : context.lookup(name); } function handleError(error, lineno, colno) { if (error.lineno) { return error; } else { return new lib.TemplateError(error, lineno, colno); } } function asyncEach(arr, dimen, iter, cb) { if (lib.isArray(arr)) { var len = arr.length; lib.asyncIter(arr, function iterCallback(item, i, next) { switch (dimen) { case 1: iter(item, i, len, next); break; case 2: iter(item[0], item[1], i, len, next); break; case 3: iter(item[0], item[1], item[2], i, len, next); break; default: item.push(i, len, next); iter.apply(this, item); } }, cb); } else { lib.asyncFor(arr, function iterCallback(key, val, i, len, next) { iter(key, val, i, len, next); }, cb); } } function asyncAll(arr, dimen, func, cb) { var finished = 0; var len; var outputArr; function done(i, output) { finished++; outputArr[i] = output; if (finished === len) { cb(null, outputArr.join('')); } } if (lib.isArray(arr)) { len = arr.length; outputArr = new Array(len); if (len === 0) { cb(null, ''); } else { for (var i = 0; i < arr.length; i++) { var item = arr[i]; switch (dimen) { case 1: func(item, i, len, done); break; case 2: func(item[0], item[1], i, len, done); break; case 3: func(item[0], item[1], item[2], i, len, done); break; default: item.push(i, len, done); func.apply(this, item); } } } } else { var keys = lib.keys(arr || {}); len = keys.length; outputArr = new Array(len); if (len === 0) { cb(null, ''); } else { for (var _i = 0; _i < keys.length; _i++) { var k = keys[_i]; func(k, arr[k], _i, len, done); } } } } function fromIterator(arr) { if (typeof arr !== 'object' || arr === null || lib.isArray(arr)) { return arr; } else if (supportsIterators && Symbol.iterator in arr) { return arrayFrom(arr); } else { return arr; } } module.exports = { Frame: Frame, makeMacro: makeMacro, makeKeywordArgs: makeKeywordArgs, numArgs: numArgs, suppressValue: suppressValue, ensureDefined: ensureDefined, memberLookup: memberLookup, contextOrFrameLookup: contextOrFrameLookup, callWrap: callWrap, handleError: handleError, isArray: lib.isArray, keys: lib.keys, SafeString: SafeString, copySafeness: copySafeness, markSafe: markSafe, asyncEach: asyncEach, asyncAll: asyncAll, inOperator: lib.inOperator, fromIterator: fromIterator };
var gridInstance = ( <Grid fixed className="doc-g"> <Col sm={4}>4</Col> <Col sm={8}>8</Col> </Grid> ); React.render(gridInstance, mountNode);
fixture `gh-856` .page `http://localhost:3000/fixtures/regression/gh-856/pages/first.html`; test('gh-856', async t => { await t.click('#link'); }); test('gh-856 (iframe)', async t => { await t .switchToIframe('#iframe') .click('#link'); });
test( 'atomic.themes.core.UrlTypeTest', [ 'tinymce.themes.inlite.core.UrlType' ], function (UrlType) { var testIsDomainLike = function () { var mostUsedTopLevelDomains = [ 'com', 'org', 'edu', 'gov', 'uk', 'net', 'ca', 'de', 'jp', 'fr', 'au', 'us', 'ru', 'ch', 'it', 'nl', 'se', 'no', 'es', 'mil' ]; assert.eq(UrlType.isDomainLike('www.site.com'), true); assert.eq(UrlType.isDomainLike('www.site.xyz'), true); assert.eq(UrlType.isDomainLike(' www.site.xyz'), true); assert.eq(UrlType.isDomainLike('site.xyz'), false); mostUsedTopLevelDomains.forEach(function (tld) { assert.eq(UrlType.isDomainLike('site.' + tld), true); assert.eq(UrlType.isDomainLike(' site.' + tld), true); assert.eq(UrlType.isDomainLike('site.' + tld + ' '), true); }); assert.eq(UrlType.isDomainLike('/a/b'), false); }; var testIsAbsoluteUrl = function () { assert.eq(UrlType.isAbsolute('http://www.site.com'), true); assert.eq(UrlType.isAbsolute('https://www.site.com'), true); assert.eq(UrlType.isAbsolute('www.site.com'), false); assert.eq(UrlType.isAbsolute('file.gif'), false); }; testIsDomainLike(); testIsAbsoluteUrl(); } );
/** * (c) 2010-2017 Torstein Honsi * * License: www.highcharts.com/license */ 'use strict'; import H from './Globals.js'; import './Utilities.js'; import './Color.js'; import './Legend.js'; import './Series.js'; import './Options.js'; var animObject = H.animObject, color = H.color, each = H.each, extend = H.extend, isNumber = H.isNumber, LegendSymbolMixin = H.LegendSymbolMixin, merge = H.merge, noop = H.noop, pick = H.pick, Series = H.Series, seriesType = H.seriesType, svg = H.svg; /** * The column series type. * * @constructor seriesTypes.column * @augments Series */ /** * Column series display one column per value along an X axis. * * @sample {highcharts} highcharts/demo/column-basic/ Column chart * @sample {highstock} stock/demo/column/ Column chart * * @extends {plotOptions.line} * @product highcharts highstock * @excluding connectNulls,dashStyle,gapSize,gapUnit,linecap,lineWidth, * marker,connectEnds,step * @optionparent plotOptions.column */ seriesType('column', 'line', { /** * The corner radius of the border surrounding each column or bar. * * @type {Number} * @sample {highcharts} highcharts/plotoptions/column-borderradius/ * Rounded columns * @default 0 * @product highcharts highstock */ borderRadius: 0, /** * When using automatic point colors pulled from the `options.colors` * collection, this option determines whether the chart should receive * one color per series or one color per point. * * @type {Boolean} * @see [series colors](#plotOptions.column.colors) * @sample {highcharts} highcharts/plotoptions/column-colorbypoint-false/ * False by default * @sample {highcharts} highcharts/plotoptions/column-colorbypoint-true/ * True * @default false * @since 2.0 * @product highcharts highstock * @apioption plotOptions.column.colorByPoint */ /** * A series specific or series type specific color set to apply instead * of the global [colors](#colors) when [colorByPoint]( * #plotOptions.column.colorByPoint) is true. * * @type {Array<Color>} * @since 3.0 * @product highcharts highstock * @apioption plotOptions.column.colors */ /** * When true, each column edge is rounded to its nearest pixel in order * to render sharp on screen. In some cases, when there are a lot of * densely packed columns, this leads to visible difference in column * widths or distance between columns. In these cases, setting `crisp` * to `false` may look better, even though each column is rendered * blurry. * * @sample {highcharts} highcharts/plotoptions/column-crisp-false/ * Crisp is false * @since 5.0.10 * @product highcharts highstock */ crisp: true, /** * Padding between each value groups, in x axis units. * * @sample {highcharts} highcharts/plotoptions/column-grouppadding-default/ * 0.2 by default * @sample {highcharts} highcharts/plotoptions/column-grouppadding-none/ * No group padding - all columns are evenly spaced * @product highcharts highstock */ groupPadding: 0.2, /** * Whether to group non-stacked columns or to let them render independent * of each other. Non-grouped columns will be laid out individually * and overlap each other. * * @type {Boolean} * @sample {highcharts} highcharts/plotoptions/column-grouping-false/ * Grouping disabled * @sample {highstock} highcharts/plotoptions/column-grouping-false/ * Grouping disabled * @default true * @since 2.3.0 * @product highcharts highstock * @apioption plotOptions.column.grouping */ /** * @ignore-option */ marker: null, // point options are specified in the base options /** * The maximum allowed pixel width for a column, translated to the height * of a bar in a bar chart. This prevents the columns from becoming * too wide when there is a small number of points in the chart. * * @type {Number} * @see [pointWidth](#plotOptions.column.pointWidth) * @sample {highcharts} highcharts/plotoptions/column-maxpointwidth-20/ * Limited to 50 * @sample {highstock} highcharts/plotoptions/column-maxpointwidth-20/ * Limited to 50 * @default null * @since 4.1.8 * @product highcharts highstock * @apioption plotOptions.column.maxPointWidth */ /** * Padding between each column or bar, in x axis units. * * @sample {highcharts} highcharts/plotoptions/column-pointpadding-default/ * 0.1 by default * @sample {highcharts} highcharts/plotoptions/column-pointpadding-025/ * 0.25 * @sample {highcharts} highcharts/plotoptions/column-pointpadding-none/ * 0 for tightly packed columns * @product highcharts highstock */ pointPadding: 0.1, /** * A pixel value specifying a fixed width for each column or bar. When * `null`, the width is calculated from the `pointPadding` and * `groupPadding`. * * @type {Number} * @see [maxPointWidth](#plotOptions.column.maxPointWidth) * @sample {highcharts} highcharts/plotoptions/column-pointwidth-20/ * 20px wide columns regardless of chart width or the amount * of data points * @default null * @since 1.2.5 * @product highcharts highstock * @apioption plotOptions.column.pointWidth */ /** * The minimal height for a column or width for a bar. By default, * 0 values are not shown. To visualize a 0 (or close to zero) point, * set the minimal point length to a pixel value like 3\. In stacked * column charts, minPointLength might not be respected for tightly * packed values. * * @sample {highcharts} * highcharts/plotoptions/column-minpointlength/ * Zero base value * @sample {highcharts} * highcharts/plotoptions/column-minpointlength-pos-and-neg/ * Positive and negative close to zero values * @product highcharts highstock */ minPointLength: 0, /** * When the series contains less points than the crop threshold, all * points are drawn, event if the points fall outside the visible plot * area at the current zoom. The advantage of drawing all points (including * markers and columns), is that animation is performed on updates. * On the other hand, when the series contains more points than the * crop threshold, the series data is cropped to only contain points * that fall within the plot area. The advantage of cropping away invisible * points is to increase performance on large series. . * * @product highcharts highstock */ cropThreshold: 50, /** * The X axis range that each point is valid for. This determines the * width of the column. On a categorized axis, the range will be 1 * by default (one category unit). On linear and datetime axes, the * range will be computed as the distance between the two closest data * points. * * The default `null` means it is computed automatically, but this option * can be used to override the automatic value. * * @type {Number} * @sample {highcharts} highcharts/plotoptions/column-pointrange/ * Set the point range to one day on a data set with one week * between the points * @since 2.3 * @product highcharts highstock */ pointRange: null, states: { /** * Options for the hovered point. These settings override the normal * state options when a point is moused over or touched. * * @extends plotOptions.series.states.hover * @excluding halo,lineWidth,lineWidthPlus,marker * @product highcharts highstock */ hover: { /** @ignore-option */ halo: false, /** * A specific border color for the hovered point. Defaults to * inherit the normal state border color. * * @type {Color} * @product highcharts * @apioption plotOptions.column.states.hover.borderColor */ /** * A specific color for the hovered point. * * @type {Color} * @default undefined * @product highcharts * @apioption plotOptions.column.states.hover.color */ /** * How much to brighten the point on interaction. Requires the main * color to be defined in hex or rgb(a) format. * * In styled mode, the hover brightening is by default replaced * with a fill-opacity set in the `.highcharts-point:hover` rule. * * @sample {highcharts} * highcharts/plotoptions/column-states-hover-brightness/ * Brighten by 0.5 * @product highcharts highstock */ brightness: 0.1 }, /** * Options for the selected point. These settings override the normal * state options when a point is selected. * * @excluding halo,lineWidth,lineWidthPlus,marker * @product highcharts highstock */ select: { /** * A specific color for the selected point. * * @type {Color} * @default #cccccc * @product highcharts highstock */ color: '#cccccc', /** * A specific border color for the selected point. * * @type {Color} * @default #000000 * @product highcharts highstock */ borderColor: '#000000' } }, dataLabels: { align: null, // auto verticalAlign: null, // auto y: null }, /** * When this is true, the series will not cause the Y axis to cross * the zero plane (or [threshold](#plotOptions.series.threshold) option) * unless the data actually crosses the plane. * * For example, if `softThreshold` is `false`, a series of 0, 1, 2, * 3 will make the Y axis show negative values according to the `minPadding` * option. If `softThreshold` is `true`, the Y axis starts at 0. * * @since 4.1.9 * @product highcharts highstock */ softThreshold: false, // false doesn't work well: https://jsfiddle.net/highcharts/hz8fopan/14/ /** * @ignore-option */ startFromThreshold: true, stickyTracking: false, tooltip: { distance: 6 }, /** * The Y axis value to serve as the base for the columns, for distinguishing * between values above and below a threshold. If `null`, the columns * extend from the padding Y axis minimum. * * @since 2.0 * @product highcharts */ threshold: 0, /** * The width of the border surrounding each column or bar. * * In styled mode, the stroke width can be set with the `.highcharts-point` * rule. * * @type {Number} * @sample {highcharts} highcharts/plotoptions/column-borderwidth/ * 2px black border * @default 1 * @product highcharts highstock * @apioption plotOptions.column.borderWidth */ /** * The color of the border surrounding each column or bar. * * In styled mode, the border stroke can be set with the `.highcharts-point` * rule. * * @type {Color} * @sample {highcharts} highcharts/plotoptions/column-bordercolor/ * Dark gray border * @default #ffffff * @product highcharts highstock */ borderColor: '#ffffff' }, /** @lends seriesTypes.column.prototype */ { cropShoulder: 0, // When tooltip is not shared, this series (and derivatives) requires direct // touch/hover. KD-tree does not apply. directTouch: true, trackerGroups: ['group', 'dataLabelsGroup'], // use separate negative stacks, unlike area stacks where a negative point // is substracted from previous (#1910) negStacks: true, /** * Initialize the series. Extends the basic Series.init method by * marking other series of the same type as dirty. * * @function #init * @memberof seriesTypes.column * */ init: function () { Series.prototype.init.apply(this, arguments); var series = this, chart = series.chart; // if the series is added dynamically, force redraw of other // series affected by a new column if (chart.hasRendered) { each(chart.series, function (otherSeries) { if (otherSeries.type === series.type) { otherSeries.isDirty = true; } }); } }, /** * Return the width and x offset of the columns adjusted for grouping, * groupPadding, pointPadding, pointWidth etc. */ getColumnMetrics: function () { var series = this, options = series.options, xAxis = series.xAxis, yAxis = series.yAxis, reversedStacks = xAxis.options.reversedStacks, // Keep backward compatibility: reversed xAxis had reversed stacks reverseStacks = (xAxis.reversed && !reversedStacks) || (!xAxis.reversed && reversedStacks), stackKey, stackGroups = {}, columnCount = 0; // Get the total number of column type series. This is called on every // series. Consider moving this logic to a chart.orderStacks() function // and call it on init, addSeries and removeSeries if (options.grouping === false) { columnCount = 1; } else { each(series.chart.series, function (otherSeries) { var otherOptions = otherSeries.options, otherYAxis = otherSeries.yAxis, columnIndex; if ( otherSeries.type === series.type && ( otherSeries.visible || !series.chart.options.chart.ignoreHiddenSeries ) && yAxis.len === otherYAxis.len && yAxis.pos === otherYAxis.pos ) { // #642, #2086 if (otherOptions.stacking) { stackKey = otherSeries.stackKey; if (stackGroups[stackKey] === undefined) { stackGroups[stackKey] = columnCount++; } columnIndex = stackGroups[stackKey]; } else if (otherOptions.grouping !== false) { // #1162 columnIndex = columnCount++; } otherSeries.columnIndex = columnIndex; } }); } var categoryWidth = Math.min( Math.abs(xAxis.transA) * ( xAxis.ordinalSlope || options.pointRange || xAxis.closestPointRange || xAxis.tickInterval || 1 ), // #2610 xAxis.len // #1535 ), groupPadding = categoryWidth * options.groupPadding, groupWidth = categoryWidth - 2 * groupPadding, pointOffsetWidth = groupWidth / (columnCount || 1), pointWidth = Math.min( options.maxPointWidth || xAxis.len, pick( options.pointWidth, pointOffsetWidth * (1 - 2 * options.pointPadding) ) ), pointPadding = (pointOffsetWidth - pointWidth) / 2, // #1251, #3737 colIndex = (series.columnIndex || 0) + (reverseStacks ? 1 : 0), pointXOffset = pointPadding + ( groupPadding + colIndex * pointOffsetWidth - (categoryWidth / 2) ) * (reverseStacks ? -1 : 1); // Save it for reading in linked series (Error bars particularly) series.columnMetrics = { width: pointWidth, offset: pointXOffset }; return series.columnMetrics; }, /** * Make the columns crisp. The edges are rounded to the nearest full pixel. */ crispCol: function (x, y, w, h) { var chart = this.chart, borderWidth = this.borderWidth, xCrisp = -(borderWidth % 2 ? 0.5 : 0), yCrisp = borderWidth % 2 ? 0.5 : 1, right, bottom, fromTop; if (chart.inverted && chart.renderer.isVML) { yCrisp += 1; } // Horizontal. We need to first compute the exact right edge, then round // it and compute the width from there. if (this.options.crisp) { right = Math.round(x + w) + xCrisp; x = Math.round(x) + xCrisp; w = right - x; } // Vertical bottom = Math.round(y + h) + yCrisp; fromTop = Math.abs(y) <= 0.5 && bottom > 0.5; // #4504, #4656 y = Math.round(y) + yCrisp; h = bottom - y; // Top edges are exceptions if (fromTop && h) { // #5146 y -= 1; h += 1; } return { x: x, y: y, width: w, height: h }; }, /** * Translate each point to the plot area coordinate system and find shape * positions */ translate: function () { var series = this, chart = series.chart, options = series.options, dense = series.dense = series.closestPointRange * series.xAxis.transA < 2, borderWidth = series.borderWidth = pick( options.borderWidth, dense ? 0 : 1 // #3635 ), yAxis = series.yAxis, threshold = options.threshold, translatedThreshold = series.translatedThreshold = yAxis.getThreshold(threshold), minPointLength = pick(options.minPointLength, 5), metrics = series.getColumnMetrics(), pointWidth = metrics.width, // postprocessed for border width seriesBarW = series.barW = Math.max(pointWidth, 1 + 2 * borderWidth), pointXOffset = series.pointXOffset = metrics.offset; if (chart.inverted) { translatedThreshold -= 0.5; // #3355 } // When the pointPadding is 0, we want the columns to be packed tightly, // so we allow individual columns to have individual sizes. When // pointPadding is greater, we strive for equal-width columns (#2694). if (options.pointPadding) { seriesBarW = Math.ceil(seriesBarW); } Series.prototype.translate.apply(series); // Record the new values each(series.points, function (point) { var yBottom = pick(point.yBottom, translatedThreshold), safeDistance = 999 + Math.abs(yBottom), plotY = Math.min( Math.max(-safeDistance, point.plotY), yAxis.len + safeDistance ), // Don't draw too far outside plot area (#1303, #2241, #4264) barX = point.plotX + pointXOffset, barW = seriesBarW, barY = Math.min(plotY, yBottom), up, barH = Math.max(plotY, yBottom) - barY; // Handle options.minPointLength if (minPointLength && Math.abs(barH) < minPointLength) { barH = minPointLength; up = (!yAxis.reversed && !point.negative) || (yAxis.reversed && point.negative); // Reverse zeros if there's no positive value in the series // in visible range (#7046) if ( point.y === threshold && series.dataMax <= threshold && yAxis.min < threshold // and if there's room for it (#7311) ) { up = !up; } // If stacked... barY = Math.abs(barY - translatedThreshold) > minPointLength ? // ...keep position yBottom - minPointLength : // #1485, #4051 translatedThreshold - (up ? minPointLength : 0); } // Cache for access in polar point.barX = barX; point.pointWidth = pointWidth; // Fix the tooltip on center of grouped columns (#1216, #424, #3648) point.tooltipPos = chart.inverted ? [ yAxis.len + yAxis.pos - chart.plotLeft - plotY, series.xAxis.len - barX - barW / 2, barH ] : [barX + barW / 2, plotY + yAxis.pos - chart.plotTop, barH]; // Register shape type and arguments to be used in drawPoints point.shapeType = 'rect'; point.shapeArgs = series.crispCol.apply( series, point.isNull ? // #3169, drilldown from null must have a position to work // from #6585, dataLabel should be placed on xAxis, not // floating in the middle of the chart [barX, translatedThreshold, barW, 0] : [barX, barY, barW, barH] ); }); }, getSymbol: noop, /** * Use a solid rectangle like the area series types */ drawLegendSymbol: LegendSymbolMixin.drawRectangle, /** * Columns have no graph */ drawGraph: function () { this.group[ this.dense ? 'addClass' : 'removeClass' ]('highcharts-dense-data'); }, /** * Get presentational attributes */ pointAttribs: function (point, state) { var options = this.options, stateOptions, ret, p2o = this.pointAttrToOptions || {}, strokeOption = p2o.stroke || 'borderColor', strokeWidthOption = p2o['stroke-width'] || 'borderWidth', fill = (point && point.color) || this.color, stroke = (point && point[strokeOption]) || options[strokeOption] || this.color || fill, // set to fill when borderColor null strokeWidth = (point && point[strokeWidthOption]) || options[strokeWidthOption] || this[strokeWidthOption] || 0, dashstyle = options.dashStyle, zone, brightness; // Handle zone colors if (point && this.zones.length) { zone = point.getZone(); // When zones are present, don't use point.color (#4267). Changed // order (#6527) fill = point.options.color || (zone && zone.color) || this.color; } // Select or hover states if (state) { stateOptions = merge( options.states[state], // #6401 point.options.states && point.options.states[state] || {} ); brightness = stateOptions.brightness; fill = stateOptions.color || ( brightness !== undefined && color(fill).brighten(stateOptions.brightness).get() ) || fill; stroke = stateOptions[strokeOption] || stroke; strokeWidth = stateOptions[strokeWidthOption] || strokeWidth; dashstyle = stateOptions.dashStyle || dashstyle; } ret = { 'fill': fill, 'stroke': stroke, 'stroke-width': strokeWidth }; if (dashstyle) { ret.dashstyle = dashstyle; } return ret; }, /** * Draw the columns. For bars, the series.group is rotated, so the same * coordinates apply for columns and bars. This method is inherited by * scatter series. */ drawPoints: function () { var series = this, chart = this.chart, options = series.options, renderer = chart.renderer, animationLimit = options.animationLimit || 250, shapeArgs; // draw the columns each(series.points, function (point) { var plotY = point.plotY, graphic = point.graphic, verb = graphic && chart.pointCount < animationLimit ? 'animate' : 'attr'; if (isNumber(plotY) && point.y !== null) { shapeArgs = point.shapeArgs; if (graphic) { // update graphic[verb]( merge(shapeArgs) ); } else { point.graphic = graphic = renderer[point.shapeType](shapeArgs) .add(point.group || series.group); } // Border radius is not stylable (#6900) if (options.borderRadius) { graphic.attr({ r: options.borderRadius }); } // Presentational graphic[verb](series.pointAttribs( point, point.selected && 'select' )) .shadow( options.shadow, null, options.stacking && !options.borderRadius ); graphic.addClass(point.getClassName(), true); } else if (graphic) { point.graphic = graphic.destroy(); // #1269 } }); }, /** * Animate the column heights one by one from zero * @param {Boolean} init Whether to initialize the animation or run it */ animate: function (init) { var series = this, yAxis = this.yAxis, options = series.options, inverted = this.chart.inverted, attr = {}, translateProp = inverted ? 'translateX' : 'translateY', translateStart, translatedThreshold; if (svg) { // VML is too slow anyway if (init) { attr.scaleY = 0.001; translatedThreshold = Math.min( yAxis.pos + yAxis.len, Math.max(yAxis.pos, yAxis.toPixels(options.threshold)) ); if (inverted) { attr.translateX = translatedThreshold - yAxis.len; } else { attr.translateY = translatedThreshold; } series.group.attr(attr); } else { // run the animation translateStart = series.group.attr(translateProp); series.group.animate( { scaleY: 1 }, extend(animObject(series.options.animation ), { // Do the scale synchronously to ensure smooth updating // (#5030, #7228) step: function (val, fx) { attr[translateProp] = translateStart + fx.pos * (yAxis.pos - translateStart); series.group.attr(attr); } })); // delete this function to allow it only once series.animate = null; } } }, /** * Remove this series from the chart */ remove: function () { var series = this, chart = series.chart; // column and bar series affects other series of the same type // as they are either stacked or grouped if (chart.hasRendered) { each(chart.series, function (otherSeries) { if (otherSeries.type === series.type) { otherSeries.isDirty = true; } }); } Series.prototype.remove.apply(series, arguments); } }); /** * A `column` series. If the [type](#series.column.type) option is * not specified, it is inherited from [chart.type](#chart.type). * * @type {Object} * @extends series,plotOptions.column * @excluding connectNulls,dashStyle,dataParser,dataURL,gapSize,gapUnit,linecap, * lineWidth,marker,connectEnds,step * @product highcharts highstock * @apioption series.column */ /** * @excluding halo,lineWidth,lineWidthPlus,marker * @product highcharts highstock * @apioption series.column.states.hover */ /** * @excluding halo,lineWidth,lineWidthPlus,marker * @product highcharts highstock * @apioption series.column.states.select */ /** * An array of data points for the series. For the `column` series type, * points can be given in the following ways: * * 1. An array of numerical values. In this case, the numerical values * will be interpreted as `y` options. The `x` values will be automatically * calculated, either starting at 0 and incremented by 1, or from `pointStart` * and `pointInterval` given in the series options. If the axis has * categories, these will be used. Example: * * ```js * data: [0, 5, 3, 5] * ``` * * 2. An array of arrays with 2 values. In this case, the values correspond * to `x,y`. If the first value is a string, it is applied as the name * of the point, and the `x` value is inferred. * * ```js * data: [ * [0, 6], * [1, 2], * [2, 6] * ] * ``` * * 3. An array of objects with named values. The objects are point * configuration objects as seen below. If the total number of data * points exceeds the series' [turboThreshold](#series.column.turboThreshold), * this option is not available. * * ```js * data: [{ * x: 1, * y: 9, * name: "Point2", * color: "#00FF00" * }, { * x: 1, * y: 6, * name: "Point1", * color: "#FF00FF" * }] * ``` * * @type {Array<Object|Array|Number>} * @extends series.line.data * @excluding marker * @sample {highcharts} highcharts/chart/reflow-true/ * Numerical values * @sample {highcharts} highcharts/series/data-array-of-arrays/ * Arrays of numeric x and y * @sample {highcharts} highcharts/series/data-array-of-arrays-datetime/ * Arrays of datetime x and y * @sample {highcharts} highcharts/series/data-array-of-name-value/ * Arrays of point.name and y * @sample {highcharts} highcharts/series/data-array-of-objects/ * Config objects * @product highcharts highstock * @apioption series.column.data */ /** * The color of the border surrounding the column or bar. * * In styled mode, the border stroke can be set with the `.highcharts-point` * rule. * * @type {Color} * @sample {highcharts} highcharts/plotoptions/column-bordercolor/ * Dark gray border * @default undefined * @product highcharts highstock * @apioption series.column.data.borderColor */ /** * The width of the border surrounding the column or bar. * * In styled mode, the stroke width can be set with the `.highcharts-point` * rule. * * @type {Number} * @sample {highcharts} highcharts/plotoptions/column-borderwidth/ * 2px black border * @default undefined * @product highcharts highstock * @apioption series.column.data.borderWidth */
/* Copyright (c) 2004-2009, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ if(!dojo._hasResource["dojox.form.TimeSpinner"]){ dojo._hasResource["dojox.form.TimeSpinner"]=true; dojo.provide("dojox.form.TimeSpinner"); dojo.require("dijit.form._Spinner"); dojo.require("dijit.form.NumberTextBox"); dojo.require("dojo.date"); dojo.require("dojo.date.locale"); dojo.require("dojo.date.stamp"); dojo.declare("dojox.form.TimeSpinner",[dijit.form._Spinner],{required:false,adjust:function(_1,_2){ return dojo.date.add(_1,"minute",_2); },isValid:function(){ return true; },smallDelta:5,largeDelta:30,timeoutChangeRate:0.5,parse:function(_3,_4){ return dojo.date.locale.parse(_3,{selector:"time",formatLength:"short"}); },format:function(_5,_6){ if(dojo.isString(_5)){ return _5; } return dojo.date.locale.format(_5,{selector:"time",formatLength:"short"}); },serialize:dojo.date.stamp.toISOString,value:"12:00 AM"}); }
// @flow import React from 'react'; class Foo extends React.Component<{bar: number}, void> { static defaultProps = {bar: 42}; } <Foo bar={42}/>; // OK <Foo bar="42"/>; // Error <Foo bar={undefined}/>; // OK: React will replace `undefined` with the default.
import 'ember'; import Ember from 'ember-metal/core'; import isEnabled from 'ember-metal/features'; import EmberHandlebars from 'ember-htmlbars/compat'; var compile = EmberHandlebars.compile; var Router, App, router, registry, container; function bootApplication() { router = container.lookup('router:main'); Ember.run(App, 'advanceReadiness'); } var startingURL = ''; var expectedReplaceURL, expectedPushURL; function setAndFlush(obj, prop, value) { Ember.run(obj, 'set', prop, value); } var TestLocation = Ember.NoneLocation.extend({ initState() { this.set('path', startingURL); }, setURL(path) { if (expectedReplaceURL) { ok(false, 'pushState occurred but a replaceState was expected'); } if (expectedPushURL) { equal(path, expectedPushURL, 'an expected pushState occurred'); expectedPushURL = null; } this.set('path', path); }, replaceURL(path) { if (expectedPushURL) { ok(false, 'replaceState occurred but a pushState was expected'); } if (expectedReplaceURL) { equal(path, expectedReplaceURL, 'an expected replaceState occurred'); expectedReplaceURL = null; } this.set('path', path); } }); function sharedSetup() { Ember.run(function() { App = Ember.Application.create({ name: 'App', rootElement: '#qunit-fixture' }); App.deferReadiness(); registry = App.__registry__; container = App.__container__; registry.register('location:test', TestLocation); startingURL = expectedReplaceURL = expectedPushURL = ''; App.Router.reopen({ location: 'test' }); Router = App.Router; App.LoadingRoute = Ember.Route.extend({ }); Ember.TEMPLATES.application = compile('{{outlet}}'); Ember.TEMPLATES.home = compile('<h3>Hours</h3>'); }); } function sharedTeardown() { Ember.run(function() { App.destroy(); App = null; Ember.TEMPLATES = {}; }); } if (isEnabled('ember-routing-route-configured-query-params')) { QUnit.module('Query Params - overlapping query param property names when configured on the route', { setup() { sharedSetup(); App.Router.map(function() { this.route('parent', function() { this.route('child'); }); }); this.boot = function() { bootApplication(); Ember.run(router, 'transitionTo', 'parent.child'); }; }, teardown() { sharedTeardown(); } }); QUnit.test('can remap same-named qp props', function() { App.ParentRoute = Ember.Route.extend({ queryParams: { page: { as: 'parentPage', defaultValue: 1 } } }); App.ParentChildRoute = Ember.Route.extend({ queryParams: { page: { as: 'childPage', defaultValue: 1 } } }); this.boot(); equal(router.get('location.path'), '/parent/child'); var parentController = container.lookup('controller:parent'); var parentChildController = container.lookup('controller:parent.child'); setAndFlush(parentController, 'page', 2); equal(router.get('location.path'), '/parent/child?parentPage=2'); setAndFlush(parentController, 'page', 1); equal(router.get('location.path'), '/parent/child'); setAndFlush(parentChildController, 'page', 2); equal(router.get('location.path'), '/parent/child?childPage=2'); setAndFlush(parentChildController, 'page', 1); equal(router.get('location.path'), '/parent/child'); Ember.run(function() { parentController.set('page', 2); parentChildController.set('page', 2); }); equal(router.get('location.path'), '/parent/child?childPage=2&parentPage=2'); Ember.run(function() { parentController.set('page', 1); parentChildController.set('page', 1); }); equal(router.get('location.path'), '/parent/child'); }); QUnit.test('query params in the same route hierarchy with the same url key get auto-scoped', function() { App.ParentRoute = Ember.Route.extend({ queryParams: { foo: { as: 'shared', defaultValue: 1 } } }); App.ParentChildRoute = Ember.Route.extend({ queryParams: { bar: { as: 'shared', defaultValue: 1 } } }); var self = this; expectAssertion(function() { self.boot(); }, 'You\'re not allowed to have more than one controller property map to the same query param key, but both `parent:foo` and `parent.child:bar` map to `shared`. You can fix this by mapping one of the controller properties to a different query param key via the `as` config option, e.g. `foo: { as: \'other-foo\' }`'); }); } else { QUnit.module('Query Params - overlapping query param property names', { setup() { sharedSetup(); App.Router.map(function() { this.route('parent', function() { this.route('child'); }); }); this.boot = function() { bootApplication(); Ember.run(router, 'transitionTo', 'parent.child'); }; }, teardown() { sharedTeardown(); } }); QUnit.test('can remap same-named qp props', function() { App.ParentController = Ember.Controller.extend({ queryParams: { page: 'parentPage' }, page: 1 }); App.ParentChildController = Ember.Controller.extend({ queryParams: { page: 'childPage' }, page: 1 }); this.boot(); equal(router.get('location.path'), '/parent/child'); var parentController = container.lookup('controller:parent'); var parentChildController = container.lookup('controller:parent.child'); setAndFlush(parentController, 'page', 2); equal(router.get('location.path'), '/parent/child?parentPage=2'); setAndFlush(parentController, 'page', 1); equal(router.get('location.path'), '/parent/child'); setAndFlush(parentChildController, 'page', 2); equal(router.get('location.path'), '/parent/child?childPage=2'); setAndFlush(parentChildController, 'page', 1); equal(router.get('location.path'), '/parent/child'); Ember.run(function() { parentController.set('page', 2); parentChildController.set('page', 2); }); equal(router.get('location.path'), '/parent/child?childPage=2&parentPage=2'); Ember.run(function() { parentController.set('page', 1); parentChildController.set('page', 1); }); equal(router.get('location.path'), '/parent/child'); }); QUnit.test('query params in the same route hierarchy with the same url key get auto-scoped', function() { App.ParentController = Ember.Controller.extend({ queryParams: { foo: 'shared' }, foo: 1 }); App.ParentChildController = Ember.Controller.extend({ queryParams: { bar: 'shared' }, bar: 1 }); var self = this; expectAssertion(function() { self.boot(); }, 'You\'re not allowed to have more than one controller property map to the same query param key, but both `parent:foo` and `parent.child:bar` map to `shared`. You can fix this by mapping one of the controller properties to a different query param key via the `as` config option, e.g. `foo: { as: \'other-foo\' }`'); }); QUnit.test('Support shared but overridable mixin pattern', function() { var HasPage = Ember.Mixin.create({ queryParams: 'page', page: 1 }); App.ParentController = Ember.Controller.extend(HasPage, { queryParams: { page: 'yespage' } }); App.ParentChildController = Ember.Controller.extend(HasPage); this.boot(); equal(router.get('location.path'), '/parent/child'); var parentController = container.lookup('controller:parent'); var parentChildController = container.lookup('controller:parent.child'); setAndFlush(parentChildController, 'page', 2); equal(router.get('location.path'), '/parent/child?page=2'); equal(parentController.get('page'), 1); equal(parentChildController.get('page'), 2); setAndFlush(parentController, 'page', 2); equal(router.get('location.path'), '/parent/child?page=2&yespage=2'); equal(parentController.get('page'), 2); equal(parentChildController.get('page'), 2); }); }
var PriorityQueue = require('pomelo-collection').priorityQueue; var id = 0; /** * The cache for pathfinding */ var PathCache = function(opts) { this.id = id++; this.limit = opts.limit||30000; this.size = 0; this.queue = new PriorityQueue(comparator); this.cache = {}; }; var pro = PathCache.prototype; /** * Get a path from cache * @param x1, y1 {Number} Start point of path * @param x2, y2 {Number} End point of path * @return {Object} The path in cache or null if no path exist in cache. * @api public */ pro.getPath = function(x1, y1, x2, y2) { var key = this.genKey(x1, y1, x2, y2); if(!!this.cache[key]) { return this.cache[key]; } return null; }; /** * Generate key for given path, for a path can be identified by start and end point, we use then to construct the key * @param x1, y1 {Number} Start point of path * @param x2, y2 {Number} End point of path * @return {String} The path's key * @api public */ pro.genKey = function(x1, y1, x2, y2) { return x1 + '_' + y1 + '_' + x2 + '_' + y2; }; /** * Add a path to cache * @param x1, y1 {Number} Start point of path * @param x2, y2 {Number} End point of path * @param path {Object} The path to add * @api public */ pro.addPath = function(x1, y1, x2, y2, path) { var key = this.genKey(x1, y1, x2, y2); if(!!this.cache[key]) { this.cache[key] = path; this.cache[key].update = true; this.cache[key].time = Date.now(); } else if(this.size < this.limit) { this.queue.offer({ time : Date.now(), key : key }); this.cache[key] = path; this.size++; } else if(this.size === this.limit) { var delKey = this.queue.pop().key; while(this.cache[delKey].update === true) { this.queue.offer({ time : this.cache[delKey].time, key : delKey }); delKey = this.queue.pop(); } delete this.cache[delKey]; this.queue.offer({ time : Date.now(), key : key }); this.cache[key] = path; } }; var comparator = function(a, b) { return a.time < b.time; }; module.exports = PathCache;
/* jshint node:true */ 'use strict'; var fs = require('fs'); var path = require('path'); module.exports = function() { var js_dependencies =[ 'bower_components/ace-builds/src-min-noconflict/ace.js', 'bower_components/ace-builds/src-min-noconflict/theme-twilight.js', 'bower_components/ace-builds/src-min-noconflict/mode-markdown.js', 'bower_components/ace-builds/src-min-noconflict/mode-scheme.js', 'bower_components/ace-builds/src-min-noconflict/worker-javascript.js' ]; function putThemInVendorDir (filepath) { return 'vendor/' + path.basename(filepath); } return { humaName : 'UI.Ace', repoName : 'ui-ace', inlineHTML : fs.readFileSync(__dirname + '/demo/demo.html'), inlineJS : fs.readFileSync(__dirname + '/demo/demo.js'), css: ['demo/demo.css'], js : js_dependencies.map(putThemInVendorDir).concat(['dist/ui-ace.min.js']), tocopy : js_dependencies, bowerData : { main: './ui-ace.js'} }; };
;window.Modernizr=(function(window,document,undefined){var version='2.8.3',Modernizr={},enableClasses=true,docElement=document.documentElement,mod='modernizr',modElem=document.createElement(mod),mStyle=modElem.style,inputElem,toString={}.toString,prefixes=' -webkit- -moz- -o- -ms- '.split(' '),omPrefixes='Webkit Moz O ms',cssomPrefixes=omPrefixes.split(' '),domPrefixes=omPrefixes.toLowerCase().split(' '),tests={},inputs={},attrs={},classes=[],slice=classes.slice,featureName,injectElementWithStyles=function(rule,callback,nodes,testnames){var style,ret,node,docOverflow,div=document.createElement('div'),body=document.body,fakeBody=body||document.createElement('body');if(parseInt(nodes,10)){while(nodes--){node=document.createElement('div');node.id=testnames?testnames[nodes]:mod+(nodes+ 1);div.appendChild(node);}} style=['&#173;','<style id="s',mod,'">',rule,'</style>'].join('');div.id=mod;(body?div:fakeBody).innerHTML+=style;fakeBody.appendChild(div);if(!body){fakeBody.style.background='';fakeBody.style.overflow='hidden';docOverflow=docElement.style.overflow;docElement.style.overflow='hidden';docElement.appendChild(fakeBody);} ret=callback(div,rule);if(!body){fakeBody.parentNode.removeChild(fakeBody);docElement.style.overflow=docOverflow;}else{div.parentNode.removeChild(div);} return!!ret;},_hasOwnProperty=({}).hasOwnProperty,hasOwnProp;if(!is(_hasOwnProperty,'undefined')&&!is(_hasOwnProperty.call,'undefined')){hasOwnProp=function(object,property){return _hasOwnProperty.call(object,property);};} else{hasOwnProp=function(object,property){return((property in object)&&is(object.constructor.prototype[property],'undefined'));};} if(!Function.prototype.bind){Function.prototype.bind=function bind(that){var target=this;if(typeof target!="function"){throw new TypeError();} var args=slice.call(arguments,1),bound=function(){if(this instanceof bound){var F=function(){};F.prototype=target.prototype;var self=new F();var result=target.apply(self,args.concat(slice.call(arguments)));if(Object(result)===result){return result;} return self;}else{return target.apply(that,args.concat(slice.call(arguments)));}};return bound;};} function setCss(str){mStyle.cssText=str;} function setCssAll(str1,str2){return setCss(prefixes.join(str1+';')+(str2||''));} function is(obj,type){return typeof obj===type;} function contains(str,substr){return!!~(''+ str).indexOf(substr);} function testProps(props,prefixed){for(var i in props){var prop=props[i];if(!contains(prop,"-")&&mStyle[prop]!==undefined){return prefixed=='pfx'?prop:true;}} return false;} function testDOMProps(props,obj,elem){for(var i in props){var item=obj[props[i]];if(item!==undefined){if(elem===false)return props[i];if(is(item,'function')){return item.bind(elem||obj);} return item;}} return false;} function testPropsAll(prop,prefixed,elem){var ucProp=prop.charAt(0).toUpperCase()+ prop.slice(1),props=(prop+' '+ cssomPrefixes.join(ucProp+' ')+ ucProp).split(' ');if(is(prefixed,"string")||is(prefixed,"undefined")){return testProps(props,prefixed);}else{props=(prop+' '+(domPrefixes).join(ucProp+' ')+ ucProp).split(' ');return testDOMProps(props,prefixed,elem);}}tests['cssanimations']=function(){return testPropsAll('animationName');};tests['csstransforms3d']=function(){var ret=!!testPropsAll('perspective');if(ret&&'webkitPerspective'in docElement.style){injectElementWithStyles('@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}',function(node,rule){ret=node.offsetLeft===9&&node.offsetHeight===3;});} return ret;};tests['csstransitions']=function(){return testPropsAll('transition');};for(var feature in tests){if(hasOwnProp(tests,feature)){featureName=feature.toLowerCase();Modernizr[featureName]=tests[feature]();classes.push((Modernizr[featureName]?'':'no-')+ featureName);}} Modernizr.addTest=function(feature,test){if(typeof feature=='object'){for(var key in feature){if(hasOwnProp(feature,key)){Modernizr.addTest(key,feature[key]);}}}else{feature=feature.toLowerCase();if(Modernizr[feature]!==undefined){return Modernizr;} test=typeof test=='function'?test():test;if(typeof enableClasses!=="undefined"&&enableClasses){docElement.className+=' '+(test?'':'no-')+ feature;} Modernizr[feature]=test;} return Modernizr;};setCss('');modElem=inputElem=null;Modernizr._version=version;Modernizr._prefixes=prefixes;Modernizr._domPrefixes=domPrefixes;Modernizr._cssomPrefixes=cssomPrefixes;Modernizr.testProp=function(prop){return testProps([prop]);};Modernizr.testAllProps=testPropsAll;Modernizr.testStyles=injectElementWithStyles;docElement.className=docElement.className.replace(/(^|\s)no-js(\s|$)/,'$1$2')+ (enableClasses?' js '+ classes.join(' '):'');return Modernizr;})(this,this.document);;
Mithril = m = new function app(window) { var selectorCache = {} var type = {}.toString var parser = /(?:(^|#|\.)([^#\.\[\]]+))|(\[.+?\])/g, attrParser = /\[(.+?)(?:=("|'|)(.+?)\2)?\]/ function m() { var args = arguments var hasAttrs = type.call(args[1]) == "[object Object]" var attrs = hasAttrs ? args[1] : {} var classAttrName = "class" in attrs ? "class" : "className" var cell = selectorCache[args[0]] if (cell === undefined) { selectorCache[args[0]] = cell = {tag: "div", attrs: {}} var match, classes = [] while (match = parser.exec(args[0])) { if (match[1] == "") cell.tag = match[2] else if (match[1] == "#") cell.attrs.id = match[2] else if (match[1] == ".") classes.push(match[2]) else if (match[3][0] == "[") { var pair = attrParser.exec(match[3]) cell.attrs[pair[1]] = pair[3] || true } } if (classes.length > 0) cell.attrs[classAttrName] = classes.join(" ") } cell = clone(cell) cell.attrs = clone(cell.attrs) cell.children = hasAttrs ? args[2] : args[1] for (var attrName in attrs) { if (attrName == classAttrName) cell.attrs[attrName] = (cell.attrs[attrName] || "") + " " + attrs[attrName] else cell.attrs[attrName] = attrs[attrName] } return cell } function build(parent, data, cached, shouldReattach, index, namespace) { if (data === null || data === undefined) { if (cached) clear(cached.nodes) return } if (data.subtree === "retain") return var cachedType = type.call(cached), dataType = type.call(data) if (cachedType != dataType) { if (cached !== null && cached !== undefined) clear(cached.nodes) cached = new data.constructor cached.nodes = [] } if (dataType == "[object Array]") { var nodes = [], intact = cached.length === data.length, subArrayCount = 0 for (var i = 0, cacheCount = 0; i < data.length; i++) { var item = build(parent, data[i], cached[cacheCount], shouldReattach, index + subArrayCount || subArrayCount, namespace) if (item === undefined) continue if (!item.nodes.intact) intact = false subArrayCount += item instanceof Array ? item.length : 1 cached[cacheCount++] = item } if (!intact) { for (var i = 0; i < data.length; i++) if (cached[i] !== undefined) nodes = nodes.concat(cached[i].nodes) for (var i = nodes.length, node; node = cached.nodes[i]; i++) if (node.parentNode !== null) node.parentNode.removeChild(node) for (var i = cached.nodes.length, node; node = nodes[i]; i++) if (node.parentNode === null) parent.appendChild(node) if (data.length < cached.length) cached.length = data.length cached.nodes = nodes } } else if (dataType == "[object Object]") { if (data.tag != cached.tag || Object.keys(data.attrs).join() != Object.keys(cached.attrs).join() || data.attrs.id != cached.attrs.id) clear(cached.nodes) if (typeof data.tag != "string") return var node, isNew = cached.nodes.length === 0 if (data.tag === "svg") namespace = "http://www.w3.org/2000/svg" if (isNew) { node = namespace === undefined ? window.document.createElement(data.tag) : window.document.createElementNS(namespace, data.tag) cached = { tag: data.tag, attrs: setAttributes(node, data.attrs, {}, namespace), children: build(node, data.children, cached.children, true, 0, namespace), nodes: [node] } parent.insertBefore(node, parent.childNodes[index] || null) } else { node = cached.nodes[0] setAttributes(node, data.attrs, cached.attrs, namespace) cached.children = build(node, data.children, cached.children, false, 0, namespace) cached.nodes.intact = true if (shouldReattach === true) parent.insertBefore(node, parent.childNodes[index] || null) } if (type.call(data.attrs["config"]) == "[object Function]") data.attrs["config"](node, !isNew) } else { var node if (cached.nodes.length === 0) { if (data.$trusted) { node = injectHTML(parent, index, data) } else { node = window.document.createTextNode(data) parent.insertBefore(node, parent.childNodes[index] || null) } cached = "string number boolean".indexOf(typeof data) > -1 ? new data.constructor(data) : data cached.nodes = [node] } else if (cached.valueOf() !== data.valueOf() || shouldReattach === true) { if (data.$trusted) { var current = cached.nodes[0], nodes = [current] if (current) { while (current = current.nextSibling) nodes.push(current) clear(nodes) node = injectHTML(parent, index, data) } else parent.innerHTML = data } else { node = cached.nodes[0] parent.insertBefore(node, parent.childNodes[index] || null) node.nodeValue = data } cached = new data.constructor(data) cached.nodes = [node] } else cached.nodes.intact = true } return cached } function setAttributes(node, dataAttrs, cachedAttrs, namespace) { for (var attrName in dataAttrs) { var dataAttr = dataAttrs[attrName] var cachedAttr = cachedAttrs[attrName] if (!(attrName in cachedAttrs) || (cachedAttr !== dataAttr) || node === window.document.activeElement) { cachedAttrs[attrName] = dataAttr if (attrName === "config") continue else if (typeof dataAttr == "function" && attrName.indexOf("on") == 0) { node[attrName] = autoredraw(dataAttr, node) } else if (attrName === "style") { for (var rule in dataAttr) { if (cachedAttr === undefined || cachedAttr[rule] !== dataAttr[rule]) node.style[rule] = dataAttr[rule] } } else if (namespace !== undefined) { if (attrName === "href") node.setAttributeNS("http://www.w3.org/1999/xlink", "href", dataAttr) else if (attrName === "className") node.setAttribute("class", dataAttr) else node.setAttribute(attrName, dataAttr) } else if (attrName in node) node[attrName] = dataAttr else node.setAttribute(attrName, dataAttr) } } return cachedAttrs } function clear(nodes) { for (var i = 0; i < nodes.length; i++) nodes[i].parentNode.removeChild(nodes[i]) nodes.length = 0 } function injectHTML(parent, index, data) { var nextSibling = parent.childNodes[index] if (nextSibling) nextSibling.insertAdjacentHTML("beforebegin", data) else parent.insertAdjacentHTML("beforeend", data) return nextSibling ? nextSibling.previousSibling : parent.firstChild } function clone(object) { var result = {} for (var prop in object) result[prop] = object[prop] return result } function autoredraw(callback, object) { return function(e) { m.startComputation() var output = callback.call(object, e) m.endComputation() return output } } var html var documentNode = { insertAdjacentHTML: function(_, data) { window.document.write(data) window.document.close() }, appendChild: function(node) { if (html === undefined) html = window.document.createElement("html") if (node.nodeName == "HTML") html = node else html.appendChild(node) if (window.document.documentElement !== html) { window.document.replaceChild(html, window.document.documentElement) } }, insertBefore: function(node, reference) { this.appendChild(node) }, childNodes: [] } var nodeCache = [], cellCache = {} m.render = function(root, cell) { var index = nodeCache.indexOf(root) var id = index < 0 ? nodeCache.push(root) - 1 : index var node = root == window.document || root == window.document.documentElement ? documentNode : root cellCache[id] = build(node, cell, cellCache[id], false, 0) } m.trust = function(value) { value = new String(value) value.$trusted = true return value } var roots = [], modules = [], controllers = [], now = 0, lastRedraw = 0, lastRedrawId = 0 m.module = function(root, module) { m.startComputation() var index = roots.indexOf(root) if (index < 0) index = roots.length roots[index] = root modules[index] = module controllers[index] = new module.controller m.endComputation() } m.redraw = function() { for (var i = 0; i < roots.length; i++) { m.render(roots[i], modules[i].view(controllers[i])) } lastRedraw = now } function redraw() { now = window.performance && window.performance.now ? window.performance.now() : new window.Date().getTime() if (now - lastRedraw > 16) m.redraw() else { var cancel = window.cancelAnimationFrame || window.clearTimeout var defer = window.requestAnimationFrame || window.setTimeout cancel(lastRedrawId) lastRedrawId = defer(m.redraw, 0) } } var pendingRequests = 0, computePostRedrawHook = null m.startComputation = function() {pendingRequests++} m.endComputation = function() { pendingRequests = Math.max(pendingRequests - 1, 0) if (pendingRequests == 0) { redraw() if (computePostRedrawHook) { computePostRedrawHook() computePostRedrawHook = null } } } m.withAttr = function(prop, withAttrCallback) { return function(e) {withAttrCallback(prop in e.currentTarget ? e.currentTarget[prop] : e.currentTarget.getAttribute(prop))} } //routing var modes = {pathname: "", hash: "#", search: "?"} var redirect = function() {}, routeParams = {} m.route = function() { if (arguments.length == 3) { var root = arguments[0], defaultRoute = arguments[1], router = arguments[2] redirect = function(source) { var path = source.slice(modes[m.route.mode].length) if (!routeByValue(root, router, path)) { m.route(defaultRoute, true) } } var listener = m.route.mode == "hash" ? "onhashchange" : "onpopstate" window[listener] = function() { redirect(window.location[m.route.mode]) } computePostRedrawHook = scrollToHash window[listener]() } else if (arguments[0].addEventListener) { var element = arguments[0] var isInitialized = arguments[1] if (!isInitialized) { element.removeEventListener("click", routeUnobtrusive) element.addEventListener("click", routeUnobtrusive) } } else if (typeof arguments[0] == "string") { var route = arguments[0] var shouldReplaceHistoryEntry = arguments[1] === true if (window.history.pushState) { computePostRedrawHook = function() { window.history[shouldReplaceHistoryEntry ? "replaceState" : "pushState"](null, window.document.title, modes[m.route.mode] + route) scrollToHash() } redirect(modes[m.route.mode] + route) } else window.location[m.route.mode] = route } } m.route.param = function(key) {return routeParams[key]} m.route.mode = "search" function routeByValue(root, router, path) { routeParams = {} for (var route in router) { if (route == path) return !void m.module(root, router[route]) var matcher = new RegExp("^" + route.replace(/:[^\/]+/g, "([^\\/]+)") + "$") if (matcher.test(path)) { return !void path.replace(matcher, function() { var keys = route.match(/:[^\/]+/g) var values = [].slice.call(arguments, 1, -2) for (var i = 0; i < keys.length; i++) routeParams[keys[i].slice(1)] = values[i] m.module(root, router[route]) }) } } } function routeUnobtrusive(e) { e.preventDefault() m.route(e.currentTarget.getAttribute("href")) } function scrollToHash() { if (m.route.mode != "hash" && window.location.hash) window.location.hash = window.location.hash } //model m.prop = function(store) { var prop = function() { if (arguments.length) store = arguments[0] return store } prop.toJSON = function() { return store } return prop } m.deferred = function() { var resolvers = [], rejecters = [] var object = { resolve: function(value) { for (var i = 0; i < resolvers.length; i++) resolvers[i](value) }, reject: function(value) { for (var i = 0; i < rejecters.length; i++) rejecters[i](value) }, promise: m.prop() } object.promise.resolvers = resolvers object.promise.then = function(success, error) { var next = m.deferred() if (!success) success = identity if (!error) error = identity function push(list, method, callback) { list.push(function(value) { try { var result = callback(value) if (result && typeof result.then == "function") result.then(next[method], error) else next[method](result !== undefined ? result : value) } catch (e) { if (e instanceof Error && e.constructor !== Error) throw e else next.reject(e) } }) } push(resolvers, "resolve", success) push(rejecters, "reject", error) return next.promise } return object } m.sync = function(args) { var method = "resolve" function synchronizer(resolved) { return function(value) { results.push(value) if (!resolved) method = "reject" if (results.length == args.length) { deferred.promise(results) deferred[method](results) } return value } } var deferred = m.deferred() var results = [] for (var i = 0; i < args.length; i++) { args[i].then(synchronizer(true), synchronizer(false)) } return deferred.promise } function identity(value) {return value} function ajax(options) { var xhr = window.XDomainRequest ? new window.XDomainRequest : new window.XMLHttpRequest xhr.open(options.method, options.url, true, options.user, options.password) xhr.onload = typeof options.onload == "function" ? options.onload : function() {} xhr.onerror = typeof options.onerror == "function" ? options.onerror : function() {} if (typeof options.config == "function") options.config(xhr, options) xhr.send(options.data) return xhr } function querystring(object, prefix) { var str = [] for(var prop in object) { var key = prefix ? prefix + "[" + prop + "]" : prop, value = object[prop] str.push(typeof value == "object" ? querystring(value, key) : encodeURIComponent(key) + "=" + encodeURIComponent(value)) } return str.join("&") } function bindData(xhrOptions, data, serialize) { if (data && Object.keys(data).length > 0) { if (xhrOptions.method == "GET") { xhrOptions.url = xhrOptions.url + (xhrOptions.url.indexOf("?") < 0 ? "?" : "&") + querystring(data) } else xhrOptions.data = serialize(data) } return xhrOptions } function parameterizeUrl(url, data) { var tokens = url.match(/:[a-z]\w+/gi) if (tokens && data) { for (var i = 0; i < tokens.length; i++) { var key = tokens[i].slice(1) url = url.replace(tokens[i], data[key]) delete data[key] } } return url } m.request = function(xhrOptions) { m.startComputation() var deferred = m.deferred() var serialize = xhrOptions.serialize || JSON.stringify var deserialize = xhrOptions.deserialize || JSON.parse var extract = xhrOptions.extract || function(xhr, xhrOptions) {return xhr.responseText} xhrOptions.url = parameterizeUrl(xhrOptions.url, xhrOptions.data) xhrOptions = bindData(xhrOptions, xhrOptions.data, serialize) xhrOptions.onload = xhrOptions.onerror = function(e) { var unwrap = (e.type == "load" ? xhrOptions.unwrapSuccess : xhrOptions.unwrapError) || identity var response = unwrap(deserialize(extract(e.target, xhrOptions))) if (response instanceof Array && xhrOptions.type) { for (var i = 0; i < response.length; i++) response[i] = new xhrOptions.type(response[i]) } else if (xhrOptions.type) response = new xhrOptions.type(response) deferred.promise(response) deferred[e.type == "load" ? "resolve" : "reject"](response) m.endComputation() } ajax(xhrOptions) deferred.promise.then = propBinder(deferred.promise) return deferred.promise } function propBinder(promise) { var bind = promise.then return function(success, error) { var next = bind(function(value) {return next(success(value))}, function(value) {return next(error(value))}) next.then = propBinder(next) return next } } //testing API m.deps = function(mock) {return window = mock} return m }(this) if (typeof module != "undefined" && module !== null) module.exports = m if (typeof define == "function" && define.amd) define(function() {return m}) function test(condition) { try {if (!condition()) throw new Error} catch (e) {console.error(e);test.failures.push(condition)} test.total++ } test.total = 0 test.failures = [] test.print = function(print) { for (var i = 0; i < test.failures.length; i++) { print(test.failures[i].toString()) } print("tests: " + test.total + "\nfailures: " + test.failures.length) if (test.failures.length > 0) { throw new Error(test.failures.length + " tests did not pass") } } var mock = {} mock.window = new function() { var window = {} window.document = {} window.document.childNodes = [] window.document.createElement = function(tag) { return { childNodes: [], nodeName: tag.toUpperCase(), appendChild: window.document.appendChild, removeChild: window.document.removeChild, replaceChild: window.document.replaceChild, insertBefore: function(node, reference) { node.parentNode = this var referenceIndex = this.childNodes.indexOf(reference) if (referenceIndex < 0) this.childNodes.push(node) else { var index = this.childNodes.indexOf(node) this.childNodes.splice(referenceIndex, index < 0 ? 0 : 1, node) } }, insertAdjacentHTML: function(position, html) { //todo: accept markup if (position == "beforebegin") { this.parentNode.insertBefore(window.document.createTextNode(html), this) } else if (position == "beforeend") { this.appendChild(window.document.createTextNode(html)) } }, setAttribute: function(name, value) { this[name] = value.toString() }, setAttributeNS: function(namespace, name, value) { this.namespaceURI = namespace this[name] = value.toString() }, getAttribute: function(name, value) { return this[name] } } } window.document.createElementNS = function(namespace, tag) { var element = window.document.createElement(tag) element.namespaceURI = namespace return element } window.document.createTextNode = function(text) { return {nodeValue: text.toString()} } window.document.documentElement = window.document.createElement("html") window.document.replaceChild = function(newChild, oldChild) { var index = this.childNodes.indexOf(oldChild) if (index > -1) this.childNodes.splice(index, 1, newChild) else this.childNodes.push(newChild) newChild.parentNode = this oldChild.parentNode = null } window.document.appendChild = function(child) { var index = this.childNodes.indexOf(child) if (index > -1) this.childNodes.splice(index, 1) this.childNodes.push(child) child.parentNode = this } window.document.removeChild = function(child) { var index = this.childNodes.indexOf(child) this.childNodes.splice(index, 1) child.parentNode = null } window.performance = new function () { var timestamp = 50 this.$elapse = function(amount) {timestamp += amount} this.now = function() {return timestamp} } window.cancelAnimationFrame = function() {} window.requestAnimationFrame = function(callback) {window.requestAnimationFrame.$callback = callback} window.requestAnimationFrame.$resolve = function() { if (window.requestAnimationFrame.$callback) window.requestAnimationFrame.$callback() window.requestAnimationFrame.$callback = null window.performance.$elapse(20) } window.XMLHttpRequest = new function() { var request = function() { this.open = function(method, url) { this.method = method this.url = url } this.send = function() { this.responseText = JSON.stringify(this) request.$events.push({type: "load", target: this}) } } request.$events = [] return request } window.location = {search: "", pathname: "", hash: ""}, window.history = {} window.history.pushState = function(data, title, url) { window.location.pathname = window.location.search = window.location.hash = url }, window.history.replaceState = function(data, title, url) { window.location.pathname = window.location.search = window.location.hash = url } return window } function testMithril(mock) { m.deps(mock) //m test(function() {return m("div").tag === "div"}) test(function() {return m(".foo").tag === "div"}) test(function() {return m(".foo").attrs.className === "foo"}) test(function() {return m("[title=bar]").tag === "div"}) test(function() {return m("[title=bar]").attrs.title === "bar"}) test(function() {return m("[title=\'bar\']").attrs.title === "bar"}) test(function() {return m("[title=\"bar\"]").attrs.title === "bar"}) test(function() {return m("div", "test").children === "test"}) test(function() {return m("div", ["test"]).children[0] === "test"}) test(function() {return m("div", {title: "bar"}, "test").attrs.title === "bar"}) test(function() {return m("div", {title: "bar"}, "test").children === "test"}) test(function() {return m("div", {title: "bar"}, ["test"]).children[0] === "test"}) test(function() {return m("div", {title: "bar"}, m("div")).children.tag === "div"}) test(function() {return m("div", {title: "bar"}, [m("div")]).children[0].tag === "div"}) test(function() {return m("div", ["a", "b"]).children.length === 2}) test(function() {return m("div", [m("div")]).children[0].tag === "div"}) test(function() {return m("div", m("div")).attrs.tag === "div"}) //yes, this is expected behavior: see method signature test(function() {return m("div", [undefined]).tag === "div"}) test(function() {return m("div", [{foo: "bar"}])}) //as long as it doesn't throw errors, it's fine test(function() {return m("svg", [m("g")])}) test(function() {return m("svg", [m("a[href='http://google.com']")])}) //m.module test(function() { mock.performance.$elapse(50) var root1 = mock.document.createElement("div") m.module(root1, { controller: function() {this.value = "test1"}, view: function(ctrl) {return ctrl.value} }) var root2 = mock.document.createElement("div") m.module(root2, { controller: function() {this.value = "test2"}, view: function(ctrl) {return ctrl.value} }) mock.requestAnimationFrame.$resolve() return root1.childNodes[0].nodeValue === "test1" && root2.childNodes[0].nodeValue === "test2" }) //m.withAttr test(function() { var value var handler = m.withAttr("test", function(data) {value = data}) handler({currentTarget: {test: "foo"}}) return value === "foo" }) //m.trust test(function() {return m.trust("test").valueOf() === "test"}) //m.render test(function() { var root = mock.document.createElement("div") m.render(root, "test") return root.childNodes[0].nodeValue === "test" }) test(function() { var root = mock.document.createElement("div") m.render(root, m("div", {class: "a"})) var elementBefore = root.childNodes[0] m.render(root, m("div", {class: "b"})) var elementAfter = root.childNodes[0] return elementBefore === elementAfter }) test(function() { var root = mock.document.createElement("div") m.render(root, m(".a")) var elementBefore = root.childNodes[0] m.render(root, m(".b")) var elementAfter = root.childNodes[0] return elementBefore === elementAfter }) test(function() { var root = mock.document.createElement("div") m.render(root, m("div", {id: "a"})) var elementBefore = root.childNodes[0] m.render(root, m("div", {title: "b"})) var elementAfter = root.childNodes[0] return elementBefore !== elementAfter }) test(function() { var root = mock.document.createElement("div") m.render(root, m("#a")) var elementBefore = root.childNodes[0] m.render(root, m("[title=b]")) var elementAfter = root.childNodes[0] return elementBefore !== elementAfter }) test(function() { var root = mock.document.createElement("div") m.render(root, m("#a")) var elementBefore = root.childNodes[0] m.render(root, "test") var elementAfter = root.childNodes[0] return elementBefore !== elementAfter }) test(function() { var root = mock.document.createElement("div") m.render(root, m("div", [undefined])) return root.childNodes[0].childNodes.length === 0 }) test(function() { var root = mock.document.createElement("div") m.render(root, m("svg", [m("g")])) var g = root.childNodes[0].childNodes[0] return g.nodeName === "G" && g.namespaceURI == "http://www.w3.org/2000/svg" }) test(function() { var root = mock.document.createElement("div") m.render(root, m("svg", [m("a[href='http://google.com']")])) return root.childNodes[0].childNodes[0].nodeName === "A" }) test(function() { var root = mock.document.createElement("div") m.render(root, m("div.classname", [m("a", {href: "/first"})])) m.render(root, m("div", [m("a", {href: "/second"})])) return root.childNodes[0].childNodes.length == 1 }) test(function() { var root = mock.document.createElement("div") m.render(root, m("ul", [m("li")])) m.render(root, m("ul", [m("li"), undefined])) return root.childNodes[0].childNodes.length === 1 }) test(function() { var root = mock.document.createElement("div") m.render(root, m("ul", [m("li"), m("li")])) m.render(root, m("ul", [m("li"), undefined])) return root.childNodes[0].childNodes.length === 1 }) test(function() { var root = mock.document.createElement("div") m.render(root, m("ul", [m("li")])) m.render(root, m("ul", [undefined])) return root.childNodes[0].childNodes.length === 0 }) test(function() { var root = mock.document.createElement("div") m.render(root, m("ul", [m("li")])) m.render(root, m("ul", [{}])) return root.childNodes[0].childNodes.length === 0 }) test(function() { var root = mock.document.createElement("div") m.render(root, m("ul", [m("li", [m("a")])])) m.render(root, m("ul", [{subtree: "retain"}])) return root.childNodes[0].childNodes[0].childNodes[0].nodeName === "A" }) test(function() { //https://github.com/lhorie/mithril.js/issues/43 var root = mock.document.createElement("div") m.render(root, m("a", {config: m.route}, "test")) m.render(root, m("a", {config: m.route}, "test")) return root.childNodes[0].childNodes[0].nodeValue === "test" }) test(function() { //https://github.com/lhorie/mithril.js/issues/29 var root = mock.document.createElement("div") var list = [false, false] m.render(root, list.reverse().map(function(flag, index) { return m("input[type=checkbox]", {onclick: m.withAttr("checked", function(value) {list[index] = value}), checked: flag}) })) mock.document.activeElement = root.childNodes[0] root.childNodes[0].checked = true root.childNodes[0].onclick({currentTarget: {checked: true}}) m.render(root, list.reverse().map(function(flag, index) { return m("input[type=checkbox]", {onclick: m.withAttr("checked", function(value) {list[index] = value}), checked: flag}) })) mock.document.activeElement = null return root.childNodes[0].checked === false && root.childNodes[1].checked === true }) test(function() { //https://github.com/lhorie/mithril.js/issues/44 (1) var root = mock.document.createElement("div") m.render(root, m("#foo", [null, m("#bar")])) m.render(root, m("#foo", ["test", m("#bar")])) return root.childNodes[0].childNodes[0].nodeValue === "test" }) test(function() { //https://github.com/lhorie/mithril.js/issues/44 (2) var root = mock.document.createElement("div") m.render(root, m("#foo", [null, m("#bar")])) m.render(root, m("#foo", [m("div"), m("#bar")])) return root.childNodes[0].childNodes[0].nodeName === "DIV" }) test(function() { //https://github.com/lhorie/mithril.js/issues/44 (3) var root = mock.document.createElement("div") m.render(root, m("#foo", ["test", m("#bar")])) m.render(root, m("#foo", [m("div"), m("#bar")])) return root.childNodes[0].childNodes[0].nodeName === "DIV" }) test(function() { //https://github.com/lhorie/mithril.js/issues/44 (4) var root = mock.document.createElement("div") m.render(root, m("#foo", [m("div"), m("#bar")])) m.render(root, m("#foo", ["test", m("#bar")])) return root.childNodes[0].childNodes[0].nodeValue === "test" }) test(function() { //https://github.com/lhorie/mithril.js/issues/44 (5) var root = mock.document.createElement("div") m.render(root, m("#foo", [m("#bar")])) m.render(root, m("#foo", [m("#bar"), [m("#baz")]])) return root.childNodes[0].childNodes[1].id === "baz" }) test(function() { //https://github.com/lhorie/mithril.js/issues/48 var root = mock.document m.render(root, m("html", [m("#foo")])) var result = root.childNodes[0].childNodes[0].id === "foo" root.childNodes = [mock.document.createElement("html")] return result }) test(function() { //https://github.com/lhorie/mithril.js/issues/49 var root = mock.document.createElement("div") m.render(root, m("a", "test")) m.render(root, m("a.foo", "test")) return root.childNodes[0].childNodes[0].nodeValue === "test" }) test(function() { //https://github.com/lhorie/mithril.js/issues/49 var root = mock.document.createElement("div") m.render(root, m("a.foo", "test")) m.render(root, m("a", "test")) return root.childNodes[0].childNodes[0].nodeValue === "test" }) test(function() { //https://github.com/lhorie/mithril.js/issues/49 var root = mock.document.createElement("div") m.render(root, m("a.foo", "test")) m.render(root, m("a", "test1")) return root.childNodes[0].childNodes[0].nodeValue === "test1" }) test(function() { //https://github.com/lhorie/mithril.js/issues/49 var root = mock.document.createElement("div") m.render(root, m("a", "test")) m.render(root, m("a", "test1")) return root.childNodes[0].childNodes[0].nodeValue === "test1" }) test(function() { //https://github.com/lhorie/mithril.js/issues/50 var root = mock.document.createElement("div") m.render(root, m("#foo", [[m("div", "a"), m("div", "b")], m("#bar")])) return root.childNodes[0].childNodes[1].childNodes[0].nodeValue === "b" }) test(function() { //https://github.com/lhorie/mithril.js/issues/50 var root = mock.document.createElement("div") m.render(root, m("#foo", [[m("div", "a"), m("div", "b")], m("#bar")])) m.render(root, m("#foo", [[m("div", "a"), m("div", "b"), m("div", "c")], m("#bar")])) return root.childNodes[0].childNodes[2].childNodes[0].nodeValue === "c" }) test(function() { //https://github.com/lhorie/mithril.js/issues/50 var root = mock.document.createElement("div") m.render(root, m("#foo", [[m("div", "a"), m("div", "b")], [m("div", "c"), m("div", "d")], m("#bar")])) return root.childNodes[0].childNodes[3].childNodes[0].nodeValue === "d" && root.childNodes[0].childNodes[4].id === "bar" }) test(function() { //https://github.com/lhorie/mithril.js/issues/50 var root = mock.document.createElement("div") m.render(root, m("#foo", [[m("div", "a"), m("div", "b")], "test"])) return root.childNodes[0].childNodes[1].childNodes[0].nodeValue === "b" && root.childNodes[0].childNodes[2].nodeValue === "test" }) test(function() { //https://github.com/lhorie/mithril.js/issues/50 var root = mock.document.createElement("div") m.render(root, m("#foo", [["a", "b"], "test"])) return root.childNodes[0].childNodes[1].nodeValue === "b" && root.childNodes[0].childNodes[2].nodeValue === "test" }) test(function() { //https://github.com/lhorie/mithril.js/issues/51 var root = mock.document.createElement("div") m.render(root, m("main", [m("button"), m("article", [m("section"), m("nav")])])) m.render(root, m("main", [m("button"), m("article", [m("span"), m("nav")])])) return root.childNodes[0].childNodes[1].childNodes[0].nodeName === "SPAN" }) test(function() { //https://github.com/lhorie/mithril.js/issues/51 var root = mock.document.createElement("div") m.render(root, m("main", [m("button"), m("article", [m("section"), m("nav")])])) m.render(root, m("main", [m("button"), m("article", ["test", m("nav")])])) return root.childNodes[0].childNodes[1].childNodes[0].nodeValue === "test" }) test(function() { //https://github.com/lhorie/mithril.js/issues/51 var root = mock.document.createElement("div") m.render(root, m("main", [m("button"), m("article", [m("section"), m("nav")])])) m.render(root, m("main", [m("button"), m("article", [m.trust("test"), m("nav")])])) return root.childNodes[0].childNodes[1].childNodes[0].nodeValue === "test" }) test(function() { //https://github.com/lhorie/mithril.js/issues/55 var root = mock.document.createElement("div") m.render(root, m("#a")) var elementBefore = root.childNodes[0] m.render(root, m("#b")) var elementAfter = root.childNodes[0] return elementBefore !== elementAfter }) test(function() { //https://github.com/lhorie/mithril.js/issues/56 var root = mock.document.createElement("div") m.render(root, [null, "foo"]) m.render(root, ["bar"]) console.log(root.childNodes) return root.childNodes.length == 1 }) //end m.render //m.redraw test(function() { var controller var root = mock.document.createElement("div") m.module(root, { controller: function() {controller = this}, view: function(ctrl) {return ctrl.value} }) controller.value = "foo" m.redraw() return root.childNodes[0].nodeValue === "foo" }) //m.route test(function() { mock.performance.$elapse(50) mock.location.search = "?" var root = mock.document.createElement("div") m.route.mode = "search" m.route(root, "/test1", { "/test1": {controller: function() {}, view: function() {return "foo"}} }) return mock.location.search == "?/test1" && root.childNodes[0].nodeValue === "foo" }) test(function() { mock.performance.$elapse(50) mock.location.pathname = "/" var root = mock.document.createElement("div") m.route.mode = "pathname" m.route(root, "/test2", { "/test2": {controller: function() {}, view: function() {return "foo"}} }) return mock.location.pathname == "/test2" && root.childNodes[0].nodeValue === "foo" }) test(function() { mock.performance.$elapse(50) mock.location.hash = "#" var root = mock.document.createElement("div") m.route.mode = "hash" m.route(root, "/test3", { "/test3": {controller: function() {}, view: function() {return "foo"}} }) return mock.location.hash == "#/test3" && root.childNodes[0].nodeValue === "foo" }) test(function() { mock.performance.$elapse(50) mock.location.search = "?" var root = mock.document.createElement("div") m.route.mode = "search" m.route(root, "/test4/foo", { "/test4/:test": {controller: function() {}, view: function() {return m.route.param("test")}} }) return mock.location.search == "?/test4/foo" && root.childNodes[0].nodeValue === "foo" }) test(function() { mock.performance.$elapse(50) mock.location.search = "?" var module = {controller: function() {}, view: function() {return m.route.param("test")}} var root = mock.document.createElement("div") m.route.mode = "search" m.route(root, "/test5/foo", { "/": module, "/test5/:test": module }) var paramValueBefore = m.route.param("test") m.route("/") var paramValueAfter = m.route.param("test") return mock.location.search == "?/" && paramValueBefore === "foo" && paramValueAfter === undefined }) test(function() { mock.performance.$elapse(50) mock.location.search = "?" var module = {controller: function() {}, view: function() {return m.route.param("a1")}} var root = mock.document.createElement("div") m.route.mode = "search" m.route(root, "/test6/foo", { "/": module, "/test6/:a1": module }) var paramValueBefore = m.route.param("a1") m.route("/") var paramValueAfter = m.route.param("a1") return mock.location.search == "?/" && paramValueBefore === "foo" && paramValueAfter === undefined }) //m.prop test(function() { var prop = m.prop("test") return prop() === "test" }) test(function() { var prop = m.prop("test") prop("foo") return prop() === "foo" }) test(function() { var prop = m.prop("test") return JSON.stringify(prop) === '"test"' }) test(function() { var obj = {prop: m.prop("test")} return JSON.stringify(obj) === '{"prop":"test"}' }) //m.request test(function() { var prop = m.request({method: "GET", url: "test"}) var e = mock.XMLHttpRequest.$events.pop() e.target.onload(e) return prop().method === "GET" && prop().url === "test" }) test(function() { var prop = m.request({method: "GET", url: "test"}).then(function(value) {return "foo"}) var e = mock.XMLHttpRequest.$events.pop() e.target.onload(e) return prop() === "foo" }) test(function() { var prop = m.request({method: "POST", url: "http://domain.com:80", data: {}}).then(function(value) {return value}) var e = mock.XMLHttpRequest.$events.pop() e.target.onload(e) return prop().url === "http://domain.com:80" }) test(function() { var prop = m.request({method: "POST", url: "http://domain.com:80/:test1", data: {test1: "foo"}}).then(function(value) {return value}) var e = mock.XMLHttpRequest.$events.pop() e.target.onload(e) return prop().url === "http://domain.com:80/foo" }) //m.deferred test(function() { var value var deferred = m.deferred() deferred.promise.then(function(data) {value = data}) deferred.resolve("test") return value === "test" }) test(function() { var value var deferred = m.deferred() deferred.promise.then(function(data) {return "foo"}).then(function(data) {value = data}) deferred.resolve("test") return value === "foo" }) test(function() { var value var deferred = m.deferred() deferred.promise.then(null, function(data) {value = data}) deferred.reject("test") return value === "test" }) test(function() { var value var deferred = m.deferred() deferred.promise.then(null, function(data) {return "foo"}).then(null, function(data) {value = data}) deferred.reject("test") return value === "foo" }) test(function() { var value1, value2 var deferred = m.deferred() deferred.promise.then(function(data) {throw new Error}).then(function(data) {value1 = 1}, function(data) {value2 = data}) deferred.resolve("test") return value1 === undefined && value2 instanceof Error }) test(function() { var deferred1 = m.deferred() var deferred2 = m.deferred() var value1, value2 deferred1.promise.then(function(data) { value1 = data return deferred2.promise }).then(function(data) { value2 = data }) deferred1.resolve(1) deferred2.resolve(2) return value1 === 1 && value2 === 2 }) //m.sync test(function() { var value var deferred1 = m.deferred() var deferred2 = m.deferred() m.sync([deferred1.promise, deferred2.promise]).then(function(data) {value = data}) deferred1.resolve("test") deferred2.resolve("foo") return value[0] === "test" && value[1] === "foo" }) //m.startComputation/m.endComputation test(function() { mock.performance.$elapse(50) var controller var root = mock.document.createElement("div") m.module(root, { controller: function() {controller = this}, view: function(ctrl) {return ctrl.value} }) mock.performance.$elapse(50) m.startComputation() controller.value = "foo" m.endComputation() return root.childNodes[0].nodeValue === "foo" }) } //mocks testMithril(mock.window) test.print(console.log)
/******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) /******/ return installedModules[moduleId].exports; /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ exports: {}, /******/ id: moduleId, /******/ loaded: false /******/ }; /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ // Flag the module as loaded /******/ module.loaded = true; /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ // Load entry module and return exports /******/ return __webpack_require__(0); /******/ }) /************************************************************************/ /******/ ({ /***/ 0: /***/ function(module, exports, __webpack_require__) { var __weex_template__ = __webpack_require__(264) var __weex_script__ = __webpack_require__(265) __weex_define__('@weex-component/4921d4510db0a127687a84f88dda307c', [], function(__weex_require__, __weex_exports__, __weex_module__) { __weex_script__(__weex_module__, __weex_exports__, __weex_require__) if (__weex_exports__.__esModule && __weex_exports__.default) { __weex_module__.exports = __weex_exports__.default } __weex_module__.exports.template = __weex_template__ }) __weex_bootstrap__('@weex-component/4921d4510db0a127687a84f88dda307c',undefined,undefined) /***/ }, /***/ 264: /***/ function(module, exports) { module.exports = { "type": "text", "classList": [ "link" ], "shown": function () {return this.href}, "events": { "click": "_clickHandler" }, "attr": { "value": function () {return this.text} } } /***/ }, /***/ 265: /***/ function(module, exports) { module.exports = function(module, exports, __weex_require__){'use strict'; module.exports = { data: function () {return { text: '', href: '' }}, methods: { _clickHandler: function _clickHandler() { this.$call('modal', 'toast', { message: 'click', duration: 1 }); } } };} /* generated by weex-loader */ /***/ } /******/ });
var deleteHooks = require('strider-github/lib/api').deleteHooks module.exports = function (browser, callback) { describe('Github Integration', function () { var robot = { username: 'strider-test-robot', password: 'i0CheCtzY0yv4WP2o', repo: 'strider-extension-loader', token: 'df24805561a32092b24fe274136c299e842d5fcf' } before(function(done) { var url = 'http://localhost:4000/'+robot.username+'/'+robot.repo+'/api/github/webhook' var repo = robot.username+'/'+robot.repo deleteHooks(repo, url, robot.token, done) }) beforeEach(function() { this.currentTest.browser = browser; }); it('should link account with github', function () { return browser.rel('/') .elementByName('email') .type('test1@example.com') .elementByName('password') .type('open-sesame') .elementByClassName('login-form') .submit() .elementByClassName('provider-github') .click() .waitForElementByClassName('octicon-logo-github', 6000) .isDisplayed() .elementByName('login') .type(robot.username) .elementByName('password') .type(robot.password) .elementByName('commit') .click() .waitForElementByClassName('StriderBlock_Brand', 6000) .isDisplayed() }) it('should create a project from github and run its first test', function () { return browser.rel('/projects') .elementByClassName('add-repo') .click() .elementByCssSelector('.project-type.btn') .click() .waitForElementByCssSelector('.btn-success', 5000) .click() .waitForElementByLinkText('Click to watch it run', 3000) .click() .waitForElementByCssSelector('.job-repo', 2000) .url().should.eventually.include(robot.username+'/'+robot.repo) }) after(function () { return browser.quit(function () { callback() }) }) }) }
version https://git-lfs.github.com/spec/v1 oid sha256:c45f57a31572e24aae8775aab0936168c38fadab3b1e36d514ff91cbaac66b61 size 2664
YUI.add("axis-stacked-base",function(e,t){function n(){}n.NAME="stackedImpl",n.prototype={_type:"stacked",_updateMinAndMax:function(){var e=0,t=0,n=0,r=0,i=0,s=0,o,u,a=this.get("keys"),f=this.get("setMin"),l=this.get("setMax");for(o in a)a.hasOwnProperty(o)&&(i=Math.max(i,a[o].length));for(;s<i;++s){n=0,r=0;for(o in a)if(a.hasOwnProperty(o)){u=a[o][s];if(isNaN(u))continue;u>=0?n+=u:r+=u}n>0?e=Math.max(e,n):e=Math.max(e,r),r<0?t=Math.min(t,r):t=Math.min(t,n)}this._actualMaximum=e,this._actualMinimum=t,l&&(e=this._setMaximum),f&&(t=this._setMinimum),this._roundMinAndMax(t,e,f,l)}},e.StackedImpl=n,e.StackedAxisBase=e.Base.create("stackedAxisBase",e.NumericAxisBase,[e.StackedImpl])},"3.18.1",{requires:["axis-numeric-base"]});
"use strict"; function _foo() { const data = babelHelpers.interopRequireDefault(require("foo")); _foo = function () { return data; }; return data; } console.log(_foo().default);
import { normalizeControllerQueryParams } from '../utils'; QUnit.module('Routing query parameter utils - normalizeControllerQueryParams'); QUnit.test('converts array style into verbose object style', function(assert) { let paramName = 'foo'; let params = [paramName]; let normalized = normalizeControllerQueryParams(params); ok(normalized[paramName], 'turns the query param name into key'); equal(normalized[paramName].as, null, 'includes a blank alias in \'as\' key'); equal(normalized[paramName].scope, 'model', 'defaults scope to model'); }); QUnit.test('converts object style [{foo: \'an_alias\'}]', function(assert) { let paramName = 'foo'; let params = [{ 'foo': 'an_alias' }]; let normalized = normalizeControllerQueryParams(params); ok(normalized[paramName], 'retains the query param name as key'); equal(normalized[paramName].as, 'an_alias', 'includes the provided alias in \'as\' key'); equal(normalized[paramName].scope, 'model', 'defaults scope to model'); }); QUnit.test('retains maximally verbose object style [{foo: {as: \'foo\'}}]', function(assert) { let paramName = 'foo'; let params = [{ 'foo': { as: 'an_alias' } }]; let normalized = normalizeControllerQueryParams(params); ok(normalized[paramName], 'retains the query param name as key'); equal(normalized[paramName].as, 'an_alias', 'includes the provided alias in \'as\' key'); equal(normalized[paramName].scope, 'model', 'defaults scope to model'); });
loadIonicon('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M250.4 464c1-7.9 1.6-15.9 1.6-23.9 0-48.1-18.7-94.3-52.7-128.3S119 260 70.9 260c-7.7 0-15.4.5-22.9 1.4 2.8 110.3 92.3 199.3 202.4 202.6z"/><path d="M230 74c0-8.3.5-16.4 1.4-24.5-95.3 11.7-171.7 89-182.2 184.7 7.2-.7 14.4-1.1 21.8-1.1 114.9 0 207.1 92.2 207.1 207 0 7.7-.4 15.3-1.3 22.8 96.6-10.1 174.6-86.2 185.8-182.4-8.4 1-16.9.6-25.5.6C322.1 281 230 188.9 230 74z"/><path d="M308.7 202.3c34 34 80.2 52.7 128.3 52.7 9.1 0 18.1-.7 27-2-2.2-112-93.9-203.5-206.1-205-1.2 8.5-1.9 17.2-1.9 26 0 48.1 18.7 94.3 52.7 128.3zM232 49.3z"/></svg>','ios-tennisball');
version https://git-lfs.github.com/spec/v1 oid sha256:2588e220aad2d951799d58aed97838ec0b7dee506d5653da3275db8d7d890c53 size 2241
(function () { 'use strict'; angular .module('com.module.core') /** * @ngdoc function * @name com.module.core.controller:LayoutCtrl * @description Layout controller * @requires $scope * @requires $rootScope * @requires CoreService * @requires gettextCatalog **/ .controller('LayoutCtrl', function ($scope, $rootScope, $cookies, CoreService, gettextCatalog) { // angular translate $scope.locale = { isopen: false }; $scope.locales = $rootScope.locales; $scope.selectLocale = $rootScope.locale; $scope.setLocale = function (locale) { // set the current lang $scope.locale = $scope.locales[locale]; $scope.selectLocale = $scope.locale; $rootScope.locale = $scope.locale; $cookies.lang = $scope.locale.lang; // You can change the language during runtime $scope.locale.isopen = !$scope.locale.isopen; gettextCatalog.setCurrentLanguage($scope.locale.lang); }; $scope.appName = 'LoopBack Admin'; $scope.apiUrl = CoreService.env.apiUrl; $scope.appTheme = 'skin-blue'; $scope.appThemes = [ { 'name': 'Black', 'class': 'skin-black' }, { 'name': 'Blue', 'class': 'skin-blue' } ]; $scope.appLayout = ''; $scope.appLayouts = [ { 'name': 'Fixed', 'class': 'fixed' }, { 'name': 'Scrolling', 'class': 'not-fixed' } ]; $scope.toggleSidebar = function () { var $ = angular.element; if ($(window).width() <= 992) { $('.row-offcanvas').toggleClass('active'); $('.left-side').removeClass('collapse-left'); $('.right-side').removeClass('strech'); $('.row-offcanvas').toggleClass('relative'); } else { // Else, enable content streching $('.left-side').toggleClass('collapse-left'); $('.right-side').toggleClass('strech'); } }; $scope.settings = $rootScope.settings; $rootScope.loadSettings(); }); })();
/* =================================================== * bootstrap-transition.js v2.2.0 * http://twitter.github.com/bootstrap/javascript.html#transitions * =================================================== * Copyright 2012 Twitter, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ========================================================== */ !function ($) { "use strict"; // jshint ;_; /* CSS TRANSITION SUPPORT (http://www.modernizr.com/) * ======================================================= */ $(function () { $.support.transition = (function () { var transitionEnd = (function () { var el = document.createElement('bootstrap') , transEndEventNames = { 'WebkitTransition' : 'webkitTransitionEnd' , 'MozTransition' : 'transitionend' , 'OTransition' : 'oTransitionEnd otransitionend' , 'transition' : 'transitionend' } , name for (name in transEndEventNames){ if (el.style[name] !== undefined) { return transEndEventNames[name] } } }()) return transitionEnd && { end: transitionEnd } })() }) }(window.jQuery);/* ========================================================== * bootstrap-alert.js v2.2.0 * http://twitter.github.com/bootstrap/javascript.html#alerts * ========================================================== * Copyright 2012 Twitter, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ========================================================== */ !function ($) { "use strict"; // jshint ;_; /* ALERT CLASS DEFINITION * ====================== */ var dismiss = '[data-dismiss="alert"]' , Alert = function (el) { $(el).on('click', dismiss, this.close) } Alert.prototype.close = function (e) { var $this = $(this) , selector = $this.attr('data-target') , $parent if (!selector) { selector = $this.attr('href') selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 } $parent = $(selector) e && e.preventDefault() $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent()) $parent.trigger(e = $.Event('close')) if (e.isDefaultPrevented()) return $parent.removeClass('in') function removeElement() { $parent .trigger('closed') .remove() } $.support.transition && $parent.hasClass('fade') ? $parent.on($.support.transition.end, removeElement) : removeElement() } /* ALERT PLUGIN DEFINITION * ======================= */ $.fn.alert = function (option) { return this.each(function () { var $this = $(this) , data = $this.data('alert') if (!data) $this.data('alert', (data = new Alert(this))) if (typeof option == 'string') data[option].call($this) }) } $.fn.alert.Constructor = Alert /* ALERT DATA-API * ============== */ $(document).on('click.alert.data-api', dismiss, Alert.prototype.close) }(window.jQuery);/* ============================================================ * bootstrap-button.js v2.2.0 * http://twitter.github.com/bootstrap/javascript.html#buttons * ============================================================ * Copyright 2012 Twitter, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================ */ !function ($) { "use strict"; // jshint ;_; /* BUTTON PUBLIC CLASS DEFINITION * ============================== */ var Button = function (element, options) { this.$element = $(element) this.options = $.extend({}, $.fn.button.defaults, options) } Button.prototype.setState = function (state) { var d = 'disabled' , $el = this.$element , data = $el.data() , val = $el.is('input') ? 'val' : 'html' state = state + 'Text' data.resetText || $el.data('resetText', $el[val]()) $el[val](data[state] || this.options[state]) // push to event loop to allow forms to submit setTimeout(function () { state == 'loadingText' ? $el.addClass(d).attr(d, d) : $el.removeClass(d).removeAttr(d) }, 0) } Button.prototype.toggle = function () { var $parent = this.$element.closest('[data-toggle="buttons-radio"]') $parent && $parent .find('.active') .removeClass('active') this.$element.toggleClass('active') } /* BUTTON PLUGIN DEFINITION * ======================== */ $.fn.button = function (option) { return this.each(function () { var $this = $(this) , data = $this.data('button') , options = typeof option == 'object' && option if (!data) $this.data('button', (data = new Button(this, options))) if (option == 'toggle') data.toggle() else if (option) data.setState(option) }) } $.fn.button.defaults = { loadingText: 'loading...' } $.fn.button.Constructor = Button /* BUTTON DATA-API * =============== */ $(document).on('click.button.data-api', '[data-toggle^=button]', function (e) { var $btn = $(e.target) if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn') $btn.button('toggle') }) }(window.jQuery);/* ========================================================== * bootstrap-carousel.js v2.2.0 * http://twitter.github.com/bootstrap/javascript.html#carousel * ========================================================== * Copyright 2012 Twitter, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ========================================================== */ !function ($) { "use strict"; // jshint ;_; /* CAROUSEL CLASS DEFINITION * ========================= */ var Carousel = function (element, options) { this.$element = $(element) this.options = options this.options.slide && this.slide(this.options.slide) this.options.pause == 'hover' && this.$element .on('mouseenter', $.proxy(this.pause, this)) .on('mouseleave', $.proxy(this.cycle, this)) } Carousel.prototype = { cycle: function (e) { if (!e) this.paused = false this.options.interval && !this.paused && (this.interval = setInterval($.proxy(this.next, this), this.options.interval)) return this } , to: function (pos) { var $active = this.$element.find('.item.active') , children = $active.parent().children() , activePos = children.index($active) , that = this if (pos > (children.length - 1) || pos < 0) return if (this.sliding) { return this.$element.one('slid', function () { that.to(pos) }) } if (activePos == pos) { return this.pause().cycle() } return this.slide(pos > activePos ? 'next' : 'prev', $(children[pos])) } , pause: function (e) { if (!e) this.paused = true if (this.$element.find('.next, .prev').length && $.support.transition.end) { this.$element.trigger($.support.transition.end) this.cycle() } clearInterval(this.interval) this.interval = null return this } , next: function () { if (this.sliding) return return this.slide('next') } , prev: function () { if (this.sliding) return return this.slide('prev') } , slide: function (type, next) { var $active = this.$element.find('.item.active') , $next = next || $active[type]() , isCycling = this.interval , direction = type == 'next' ? 'left' : 'right' , fallback = type == 'next' ? 'first' : 'last' , that = this , e this.sliding = true isCycling && this.pause() $next = $next.length ? $next : this.$element.find('.item')[fallback]() e = $.Event('slide', { relatedTarget: $next[0] }) if ($next.hasClass('active')) return if ($.support.transition && this.$element.hasClass('slide')) { this.$element.trigger(e) if (e.isDefaultPrevented()) return $next.addClass(type) $next[0].offsetWidth // force reflow $active.addClass(direction) $next.addClass(direction) this.$element.one($.support.transition.end, function () { $next.removeClass([type, direction].join(' ')).addClass('active') $active.removeClass(['active', direction].join(' ')) that.sliding = false setTimeout(function () { that.$element.trigger('slid') }, 0) }) } else { this.$element.trigger(e) if (e.isDefaultPrevented()) return $active.removeClass('active') $next.addClass('active') this.sliding = false this.$element.trigger('slid') } isCycling && this.cycle() return this } } /* CAROUSEL PLUGIN DEFINITION * ========================== */ $.fn.carousel = function (option) { return this.each(function () { var $this = $(this) , data = $this.data('carousel') , options = $.extend({}, $.fn.carousel.defaults, typeof option == 'object' && option) , action = typeof option == 'string' ? option : options.slide if (!data) $this.data('carousel', (data = new Carousel(this, options))) if (typeof option == 'number') data.to(option) else if (action) data[action]() else if (options.interval) data.cycle() }) } $.fn.carousel.defaults = { interval: 5000 , pause: 'hover' } $.fn.carousel.Constructor = Carousel /* CAROUSEL DATA-API * ================= */ $(document).on('click.carousel.data-api', '[data-slide]', function (e) { var $this = $(this), href , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 , options = !$target.data('carousel') && $.extend({}, $target.data(), $this.data()) $target.carousel(options) e.preventDefault() }) }(window.jQuery);/* ============================================================= * bootstrap-collapse.js v2.2.0 * http://twitter.github.com/bootstrap/javascript.html#collapse * ============================================================= * Copyright 2012 Twitter, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================ */ !function ($) { "use strict"; // jshint ;_; /* COLLAPSE PUBLIC CLASS DEFINITION * ================================ */ var Collapse = function (element, options) { this.$element = $(element) this.options = $.extend({}, $.fn.collapse.defaults, options) if (this.options.parent) { this.$parent = $(this.options.parent) } this.options.toggle && this.toggle() } Collapse.prototype = { constructor: Collapse , dimension: function () { var hasWidth = this.$element.hasClass('width') return hasWidth ? 'width' : 'height' } , show: function () { var dimension , scroll , actives , hasData if (this.transitioning) return dimension = this.dimension() scroll = $.camelCase(['scroll', dimension].join('-')) actives = this.$parent && this.$parent.find('> .accordion-group > .in') if (actives && actives.length) { hasData = actives.data('collapse') if (hasData && hasData.transitioning) return actives.collapse('hide') hasData || actives.data('collapse', null) } this.$element[dimension](0) this.transition('addClass', $.Event('show'), 'shown') $.support.transition && this.$element[dimension](this.$element[0][scroll]) } , hide: function () { var dimension if (this.transitioning) return dimension = this.dimension() this.reset(this.$element[dimension]()) this.transition('removeClass', $.Event('hide'), 'hidden') this.$element[dimension](0) } , reset: function (size) { var dimension = this.dimension() this.$element .removeClass('collapse') [dimension](size || 'auto') [0].offsetWidth this.$element[size !== null ? 'addClass' : 'removeClass']('collapse') return this } , transition: function (method, startEvent, completeEvent) { var that = this , complete = function () { if (startEvent.type == 'show') that.reset() that.transitioning = 0 that.$element.trigger(completeEvent) } this.$element.trigger(startEvent) if (startEvent.isDefaultPrevented()) return this.transitioning = 1 this.$element[method]('in') $.support.transition && this.$element.hasClass('collapse') ? this.$element.one($.support.transition.end, complete) : complete() } , toggle: function () { this[this.$element.hasClass('in') ? 'hide' : 'show']() } } /* COLLAPSIBLE PLUGIN DEFINITION * ============================== */ $.fn.collapse = function (option) { return this.each(function () { var $this = $(this) , data = $this.data('collapse') , options = typeof option == 'object' && option if (!data) $this.data('collapse', (data = new Collapse(this, options))) if (typeof option == 'string') data[option]() }) } $.fn.collapse.defaults = { toggle: true } $.fn.collapse.Constructor = Collapse /* COLLAPSIBLE DATA-API * ==================== */ $(document).on('click.collapse.data-api', '[data-toggle=collapse]', function (e) { var $this = $(this), href , target = $this.attr('data-target') || e.preventDefault() || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7 , option = $(target).data('collapse') ? 'toggle' : $this.data() $this[$(target).hasClass('in') ? 'addClass' : 'removeClass']('collapsed') $(target).collapse(option) }) }(window.jQuery);/* ============================================================ * bootstrap-dropdown.js v2.2.0 * http://twitter.github.com/bootstrap/javascript.html#dropdowns * ============================================================ * Copyright 2012 Twitter, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================ */ !function ($) { "use strict"; // jshint ;_; /* DROPDOWN CLASS DEFINITION * ========================= */ var toggle = '[data-toggle=dropdown]' , Dropdown = function (element) { var $el = $(element).on('click.dropdown.data-api', this.toggle) $('html').on('click.dropdown.data-api', function () { $el.parent().removeClass('open') }) } Dropdown.prototype = { constructor: Dropdown , toggle: function (e) { var $this = $(this) , $parent , isActive if ($this.is('.disabled, :disabled')) return $parent = getParent($this) isActive = $parent.hasClass('open') clearMenus() if (!isActive) { $parent.toggleClass('open') $this.focus() } return false } , keydown: function (e) { var $this , $items , $active , $parent , isActive , index if (!/(38|40|27)/.test(e.keyCode)) return $this = $(this) e.preventDefault() e.stopPropagation() if ($this.is('.disabled, :disabled')) return $parent = getParent($this) isActive = $parent.hasClass('open') if (!isActive || (isActive && e.keyCode == 27)) return $this.click() $items = $('[role=menu] li:not(.divider) a', $parent) if (!$items.length) return index = $items.index($items.filter(':focus')) if (e.keyCode == 38 && index > 0) index-- // up if (e.keyCode == 40 && index < $items.length - 1) index++ // down if (!~index) index = 0 $items .eq(index) .focus() } } function clearMenus() { $(toggle).each(function () { getParent($(this)).removeClass("open") }) } function getParent($this) { var selector = $this.attr('data-target') , $parent if (!selector) { selector = $this.attr('href') selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 } $parent = $(selector) $parent.length || ($parent = $this.parent()) return $parent } /* DROPDOWN PLUGIN DEFINITION * ========================== */ $.fn.dropdown = function (option) { return this.each(function () { var $this = $(this) , data = $this.data('dropdown') if (!data) $this.data('dropdown', (data = new Dropdown(this))) if (typeof option == 'string') data[option].call($this) }) } $.fn.dropdown.Constructor = Dropdown /* APPLY TO STANDARD DROPDOWN ELEMENTS * =================================== */ $(document) .on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus) .on('click.dropdown touchstart.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() }) .on('click.dropdown.data-api touchstart.dropdown.data-api' , toggle, Dropdown.prototype.toggle) .on('keydown.dropdown.data-api touchstart.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown) }(window.jQuery);/* ========================================================= * bootstrap-modal.js v2.2.0 * http://twitter.github.com/bootstrap/javascript.html#modals * ========================================================= * Copyright 2012 Twitter, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ========================================================= */ !function ($) { "use strict"; // jshint ;_; /* MODAL CLASS DEFINITION * ====================== */ var Modal = function (element, options) { this.options = options this.$element = $(element) .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this)) this.options.remote && this.$element.find('.modal-body').load(this.options.remote) } Modal.prototype = { constructor: Modal , toggle: function () { return this[!this.isShown ? 'show' : 'hide']() } , show: function () { var that = this , e = $.Event('show') this.$element.trigger(e) if (this.isShown || e.isDefaultPrevented()) return this.isShown = true this.escape() this.backdrop(function () { var transition = $.support.transition && that.$element.hasClass('fade') if (!that.$element.parent().length) { that.$element.appendTo(document.body) //don't move modals dom position } that.$element .show() if (transition) { that.$element[0].offsetWidth // force reflow } that.$element .addClass('in') .attr('aria-hidden', false) that.enforceFocus() transition ? that.$element.one($.support.transition.end, function () { that.$element.focus().trigger('shown') }) : that.$element.focus().trigger('shown') }) } , hide: function (e) { e && e.preventDefault() var that = this e = $.Event('hide') this.$element.trigger(e) if (!this.isShown || e.isDefaultPrevented()) return this.isShown = false this.escape() $(document).off('focusin.modal') this.$element .removeClass('in') .attr('aria-hidden', true) $.support.transition && this.$element.hasClass('fade') ? this.hideWithTransition() : this.hideModal() } , enforceFocus: function () { var that = this $(document).on('focusin.modal', function (e) { if (that.$element[0] !== e.target && !that.$element.has(e.target).length) { that.$element.focus() } }) } , escape: function () { var that = this if (this.isShown && this.options.keyboard) { this.$element.on('keyup.dismiss.modal', function ( e ) { e.which == 27 && that.hide() }) } else if (!this.isShown) { this.$element.off('keyup.dismiss.modal') } } , hideWithTransition: function () { var that = this , timeout = setTimeout(function () { that.$element.off($.support.transition.end) that.hideModal() }, 500) this.$element.one($.support.transition.end, function () { clearTimeout(timeout) that.hideModal() }) } , hideModal: function (that) { this.$element .hide() .trigger('hidden') this.backdrop() } , removeBackdrop: function () { this.$backdrop.remove() this.$backdrop = null } , backdrop: function (callback) { var that = this , animate = this.$element.hasClass('fade') ? 'fade' : '' if (this.isShown && this.options.backdrop) { var doAnimate = $.support.transition && animate this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />') .appendTo(document.body) this.$backdrop.click( this.options.backdrop == 'static' ? $.proxy(this.$element[0].focus, this.$element[0]) : $.proxy(this.hide, this) ) if (doAnimate) this.$backdrop[0].offsetWidth // force reflow this.$backdrop.addClass('in') doAnimate ? this.$backdrop.one($.support.transition.end, callback) : callback() } else if (!this.isShown && this.$backdrop) { this.$backdrop.removeClass('in') $.support.transition && this.$element.hasClass('fade')? this.$backdrop.one($.support.transition.end, $.proxy(this.removeBackdrop, this)) : this.removeBackdrop() } else if (callback) { callback() } } } /* MODAL PLUGIN DEFINITION * ======================= */ $.fn.modal = function (option) { return this.each(function () { var $this = $(this) , data = $this.data('modal') , options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option) if (!data) $this.data('modal', (data = new Modal(this, options))) if (typeof option == 'string') data[option]() else if (options.show) data.show() }) } $.fn.modal.defaults = { backdrop: true , keyboard: true , show: true } $.fn.modal.Constructor = Modal /* MODAL DATA-API * ============== */ $(document).on('click.modal.data-api', '[data-toggle="modal"]', function (e) { var $this = $(this) , href = $this.attr('href') , $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7 , option = $target.data('modal') ? 'toggle' : $.extend({ remote:!/#/.test(href) && href }, $target.data(), $this.data()) e.preventDefault() $target .modal(option) .one('hide', function () { $this.focus() }) }) }(window.jQuery); /* =========================================================== * bootstrap-tooltip.js v2.2.0 * http://twitter.github.com/bootstrap/javascript.html#tooltips * Inspired by the original jQuery.tipsy by Jason Frame * =========================================================== * Copyright 2012 Twitter, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ========================================================== */ !function ($) { "use strict"; // jshint ;_; /* TOOLTIP PUBLIC CLASS DEFINITION * =============================== */ var Tooltip = function (element, options) { this.init('tooltip', element, options) } Tooltip.prototype = { constructor: Tooltip , init: function (type, element, options) { var eventIn , eventOut this.type = type this.$element = $(element) this.options = this.getOptions(options) this.enabled = true if (this.options.trigger == 'click') { this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this)) } else if (this.options.trigger != 'manual') { eventIn = this.options.trigger == 'hover' ? 'mouseenter' : 'focus' eventOut = this.options.trigger == 'hover' ? 'mouseleave' : 'blur' this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this)) this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this)) } this.options.selector ? (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) : this.fixTitle() } , getOptions: function (options) { options = $.extend({}, $.fn[this.type].defaults, options, this.$element.data()) if (options.delay && typeof options.delay == 'number') { options.delay = { show: options.delay , hide: options.delay } } return options } , enter: function (e) { var self = $(e.currentTarget)[this.type](this._options).data(this.type) if (!self.options.delay || !self.options.delay.show) return self.show() clearTimeout(this.timeout) self.hoverState = 'in' this.timeout = setTimeout(function() { if (self.hoverState == 'in') self.show() }, self.options.delay.show) } , leave: function (e) { var self = $(e.currentTarget)[this.type](this._options).data(this.type) if (this.timeout) clearTimeout(this.timeout) if (!self.options.delay || !self.options.delay.hide) return self.hide() self.hoverState = 'out' this.timeout = setTimeout(function() { if (self.hoverState == 'out') self.hide() }, self.options.delay.hide) } , show: function () { var $tip , inside , pos , actualWidth , actualHeight , placement , tp if (this.hasContent() && this.enabled) { $tip = this.tip() this.setContent() if (this.options.animation) { $tip.addClass('fade') } placement = typeof this.options.placement == 'function' ? this.options.placement.call(this, $tip[0], this.$element[0]) : this.options.placement inside = /in/.test(placement) $tip .detach() .css({ top: 0, left: 0, display: 'block' }) .insertAfter(this.$element) pos = this.getPosition(inside) actualWidth = $tip[0].offsetWidth actualHeight = $tip[0].offsetHeight switch (inside ? placement.split(' ')[1] : placement) { case 'bottom': tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2} break case 'top': tp = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2} break case 'left': tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth} break case 'right': tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width} break } $tip .offset(tp) .addClass(placement) .addClass('in') } } , setContent: function () { var $tip = this.tip() , title = this.getTitle() $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title) $tip.removeClass('fade in top bottom left right') } , hide: function () { var that = this , $tip = this.tip() $tip.removeClass('in') function removeWithAnimation() { var timeout = setTimeout(function () { $tip.off($.support.transition.end).detach() }, 500) $tip.one($.support.transition.end, function () { clearTimeout(timeout) $tip.detach() }) } $.support.transition && this.$tip.hasClass('fade') ? removeWithAnimation() : $tip.detach() return this } , fixTitle: function () { var $e = this.$element if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') { $e.attr('data-original-title', $e.attr('title') || '').removeAttr('title') } } , hasContent: function () { return this.getTitle() } , getPosition: function (inside) { return $.extend({}, (inside ? {top: 0, left: 0} : this.$element.offset()), { width: this.$element[0].offsetWidth , height: this.$element[0].offsetHeight }) } , getTitle: function () { var title , $e = this.$element , o = this.options title = $e.attr('data-original-title') || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title) return title } , tip: function () { return this.$tip = this.$tip || $(this.options.template) } , validate: function () { if (!this.$element[0].parentNode) { this.hide() this.$element = null this.options = null } } , enable: function () { this.enabled = true } , disable: function () { this.enabled = false } , toggleEnabled: function () { this.enabled = !this.enabled } , toggle: function (e) { var self = $(e.currentTarget)[this.type](this._options).data(this.type) self[self.tip().hasClass('in') ? 'hide' : 'show']() } , destroy: function () { this.hide().$element.off('.' + this.type).removeData(this.type) } } /* TOOLTIP PLUGIN DEFINITION * ========================= */ $.fn.tooltip = function ( option ) { return this.each(function () { var $this = $(this) , data = $this.data('tooltip') , options = typeof option == 'object' && option if (!data) $this.data('tooltip', (data = new Tooltip(this, options))) if (typeof option == 'string') data[option]() }) } $.fn.tooltip.Constructor = Tooltip $.fn.tooltip.defaults = { animation: true , placement: 'top' , selector: false , template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>' , trigger: 'hover' , title: '' , delay: 0 , html: false } }(window.jQuery);/* =========================================================== * bootstrap-popover.js v2.2.0 * http://twitter.github.com/bootstrap/javascript.html#popovers * =========================================================== * Copyright 2012 Twitter, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * =========================================================== */ !function ($) { "use strict"; // jshint ;_; /* POPOVER PUBLIC CLASS DEFINITION * =============================== */ var Popover = function (element, options) { this.init('popover', element, options) } /* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js ========================================== */ Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype, { constructor: Popover , setContent: function () { var $tip = this.tip() , title = this.getTitle() , content = this.getContent() $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title) $tip.find('.popover-content > *')[this.options.html ? 'html' : 'text'](content) $tip.removeClass('fade top bottom left right in') } , hasContent: function () { return this.getTitle() || this.getContent() } , getContent: function () { var content , $e = this.$element , o = this.options content = $e.attr('data-content') || (typeof o.content == 'function' ? o.content.call($e[0]) : o.content) return content } , tip: function () { if (!this.$tip) { this.$tip = $(this.options.template) } return this.$tip } , destroy: function () { this.hide().$element.off('.' + this.type).removeData(this.type) } }) /* POPOVER PLUGIN DEFINITION * ======================= */ $.fn.popover = function (option) { return this.each(function () { var $this = $(this) , data = $this.data('popover') , options = typeof option == 'object' && option if (!data) $this.data('popover', (data = new Popover(this, options))) if (typeof option == 'string') data[option]() }) } $.fn.popover.Constructor = Popover $.fn.popover.defaults = $.extend({} , $.fn.tooltip.defaults, { placement: 'right' , trigger: 'click' , content: '' , template: '<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>' }) }(window.jQuery);/* ============================================================= * bootstrap-scrollspy.js v2.2.0 * http://twitter.github.com/bootstrap/javascript.html#scrollspy * ============================================================= * Copyright 2012 Twitter, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================== */ !function ($) { "use strict"; // jshint ;_; /* SCROLLSPY CLASS DEFINITION * ========================== */ function ScrollSpy(element, options) { var process = $.proxy(this.process, this) , $element = $(element).is('body') ? $(window) : $(element) , href this.options = $.extend({}, $.fn.scrollspy.defaults, options) this.$scrollElement = $element.on('scroll.scroll-spy.data-api', process) this.selector = (this.options.target || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 || '') + ' .nav li > a' this.$body = $('body') this.refresh() this.process() } ScrollSpy.prototype = { constructor: ScrollSpy , refresh: function () { var self = this , $targets this.offsets = $([]) this.targets = $([]) $targets = this.$body .find(this.selector) .map(function () { var $el = $(this) , href = $el.data('target') || $el.attr('href') , $href = /^#\w/.test(href) && $(href) return ( $href && $href.length && [[ $href.position().top, href ]] ) || null }) .sort(function (a, b) { return a[0] - b[0] }) .each(function () { self.offsets.push(this[0]) self.targets.push(this[1]) }) } , process: function () { var scrollTop = this.$scrollElement.scrollTop() + this.options.offset , scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight , maxScroll = scrollHeight - this.$scrollElement.height() , offsets = this.offsets , targets = this.targets , activeTarget = this.activeTarget , i if (scrollTop >= maxScroll) { return activeTarget != (i = targets.last()[0]) && this.activate ( i ) } for (i = offsets.length; i--;) { activeTarget != targets[i] && scrollTop >= offsets[i] && (!offsets[i + 1] || scrollTop <= offsets[i + 1]) && this.activate( targets[i] ) } } , activate: function (target) { var active , selector this.activeTarget = target $(this.selector) .parent('.active') .removeClass('active') selector = this.selector + '[data-target="' + target + '"],' + this.selector + '[href="' + target + '"]' active = $(selector) .parent('li') .addClass('active') if (active.parent('.dropdown-menu').length) { active = active.closest('li.dropdown').addClass('active') } active.trigger('activate') } } /* SCROLLSPY PLUGIN DEFINITION * =========================== */ $.fn.scrollspy = function (option) { return this.each(function () { var $this = $(this) , data = $this.data('scrollspy') , options = typeof option == 'object' && option if (!data) $this.data('scrollspy', (data = new ScrollSpy(this, options))) if (typeof option == 'string') data[option]() }) } $.fn.scrollspy.Constructor = ScrollSpy $.fn.scrollspy.defaults = { offset: 10 } /* SCROLLSPY DATA-API * ================== */ $(window).on('load', function () { $('[data-spy="scroll"]').each(function () { var $spy = $(this) $spy.scrollspy($spy.data()) }) }) }(window.jQuery);/* ======================================================== * bootstrap-tab.js v2.2.0 * http://twitter.github.com/bootstrap/javascript.html#tabs * ======================================================== * Copyright 2012 Twitter, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ======================================================== */ !function ($) { "use strict"; // jshint ;_; /* TAB CLASS DEFINITION * ==================== */ var Tab = function (element) { this.element = $(element) } Tab.prototype = { constructor: Tab , show: function () { var $this = this.element , $ul = $this.closest('ul:not(.dropdown-menu)') , selector = $this.attr('data-target') , previous , $target , e if (!selector) { selector = $this.attr('href') selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 } if ( $this.parent('li').hasClass('active') ) return previous = $ul.find('.active:last a')[0] e = $.Event('show', { relatedTarget: previous }) $this.trigger(e) if (e.isDefaultPrevented()) return $target = $(selector) this.activate($this.parent('li'), $ul) this.activate($target, $target.parent(), function () { $this.trigger({ type: 'shown' , relatedTarget: previous }) }) } , activate: function ( element, container, callback) { var $active = container.find('> .active') , transition = callback && $.support.transition && $active.hasClass('fade') function next() { $active .removeClass('active') .find('> .dropdown-menu > .active') .removeClass('active') element.addClass('active') if (transition) { element[0].offsetWidth // reflow for transition element.addClass('in') } else { element.removeClass('fade') } if ( element.parent('.dropdown-menu') ) { element.closest('li.dropdown').addClass('active') } callback && callback() } transition ? $active.one($.support.transition.end, next) : next() $active.removeClass('in') } } /* TAB PLUGIN DEFINITION * ===================== */ $.fn.tab = function ( option ) { return this.each(function () { var $this = $(this) , data = $this.data('tab') if (!data) $this.data('tab', (data = new Tab(this))) if (typeof option == 'string') data[option]() }) } $.fn.tab.Constructor = Tab /* TAB DATA-API * ============ */ $(document).on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) { e.preventDefault() $(this).tab('show') }) }(window.jQuery);/* ============================================================= * bootstrap-typeahead.js v2.2.0 * http://twitter.github.com/bootstrap/javascript.html#typeahead * ============================================================= * Copyright 2012 Twitter, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================ */ !function($){ "use strict"; // jshint ;_; /* TYPEAHEAD PUBLIC CLASS DEFINITION * ================================= */ var Typeahead = function (element, options) { this.$element = $(element) this.options = $.extend({}, $.fn.typeahead.defaults, options) this.matcher = this.options.matcher || this.matcher this.sorter = this.options.sorter || this.sorter this.highlighter = this.options.highlighter || this.highlighter this.updater = this.options.updater || this.updater this.$menu = $(this.options.menu).appendTo('body') this.source = this.options.source this.shown = false this.listen() } Typeahead.prototype = { constructor: Typeahead , select: function () { var val = this.$menu.find('.active').attr('data-value') this.$element .val(this.updater(val)) .change() return this.hide() } , updater: function (item) { return item } , show: function () { var pos = $.extend({}, this.$element.offset(), { height: this.$element[0].offsetHeight }) this.$menu.css({ top: pos.top + pos.height , left: pos.left }) this.$menu.show() this.shown = true return this } , hide: function () { this.$menu.hide() this.shown = false return this } , lookup: function (event) { var items this.query = this.$element.val() if (!this.query || this.query.length < this.options.minLength) { return this.shown ? this.hide() : this } items = $.isFunction(this.source) ? this.source(this.query, $.proxy(this.process, this)) : this.source return items ? this.process(items) : this } , process: function (items) { var that = this items = $.grep(items, function (item) { return that.matcher(item) }) items = this.sorter(items) if (!items.length) { return this.shown ? this.hide() : this } return this.render(items.slice(0, this.options.items)).show() } , matcher: function (item) { return ~item.toLowerCase().indexOf(this.query.toLowerCase()) } , sorter: function (items) { var beginswith = [] , caseSensitive = [] , caseInsensitive = [] , item while (item = items.shift()) { if (!item.toLowerCase().indexOf(this.query.toLowerCase())) beginswith.push(item) else if (~item.indexOf(this.query)) caseSensitive.push(item) else caseInsensitive.push(item) } return beginswith.concat(caseSensitive, caseInsensitive) } , highlighter: function (item) { var query = this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&') return item.replace(new RegExp('(' + query + ')', 'ig'), function ($1, match) { return '<strong>' + match + '</strong>' }) } , render: function (items) { var that = this items = $(items).map(function (i, item) { i = $(that.options.item).attr('data-value', item) i.find('a').html(that.highlighter(item)) return i[0] }) items.first().addClass('active') this.$menu.html(items) return this } , next: function (event) { var active = this.$menu.find('.active').removeClass('active') , next = active.next() if (!next.length) { next = $(this.$menu.find('li')[0]) } next.addClass('active') } , prev: function (event) { var active = this.$menu.find('.active').removeClass('active') , prev = active.prev() if (!prev.length) { prev = this.$menu.find('li').last() } prev.addClass('active') } , listen: function () { this.$element .on('blur', $.proxy(this.blur, this)) .on('keypress', $.proxy(this.keypress, this)) .on('keyup', $.proxy(this.keyup, this)) if (this.eventSupported('keydown')) { this.$element.on('keydown', $.proxy(this.keydown, this)) } this.$menu .on('click', $.proxy(this.click, this)) .on('mouseenter', 'li', $.proxy(this.mouseenter, this)) } , eventSupported: function(eventName) { var isSupported = eventName in this.$element if (!isSupported) { this.$element.setAttribute(eventName, 'return;') isSupported = typeof this.$element[eventName] === 'function' } return isSupported } , move: function (e) { if (!this.shown) return switch(e.keyCode) { case 9: // tab case 13: // enter case 27: // escape e.preventDefault() break case 38: // up arrow e.preventDefault() this.prev() break case 40: // down arrow e.preventDefault() this.next() break } e.stopPropagation() } , keydown: function (e) { this.suppressKeyPressRepeat = !~$.inArray(e.keyCode, [40,38,9,13,27]) this.move(e) } , keypress: function (e) { if (this.suppressKeyPressRepeat) return this.move(e) } , keyup: function (e) { switch(e.keyCode) { case 40: // down arrow case 38: // up arrow case 16: // shift case 17: // ctrl case 18: // alt break case 9: // tab case 13: // enter if (!this.shown) return this.select() break case 27: // escape if (!this.shown) return this.hide() break default: this.lookup() } e.stopPropagation() e.preventDefault() } , blur: function (e) { var that = this setTimeout(function () { that.hide() }, 150) } , click: function (e) { e.stopPropagation() e.preventDefault() this.select() } , mouseenter: function (e) { this.$menu.find('.active').removeClass('active') $(e.currentTarget).addClass('active') } } /* TYPEAHEAD PLUGIN DEFINITION * =========================== */ $.fn.typeahead = function (option) { return this.each(function () { var $this = $(this) , data = $this.data('typeahead') , options = typeof option == 'object' && option if (!data) $this.data('typeahead', (data = new Typeahead(this, options))) if (typeof option == 'string') data[option]() }) } $.fn.typeahead.defaults = { source: [] , items: 8 , menu: '<ul class="typeahead dropdown-menu"></ul>' , item: '<li><a href="#"></a></li>' , minLength: 1 } $.fn.typeahead.Constructor = Typeahead /* TYPEAHEAD DATA-API * ================== */ $(document).on('focus.typeahead.data-api', '[data-provide="typeahead"]', function (e) { var $this = $(this) if ($this.data('typeahead')) return e.preventDefault() $this.typeahead($this.data()) }) }(window.jQuery); /* ========================================================== * bootstrap-affix.js v2.2.0 * http://twitter.github.com/bootstrap/javascript.html#affix * ========================================================== * Copyright 2012 Twitter, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ========================================================== */ !function ($) { "use strict"; // jshint ;_; /* AFFIX CLASS DEFINITION * ====================== */ var Affix = function (element, options) { this.options = $.extend({}, $.fn.affix.defaults, options) this.$window = $(window) .on('scroll.affix.data-api', $.proxy(this.checkPosition, this)) .on('click.affix.data-api', $.proxy(function () { setTimeout($.proxy(this.checkPosition, this), 1) }, this)) this.$element = $(element) this.checkPosition() } Affix.prototype.checkPosition = function () { if (!this.$element.is(':visible')) return var scrollHeight = $(document).height() , scrollTop = this.$window.scrollTop() , position = this.$element.offset() , offset = this.options.offset , offsetBottom = offset.bottom , offsetTop = offset.top , reset = 'affix affix-top affix-bottom' , affix if (typeof offset != 'object') offsetBottom = offsetTop = offset if (typeof offsetTop == 'function') offsetTop = offset.top() if (typeof offsetBottom == 'function') offsetBottom = offset.bottom() affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? false : offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' : offsetTop != null && scrollTop <= offsetTop ? 'top' : false if (this.affixed === affix) return this.affixed = affix this.unpin = affix == 'bottom' ? position.top - scrollTop : null this.$element.removeClass(reset).addClass('affix' + (affix ? '-' + affix : '')) } /* AFFIX PLUGIN DEFINITION * ======================= */ $.fn.affix = function (option) { return this.each(function () { var $this = $(this) , data = $this.data('affix') , options = typeof option == 'object' && option if (!data) $this.data('affix', (data = new Affix(this, options))) if (typeof option == 'string') data[option]() }) } $.fn.affix.Constructor = Affix $.fn.affix.defaults = { offset: 0 } /* AFFIX DATA-API * ============== */ $(window).on('load', function () { $('[data-spy="affix"]').each(function () { var $spy = $(this) , data = $spy.data() data.offset = data.offset || {} data.offsetBottom && (data.offset.bottom = data.offsetBottom) data.offsetTop && (data.offset.top = data.offsetTop) $spy.affix(data) }) }) }(window.jQuery);
var doc = window.document, promise, ready function GET(url, fn) { var req = new XMLHttpRequest() req.onreadystatechange = function() { if (req.readyState == 4 && (req.status == 200 || (!req.status && req.responseText.length))) fn(req.responseText) } req.open('GET', url, true) req.send('') } function unindent(src) { var ident = /[ \t]+/.exec(src) if (ident) src = src.replace(new RegExp('^' + ident[0], 'gm'), '') return src } function globalEval(js) { var node = doc.createElement('script'), root = doc.documentElement node.text = compile(js) root.appendChild(node) root.removeChild(node) } function compileScripts(fn) { var scripts = doc.querySelectorAll('script[type="riot/tag"]'), scriptsAmount = scripts.length function done() { promise.trigger('ready') ready = true if (fn) fn() } if (!scriptsAmount) { done() } else { [].map.call(scripts, function(script) { var url = script.getAttribute('src') function compileTag(source) { globalEval(source) scriptsAmount-- if (!scriptsAmount) { done() } } return url ? GET(url, compileTag) : compileTag(unindent(script.innerHTML)) }) } } riot.compile = function(arg, fn) { // string if (typeof arg === T_STRING) { // compile & return if (arg.trim()[0] == '<') { var js = unindent(compile(arg)) if (!fn) globalEval(js) return js // URL } else { return GET(arg, function(str) { var js = unindent(compile(str)) globalEval(js) if (fn) fn(js, str) }) } } // must be a function if (typeof arg !== 'function') arg = undefined // all compiled if (ready) return arg && arg() // add to queue if (promise) { if (arg) promise.on('ready', arg) // grab riot/tag elements + load & execute them } else { promise = riot.observable() compileScripts(arg) } } // reassign mount methods var mount = riot.mount riot.mount = function(a, b, c) { var ret riot.compile(function() { ret = mount(a, b, c) }) return ret } // @deprecated riot.mountTo = riot.mount
/** * ag-grid - Advanced Data Grid / Data Table supporting Javascript / React / AngularJS / Web Components * @version v11.0.0 * @link http://www.ag-grid.com/ * @license MIT */ "use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var component_1 = require("../../widgets/component"); var constants_1 = require("../../constants"); var utils_1 = require("../../utils"); var LargeTextCellEditor = (function (_super) { __extends(LargeTextCellEditor, _super); function LargeTextCellEditor() { return _super.call(this, LargeTextCellEditor.TEMPLATE) || this; } LargeTextCellEditor.prototype.init = function (params) { this.params = params; this.focusAfterAttached = params.cellStartedEdit; this.textarea = document.createElement("textarea"); this.textarea.maxLength = params.maxLength ? params.maxLength : "200"; this.textarea.cols = params.cols ? params.cols : "60"; this.textarea.rows = params.rows ? params.rows : "10"; if (utils_1.Utils.exists(params.value)) { this.textarea.value = params.value.toString(); } this.getGui().querySelector('.ag-large-textarea').appendChild(this.textarea); this.addGuiEventListener('keydown', this.onKeyDown.bind(this)); }; LargeTextCellEditor.prototype.onKeyDown = function (event) { var key = event.which || event.keyCode; if (key == constants_1.Constants.KEY_LEFT || key == constants_1.Constants.KEY_UP || key == constants_1.Constants.KEY_RIGHT || key == constants_1.Constants.KEY_DOWN || (event.shiftKey && key == constants_1.Constants.KEY_ENTER)) { event.stopPropagation(); } }; LargeTextCellEditor.prototype.afterGuiAttached = function () { if (this.focusAfterAttached) { this.textarea.focus(); } }; LargeTextCellEditor.prototype.getValue = function () { return this.textarea.value; }; LargeTextCellEditor.prototype.isPopup = function () { return true; }; return LargeTextCellEditor; }(component_1.Component)); LargeTextCellEditor.TEMPLATE = // tab index is needed so we can focus, which is needed for keyboard events '<div class="ag-large-text" tabindex="0">' + '<div class="ag-large-textarea"></div>' + '</div>'; exports.LargeTextCellEditor = LargeTextCellEditor;
/* @flow */ import { noop } from 'shared/util' import { warn, tip } from 'core/util/debug' type CompiledFunctionResult = { render: Function; staticRenderFns: Array<Function>; }; function createFunction (code, errors) { try { return new Function(code) } catch (err) { errors.push({ err, code }) return noop } } export function createCompileToFunctionFn (compile: Function): Function { const cache: { [key: string]: CompiledFunctionResult; } = Object.create(null) return function compileToFunctions ( template: string, options?: CompilerOptions, vm?: Component ): CompiledFunctionResult { options = options || {} /* istanbul ignore if */ if (process.env.NODE_ENV !== 'production') { // detect possible CSP restriction try { new Function('return 1') } catch (e) { if (e.toString().match(/unsafe-eval|CSP/)) { warn( 'It seems you are using the standalone build of Vue.js in an ' + 'environment with Content Security Policy that prohibits unsafe-eval. ' + 'The template compiler cannot work in this environment. Consider ' + 'relaxing the policy to allow unsafe-eval or pre-compiling your ' + 'templates into render functions.' ) } } } // check cache const key = options.delimiters ? String(options.delimiters) + template : template if (cache[key]) { return cache[key] } // compile const compiled = compile(template, options) // check compilation errors/tips if (process.env.NODE_ENV !== 'production') { if (compiled.errors && compiled.errors.length) { warn( `Error compiling template:\n\n${template}\n\n` + compiled.errors.map(e => `- ${e}`).join('\n') + '\n', vm ) } if (compiled.tips && compiled.tips.length) { compiled.tips.forEach(msg => tip(msg, vm)) } } // turn code into functions const res = {} const fnGenErrors = [] res.render = createFunction(compiled.render, fnGenErrors) res.staticRenderFns = compiled.staticRenderFns.map(code => { return createFunction(code, fnGenErrors) }) // check function generation errors. // this should only happen if there is a bug in the compiler itself. // mostly for codegen development use /* istanbul ignore if */ if (process.env.NODE_ENV !== 'production') { if ((!compiled.errors || !compiled.errors.length) && fnGenErrors.length) { warn( `Failed to generate render function:\n\n` + fnGenErrors.map(({ err, code }) => `${err.toString()} in\n\n${code}\n`).join('\n'), vm ) } } return (cache[key] = res) } }
'use strict'; module.exports = angular .module('diDocuments', [ 'diDocuments.service', 'diDocuments.export' ]) .controller('Documents', function($scope, $timeout, $rootScope, userService, documentsService) { var vm = this; vm.status = { import: true, save: true, linkUnlink: true, document: false }; $scope.profile = userService.profile; $scope.saveDocument = save; $scope.createDocument = createDocument; $scope.removeDocument = removeDocument; $scope.selectDocument = selectDocument; $rootScope.documents = documentsService.getItems(); $rootScope.editor.on('change', doAutoSave); $rootScope.$on('autosave', doAutoSave); function save(manuel) { var item; item = documentsService.getCurrentDocument(); item.body = $rootScope.editor.getSession().getValue(); documentsService.setCurrentDocument(item); return documentsService.save(manuel); } function initDocument() { var item; item = documentsService.getItemById($rootScope.currentDocument.id); documentsService.setCurrentDocument(item); return $rootScope.$emit('document.refresh'); } function selectDocument(item) { item = documentsService.getItem(item); documentsService.setCurrentDocument(item); return $rootScope.$emit('document.refresh'); } function removeDocument(item) { var next; // The order is important here. documentsService.removeItem(item); next = documentsService.getItemByIndex(0); documentsService.setCurrentDocument(next); return $rootScope.$emit('document.refresh'); } function createDocument() { var item; item = documentsService.createItem(); documentsService.addItem(item); documentsService.setCurrentDocument(item); return $rootScope.$emit('document.refresh'); } function doAutoSave() { if ($scope.profile.enableAutoSave) { return save(); } return false; } $scope.$on('$destroy', function() { vm = null; $scope = null; return false; }); initDocument(); });
version https://git-lfs.github.com/spec/v1 oid sha256:d4784d79e81a0e28efa12f69aea1ef10fc49479fe5f14feab93caa788b7f8e1c size 5929
/************************************************************* * * MathJax/jax/output/HTML-CSS/fonts/TeX/Main/Bold/MathOperators.js * * Copyright (c) 2009-2014 The MathJax Consortium * * 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. * */ MathJax.Hub.Insert( MathJax.OutputJax['HTML-CSS'].FONTDATA.FONTS['MathJax_Main-bold'], { 0x2200: [694,16,639,1,640], // FOR ALL 0x2202: [710,17,628,60,657], // PARTIAL DIFFERENTIAL 0x2203: [694,-1,639,64,574], // THERE EXISTS 0x2205: [767,73,575,46,528], // EMPTY SET 0x2207: [686,24,958,56,901], // NABLA 0x2208: [587,86,767,97,670], // ELEMENT OF 0x2209: [711,210,767,97,670], // stix-negated (vert) set membership, variant 0x220B: [587,86,767,96,670], // CONTAINS AS MEMBER 0x2212: [281,-221,894,96,797], // MINUS SIGN 0x2213: [537,227,894,64,829], // MINUS-OR-PLUS SIGN 0x2215: [750,250,575,63,511], // DIVISION SLASH 0x2216: [750,250,575,63,511], // SET MINUS 0x2217: [472,-28,575,73,501], // ASTERISK OPERATOR 0x2218: [474,-28,575,64,510], // RING OPERATOR 0x2219: [474,-28,575,64,510], // BULLET OPERATOR 0x221A: [820,180,958,78,988], // SQUARE ROOT 0x221D: [451,8,894,65,830], // PROPORTIONAL TO 0x221E: [452,8,1150,65,1084], // INFINITY 0x2220: [714,0,722,55,676], // ANGLE 0x2223: [750,249,319,129,190], // DIVIDES 0x2225: [750,248,575,145,430], // PARALLEL TO 0x2227: [604,17,767,64,702], // LOGICAL AND 0x2228: [604,16,767,64,702], // LOGICAL OR 0x2229: [603,16,767,64,702], // stix-intersection, serifs 0x222A: [604,16,767,64,702], // stix-union, serifs 0x222B: [711,211,569,64,632], // INTEGRAL 0x223C: [391,-109,894,64,828], // TILDE OPERATOR 0x2240: [583,82,319,64,254], // WREATH PRODUCT 0x2243: [502,3,894,64,829], // ASYMPTOTICALLY EQUAL TO 0x2245: [638,27,1000,64,829], // APPROXIMATELY EQUAL TO 0x2248: [524,-32,894,64,829], // ALMOST EQUAL TO 0x224D: [533,32,894,64,829], // EQUIVALENT TO 0x2250: [721,-109,894,64,829], // APPROACHES THE LIMIT 0x2260: [711,210,894,64,829], // stix-not (vert) equals 0x2261: [505,3,894,64,829], // IDENTICAL TO 0x2264: [697,199,894,96,797], // LESS-THAN OR EQUAL TO 0x2265: [697,199,894,96,797], // GREATER-THAN OR EQUAL TO 0x226A: [617,116,1150,64,1085], // MUCH LESS-THAN 0x226B: [618,116,1150,64,1085], // MUCH GREATER-THAN 0x227A: [585,86,894,96,797], // PRECEDES 0x227B: [586,86,894,96,797], // SUCCEEDS 0x2282: [587,85,894,96,797], // SUBSET OF 0x2283: [587,86,894,96,796], // SUPERSET OF 0x2286: [697,199,894,96,797], // SUBSET OF OR EQUAL TO 0x2287: [697,199,894,96,796], // SUPERSET OF OR EQUAL TO 0x228E: [604,16,767,64,702], // MULTISET UNION 0x2291: [697,199,894,96,828], // SQUARE IMAGE OF OR EQUAL TO 0x2292: [697,199,894,66,797], // SQUARE ORIGINAL OF OR EQUAL TO 0x2293: [604,-1,767,70,696], // stix-square intersection, serifs 0x2294: [604,-1,767,70,696], // stix-square union, serifs 0x2295: [632,132,894,64,828], // stix-circled plus (with rim) 0x2296: [632,132,894,64,828], // CIRCLED MINUS 0x2297: [632,132,894,64,828], // stix-circled times (with rim) 0x2298: [632,132,894,64,828], // CIRCLED DIVISION SLASH 0x2299: [632,132,894,64,828], // CIRCLED DOT OPERATOR 0x22A2: [693,-1,703,65,637], // RIGHT TACK 0x22A3: [693,-1,703,64,638], // LEFT TACK 0x22A4: [694,-1,894,64,829], // DOWN TACK 0x22A5: [693,-1,894,65,829], // UP TACK 0x22A8: [750,249,974,129,918], // TRUE 0x22C4: [523,21,575,15,560], // DIAMOND OPERATOR 0x22C5: [336,-166,319,74,245], // DOT OPERATOR 0x22C6: [502,0,575,24,550], // STAR OPERATOR 0x22C8: [540,39,1000,33,967], // BOWTIE 0x22EE: [951,29,319,74,245], // VERTICAL ELLIPSIS 0x22EF: [336,-166,1295,74,1221], // MIDLINE HORIZONTAL ELLIPSIS 0x22F1: [871,-101,1323,129,1194] // DOWN RIGHT DIAGONAL ELLIPSIS } ); MathJax.Ajax.loadComplete(MathJax.OutputJax["HTML-CSS"].fontDir + "/Main/Bold/MathOperators.js");