path
stringlengths 5
300
| repo_name
stringlengths 6
76
| content
stringlengths 26
1.05M
|
|---|---|---|
packages/react-interactions/accessibility/src/FocusGroup.js
|
mjackson/react
|
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
import type {ReactScopeMethods} from 'shared/ReactTypes';
import type {KeyboardEvent} from 'react-interactions/events/keyboard';
import React from 'react';
import {useKeyboard} from 'react-interactions/events/keyboard';
import setElementCanTab from './shared/setElementCanTab';
type FocusItemProps = {
children?: React.Node,
onKeyDown?: KeyboardEvent => void,
};
type FocusGroupProps = {|
children: React.Node,
portrait: boolean,
wrap?: boolean,
tabScopeQuery?: (type: string | Object, props: Object) => boolean,
allowModifiers?: boolean,
|};
const {useRef} = React;
function focusGroupItem(
scopeQuery: (type: string | Object, props: Object) => boolean,
cell: ReactScopeMethods,
event: KeyboardEvent,
): void {
const firstScopedNode = cell.queryFirstNode(scopeQuery);
if (firstScopedNode !== null) {
firstScopedNode.focus();
event.preventDefault();
}
}
function getPreviousGroupItem(
group: ReactScopeMethods,
currentItem: ReactScopeMethods,
): null | ReactScopeMethods {
const items = group.getChildren();
if (items !== null) {
const currentItemIndex = items.indexOf(currentItem);
const wrap = getGroupProps(currentItem).wrap;
if (currentItemIndex === 0 && wrap) {
return items[items.length - 1] || null;
} else if (currentItemIndex > 0) {
return items[currentItemIndex - 1] || null;
}
}
return null;
}
function getNextGroupItem(
group: ReactScopeMethods,
currentItem: ReactScopeMethods,
): null | ReactScopeMethods {
const items = group.getChildren();
if (items !== null) {
const currentItemIndex = items.indexOf(currentItem);
const wrap = getGroupProps(currentItem).wrap;
const end = currentItemIndex === items.length - 1;
if (end && wrap) {
return items[0] || null;
} else if (currentItemIndex !== -1 && !end) {
return items[currentItemIndex + 1] || null;
}
}
return null;
}
function getGroupProps(currentCell: ReactScopeMethods): Object {
const group = currentCell.getParent();
if (group !== null) {
const groupProps = group.getProps();
if (groupProps && groupProps.type === 'group') {
return groupProps;
}
}
return {};
}
function hasModifierKey(event: KeyboardEvent): boolean {
const {altKey, ctrlKey, metaKey, shiftKey} = event;
return (
altKey === true || ctrlKey === true || metaKey === true || shiftKey === true
);
}
export function createFocusGroup(
scopeQuery: (type: string | Object, props: Object) => boolean,
): [(FocusGroupProps) => React.Node, (FocusItemProps) => React.Node] {
const TableScope = React.unstable_createScope();
function Group({
children,
portrait,
wrap,
tabScopeQuery,
allowModifiers,
}: FocusGroupProps): React.Node {
return (
<TableScope
type="group"
portrait={portrait}
wrap={wrap}
tabScopeQuery={tabScopeQuery}
allowModifiers={allowModifiers}>
{children}
</TableScope>
);
}
function Item({children, onKeyDown}: FocusItemProps): React.Node {
const scopeRef = useRef(null);
const keyboard = useKeyboard({
onKeyDown(event: KeyboardEvent): void {
const currentItem = scopeRef.current;
if (currentItem !== null) {
const group = currentItem.getParent();
const groupProps = group && group.getProps();
if (group !== null && groupProps.type === 'group') {
const portrait = groupProps.portrait;
const key = event.key;
if (key === 'Tab') {
const tabScopeQuery = getGroupProps(currentItem).tabScopeQuery;
if (tabScopeQuery) {
const groupScope = currentItem.getParent();
if (groupScope) {
const activeNode = document.activeElement;
const nodes = groupScope.queryAllNodes(tabScopeQuery);
for (let i = 0; i < nodes.length; i++) {
const node = nodes[i];
if (node !== activeNode) {
setElementCanTab(node, false);
} else {
setElementCanTab(node, true);
}
}
return;
}
}
event.continuePropagation();
return;
}
// Using modifier keys with keyboard arrow events should be no-ops
// unless an explicit allowModifiers flag is set on the FocusGroup.
if (hasModifierKey(event)) {
const allowModifiers = getGroupProps(currentItem).allowModifiers;
if (!allowModifiers) {
event.continuePropagation();
return;
}
}
switch (key) {
case 'ArrowUp': {
if (portrait) {
const previousGroupItem = getPreviousGroupItem(
group,
currentItem,
);
if (previousGroupItem) {
focusGroupItem(scopeQuery, previousGroupItem, event);
return;
}
}
break;
}
case 'ArrowDown': {
if (portrait) {
const nextGroupItem = getNextGroupItem(group, currentItem);
if (nextGroupItem) {
focusGroupItem(scopeQuery, nextGroupItem, event);
return;
}
}
break;
}
case 'ArrowLeft': {
if (!portrait) {
const previousGroupItem = getPreviousGroupItem(
group,
currentItem,
);
if (previousGroupItem) {
focusGroupItem(scopeQuery, previousGroupItem, event);
return;
}
}
break;
}
case 'ArrowRight': {
if (!portrait) {
const nextGroupItem = getNextGroupItem(group, currentItem);
if (nextGroupItem) {
focusGroupItem(scopeQuery, nextGroupItem, event);
return;
}
}
break;
}
}
}
}
if (onKeyDown) {
onKeyDown(event);
}
event.continuePropagation();
},
});
return (
<TableScope
DEPRECATED_flareListeners={keyboard}
ref={scopeRef}
type="item">
{children}
</TableScope>
);
}
return [Group, Item];
}
|
src/components/Layout/Bread.js
|
steem/qwp-antd
|
import React from 'react'
import PropTypes from 'prop-types'
import { Breadcrumb, Icon } from 'antd'
import { Link } from 'dva/router'
import styles from './Bread.less'
import { l } from 'utils/localization'
const Bread = ({ menu }) => {
let pathArray = []
const getPathArray = (path) => {
let result = []
path = path.split('/')
for (let i = 1; i < path.length; ++i) {
let tmp = []
for (let j = 0; j <= i; ++j) {
tmp.push(path[j])
}
result.push(tmp.join('/'))
}
return result
}
pathArray = getPathArray(location.pathname)
let menuOfPath = []
for (let item of menu) {
if (pathArray.includes(item.path)) menuOfPath.push(item)
}
const breads = menuOfPath.map(item => {
const content = (
<span>{item.icon
? <Icon type={item.icon} style={{ marginRight: 4 }} />
: ''}{l(item.name)}</span>
)
return (
<Breadcrumb.Item key={item.path}>
{content}
</Breadcrumb.Item>
)
})
return (
<div className={styles.bread} style={ {display: menuOfPath.length > 0 ? 'block' : 'none'} }>
<Breadcrumb>
{breads}
</Breadcrumb>
</div>
)
}
Bread.propTypes = {
menu: PropTypes.array.isRequired,
}
export default Bread
|
src/components/City/City.js
|
maximgatilin/weathernow
|
import React, { Component } from 'react';
import { TweenLite, Elastic } from 'gsap';
import styles from './City.css';
class City extends Component {
componentWillAppear() {
const el = this.el;
TweenLite.fromTo(el, 1.3, {y: 30, opacity: 0}, {y: 0, opacity: 1, ease: Elastic.easeOut.config(1.2, 0.75) });
}
render() {
return (
<h2 className={styles.city} ref={c => this.el = c}>{this.props.children}</h2>
)
}
}
export default City;
|
packages/material-ui-icons/src/SubjectRounded.js
|
allanalexandre/material-ui
|
import React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<React.Fragment><path fill="none" d="M0 0h24v24H0V0z" /><path d="M13 17H5c-.55 0-1 .45-1 1s.45 1 1 1h8c.55 0 1-.45 1-1s-.45-1-1-1zm6-8H5c-.55 0-1 .45-1 1s.45 1 1 1h14c.55 0 1-.45 1-1s-.45-1-1-1zM5 15h14c.55 0 1-.45 1-1s-.45-1-1-1H5c-.55 0-1 .45-1 1s.45 1 1 1zM4 6c0 .55.45 1 1 1h14c.55 0 1-.45 1-1s-.45-1-1-1H5c-.55 0-1 .45-1 1z" /></React.Fragment>
, 'SubjectRounded');
|
jssource/src_files/include/javascript/yui3/build/simpleyui/simpleyui.js
|
nicoavn/suitecrm-impl
|
/*
Copyright (c) 2010, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.com/yui/license.html
version: 3.3.0
build: 3167
*/
/**
* The YUI module contains the components required for building the YUI seed
* file. This includes the script loading mechanism, a simple queue, and
* the core utilities for the library.
* @module yui
* @submodule yui-base
*/
if (typeof YUI != 'undefined') {
YUI._YUI = YUI;
}
/**
* The YUI global namespace object. If YUI is already defined, the
* existing YUI object will not be overwritten so that defined
* namespaces are preserved. It is the constructor for the object
* the end user interacts with. As indicated below, each instance
* has full custom event support, but only if the event system
* is available. This is a self-instantiable factory function. You
* can invoke it directly like this:
*
* YUI().use('*', function(Y) {
* // ready
* });
*
* But it also works like this:
*
* var Y = YUI();
*
* @class YUI
* @constructor
* @global
* @uses EventTarget
* @param o* {object} 0..n optional configuration objects. these values
* are store in Y.config. See config for the list of supported
* properties.
*/
/*global YUI*/
/*global YUI_config*/
var YUI = function() {
var i = 0,
Y = this,
args = arguments,
l = args.length,
instanceOf = function(o, type) {
return (o && o.hasOwnProperty && (o instanceof type));
},
gconf = (typeof YUI_config !== 'undefined') && YUI_config;
if (!(instanceOf(Y, YUI))) {
Y = new YUI();
} else {
// set up the core environment
Y._init();
// YUI.GlobalConfig is a master configuration that might span
// multiple contexts in a non-browser environment. It is applied
// first to all instances in all contexts.
if (YUI.GlobalConfig) {
Y.applyConfig(YUI.GlobalConfig);
}
// YUI_Config is a page-level config. It is applied to all
// instances created on the page. This is applied after
// YUI.GlobalConfig, and before the instance level configuration
// objects.
if (gconf) {
Y.applyConfig(gconf);
}
// bind the specified additional modules for this instance
if (!l) {
Y._setup();
}
}
if (l) {
// Each instance can accept one or more configuration objects.
// These are applied after YUI.GlobalConfig and YUI_Config,
// overriding values set in those config files if there is a '
// matching property.
for (; i < l; i++) {
Y.applyConfig(args[i]);
}
Y._setup();
}
Y.instanceOf = instanceOf;
return Y;
};
(function() {
var proto, prop,
VERSION = '3.3.0',
PERIOD = '.',
BASE = 'http://yui.yahooapis.com/',
DOC_LABEL = 'yui3-js-enabled',
NOOP = function() {},
SLICE = Array.prototype.slice,
APPLY_TO_AUTH = { 'io.xdrReady': 1, // the functions applyTo
'io.xdrResponse': 1, // can call. this should
'SWF.eventHandler': 1 }, // be done at build time
hasWin = (typeof window != 'undefined'),
win = (hasWin) ? window : null,
doc = (hasWin) ? win.document : null,
docEl = doc && doc.documentElement,
docClass = docEl && docEl.className,
instances = {},
time = new Date().getTime(),
add = function(el, type, fn, capture) {
if (el && el.addEventListener) {
el.addEventListener(type, fn, capture);
} else if (el && el.attachEvent) {
el.attachEvent('on' + type, fn);
}
},
remove = function(el, type, fn, capture) {
if (el && el.removeEventListener) {
// this can throw an uncaught exception in FF
try {
el.removeEventListener(type, fn, capture);
} catch (ex) {}
} else if (el && el.detachEvent) {
el.detachEvent('on' + type, fn);
}
},
handleLoad = function() {
YUI.Env.windowLoaded = true;
YUI.Env.DOMReady = true;
if (hasWin) {
remove(window, 'load', handleLoad);
}
},
getLoader = function(Y, o) {
var loader = Y.Env._loader;
if (loader) {
loader.ignoreRegistered = false;
loader.onEnd = null;
loader.data = null;
loader.required = [];
loader.loadType = null;
} else {
loader = new Y.Loader(Y.config);
Y.Env._loader = loader;
}
return loader;
},
clobber = function(r, s) {
for (var i in s) {
if (s.hasOwnProperty(i)) {
r[i] = s[i];
}
}
},
ALREADY_DONE = { success: true };
// Stamp the documentElement (HTML) with a class of "yui-loaded" to
// enable styles that need to key off of JS being enabled.
if (docEl && docClass.indexOf(DOC_LABEL) == -1) {
if (docClass) {
docClass += ' ';
}
docClass += DOC_LABEL;
docEl.className = docClass;
}
if (VERSION.indexOf('@') > -1) {
VERSION = '3.2.0'; // dev time hack for cdn test
}
proto = {
/**
* Applies a new configuration object to the YUI instance config.
* This will merge new group/module definitions, and will also
* update the loader cache if necessary. Updating Y.config directly
* will not update the cache.
* @method applyConfig
* @param {object} the configuration object.
* @since 3.2.0
*/
applyConfig: function(o) {
o = o || NOOP;
var attr,
name,
// detail,
config = this.config,
mods = config.modules,
groups = config.groups,
rls = config.rls,
loader = this.Env._loader;
for (name in o) {
if (o.hasOwnProperty(name)) {
attr = o[name];
if (mods && name == 'modules') {
clobber(mods, attr);
} else if (groups && name == 'groups') {
clobber(groups, attr);
} else if (rls && name == 'rls') {
clobber(rls, attr);
} else if (name == 'win') {
config[name] = attr.contentWindow || attr;
config.doc = config[name].document;
} else if (name == '_yuid') {
// preserve the guid
} else {
config[name] = attr;
}
}
}
if (loader) {
loader._config(o);
}
},
_config: function(o) {
this.applyConfig(o);
},
/**
* Initialize this YUI instance
* @private
*/
_init: function() {
var filter,
Y = this,
G_ENV = YUI.Env,
Env = Y.Env,
prop;
/**
* The version number of the YUI instance.
* @property version
* @type string
*/
Y.version = VERSION;
if (!Env) {
Y.Env = {
mods: {}, // flat module map
versions: {}, // version module map
base: BASE,
cdn: BASE + VERSION + '/build/',
// bootstrapped: false,
_idx: 0,
_used: {},
_attached: {},
_yidx: 0,
_uidx: 0,
_guidp: 'y',
_loaded: {},
serviced: {},
getBase: G_ENV && G_ENV.getBase ||
function(srcPattern, comboPattern) {
var b, nodes, i, src, match;
// get from querystring
nodes = (doc && doc.getElementsByTagName('script')) || [];
for (i = 0; i < nodes.length; i = i + 1) {
src = nodes[i].src;
if (src) {
match = src.match(srcPattern);
b = match && match[1];
if (b) {
// this is to set up the path to the loader. The file
// filter for loader should match the yui include.
filter = match[2];
if (filter) {
match = filter.indexOf('js');
if (match > -1) {
filter = filter.substr(0, match);
}
}
// extract correct path for mixed combo urls
// http://yuilibrary.com/projects/yui3/ticket/2528423
match = src.match(comboPattern);
if (match && match[3]) {
b = match[1] + match[3];
}
break;
}
}
}
// use CDN default
return b || Env.cdn;
}
};
Env = Y.Env;
Env._loaded[VERSION] = {};
if (G_ENV && Y !== YUI) {
Env._yidx = ++G_ENV._yidx;
Env._guidp = ('yui_' + VERSION + '_' +
Env._yidx + '_' + time).replace(/\./g, '_');
} else if (YUI._YUI) {
G_ENV = YUI._YUI.Env;
Env._yidx += G_ENV._yidx;
Env._uidx += G_ENV._uidx;
for (prop in G_ENV) {
if (!(prop in Env)) {
Env[prop] = G_ENV[prop];
}
}
delete YUI._YUI;
}
Y.id = Y.stamp(Y);
instances[Y.id] = Y;
}
Y.constructor = YUI;
// configuration defaults
Y.config = Y.config || {
win: win,
doc: doc,
debug: true,
useBrowserConsole: true,
throwFail: true,
bootstrap: true,
cacheUse: true,
fetchCSS: true
};
Y.config.base = YUI.config.base ||
Y.Env.getBase(/^(.*)yui\/yui([\.\-].*)js(\?.*)?$/,
/^(.*\?)(.*\&)(.*)yui\/yui[\.\-].*js(\?.*)?$/);
if (!filter || (!('-min.-debug.').indexOf(filter))) {
filter = '-min.';
}
Y.config.loaderPath = YUI.config.loaderPath ||
'loader/loader' + (filter || '-min.') + 'js';
},
/**
* Finishes the instance setup. Attaches whatever modules were defined
* when the yui modules was registered.
* @method _setup
* @private
*/
_setup: function(o) {
var i, Y = this,
core = [],
mods = YUI.Env.mods,
extras = Y.config.core || ['get',
'rls',
'intl-base',
'loader',
'yui-log',
'yui-later',
'yui-throttle'];
for (i = 0; i < extras.length; i++) {
if (mods[extras[i]]) {
core.push(extras[i]);
}
}
Y._attach(['yui-base']);
Y._attach(core);
},
/**
* Executes a method on a YUI instance with
* the specified id if the specified method is whitelisted.
* @method applyTo
* @param id {string} the YUI instance id.
* @param method {string} the name of the method to exectute.
* Ex: 'Object.keys'.
* @param args {Array} the arguments to apply to the method.
* @return {object} the return value from the applied method or null.
*/
applyTo: function(id, method, args) {
if (!(method in APPLY_TO_AUTH)) {
this.log(method + ': applyTo not allowed', 'warn', 'yui');
return null;
}
var instance = instances[id], nest, m, i;
if (instance) {
nest = method.split('.');
m = instance;
for (i = 0; i < nest.length; i = i + 1) {
m = m[nest[i]];
if (!m) {
this.log('applyTo not found: ' + method, 'warn', 'yui');
}
}
return m.apply(instance, args);
}
return null;
},
/**
* Registers a module with the YUI global. The easiest way to create a
* first-class YUI module is to use the YUI component build tool.
*
* http://yuilibrary.com/projects/builder
*
* The build system will produce the YUI.add wrapper for you module, along
* with any configuration info required for the module.
* @method add
* @param name {string} module name.
* @param fn {Function} entry point into the module that
* is used to bind module to the YUI instance.
* @param version {string} version string.
* @param details {object} optional config data:
* requires: features that must be present before this module can be
* attached.
* optional: optional features that should be present if loadOptional
* is defined. Note: modules are not often loaded this way in YUI 3,
* but this field is still useful to inform the user that certain
* features in the component will require additional dependencies.
* use: features that are included within this module which need to
* be attached automatically when this module is attached. This
* supports the YUI 3 rollup system -- a module with submodules
* defined will need to have the submodules listed in the 'use'
* config. The YUI component build tool does this for you.
* @return {YUI} the YUI instance.
*
*/
add: function(name, fn, version, details) {
details = details || {};
var env = YUI.Env,
mod = {
name: name,
fn: fn,
version: version,
details: details
},
loader,
i, versions = env.versions;
env.mods[name] = mod;
versions[version] = versions[version] || {};
versions[version][name] = mod;
for (i in instances) {
if (instances.hasOwnProperty(i)) {
loader = instances[i].Env._loader;
if (loader) {
if (!loader.moduleInfo[name]) {
loader.addModule(details, name);
}
}
}
}
return this;
},
/**
* Executes the function associated with each required
* module, binding the module to the YUI instance.
* @method _attach
* @private
*/
_attach: function(r, fromLoader) {
var i, name, mod, details, req, use, after,
mods = YUI.Env.mods,
Y = this, j,
done = Y.Env._attached,
len = r.length, loader;
for (i = 0; i < len; i++) {
if (!done[r[i]]) {
name = r[i];
mod = mods[name];
if (!mod) {
loader = Y.Env._loader;
if (!loader || !loader.moduleInfo[name]) {
Y.message('NOT loaded: ' + name, 'warn', 'yui');
}
} else {
done[name] = true;
details = mod.details;
req = details.requires;
use = details.use;
after = details.after;
if (req) {
for (j = 0; j < req.length; j++) {
if (!done[req[j]]) {
if (!Y._attach(req)) {
return false;
}
break;
}
}
}
if (after) {
for (j = 0; j < after.length; j++) {
if (!done[after[j]]) {
if (!Y._attach(after)) {
return false;
}
break;
}
}
}
if (use) {
for (j = 0; j < use.length; j++) {
if (!done[use[j]]) {
if (!Y._attach(use)) {
return false;
}
break;
}
}
}
if (mod.fn) {
try {
mod.fn(Y, name);
} catch (e) {
Y.error('Attach error: ' + name, e, name);
return false;
}
}
}
}
}
return true;
},
/**
* Attaches one or more modules to the YUI instance. When this
* is executed, the requirements are analyzed, and one of
* several things can happen:
*
* - All requirements are available on the page -- The modules
* are attached to the instance. If supplied, the use callback
* is executed synchronously.
*
* - Modules are missing, the Get utility is not available OR
* the 'bootstrap' config is false -- A warning is issued about
* the missing modules and all available modules are attached.
*
* - Modules are missing, the Loader is not available but the Get
* utility is and boostrap is not false -- The loader is bootstrapped
* before doing the following....
*
* - Modules are missing and the Loader is available -- The loader
* expands the dependency tree and fetches missing modules. When
* the loader is finshed the callback supplied to use is executed
* asynchronously.
*
* @param modules* {string} 1-n modules to bind (uses arguments array).
* @param *callback {function} callback function executed when
* the instance has the required functionality. If included, it
* must be the last parameter.
* <code>
* // loads and attaches drag and drop and its dependencies
* YUI().use('dd', function(Y) {});
* // attaches all modules that are available on the page
* YUI().use('*', function(Y) {});
* // intrinsic YUI gallery support (since 3.1.0)
* YUI().use('gallery-yql', function(Y) {});
* // intrinsic YUI 2in3 support (since 3.1.0)
* YUI().use('yui2-datatable', function(Y) {});.
* </code>
*
* @return {YUI} the YUI instance.
*/
use: function() {
var args = SLICE.call(arguments, 0),
callback = args[args.length - 1],
Y = this,
key;
// The last argument supplied to use can be a load complete callback
if (Y.Lang.isFunction(callback)) {
args.pop();
} else {
callback = null;
}
if (Y._loading) {
Y._useQueue = Y._useQueue || new Y.Queue();
Y._useQueue.add([args, callback]);
} else {
key = args.join();
if (Y.config.cacheUse && Y.Env.serviced[key]) {
Y._notify(callback, ALREADY_DONE, args);
} else {
Y._use(args, function(Y, response) {
if (Y.config.cacheUse) {
Y.Env.serviced[key] = true;
}
Y._notify(callback, response, args);
});
}
}
return Y;
},
_notify: function(callback, response, args) {
if (!response.success && this.config.loadErrorFn) {
this.config.loadErrorFn.call(this, this, callback, response, args);
} else if (callback) {
try {
callback(this, response);
} catch (e) {
this.error('use callback error', e, args);
}
}
},
_use: function(args, callback) {
if (!this.Array) {
this._attach(['yui-base']);
}
var len, loader, handleBoot,
Y = this,
G_ENV = YUI.Env,
mods = G_ENV.mods,
Env = Y.Env,
used = Env._used,
queue = G_ENV._loaderQueue,
firstArg = args[0],
YArray = Y.Array,
config = Y.config,
boot = config.bootstrap,
missing = [],
r = [],
ret = true,
fetchCSS = config.fetchCSS,
process = function(names, skip) {
if (!names.length) {
return;
}
YArray.each(names, function(name) {
// add this module to full list of things to attach
if (!skip) {
r.push(name);
}
// only attach a module once
if (used[name]) {
return;
}
var m = mods[name], req, use;
if (m) {
used[name] = true;
req = m.details.requires;
use = m.details.use;
} else {
// CSS files don't register themselves, see if it has
// been loaded
if (!G_ENV._loaded[VERSION][name]) {
missing.push(name);
} else {
used[name] = true; // probably css
}
}
// make sure requirements are attached
if (req && req.length) {
process(req);
}
// make sure we grab the submodule dependencies too
if (use && use.length) {
process(use, 1);
}
});
},
handleLoader = function(fromLoader) {
var response = fromLoader || {
success: true,
msg: 'not dynamic'
},
redo, origMissing,
ret = true,
data = response.data;
Y._loading = false;
if (data) {
origMissing = missing;
missing = [];
r = [];
process(data);
redo = missing.length;
if (redo) {
if (missing.sort().join() ==
origMissing.sort().join()) {
redo = false;
}
}
}
if (redo && data) {
Y._loading = false;
Y._use(args, function() {
if (Y._attach(data)) {
Y._notify(callback, response, data);
}
});
} else {
if (data) {
ret = Y._attach(data);
}
if (ret) {
Y._notify(callback, response, args);
}
}
if (Y._useQueue && Y._useQueue.size() && !Y._loading) {
Y._use.apply(Y, Y._useQueue.next());
}
};
// YUI().use('*'); // bind everything available
if (firstArg === '*') {
ret = Y._attach(Y.Object.keys(mods));
if (ret) {
handleLoader();
}
return Y;
}
// use loader to expand dependencies and sort the
// requirements if it is available.
if (boot && Y.Loader && args.length) {
loader = getLoader(Y);
loader.require(args);
loader.ignoreRegistered = true;
loader.calculate(null, (fetchCSS) ? null : 'js');
args = loader.sorted;
}
// process each requirement and any additional requirements
// the module metadata specifies
process(args);
len = missing.length;
if (len) {
missing = Y.Object.keys(YArray.hash(missing));
len = missing.length;
}
// dynamic load
if (boot && len && Y.Loader) {
Y._loading = true;
loader = getLoader(Y);
loader.onEnd = handleLoader;
loader.context = Y;
loader.data = args;
loader.ignoreRegistered = false;
loader.require(args);
loader.insert(null, (fetchCSS) ? null : 'js');
// loader.partial(missing, (fetchCSS) ? null : 'js');
} else if (len && Y.config.use_rls) {
// server side loader service
Y.Get.script(Y._rls(args), {
onEnd: function(o) {
handleLoader(o);
},
data: args
});
} else if (boot && len && Y.Get && !Env.bootstrapped) {
Y._loading = true;
handleBoot = function() {
Y._loading = false;
queue.running = false;
Env.bootstrapped = true;
if (Y._attach(['loader'])) {
Y._use(args, callback);
}
};
if (G_ENV._bootstrapping) {
queue.add(handleBoot);
} else {
G_ENV._bootstrapping = true;
Y.Get.script(config.base + config.loaderPath, {
onEnd: handleBoot
});
}
} else {
ret = Y._attach(args);
if (ret) {
handleLoader();
}
}
return Y;
},
/**
* Returns the namespace specified and creates it if it doesn't exist
* <pre>
* YUI.namespace("property.package");
* YUI.namespace("YAHOO.property.package");
* </pre>
* Either of the above would create YUI.property, then
* YUI.property.package (YAHOO is scrubbed out, this is
* to remain compatible with YUI2)
*
* Be careful when naming packages. Reserved words may work in some browsers
* and not others. For instance, the following will fail in Safari:
* <pre>
* YUI.namespace("really.long.nested.namespace");
* </pre>
* This fails because "long" is a future reserved word in ECMAScript
*
* @method namespace
* @param {string*} arguments 1-n namespaces to create.
* @return {object} A reference to the last namespace object created.
*/
namespace: function() {
var a = arguments, o = this, i = 0, j, d, arg;
for (; i < a.length; i++) {
// d = ('' + a[i]).split('.');
arg = a[i];
if (arg.indexOf(PERIOD)) {
d = arg.split(PERIOD);
for (j = (d[0] == 'YAHOO') ? 1 : 0; j < d.length; j++) {
o[d[j]] = o[d[j]] || {};
o = o[d[j]];
}
} else {
o[arg] = o[arg] || {};
}
}
return o;
},
// this is replaced if the log module is included
log: NOOP,
message: NOOP,
/**
* Report an error. The reporting mechanism is controled by
* the 'throwFail' configuration attribute. If throwFail is
* not specified, the message is written to the Logger, otherwise
* a JS error is thrown
* @method error
* @param msg {string} the error message.
* @param e {Error|string} Optional JS error that was caught, or an error string.
* @param data Optional additional info
* and throwFail is specified, this error will be re-thrown.
* @return {YUI} this YUI instance.
*/
error: function(msg, e, data) {
var Y = this, ret;
if (Y.config.errorFn) {
ret = Y.config.errorFn.apply(Y, arguments);
}
if (Y.config.throwFail && !ret) {
throw (e || new Error(msg));
} else {
Y.message(msg, 'error'); // don't scrub this one
}
return Y;
},
/**
* Generate an id that is unique among all YUI instances
* @method guid
* @param pre {string} optional guid prefix.
* @return {string} the guid.
*/
guid: function(pre) {
var id = this.Env._guidp + (++this.Env._uidx);
return (pre) ? (pre + id) : id;
},
/**
* Returns a guid associated with an object. If the object
* does not have one, a new one is created unless readOnly
* is specified.
* @method stamp
* @param o The object to stamp.
* @param readOnly {boolean} if true, a valid guid will only
* be returned if the object has one assigned to it.
* @return {string} The object's guid or null.
*/
stamp: function(o, readOnly) {
var uid;
if (!o) {
return o;
}
// IE generates its own unique ID for dom nodes
// The uniqueID property of a document node returns a new ID
if (o.uniqueID && o.nodeType && o.nodeType !== 9) {
uid = o.uniqueID;
} else {
uid = (typeof o === 'string') ? o : o._yuid;
}
if (!uid) {
uid = this.guid();
if (!readOnly) {
try {
o._yuid = uid;
} catch (e) {
uid = null;
}
}
}
return uid;
},
/**
* Destroys the YUI instance
* @method destroy
* @since 3.3.0
*/
destroy: function() {
var Y = this;
if (Y.Event) {
Y.Event._unload();
}
delete instances[Y.id];
delete Y.Env;
delete Y.config;
}
/**
* instanceof check for objects that works around
* memory leak in IE when the item tested is
* window/document
* @method instanceOf
* @since 3.3.0
*/
};
YUI.prototype = proto;
// inheritance utilities are not available yet
for (prop in proto) {
if (proto.hasOwnProperty(prop)) {
YUI[prop] = proto[prop];
}
}
// set up the environment
YUI._init();
if (hasWin) {
// add a window load event at load time so we can capture
// the case where it fires before dynamic loading is
// complete.
add(window, 'load', handleLoad);
} else {
handleLoad();
}
YUI.Env.add = add;
YUI.Env.remove = remove;
/*global exports*/
// Support the CommonJS method for exporting our single global
if (typeof exports == 'object') {
exports.YUI = YUI;
}
}());
/**
* The config object contains all of the configuration options for
* the YUI instance. This object is supplied by the implementer
* when instantiating a YUI instance. Some properties have default
* values if they are not supplied by the implementer. This should
* not be updated directly because some values are cached. Use
* applyConfig() to update the config object on a YUI instance that
* has already been configured.
*
* @class config
* @static
*/
/**
* Allows the YUI seed file to fetch the loader component and library
* metadata to dynamically load additional dependencies.
*
* @property bootstrap
* @type boolean
* @default true
*/
/**
* Log to the browser console if debug is on and the browser has a
* supported console.
*
* @property useBrowserConsole
* @type boolean
* @default true
*/
/**
* A hash of log sources that should be logged. If specified, only
* log messages from these sources will be logged.
*
* @property logInclude
* @type object
*/
/**
* A hash of log sources that should be not be logged. If specified,
* all sources are logged if not on this list.
*
* @property logExclude
* @type object
*/
/**
* Set to true if the yui seed file was dynamically loaded in
* order to bootstrap components relying on the window load event
* and the 'domready' custom event.
*
* @property injected
* @type boolean
* @default false
*/
/**
* If throwFail is set, Y.error will generate or re-throw a JS Error.
* Otherwise the failure is logged.
*
* @property throwFail
* @type boolean
* @default true
*/
/**
* The window/frame that this instance should operate in.
*
* @property win
* @type Window
* @default the window hosting YUI
*/
/**
* The document associated with the 'win' configuration.
*
* @property doc
* @type Document
* @default the document hosting YUI
*/
/**
* A list of modules that defines the YUI core (overrides the default).
*
* @property core
* @type string[]
*/
/**
* A list of languages in order of preference. This list is matched against
* the list of available languages in modules that the YUI instance uses to
* determine the best possible localization of language sensitive modules.
* Languages are represented using BCP 47 language tags, such as "en-GB" for
* English as used in the United Kingdom, or "zh-Hans-CN" for simplified
* Chinese as used in China. The list can be provided as a comma-separated
* list or as an array.
*
* @property lang
* @type string|string[]
*/
/**
* The default date format
* @property dateFormat
* @type string
* @deprecated use configuration in DataType.Date.format() instead.
*/
/**
* The default locale
* @property locale
* @type string
* @deprecated use config.lang instead.
*/
/**
* The default interval when polling in milliseconds.
* @property pollInterval
* @type int
* @default 20
*/
/**
* The number of dynamic nodes to insert by default before
* automatically removing them. This applies to script nodes
* because remove the node will not make the evaluated script
* unavailable. Dynamic CSS is not auto purged, because removing
* a linked style sheet will also remove the style definitions.
* @property purgethreshold
* @type int
* @default 20
*/
/**
* The default interval when polling in milliseconds.
* @property windowResizeDelay
* @type int
* @default 40
*/
/**
* Base directory for dynamic loading
* @property base
* @type string
*/
/*
* The secure base dir (not implemented)
* For dynamic loading.
* @property secureBase
* @type string
*/
/**
* The YUI combo service base dir. Ex: http://yui.yahooapis.com/combo?
* For dynamic loading.
* @property comboBase
* @type string
*/
/**
* The root path to prepend to module path for the combo service.
* Ex: 3.0.0b1/build/
* For dynamic loading.
* @property root
* @type string
*/
/**
* A filter to apply to result urls. This filter will modify the default
* path for all modules. The default path for the YUI library is the
* minified version of the files (e.g., event-min.js). The filter property
* can be a predefined filter or a custom filter. The valid predefined
* filters are:
* <dl>
* <dt>DEBUG</dt>
* <dd>Selects the debug versions of the library (e.g., event-debug.js).
* This option will automatically include the Logger widget</dd>
* <dt>RAW</dt>
* <dd>Selects the non-minified version of the library (e.g., event.js).</dd>
* </dl>
* You can also define a custom filter, which must be an object literal
* containing a search expression and a replace string:
* <pre>
* myFilter: {
* 'searchExp': "-min\\.js",
* 'replaceStr': "-debug.js"
* }
* </pre>
*
* For dynamic loading.
*
* @property filter
* @type string|object
*/
/**
* The 'skin' config let's you configure application level skin
* customizations. It contains the following attributes which
* can be specified to override the defaults:
*
* // The default skin, which is automatically applied if not
* // overriden by a component-specific skin definition.
* // Change this in to apply a different skin globally
* defaultSkin: 'sam',
*
* // This is combined with the loader base property to get
* // the default root directory for a skin.
* base: 'assets/skins/',
*
* // Any component-specific overrides can be specified here,
* // making it possible to load different skins for different
* // components. It is possible to load more than one skin
* // for a given component as well.
* overrides: {
* slider: ['capsule', 'round']
* }
*
* For dynamic loading.
*
* @property skin
*/
/**
* Hash of per-component filter specification. If specified for a given
* component, this overrides the filter config.
*
* For dynamic loading.
*
* @property filters
*/
/**
* Use the YUI combo service to reduce the number of http connections
* required to load your dependencies. Turning this off will
* disable combo handling for YUI and all module groups configured
* with a combo service.
*
* For dynamic loading.
*
* @property combine
* @type boolean
* @default true if 'base' is not supplied, false if it is.
*/
/**
* A list of modules that should never be dynamically loaded
*
* @property ignore
* @type string[]
*/
/**
* A list of modules that should always be loaded when required, even if already
* present on the page.
*
* @property force
* @type string[]
*/
/**
* Node or id for a node that should be used as the insertion point for new
* nodes. For dynamic loading.
*
* @property insertBefore
* @type string
*/
/**
* Object literal containing attributes to add to dynamically loaded script
* nodes.
* @property jsAttributes
* @type string
*/
/**
* Object literal containing attributes to add to dynamically loaded link
* nodes.
* @property cssAttributes
* @type string
*/
/**
* Number of milliseconds before a timeout occurs when dynamically
* loading nodes. If not set, there is no timeout.
* @property timeout
* @type int
*/
/**
* Callback for the 'CSSComplete' event. When dynamically loading YUI
* components with CSS, this property fires when the CSS is finished
* loading but script loading is still ongoing. This provides an
* opportunity to enhance the presentation of a loading page a little
* bit before the entire loading process is done.
*
* @property onCSS
* @type function
*/
/**
* A hash of module definitions to add to the list of YUI components.
* These components can then be dynamically loaded side by side with
* YUI via the use() method. This is a hash, the key is the module
* name, and the value is an object literal specifying the metdata
* for the module. * See Loader.addModule for the supported module
* metadata fields. Also @see groups, which provides a way to
* configure the base and combo spec for a set of modules.
* <code>
* modules: {
* mymod1: {
* requires: ['node'],
* fullpath: 'http://myserver.mydomain.com/mymod1/mymod1.js'
* },
* mymod2: {
* requires: ['mymod1'],
* fullpath: 'http://myserver.mydomain.com/mymod2/mymod2.js'
* }
* }
* </code>
*
* @property modules
* @type object
*/
/**
* A hash of module group definitions. It for each group you
* can specify a list of modules and the base path and
* combo spec to use when dynamically loading the modules. @see
* @see modules for the details about the modules part of the
* group definition.
* <code>
* groups: {
* yui2: {
* // specify whether or not this group has a combo service
* combine: true,
*
* // the base path for non-combo paths
* base: 'http://yui.yahooapis.com/2.8.0r4/build/',
*
* // the path to the combo service
* comboBase: 'http://yui.yahooapis.com/combo?',
*
* // a fragment to prepend to the path attribute when
* // when building combo urls
* root: '2.8.0r4/build/',
*
* // the module definitions
* modules: {
* yui2_yde: {
* path: "yahoo-dom-event/yahoo-dom-event.js"
* },
* yui2_anim: {
* path: "animation/animation.js",
* requires: ['yui2_yde']
* }
* }
* }
* }
* </code>
* @property modules
* @type object
*/
/**
* The loader 'path' attribute to the loader itself. This is combined
* with the 'base' attribute to dynamically load the loader component
* when boostrapping with the get utility alone.
*
* @property loaderPath
* @type string
* @default loader/loader-min.js
*/
/**
* Specifies whether or not YUI().use(...) will attempt to load CSS
* resources at all. Any truthy value will cause CSS dependencies
* to load when fetching script. The special value 'force' will
* cause CSS dependencies to be loaded even if no script is needed.
*
* @property fetchCSS
* @type boolean|string
* @default true
*/
/**
* The default gallery version to build gallery module urls
* @property gallery
* @type string
* @since 3.1.0
*/
/**
* The default YUI 2 version to build yui2 module urls. This is for
* intrinsic YUI 2 support via the 2in3 project. Also @see the '2in3'
* config for pulling different revisions of the wrapped YUI 2
* modules.
* @since 3.1.0
* @property yui2
* @type string
* @default 2.8.1
*/
/**
* The 2in3 project is a deployment of the various versions of YUI 2
* deployed as first-class YUI 3 modules. Eventually, the wrapper
* for the modules will change (but the underlying YUI 2 code will
* be the same), and you can select a particular version of
* the wrapper modules via this config.
* @since 3.1.0
* @property 2in3
* @type string
* @default 1
*/
/**
* Alternative console log function for use in environments without
* a supported native console. The function is executed in the
* YUI instance context.
* @since 3.1.0
* @property logFn
* @type Function
*/
/**
* A callback to execute when Y.error is called. It receives the
* error message and an javascript error object if Y.error was
* executed because a javascript error was caught. The function
* is executed in the YUI instance context.
*
* @since 3.2.0
* @property errorFn
* @type Function
*/
/**
* A callback to execute when the loader fails to load one or
* more resource. This could be because of a script load
* failure. It can also fail if a javascript module fails
* to register itself, but only when the 'requireRegistration'
* is true. If this function is defined, the use() callback will
* only be called when the loader succeeds, otherwise it always
* executes unless there was a javascript error when attaching
* a module.
*
* @since 3.3.0
* @property loadErrorFn
* @type Function
*/
/**
* When set to true, the YUI loader will expect that all modules
* it is responsible for loading will be first-class YUI modules
* that register themselves with the YUI global. If this is
* set to true, loader will fail if the module registration fails
* to happen after the script is loaded.
*
* @since 3.3.0
* @property requireRegistration
* @type boolean
* @default false
*/
/**
* Cache serviced use() requests.
* @since 3.3.0
* @property cacheUse
* @type boolean
* @default true
*/
/**
* The parameter defaults for the remote loader service.
* Requires the rls submodule. The properties that are
* supported:
* <pre>
* m: comma separated list of module requirements. This
* must be the param name even for custom implemetations.
* v: the version of YUI to load. Defaults to the version
* of YUI that is being used.
* gv: the version of the gallery to load (@see the gallery config)
* env: comma separated list of modules already on the page.
* this must be the param name even for custom implemetations.
* lang: the languages supported on the page (@see the lang config)
* '2in3v': the version of the 2in3 wrapper to use (@see the 2in3 config).
* '2v': the version of yui2 to use in the yui 2in3 wrappers
* (@see the yui2 config)
* filt: a filter def to apply to the urls (@see the filter config).
* filts: a list of custom filters to apply per module
* (@see the filters config).
* tests: this is a map of conditional module test function id keys
* with the values of 1 if the test passes, 0 if not. This must be
* the name of the querystring param in custom templates.
*</pre>
*
* @since 3.2.0
* @property rls
*/
/**
* The base path to the remote loader service
*
* @since 3.2.0
* @property rls_base
*/
/**
* The template to use for building the querystring portion
* of the remote loader service url. The default is determined
* by the rls config -- each property that has a value will be
* represented.
*
* ex: m={m}&v={v}&env={env}&lang={lang}&filt={filt}&tests={tests}
*
*
* @since 3.2.0
* @property rls_tmpl
*/
/**
* Configure the instance to use a remote loader service instead of
* the client loader.
*
* @since 3.2.0
* @property use_rls
*/
YUI.add('yui-base', function(Y) {
/*
* YUI stub
* @module yui
* @submodule yui-base
*/
/**
* The YUI module contains the components required for building the YUI
* seed file. This includes the script loading mechanism, a simple queue,
* and the core utilities for the library.
* @module yui
* @submodule yui-base
*/
/**
* Provides the language utilites and extensions used by the library
* @class Lang
* @static
*/
Y.Lang = Y.Lang || {};
var L = Y.Lang,
ARRAY = 'array',
BOOLEAN = 'boolean',
DATE = 'date',
ERROR = 'error',
FUNCTION = 'function',
NUMBER = 'number',
NULL = 'null',
OBJECT = 'object',
REGEX = 'regexp',
STRING = 'string',
STRING_PROTO = String.prototype,
TOSTRING = Object.prototype.toString,
UNDEFINED = 'undefined',
TYPES = {
'undefined' : UNDEFINED,
'number' : NUMBER,
'boolean' : BOOLEAN,
'string' : STRING,
'[object Function]' : FUNCTION,
'[object RegExp]' : REGEX,
'[object Array]' : ARRAY,
'[object Date]' : DATE,
'[object Error]' : ERROR
},
TRIMREGEX = /^\s+|\s+$/g,
EMPTYSTRING = '',
SUBREGEX = /\{\s*([^\|\}]+?)\s*(?:\|([^\}]*))?\s*\}/g;
/**
* Determines whether or not the provided item is an array.
* Returns false for array-like collections such as the
* function arguments collection or HTMLElement collection
* will return false. Use <code>Y.Array.test</code> if you
* want to test for an array-like collection.
* @method isArray
* @static
* @param o The object to test.
* @return {boolean} true if o is an array.
*/
// L.isArray = Array.isArray || function(o) {
// return L.type(o) === ARRAY;
// };
L.isArray = function(o) {
return L.type(o) === ARRAY;
};
/**
* Determines whether or not the provided item is a boolean.
* @method isBoolean
* @static
* @param o The object to test.
* @return {boolean} true if o is a boolean.
*/
L.isBoolean = function(o) {
return typeof o === BOOLEAN;
};
/**
* <p>
* Determines whether or not the provided item is a function.
* Note: Internet Explorer thinks certain functions are objects:
* </p>
*
* <pre>
* var obj = document.createElement("object");
* Y.Lang.isFunction(obj.getAttribute) // reports false in IE
*
* var input = document.createElement("input"); // append to body
* Y.Lang.isFunction(input.focus) // reports false in IE
* </pre>
*
* <p>
* You will have to implement additional tests if these functions
* matter to you.
* </p>
*
* @method isFunction
* @static
* @param o The object to test.
* @return {boolean} true if o is a function.
*/
L.isFunction = function(o) {
return L.type(o) === FUNCTION;
};
/**
* Determines whether or not the supplied item is a date instance.
* @method isDate
* @static
* @param o The object to test.
* @return {boolean} true if o is a date.
*/
L.isDate = function(o) {
// return o instanceof Date;
return L.type(o) === DATE && o.toString() !== 'Invalid Date' && !isNaN(o);
};
/**
* Determines whether or not the provided item is null.
* @method isNull
* @static
* @param o The object to test.
* @return {boolean} true if o is null.
*/
L.isNull = function(o) {
return o === null;
};
/**
* Determines whether or not the provided item is a legal number.
* @method isNumber
* @static
* @param o The object to test.
* @return {boolean} true if o is a number.
*/
L.isNumber = function(o) {
return typeof o === NUMBER && isFinite(o);
};
/**
* Determines whether or not the provided item is of type object
* or function. Note that arrays are also objects, so
* <code>Y.Lang.isObject([]) === true</code>.
* @method isObject
* @static
* @param o The object to test.
* @param failfn {boolean} fail if the input is a function.
* @return {boolean} true if o is an object.
*/
L.isObject = function(o, failfn) {
var t = typeof o;
return (o && (t === OBJECT ||
(!failfn && (t === FUNCTION || L.isFunction(o))))) || false;
};
/**
* Determines whether or not the provided item is a string.
* @method isString
* @static
* @param o The object to test.
* @return {boolean} true if o is a string.
*/
L.isString = function(o) {
return typeof o === STRING;
};
/**
* Determines whether or not the provided item is undefined.
* @method isUndefined
* @static
* @param o The object to test.
* @return {boolean} true if o is undefined.
*/
L.isUndefined = function(o) {
return typeof o === UNDEFINED;
};
/**
* Returns a string without any leading or trailing whitespace. If
* the input is not a string, the input will be returned untouched.
* @method trim
* @static
* @param s {string} the string to trim.
* @return {string} the trimmed string.
*/
L.trim = STRING_PROTO.trim ? function(s) {
return (s && s.trim) ? s.trim() : s;
} : function (s) {
try {
return s.replace(TRIMREGEX, EMPTYSTRING);
} catch (e) {
return s;
}
};
/**
* Returns a string without any leading whitespace.
* @method trimLeft
* @static
* @param s {string} the string to trim.
* @return {string} the trimmed string.
*/
L.trimLeft = STRING_PROTO.trimLeft ? function (s) {
return s.trimLeft();
} : function (s) {
return s.replace(/^\s+/, '');
};
/**
* Returns a string without any trailing whitespace.
* @method trimRight
* @static
* @param s {string} the string to trim.
* @return {string} the trimmed string.
*/
L.trimRight = STRING_PROTO.trimRight ? function (s) {
return s.trimRight();
} : function (s) {
return s.replace(/\s+$/, '');
};
/**
* A convenience method for detecting a legitimate non-null value.
* Returns false for null/undefined/NaN, true for other values,
* including 0/false/''
* @method isValue
* @static
* @param o The item to test.
* @return {boolean} true if it is not null/undefined/NaN || false.
*/
L.isValue = function(o) {
var t = L.type(o);
switch (t) {
case NUMBER:
return isFinite(o);
case NULL:
case UNDEFINED:
return false;
default:
return !!(t);
}
};
/**
* <p>
* Returns a string representing the type of the item passed in.
* </p>
*
* <p>
* Known issues:
* </p>
*
* <ul>
* <li>
* <code>typeof HTMLElementCollection</code> returns function in Safari, but
* <code>Y.type()</code> reports object, which could be a good thing --
* but it actually caused the logic in <code>Y.Lang.isObject</code> to fail.
* </li>
* </ul>
*
* @method type
* @param o the item to test.
* @return {string} the detected type.
* @static
*/
L.type = function(o) {
return TYPES[typeof o] || TYPES[TOSTRING.call(o)] || (o ? OBJECT : NULL);
};
/**
* Lightweight version of <code>Y.substitute</code>. Uses the same template
* structure as <code>Y.substitute</code>, but doesn't support recursion,
* auto-object coersion, or formats.
* @method sub
* @param {string} s String to be modified.
* @param {object} o Object containing replacement values.
* @return {string} the substitute result.
* @static
* @since 3.2.0
*/
L.sub = function(s, o) {
return ((s.replace) ? s.replace(SUBREGEX, function(match, key) {
return (!L.isUndefined(o[key])) ? o[key] : match;
}) : s);
};
/**
* Returns the current time in milliseconds.
* @method now
* @return {int} the current date
* @since 3.3.0
*/
L.now = Date.now || function () {
return new Date().getTime();
};
/**
* The YUI module contains the components required for building the YUI seed
* file. This includes the script loading mechanism, a simple queue, and the
* core utilities for the library.
* @module yui
* @submodule yui-base
*/
var Native = Array.prototype, LENGTH = 'length',
/**
* Adds the following array utilities to the YUI instance. Additional
* array helpers can be found in the collection component.
* @class Array
*/
/**
* Y.Array(o) returns an array:
* - Arrays are return unmodified unless the start position is specified.
* - "Array-like" collections (@see Array.test) are converted to arrays
* - For everything else, a new array is created with the input as the sole
* item.
* - The start position is used if the input is or is like an array to return
* a subset of the collection.
*
* @todo this will not automatically convert elements that are also
* collections such as forms and selects. Passing true as the third
* param will force a conversion.
*
* @method ()
* @static
* @param {object} o the item to arrayify.
* @param {int} startIdx if an array or array-like, this is the start index.
* @param {boolean} arraylike if true, it forces the array-like fork. This
* can be used to avoid multiple Array.test calls.
* @return {Array} the resulting array.
*/
YArray = function(o, startIdx, arraylike) {
var t = (arraylike) ? 2 : YArray.test(o),
l, a, start = startIdx || 0;
if (t) {
// IE errors when trying to slice HTMLElement collections
try {
return Native.slice.call(o, start);
} catch (e) {
a = [];
l = o.length;
for (; start < l; start++) {
a.push(o[start]);
}
return a;
}
} else {
return [o];
}
};
Y.Array = YArray;
/**
* Evaluates the input to determine if it is an array, array-like, or
* something else. This is used to handle the arguments collection
* available within functions, and HTMLElement collections
*
* @method test
* @static
*
* @todo current implementation (intenionally) will not implicitly
* handle html elements that are array-like (forms, selects, etc).
*
* @param {object} o the object to test.
*
* @return {int} a number indicating the results:
* 0: Not an array or an array-like collection
* 1: A real array.
* 2: array-like collection.
*/
YArray.test = function(o) {
var r = 0;
if (Y.Lang.isObject(o)) {
if (Y.Lang.isArray(o)) {
r = 1;
} else {
try {
// indexed, but no tagName (element) or alert (window),
// or functions without apply/call (Safari
// HTMLElementCollection bug).
if ((LENGTH in o) && !o.tagName && !o.alert && !o.apply) {
r = 2;
}
} catch (e) {}
}
}
return r;
};
/**
* Executes the supplied function on each item in the array.
* @method each
* @param {Array} a the array to iterate.
* @param {Function} f the function to execute on each item. The
* function receives three arguments: the value, the index, the full array.
* @param {object} o Optional context object.
* @static
* @return {YUI} the YUI instance.
*/
YArray.each = (Native.forEach) ?
function(a, f, o) {
Native.forEach.call(a || [], f, o || Y);
return Y;
} :
function(a, f, o) {
var l = (a && a.length) || 0, i;
for (i = 0; i < l; i = i + 1) {
f.call(o || Y, a[i], i, a);
}
return Y;
};
/**
* Returns an object using the first array as keys, and
* the second as values. If the second array is not
* provided the value is set to true for each.
* @method hash
* @static
* @param {Array} k keyset.
* @param {Array} v optional valueset.
* @return {object} the hash.
*/
YArray.hash = function(k, v) {
var o = {}, l = k.length, vl = v && v.length, i;
for (i = 0; i < l; i = i + 1) {
o[k[i]] = (vl && vl > i) ? v[i] : true;
}
return o;
};
/**
* Returns the index of the first item in the array
* that contains the specified value, -1 if the
* value isn't found.
* @method indexOf
* @static
* @param {Array} a the array to search.
* @param {any} val the value to search for.
* @return {int} the index of the item that contains the value or -1.
*/
YArray.indexOf = (Native.indexOf) ?
function(a, val) {
return Native.indexOf.call(a, val);
} :
function(a, val) {
for (var i = 0; i < a.length; i = i + 1) {
if (a[i] === val) {
return i;
}
}
return -1;
};
/**
* Numeric sort convenience function.
* Y.ArrayAssert.itemsAreEqual([1,2,3], [3,1,2].sort(Y.Array.numericSort));
* @method numericSort
* @static
* @param {number} a a number.
* @param {number} b a number.
*/
YArray.numericSort = function(a, b) {
return (a - b);
};
/**
* Executes the supplied function on each item in the array.
* Returning true from the processing function will stop the
* processing of the remaining items.
* @method some
* @param {Array} a the array to iterate.
* @param {Function} f the function to execute on each item. The function
* receives three arguments: the value, the index, the full array.
* @param {object} o Optional context object.
* @static
* @return {boolean} true if the function returns true on
* any of the items in the array.
*/
YArray.some = (Native.some) ?
function(a, f, o) {
return Native.some.call(a, f, o);
} :
function(a, f, o) {
var l = a.length, i;
for (i = 0; i < l; i = i + 1) {
if (f.call(o, a[i], i, a)) {
return true;
}
}
return false;
};
/**
* The YUI module contains the components required for building the YUI
* seed file. This includes the script loading mechanism, a simple queue,
* and the core utilities for the library.
* @module yui
* @submodule yui-base
*/
/**
* A simple FIFO queue. Items are added to the Queue with add(1..n items) and
* removed using next().
*
* @class Queue
* @constructor
* @param {MIXED} item* 0..n items to seed the queue.
*/
function Queue() {
this._init();
this.add.apply(this, arguments);
}
Queue.prototype = {
/**
* Initialize the queue
*
* @method _init
* @protected
*/
_init: function() {
/**
* The collection of enqueued items
*
* @property _q
* @type Array
* @protected
*/
this._q = [];
},
/**
* Get the next item in the queue. FIFO support
*
* @method next
* @return {MIXED} the next item in the queue.
*/
next: function() {
return this._q.shift();
},
/**
* Get the last in the queue. LIFO support.
*
* @method last
* @return {MIXED} the last item in the queue.
*/
last: function() {
return this._q.pop();
},
/**
* Add 0..n items to the end of the queue.
*
* @method add
* @param {MIXED} item* 0..n items.
* @return {object} this queue.
*/
add: function() {
this._q.push.apply(this._q, arguments);
return this;
},
/**
* Returns the current number of queued items.
*
* @method size
* @return {Number} The size.
*/
size: function() {
return this._q.length;
}
};
Y.Queue = Queue;
YUI.Env._loaderQueue = YUI.Env._loaderQueue || new Queue();
/**
* The YUI module contains the components required for building the YUI
* seed file. This includes the script loading mechanism, a simple queue,
* and the core utilities for the library.
* @module yui
* @submodule yui-base
*/
var CACHED_DELIMITER = '__',
/*
* IE will not enumerate native functions in a derived object even if the
* function was overridden. This is a workaround for specific functions
* we care about on the Object prototype.
* @property _iefix
* @for YUI
* @param {Function} r the object to receive the augmentation
* @param {Function} s the object that supplies the properties to augment
* @private
*/
_iefix = function(r, s) {
var fn = s.toString;
if (Y.Lang.isFunction(fn) && fn != Object.prototype.toString) {
r.toString = fn;
}
};
/**
* Returns a new object containing all of the properties of
* all the supplied objects. The properties from later objects
* will overwrite those in earlier objects. Passing in a
* single object will create a shallow copy of it. For a deep
* copy, use clone.
* @method merge
* @for YUI
* @param arguments {Object*} the objects to merge.
* @return {object} the new merged object.
*/
Y.merge = function() {
var a = arguments, o = {}, i, l = a.length;
for (i = 0; i < l; i = i + 1) {
Y.mix(o, a[i], true);
}
return o;
};
/**
* Applies the supplier's properties to the receiver. By default
* all prototype and static propertes on the supplier are applied
* to the corresponding spot on the receiver. By default all
* properties are applied, and a property that is already on the
* reciever will not be overwritten. The default behavior can
* be modified by supplying the appropriate parameters.
*
* @todo add constants for the modes
*
* @method mix
* @param {Function} r the object to receive the augmentation.
* @param {Function} s the object that supplies the properties to augment.
* @param ov {boolean} if true, properties already on the receiver
* will be overwritten if found on the supplier.
* @param wl {string[]} a whitelist. If supplied, only properties in
* this list will be applied to the receiver.
* @param {int} mode what should be copies, and to where
* default(0): object to object
* 1: prototype to prototype (old augment)
* 2: prototype to prototype and object props (new augment)
* 3: prototype to object
* 4: object to prototype.
* @param merge {boolean/int} merge objects instead of overwriting/ignoring.
* A value of 2 will skip array merge
* Used by Y.aggregate.
* @return {object} the augmented object.
*/
Y.mix = function(r, s, ov, wl, mode, merge) {
if (!s || !r) {
return r || Y;
}
if (mode) {
switch (mode) {
case 1: // proto to proto
return Y.mix(r.prototype, s.prototype, ov, wl, 0, merge);
case 2: // object to object and proto to proto
Y.mix(r.prototype, s.prototype, ov, wl, 0, merge);
break; // pass through
case 3: // proto to static
return Y.mix(r, s.prototype, ov, wl, 0, merge);
case 4: // static to proto
return Y.mix(r.prototype, s, ov, wl, 0, merge);
default: // object to object is what happens below
}
}
// Maybe don't even need this wl && wl.length check anymore??
var i, l, p, type;
if (wl && wl.length) {
for (i = 0, l = wl.length; i < l; ++i) {
p = wl[i];
type = Y.Lang.type(r[p]);
if (s.hasOwnProperty(p)) {
if (merge && type == 'object') {
Y.mix(r[p], s[p]);
} else if (ov || !(p in r)) {
r[p] = s[p];
}
}
}
} else {
for (i in s) {
// if (s.hasOwnProperty(i) && !(i in FROZEN)) {
if (s.hasOwnProperty(i)) {
// check white list if it was supplied
// if the receiver has this property, it is an object,
// and merge is specified, merge the two objects.
if (merge && Y.Lang.isObject(r[i], true)) {
Y.mix(r[i], s[i], ov, wl, 0, true); // recursive
// otherwise apply the property only if overwrite
// is specified or the receiver doesn't have one.
} else if (ov || !(i in r)) {
r[i] = s[i];
}
// if merge is specified and the receiver is an array,
// append the array item
// } else if (arr) {
// r.push(s[i]);
// }
}
}
if (Y.UA.ie) {
_iefix(r, s);
}
}
return r;
};
/**
* Returns a wrapper for a function which caches the
* return value of that function, keyed off of the combined
* argument values.
* @method cached
* @param source {function} the function to memoize.
* @param cache an optional cache seed.
* @param refetch if supplied, this value is tested against the cached
* value. If the values are equal, the wrapped function is executed again.
* @return {Function} the wrapped function.
*/
Y.cached = function(source, cache, refetch) {
cache = cache || {};
return function(arg1) {
var k = (arguments.length > 1) ?
Array.prototype.join.call(arguments, CACHED_DELIMITER) : arg1;
if (!(k in cache) || (refetch && cache[k] == refetch)) {
cache[k] = source.apply(source, arguments);
}
return cache[k];
};
};
/**
* The YUI module contains the components required for building the YUI
* seed file. This includes the script loading mechanism, a simple queue,
* and the core utilities for the library.
* @module yui
* @submodule yui-base
*/
/**
* Adds the following Object utilities to the YUI instance
* @class Object
*/
/**
* Y.Object(o) returns a new object based upon the supplied object.
* @method ()
* @static
* @param o the supplier object.
* @return {Object} the new object.
*/
var F = function() {},
// O = Object.create || function(o) {
// F.prototype = o;
// return new F();
// },
O = function(o) {
F.prototype = o;
return new F();
},
owns = function(o, k) {
return o && o.hasOwnProperty && o.hasOwnProperty(k);
// return Object.prototype.hasOwnProperty.call(o, k);
},
UNDEF,
/**
* Extracts the keys, values, or size from an object
*
* @method _extract
* @param o the object.
* @param what what to extract (0: keys, 1: values, 2: size).
* @return {boolean|Array} the extracted info.
* @static
* @private
*/
_extract = function(o, what) {
var count = (what === 2), out = (count) ? 0 : [], i;
for (i in o) {
if (owns(o, i)) {
if (count) {
out++;
} else {
out.push((what) ? o[i] : i);
}
}
}
return out;
};
Y.Object = O;
/**
* Returns an array containing the object's keys
* @method keys
* @static
* @param o an object.
* @return {string[]} the keys.
*/
// O.keys = Object.keys || function(o) {
// return _extract(o);
// };
O.keys = function(o) {
return _extract(o);
};
/**
* Returns an array containing the object's values
* @method values
* @static
* @param o an object.
* @return {Array} the values.
*/
// O.values = Object.values || function(o) {
// return _extract(o, 1);
// };
O.values = function(o) {
return _extract(o, 1);
};
/**
* Returns the size of an object
* @method size
* @static
* @param o an object.
* @return {int} the size.
*/
O.size = Object.size || function(o) {
return _extract(o, 2);
};
/**
* Returns true if the object contains a given key
* @method hasKey
* @static
* @param o an object.
* @param k the key to query.
* @return {boolean} true if the object contains the key.
*/
O.hasKey = owns;
/**
* Returns true if the object contains a given value
* @method hasValue
* @static
* @param o an object.
* @param v the value to query.
* @return {boolean} true if the object contains the value.
*/
O.hasValue = function(o, v) {
return (Y.Array.indexOf(O.values(o), v) > -1);
};
/**
* Determines whether or not the property was added
* to the object instance. Returns false if the property is not present
* in the object, or was inherited from the prototype.
*
* @method owns
* @static
* @param o {any} The object being testing.
* @param p {string} the property to look for.
* @return {boolean} true if the object has the property on the instance.
*/
O.owns = owns;
/**
* Executes a function on each item. The function
* receives the value, the key, and the object
* as parameters (in that order).
* @method each
* @static
* @param o the object to iterate.
* @param f {Function} the function to execute on each item. The function
* receives three arguments: the value, the the key, the full object.
* @param c the execution context.
* @param proto {boolean} include proto.
* @return {YUI} the YUI instance.
*/
O.each = function(o, f, c, proto) {
var s = c || Y, i;
for (i in o) {
if (proto || owns(o, i)) {
f.call(s, o[i], i, o);
}
}
return Y;
};
/**
* Executes a function on each item, but halts if the
* function returns true. The function
* receives the value, the key, and the object
* as paramters (in that order).
* @method some
* @static
* @param o the object to iterate.
* @param f {Function} the function to execute on each item. The function
* receives three arguments: the value, the the key, the full object.
* @param c the execution context.
* @param proto {boolean} include proto.
* @return {boolean} true if any execution of the function returns true,
* false otherwise.
*/
O.some = function(o, f, c, proto) {
var s = c || Y, i;
for (i in o) {
if (proto || owns(o, i)) {
if (f.call(s, o[i], i, o)) {
return true;
}
}
}
return false;
};
/**
* Retrieves the sub value at the provided path,
* from the value object provided.
*
* @method getValue
* @static
* @param o The object from which to extract the property value.
* @param path {Array} A path array, specifying the object traversal path
* from which to obtain the sub value.
* @return {Any} The value stored in the path, undefined if not found,
* undefined if the source is not an object. Returns the source object
* if an empty path is provided.
*/
O.getValue = function(o, path) {
if (!Y.Lang.isObject(o)) {
return UNDEF;
}
var i,
p = Y.Array(path),
l = p.length;
for (i = 0; o !== UNDEF && i < l; i++) {
o = o[p[i]];
}
return o;
};
/**
* Sets the sub-attribute value at the provided path on the
* value object. Returns the modified value object, or
* undefined if the path is invalid.
*
* @method setValue
* @static
* @param o The object on which to set the sub value.
* @param path {Array} A path array, specifying the object traversal path
* at which to set the sub value.
* @param val {Any} The new value for the sub-attribute.
* @return {Object} The modified object, with the new sub value set, or
* undefined, if the path was invalid.
*/
O.setValue = function(o, path, val) {
var i,
p = Y.Array(path),
leafIdx = p.length - 1,
ref = o;
if (leafIdx >= 0) {
for (i = 0; ref !== UNDEF && i < leafIdx; i++) {
ref = ref[p[i]];
}
if (ref !== UNDEF) {
ref[p[i]] = val;
} else {
return UNDEF;
}
}
return o;
};
/**
* Returns true if the object has no properties of its own
* @method isEmpty
* @static
* @return {boolean} true if the object is empty.
* @since 3.2.0
*/
O.isEmpty = function(o) {
for (var i in o) {
if (owns(o, i)) {
return false;
}
}
return true;
};
/**
* The YUI module contains the components required for building the YUI seed
* file. This includes the script loading mechanism, a simple queue, and the
* core utilities for the library.
* @module yui
* @submodule yui-base
*/
/**
* YUI user agent detection.
* Do not fork for a browser if it can be avoided. Use feature detection when
* you can. Use the user agent as a last resort. UA stores a version
* number for the browser engine, 0 otherwise. This value may or may not map
* to the version number of the browser using the engine. The value is
* presented as a float so that it can easily be used for boolean evaluation
* as well as for looking for a particular range of versions. Because of this,
* some of the granularity of the version info may be lost (e.g., Gecko 1.8.0.9
* reports 1.8).
* @class UA
* @static
*/
/**
* Static method for parsing the UA string. Defaults to assigning it's value to Y.UA
* @static
* @method Env.parseUA
* @param {String} subUA Parse this UA string instead of navigator.userAgent
* @returns {Object} The Y.UA object
*/
YUI.Env.parseUA = function(subUA) {
var numberify = function(s) {
var c = 0;
return parseFloat(s.replace(/\./g, function() {
return (c++ == 1) ? '' : '.';
}));
},
win = Y.config.win,
nav = win && win.navigator,
o = {
/**
* Internet Explorer version number or 0. Example: 6
* @property ie
* @type float
* @static
*/
ie: 0,
/**
* Opera version number or 0. Example: 9.2
* @property opera
* @type float
* @static
*/
opera: 0,
/**
* Gecko engine revision number. Will evaluate to 1 if Gecko
* is detected but the revision could not be found. Other browsers
* will be 0. Example: 1.8
* <pre>
* Firefox 1.0.0.4: 1.7.8 <-- Reports 1.7
* Firefox 1.5.0.9: 1.8.0.9 <-- 1.8
* Firefox 2.0.0.3: 1.8.1.3 <-- 1.81
* Firefox 3.0 <-- 1.9
* Firefox 3.5 <-- 1.91
* </pre>
* @property gecko
* @type float
* @static
*/
gecko: 0,
/**
* AppleWebKit version. KHTML browsers that are not WebKit browsers
* will evaluate to 1, other browsers 0. Example: 418.9
* <pre>
* Safari 1.3.2 (312.6): 312.8.1 <-- Reports 312.8 -- currently the
* latest available for Mac OSX 10.3.
* Safari 2.0.2: 416 <-- hasOwnProperty introduced
* Safari 2.0.4: 418 <-- preventDefault fixed
* Safari 2.0.4 (419.3): 418.9.1 <-- One version of Safari may run
* different versions of webkit
* Safari 2.0.4 (419.3): 419 <-- Tiger installations that have been
* updated, but not updated
* to the latest patch.
* Webkit 212 nightly: 522+ <-- Safari 3.0 precursor (with native
* SVG and many major issues fixed).
* Safari 3.0.4 (523.12) 523.12 <-- First Tiger release - automatic
* update from 2.x via the 10.4.11 OS patch.
* Webkit nightly 1/2008:525+ <-- Supports DOMContentLoaded event.
* yahoo.com user agent hack removed.
* </pre>
* http://en.wikipedia.org/wiki/Safari_version_history
* @property webkit
* @type float
* @static
*/
webkit: 0,
/**
* Chrome will be detected as webkit, but this property will also
* be populated with the Chrome version number
* @property chrome
* @type float
* @static
*/
chrome: 0,
/**
* The mobile property will be set to a string containing any relevant
* user agent information when a modern mobile browser is detected.
* Currently limited to Safari on the iPhone/iPod Touch, Nokia N-series
* devices with the WebKit-based browser, and Opera Mini.
* @property mobile
* @type string
* @static
*/
mobile: null,
/**
* Adobe AIR version number or 0. Only populated if webkit is detected.
* Example: 1.0
* @property air
* @type float
*/
air: 0,
/**
* Detects Apple iPad's OS version
* @property ipad
* @type float
* @static
*/
ipad: 0,
/**
* Detects Apple iPhone's OS version
* @property iphone
* @type float
* @static
*/
iphone: 0,
/**
* Detects Apples iPod's OS version
* @property ipod
* @type float
* @static
*/
ipod: 0,
/**
* General truthy check for iPad, iPhone or iPod
* @property ios
* @type float
* @static
*/
ios: null,
/**
* Detects Googles Android OS version
* @property android
* @type float
* @static
*/
android: 0,
/**
* Detects Palms WebOS version
* @property webos
* @type float
* @static
*/
webos: 0,
/**
* Google Caja version number or 0.
* @property caja
* @type float
*/
caja: nav && nav.cajaVersion,
/**
* Set to true if the page appears to be in SSL
* @property secure
* @type boolean
* @static
*/
secure: false,
/**
* The operating system. Currently only detecting windows or macintosh
* @property os
* @type string
* @static
*/
os: null
},
ua = subUA || nav && nav.userAgent,
loc = win && win.location,
href = loc && loc.href,
m;
o.secure = href && (href.toLowerCase().indexOf('https') === 0);
if (ua) {
if ((/windows|win32/i).test(ua)) {
o.os = 'windows';
} else if ((/macintosh/i).test(ua)) {
o.os = 'macintosh';
} else if ((/rhino/i).test(ua)) {
o.os = 'rhino';
}
// Modern KHTML browsers should qualify as Safari X-Grade
if ((/KHTML/).test(ua)) {
o.webkit = 1;
}
// Modern WebKit browsers are at least X-Grade
m = ua.match(/AppleWebKit\/([^\s]*)/);
if (m && m[1]) {
o.webkit = numberify(m[1]);
// Mobile browser check
if (/ Mobile\//.test(ua)) {
o.mobile = 'Apple'; // iPhone or iPod Touch
m = ua.match(/OS ([^\s]*)/);
if (m && m[1]) {
m = numberify(m[1].replace('_', '.'));
}
o.ios = m;
o.ipad = o.ipod = o.iphone = 0;
m = ua.match(/iPad|iPod|iPhone/);
if (m && m[0]) {
o[m[0].toLowerCase()] = o.ios;
}
} else {
m = ua.match(/NokiaN[^\/]*|Android \d\.\d|webOS\/\d\.\d/);
if (m) {
// Nokia N-series, Android, webOS, ex: NokiaN95
o.mobile = m[0];
}
if (/webOS/.test(ua)) {
o.mobile = 'WebOS';
m = ua.match(/webOS\/([^\s]*);/);
if (m && m[1]) {
o.webos = numberify(m[1]);
}
}
if (/ Android/.test(ua)) {
o.mobile = 'Android';
m = ua.match(/Android ([^\s]*);/);
if (m && m[1]) {
o.android = numberify(m[1]);
}
}
}
m = ua.match(/Chrome\/([^\s]*)/);
if (m && m[1]) {
o.chrome = numberify(m[1]); // Chrome
} else {
m = ua.match(/AdobeAIR\/([^\s]*)/);
if (m) {
o.air = m[0]; // Adobe AIR 1.0 or better
}
}
}
if (!o.webkit) { // not webkit
// @todo check Opera/8.01 (J2ME/MIDP; Opera Mini/2.0.4509/1316; fi; U; ssr)
m = ua.match(/Opera[\s\/]([^\s]*)/);
if (m && m[1]) {
o.opera = numberify(m[1]);
m = ua.match(/Opera Mini[^;]*/);
if (m) {
o.mobile = m[0]; // ex: Opera Mini/2.0.4509/1316
}
} else { // not opera or webkit
m = ua.match(/MSIE\s([^;]*)/);
if (m && m[1]) {
o.ie = numberify(m[1]);
} else { // not opera, webkit, or ie
m = ua.match(/Gecko\/([^\s]*)/);
if (m) {
o.gecko = 1; // Gecko detected, look for revision
m = ua.match(/rv:([^\s\)]*)/);
if (m && m[1]) {
o.gecko = numberify(m[1]);
}
}
}
}
}
}
YUI.Env.UA = o;
return o;
};
Y.UA = YUI.Env.UA || YUI.Env.parseUA();
}, '3.3.0' );
YUI.add('get', function(Y) {
/**
* Provides a mechanism to fetch remote resources and
* insert them into a document.
* @module yui
* @submodule get
*/
var ua = Y.UA,
L = Y.Lang,
TYPE_JS = 'text/javascript',
TYPE_CSS = 'text/css',
STYLESHEET = 'stylesheet';
/**
* Fetches and inserts one or more script or link nodes into the document
* @class Get
* @static
*/
Y.Get = function() {
/**
* hash of queues to manage multiple requests
* @property queues
* @private
*/
var _get, _purge, _track,
queues = {},
/**
* queue index used to generate transaction ids
* @property qidx
* @type int
* @private
*/
qidx = 0,
/**
* interal property used to prevent multiple simultaneous purge
* processes
* @property purging
* @type boolean
* @private
*/
purging,
/**
* Generates an HTML element, this is not appended to a document
* @method _node
* @param {string} type the type of element.
* @param {string} attr the attributes.
* @param {Window} win optional window to create the element in.
* @return {HTMLElement} the generated node.
* @private
*/
_node = function(type, attr, win) {
var w = win || Y.config.win,
d = w.document,
n = d.createElement(type),
i;
for (i in attr) {
if (attr[i] && attr.hasOwnProperty(i)) {
n.setAttribute(i, attr[i]);
}
}
return n;
},
/**
* Generates a link node
* @method _linkNode
* @param {string} url the url for the css file.
* @param {Window} win optional window to create the node in.
* @param {object} attributes optional attributes collection to apply to the
* new node.
* @return {HTMLElement} the generated node.
* @private
*/
_linkNode = function(url, win, attributes) {
var o = {
id: Y.guid(),
type: TYPE_CSS,
rel: STYLESHEET,
href: url
};
if (attributes) {
Y.mix(o, attributes);
}
return _node('link', o, win);
},
/**
* Generates a script node
* @method _scriptNode
* @param {string} url the url for the script file.
* @param {Window} win optional window to create the node in.
* @param {object} attributes optional attributes collection to apply to the
* new node.
* @return {HTMLElement} the generated node.
* @private
*/
_scriptNode = function(url, win, attributes) {
var o = {
id: Y.guid(),
type: TYPE_JS
};
if (attributes) {
Y.mix(o, attributes);
}
o.src = url;
return _node('script', o, win);
},
/**
* Returns the data payload for callback functions.
* @method _returnData
* @param {object} q the queue.
* @param {string} msg the result message.
* @param {string} result the status message from the request.
* @return {object} the state data from the request.
* @private
*/
_returnData = function(q, msg, result) {
return {
tId: q.tId,
win: q.win,
data: q.data,
nodes: q.nodes,
msg: msg,
statusText: result,
purge: function() {
_purge(this.tId);
}
};
},
/**
* The transaction is finished
* @method _end
* @param {string} id the id of the request.
* @param {string} msg the result message.
* @param {string} result the status message from the request.
* @private
*/
_end = function(id, msg, result) {
var q = queues[id], sc;
if (q && q.onEnd) {
sc = q.context || q;
q.onEnd.call(sc, _returnData(q, msg, result));
}
},
/*
* The request failed, execute fail handler with whatever
* was accomplished. There isn't a failure case at the
* moment unless you count aborted transactions
* @method _fail
* @param {string} id the id of the request
* @private
*/
_fail = function(id, msg) {
var q = queues[id], sc;
if (q.timer) {
// q.timer.cancel();
clearTimeout(q.timer);
}
// execute failure callback
if (q.onFailure) {
sc = q.context || q;
q.onFailure.call(sc, _returnData(q, msg));
}
_end(id, msg, 'failure');
},
/**
* The request is complete, so executing the requester's callback
* @method _finish
* @param {string} id the id of the request.
* @private
*/
_finish = function(id) {
var q = queues[id], msg, sc;
if (q.timer) {
// q.timer.cancel();
clearTimeout(q.timer);
}
q.finished = true;
if (q.aborted) {
msg = 'transaction ' + id + ' was aborted';
_fail(id, msg);
return;
}
// execute success callback
if (q.onSuccess) {
sc = q.context || q;
q.onSuccess.call(sc, _returnData(q));
}
_end(id, msg, 'OK');
},
/**
* Timeout detected
* @method _timeout
* @param {string} id the id of the request.
* @private
*/
_timeout = function(id) {
var q = queues[id], sc;
if (q.onTimeout) {
sc = q.context || q;
q.onTimeout.call(sc, _returnData(q));
}
_end(id, 'timeout', 'timeout');
},
/**
* Loads the next item for a given request
* @method _next
* @param {string} id the id of the request.
* @param {string} loaded the url that was just loaded, if any.
* @return {string} the result.
* @private
*/
_next = function(id, loaded) {
var q = queues[id], msg, w, d, h, n, url, s,
insertBefore;
if (q.timer) {
// q.timer.cancel();
clearTimeout(q.timer);
}
if (q.aborted) {
msg = 'transaction ' + id + ' was aborted';
_fail(id, msg);
return;
}
if (loaded) {
q.url.shift();
if (q.varName) {
q.varName.shift();
}
} else {
// This is the first pass: make sure the url is an array
q.url = (L.isString(q.url)) ? [q.url] : q.url;
if (q.varName) {
q.varName = (L.isString(q.varName)) ? [q.varName] : q.varName;
}
}
w = q.win;
d = w.document;
h = d.getElementsByTagName('head')[0];
if (q.url.length === 0) {
_finish(id);
return;
}
url = q.url[0];
// if the url is undefined, this is probably a trailing comma
// problem in IE.
if (!url) {
q.url.shift();
return _next(id);
}
if (q.timeout) {
// q.timer = L.later(q.timeout, q, _timeout, id);
q.timer = setTimeout(function() {
_timeout(id);
}, q.timeout);
}
if (q.type === 'script') {
n = _scriptNode(url, w, q.attributes);
} else {
n = _linkNode(url, w, q.attributes);
}
// track this node's load progress
_track(q.type, n, id, url, w, q.url.length);
// add the node to the queue so we can return it to the user supplied
// callback
q.nodes.push(n);
// add it to the head or insert it before 'insertBefore'. Work around
// IE bug if there is a base tag.
insertBefore = q.insertBefore ||
d.getElementsByTagName('base')[0];
if (insertBefore) {
s = _get(insertBefore, id);
if (s) {
s.parentNode.insertBefore(n, s);
}
} else {
h.appendChild(n);
}
// FireFox does not support the onload event for link nodes, so
// there is no way to make the css requests synchronous. This means
// that the css rules in multiple files could be applied out of order
// in this browser if a later request returns before an earlier one.
// Safari too.
if ((ua.webkit || ua.gecko) && q.type === 'css') {
_next(id, url);
}
},
/**
* Removes processed queues and corresponding nodes
* @method _autoPurge
* @private
*/
_autoPurge = function() {
if (purging) {
return;
}
purging = true;
var i, q;
for (i in queues) {
if (queues.hasOwnProperty(i)) {
q = queues[i];
if (q.autopurge && q.finished) {
_purge(q.tId);
delete queues[i];
}
}
}
purging = false;
},
/**
* Saves the state for the request and begins loading
* the requested urls
* @method queue
* @param {string} type the type of node to insert.
* @param {string} url the url to load.
* @param {object} opts the hash of options for this request.
* @return {object} transaction object.
* @private
*/
_queue = function(type, url, opts) {
opts = opts || {};
var id = 'q' + (qidx++), q,
thresh = opts.purgethreshold || Y.Get.PURGE_THRESH;
if (qidx % thresh === 0) {
_autoPurge();
}
queues[id] = Y.merge(opts, {
tId: id,
type: type,
url: url,
finished: false,
nodes: []
});
q = queues[id];
q.win = q.win || Y.config.win;
q.context = q.context || q;
q.autopurge = ('autopurge' in q) ? q.autopurge :
(type === 'script') ? true : false;
q.attributes = q.attributes || {};
q.attributes.charset = opts.charset || q.attributes.charset || 'utf-8';
_next(id);
return {
tId: id
};
};
/**
* Detects when a node has been loaded. In the case of
* script nodes, this does not guarantee that contained
* script is ready to use.
* @method _track
* @param {string} type the type of node to track.
* @param {HTMLElement} n the node to track.
* @param {string} id the id of the request.
* @param {string} url the url that is being loaded.
* @param {Window} win the targeted window.
* @param {int} qlength the number of remaining items in the queue,
* including this one.
* @param {Function} trackfn function to execute when finished
* the default is _next.
* @private
*/
_track = function(type, n, id, url, win, qlength, trackfn) {
var f = trackfn || _next;
// IE supports the readystatechange event for script and css nodes
// Opera only for script nodes. Opera support onload for script
// nodes, but this doesn't fire when there is a load failure.
// The onreadystatechange appears to be a better way to respond
// to both success and failure.
if (ua.ie) {
n.onreadystatechange = function() {
var rs = this.readyState;
if ('loaded' === rs || 'complete' === rs) {
n.onreadystatechange = null;
f(id, url);
}
};
// webkit prior to 3.x is no longer supported
} else if (ua.webkit) {
if (type === 'script') {
// Safari 3.x supports the load event for script nodes (DOM2)
n.addEventListener('load', function() {
f(id, url);
});
}
// FireFox and Opera support onload (but not DOM2 in FF) handlers for
// script nodes. Opera, but not FF, supports the onload event for link
// nodes.
} else {
n.onload = function() {
f(id, url);
};
n.onerror = function(e) {
_fail(id, e + ': ' + url);
};
}
};
_get = function(nId, tId) {
var q = queues[tId],
n = (L.isString(nId)) ? q.win.document.getElementById(nId) : nId;
if (!n) {
_fail(tId, 'target node not found: ' + nId);
}
return n;
};
/**
* Removes the nodes for the specified queue
* @method _purge
* @param {string} tId the transaction id.
* @private
*/
_purge = function(tId) {
var n, l, d, h, s, i, node, attr, insertBefore,
q = queues[tId];
if (q) {
n = q.nodes;
l = n.length;
d = q.win.document;
h = d.getElementsByTagName('head')[0];
insertBefore = q.insertBefore ||
d.getElementsByTagName('base')[0];
if (insertBefore) {
s = _get(insertBefore, tId);
if (s) {
h = s.parentNode;
}
}
for (i = 0; i < l; i = i + 1) {
node = n[i];
if (node.clearAttributes) {
node.clearAttributes();
} else {
for (attr in node) {
if (node.hasOwnProperty(attr)) {
delete node[attr];
}
}
}
h.removeChild(node);
}
}
q.nodes = [];
};
return {
/**
* The number of request required before an automatic purge.
* Can be configured via the 'purgethreshold' config
* property PURGE_THRESH
* @static
* @type int
* @default 20
* @private
*/
PURGE_THRESH: 20,
/**
* Called by the the helper for detecting script load in Safari
* @method _finalize
* @static
* @param {string} id the transaction id.
* @private
*/
_finalize: function(id) {
setTimeout(function() {
_finish(id);
}, 0);
},
/**
* Abort a transaction
* @method abort
* @static
* @param {string|object} o Either the tId or the object returned from
* script() or css().
*/
abort: function(o) {
var id = (L.isString(o)) ? o : o.tId,
q = queues[id];
if (q) {
q.aborted = true;
}
},
/**
* Fetches and inserts one or more script nodes into the head
* of the current document or the document in a specified window.
*
* @method script
* @static
* @param {string|string[]} url the url or urls to the script(s).
* @param {object} opts Options:
* <dl>
* <dt>onSuccess</dt>
* <dd>
* callback to execute when the script(s) are finished loading
* The callback receives an object back with the following
* data:
* <dl>
* <dt>win</dt>
* <dd>the window the script(s) were inserted into</dd>
* <dt>data</dt>
* <dd>the data object passed in when the request was made</dd>
* <dt>nodes</dt>
* <dd>An array containing references to the nodes that were
* inserted</dd>
* <dt>purge</dt>
* <dd>A function that, when executed, will remove the nodes
* that were inserted</dd>
* <dt>
* </dl>
* </dd>
* <dt>onTimeout</dt>
* <dd>
* callback to execute when a timeout occurs.
* The callback receives an object back with the following
* data:
* <dl>
* <dt>win</dt>
* <dd>the window the script(s) were inserted into</dd>
* <dt>data</dt>
* <dd>the data object passed in when the request was made</dd>
* <dt>nodes</dt>
* <dd>An array containing references to the nodes that were
* inserted</dd>
* <dt>purge</dt>
* <dd>A function that, when executed, will remove the nodes
* that were inserted</dd>
* <dt>
* </dl>
* </dd>
* <dt>onEnd</dt>
* <dd>a function that executes when the transaction finishes,
* regardless of the exit path</dd>
* <dt>onFailure</dt>
* <dd>
* callback to execute when the script load operation fails
* The callback receives an object back with the following
* data:
* <dl>
* <dt>win</dt>
* <dd>the window the script(s) were inserted into</dd>
* <dt>data</dt>
* <dd>the data object passed in when the request was made</dd>
* <dt>nodes</dt>
* <dd>An array containing references to the nodes that were
* inserted successfully</dd>
* <dt>purge</dt>
* <dd>A function that, when executed, will remove any nodes
* that were inserted</dd>
* <dt>
* </dl>
* </dd>
* <dt>context</dt>
* <dd>the execution context for the callbacks</dd>
* <dt>win</dt>
* <dd>a window other than the one the utility occupies</dd>
* <dt>autopurge</dt>
* <dd>
* setting to true will let the utilities cleanup routine purge
* the script once loaded
* </dd>
* <dt>purgethreshold</dt>
* <dd>
* The number of transaction before autopurge should be initiated
* </dd>
* <dt>data</dt>
* <dd>
* data that is supplied to the callback when the script(s) are
* loaded.
* </dd>
* <dt>insertBefore</dt>
* <dd>node or node id that will become the new node's nextSibling.
* If this is not specified, nodes will be inserted before a base
* tag should it exist. Otherwise, the nodes will be appended to the
* end of the document head.</dd>
* </dl>
* <dt>charset</dt>
* <dd>Node charset, default utf-8 (deprecated, use the attributes
* config)</dd>
* <dt>attributes</dt>
* <dd>An object literal containing additional attributes to add to
* the link tags</dd>
* <dt>timeout</dt>
* <dd>Number of milliseconds to wait before aborting and firing
* the timeout event</dd>
* <pre>
* Y.Get.script(
* ["http://yui.yahooapis.com/2.5.2/build/yahoo/yahoo-min.js",
* "http://yui.yahooapis.com/2.5.2/build/event/event-min.js"],
* {
* onSuccess: function(o) {
* this.log("won't cause error because Y is the context");
* // immediately
* },
* onFailure: function(o) {
* },
* onTimeout: function(o) {
* },
* data: "foo",
* timeout: 10000, // 10 second timeout
* context: Y, // make the YUI instance
* // win: otherframe // target another window/frame
* autopurge: true // allow the utility to choose when to
* // remove the nodes
* purgetheshold: 1 // purge previous transaction before
* // next transaction
* });.
* </pre>
* @return {tId: string} an object containing info about the
* transaction.
*/
script: function(url, opts) {
return _queue('script', url, opts);
},
/**
* Fetches and inserts one or more css link nodes into the
* head of the current document or the document in a specified
* window.
* @method css
* @static
* @param {string} url the url or urls to the css file(s).
* @param {object} opts Options:
* <dl>
* <dt>onSuccess</dt>
* <dd>
* callback to execute when the css file(s) are finished loading
* The callback receives an object back with the following
* data:
* <dl>win</dl>
* <dd>the window the link nodes(s) were inserted into</dd>
* <dt>data</dt>
* <dd>the data object passed in when the request was made</dd>
* <dt>nodes</dt>
* <dd>An array containing references to the nodes that were
* inserted</dd>
* <dt>purge</dt>
* <dd>A function that, when executed, will remove the nodes
* that were inserted</dd>
* <dt>
* </dl>
* </dd>
* <dt>context</dt>
* <dd>the execution context for the callbacks</dd>
* <dt>win</dt>
* <dd>a window other than the one the utility occupies</dd>
* <dt>data</dt>
* <dd>
* data that is supplied to the callbacks when the nodes(s) are
* loaded.
* </dd>
* <dt>insertBefore</dt>
* <dd>node or node id that will become the new node's nextSibling</dd>
* <dt>charset</dt>
* <dd>Node charset, default utf-8 (deprecated, use the attributes
* config)</dd>
* <dt>attributes</dt>
* <dd>An object literal containing additional attributes to add to
* the link tags</dd>
* </dl>
* <pre>
* Y.Get.css("http://localhost/css/menu.css");
* </pre>
* <pre>
* Y.Get.css(
* ["http://localhost/css/menu.css",
* insertBefore: 'custom-styles' // nodes will be inserted
* // before the specified node
* });.
* </pre>
* @return {tId: string} an object containing info about the
* transaction.
*/
css: function(url, opts) {
return _queue('css', url, opts);
}
};
}();
}, '3.3.0' ,{requires:['yui-base']});
YUI.add('features', function(Y) {
var feature_tests = {};
Y.mix(Y.namespace('Features'), {
tests: feature_tests,
add: function(cat, name, o) {
feature_tests[cat] = feature_tests[cat] || {};
feature_tests[cat][name] = o;
},
all: function(cat, args) {
var cat_o = feature_tests[cat],
// results = {};
result = '';
if (cat_o) {
Y.Object.each(cat_o, function(v, k) {
// results[k] = Y.Features.test(cat, k, args);
result += k + ':' +
(Y.Features.test(cat, k, args) ? 1 : 0) + ';';
});
}
return result;
},
test: function(cat, name, args) {
args = args || [];
var result, ua, test,
cat_o = feature_tests[cat],
feature = cat_o && cat_o[name];
if (!feature) {
} else {
result = feature.result;
if (Y.Lang.isUndefined(result)) {
ua = feature.ua;
if (ua) {
result = (Y.UA[ua]);
}
test = feature.test;
if (test && ((!ua) || result)) {
result = test.apply(Y, args);
}
feature.result = result;
}
}
return result;
}
});
// Y.Features.add("load", "1", {});
// Y.Features.test("load", "1");
// caps=1:1;2:0;3:1;
/* This file is auto-generated by src/loader/meta_join.py */
var add = Y.Features.add;
// autocomplete-list-keys-sniff.js
add('load', '0', {
"test": function (Y) {
// Only add keyboard support to autocomplete-list if this doesn't appear to
// be an iOS or Android-based mobile device.
//
// There's currently no feasible way to actually detect whether a device has
// a hardware keyboard, so this sniff will have to do. It can easily be
// overridden by manually loading the autocomplete-list-keys module.
//
// Worth noting: even though iOS supports bluetooth keyboards, Mobile Safari
// doesn't fire the keyboard events used by AutoCompleteList, so there's
// no point loading the -keys module even when a bluetooth keyboard may be
// available.
return !(Y.UA.ios || Y.UA.android);
},
"trigger": "autocomplete-list"
});
// ie-style-test.js
add('load', '1', {
"test": function (Y) {
var testFeature = Y.Features.test,
addFeature = Y.Features.add,
WINDOW = Y.config.win,
DOCUMENT = Y.config.doc,
DOCUMENT_ELEMENT = 'documentElement',
ret = false;
addFeature('style', 'computedStyle', {
test: function() {
return WINDOW && 'getComputedStyle' in WINDOW;
}
});
addFeature('style', 'opacity', {
test: function() {
return DOCUMENT && 'opacity' in DOCUMENT[DOCUMENT_ELEMENT].style;
}
});
ret = (!testFeature('style', 'opacity') &&
!testFeature('style', 'computedStyle'));
return ret;
},
"trigger": "dom-style"
});
// 0
add('load', '2', {
"trigger": "widget-base",
"ua": "ie"
});
// ie-base-test.js
add('load', '3', {
"test": function(Y) {
var imp = Y.config.doc && Y.config.doc.implementation;
return (imp && (!imp.hasFeature('Events', '2.0')));
},
"trigger": "node-base"
});
// dd-gestures-test.js
add('load', '4', {
"test": function(Y) {
return (Y.config.win && ('ontouchstart' in Y.config.win && !Y.UA.chrome));
},
"trigger": "dd-drag"
});
// history-hash-ie-test.js
add('load', '5', {
"test": function (Y) {
var docMode = Y.config.doc.documentMode;
return Y.UA.ie && (!('onhashchange' in Y.config.win) ||
!docMode || docMode < 8);
},
"trigger": "history-hash"
});
}, '3.3.0' ,{requires:['yui-base']});
YUI.add('rls', function(Y) {
/**
* Implentation for building the remote loader service url.
* @method _rls
* @param {Array} what the requested modules.
* @since 3.2.0
* @return {string} the url for the remote loader service call.
*/
Y._rls = function(what) {
var config = Y.config,
// the configuration
rls = config.rls || {
m: 1, // required in the template
v: Y.version,
gv: config.gallery,
env: 1, // required in the template
lang: config.lang,
'2in3v': config['2in3'],
'2v': config.yui2,
filt: config.filter,
filts: config.filters,
tests: 1 // required in the template
},
// The rls base path
rls_base = config.rls_base || 'load?',
// the template
rls_tmpl = config.rls_tmpl || function() {
var s = '', param;
for (param in rls) {
if (param in rls && rls[param]) {
s += param + '={' + param + '}&';
}
}
// console.log('rls_tmpl: ' + s);
return s;
}(),
url;
// update the request
rls.m = what;
rls.env = Y.Object.keys(YUI.Env.mods);
rls.tests = Y.Features.all('load', [Y]);
url = Y.Lang.sub(rls_base + rls_tmpl, rls);
config.rls = rls;
config.rls_tmpl = rls_tmpl;
// console.log(url);
return url;
};
}, '3.3.0' ,{requires:['get','features']});
YUI.add('intl-base', function(Y) {
/**
* The Intl utility provides a central location for managing sets of
* localized resources (strings and formatting patterns).
*
* @class Intl
* @uses EventTarget
* @static
*/
var SPLIT_REGEX = /[, ]/;
Y.mix(Y.namespace('Intl'), {
/**
* Returns the language among those available that
* best matches the preferred language list, using the Lookup
* algorithm of BCP 47.
* If none of the available languages meets the user's preferences,
* then "" is returned.
* Extended language ranges are not supported.
*
* @method lookupBestLang
* @param {String[] | String} preferredLanguages The list of preferred
* languages in descending preference order, represented as BCP 47
* language tags. A string array or a comma-separated list.
* @param {String[]} availableLanguages The list of languages
* that the application supports, represented as BCP 47 language
* tags.
*
* @return {String} The available language that best matches the
* preferred language list, or "".
* @since 3.1.0
*/
lookupBestLang: function(preferredLanguages, availableLanguages) {
var i, language, result, index;
// check whether the list of available languages contains language;
// if so return it
function scan(language) {
var i;
for (i = 0; i < availableLanguages.length; i += 1) {
if (language.toLowerCase() ===
availableLanguages[i].toLowerCase()) {
return availableLanguages[i];
}
}
}
if (Y.Lang.isString(preferredLanguages)) {
preferredLanguages = preferredLanguages.split(SPLIT_REGEX);
}
for (i = 0; i < preferredLanguages.length; i += 1) {
language = preferredLanguages[i];
if (!language || language === '*') {
continue;
}
// check the fallback sequence for one language
while (language.length > 0) {
result = scan(language);
if (result) {
return result;
} else {
index = language.lastIndexOf('-');
if (index >= 0) {
language = language.substring(0, index);
// one-character subtags get cut along with the
// following subtag
if (index >= 2 && language.charAt(index - 2) === '-') {
language = language.substring(0, index - 2);
}
} else {
// nothing available for this language
break;
}
}
}
}
return '';
}
});
}, '3.3.0' ,{requires:['yui-base']});
YUI.add('yui-log', function(Y) {
/**
* Provides console log capability and exposes a custom event for
* console implementations.
* @module yui
* @submodule yui-log
*/
var INSTANCE = Y,
LOGEVENT = 'yui:log',
UNDEFINED = 'undefined',
LEVELS = { debug: 1,
info: 1,
warn: 1,
error: 1 };
/**
* If the 'debug' config is true, a 'yui:log' event will be
* dispatched, which the Console widget and anything else
* can consume. If the 'useBrowserConsole' config is true, it will
* write to the browser console if available. YUI-specific log
* messages will only be present in the -debug versions of the
* JS files. The build system is supposed to remove log statements
* from the raw and minified versions of the files.
*
* @method log
* @for YUI
* @param {String} msg The message to log.
* @param {String} cat The log category for the message. Default
* categories are "info", "warn", "error", time".
* Custom categories can be used as well. (opt).
* @param {String} src The source of the the message (opt).
* @param {boolean} silent If true, the log event won't fire.
* @return {YUI} YUI instance.
*/
INSTANCE.log = function(msg, cat, src, silent) {
var bail, excl, incl, m, f,
Y = INSTANCE,
c = Y.config,
publisher = (Y.fire) ? Y : YUI.Env.globalEvents;
// suppress log message if the config is off or the event stack
// or the event call stack contains a consumer of the yui:log event
if (c.debug) {
// apply source filters
if (src) {
excl = c.logExclude;
incl = c.logInclude;
if (incl && !(src in incl)) {
bail = 1;
} else if (excl && (src in excl)) {
bail = 1;
}
}
if (!bail) {
if (c.useBrowserConsole) {
m = (src) ? src + ': ' + msg : msg;
if (Y.Lang.isFunction(c.logFn)) {
c.logFn.call(Y, msg, cat, src);
} else if (typeof console != UNDEFINED && console.log) {
f = (cat && console[cat] && (cat in LEVELS)) ? cat : 'log';
console[f](m);
} else if (typeof opera != UNDEFINED) {
opera.postError(m);
}
}
if (publisher && !silent) {
if (publisher == Y && (!publisher.getEvent(LOGEVENT))) {
publisher.publish(LOGEVENT, {
broadcast: 2
});
}
publisher.fire(LOGEVENT, {
msg: msg,
cat: cat,
src: src
});
}
}
}
return Y;
};
/**
* Write a system message. This message will be preserved in the
* minified and raw versions of the YUI files, unlike log statements.
* @method message
* @for YUI
* @param {String} msg The message to log.
* @param {String} cat The log category for the message. Default
* categories are "info", "warn", "error", time".
* Custom categories can be used as well. (opt).
* @param {String} src The source of the the message (opt).
* @param {boolean} silent If true, the log event won't fire.
* @return {YUI} YUI instance.
*/
INSTANCE.message = function() {
return INSTANCE.log.apply(INSTANCE, arguments);
};
}, '3.3.0' ,{requires:['yui-base']});
YUI.add('yui-later', function(Y) {
/**
* Provides a setTimeout/setInterval wrapper
* @module yui
* @submodule yui-later
*/
/**
* Executes the supplied function in the context of the supplied
* object 'when' milliseconds later. Executes the function a
* single time unless periodic is set to true.
* @method later
* @for YUI
* @param when {int} the number of milliseconds to wait until the fn
* is executed.
* @param o the context object.
* @param fn {Function|String} the function to execute or the name of
* the method in the 'o' object to execute.
* @param data [Array] data that is provided to the function. This
* accepts either a single item or an array. If an array is provided,
* the function is executed with one parameter for each array item.
* If you need to pass a single array parameter, it needs to be wrapped
* in an array [myarray].
* @param periodic {boolean} if true, executes continuously at supplied
* interval until canceled.
* @return {object} a timer object. Call the cancel() method on this
* object to stop the timer.
*/
Y.later = function(when, o, fn, data, periodic) {
when = when || 0;
var m = fn, f, id;
if (o && Y.Lang.isString(fn)) {
m = o[fn];
}
f = !Y.Lang.isUndefined(data) ? function() {
m.apply(o, Y.Array(data));
} : function() {
m.call(o);
};
id = (periodic) ? setInterval(f, when) : setTimeout(f, when);
return {
id: id,
interval: periodic,
cancel: function() {
if (this.interval) {
clearInterval(id);
} else {
clearTimeout(id);
}
}
};
};
Y.Lang.later = Y.later;
}, '3.3.0' ,{requires:['yui-base']});
YUI.add('yui-throttle', function(Y) {
/**
* Provides a throttle/limiter for function calls
* @module yui
* @submodule yui-throttle
*/
/*! Based on work by Simon Willison: http://gist.github.com/292562 */
/**
* Throttles a call to a method based on the time between calls.
* @method throttle
* @for YUI
* @param fn {function} The function call to throttle.
* @param ms {int} The number of milliseconds to throttle the method call.
* Can set globally with Y.config.throttleTime or by call. Passing a -1 will
* disable the throttle. Defaults to 150.
* @return {function} Returns a wrapped function that calls fn throttled.
* @since 3.1.0
*/
Y.throttle = function(fn, ms) {
ms = (ms) ? ms : (Y.config.throttleTime || 150);
if (ms === -1) {
return (function() {
fn.apply(null, arguments);
});
}
var last = Y.Lang.now();
return (function() {
var now = Y.Lang.now();
if (now - last > ms) {
last = now;
fn.apply(null, arguments);
}
});
};
}, '3.3.0' ,{requires:['yui-base']});
YUI.add('yui', function(Y){}, '3.3.0' ,{use:['yui-base','get','features','rls','intl-base','yui-log','yui-later','yui-throttle']});
YUI.add('oop', function(Y) {
/**
* Supplies object inheritance and manipulation utilities. This adds
* additional functionaity to what is provided in yui-base, and the
* methods are applied directly to the YUI instance. This module
* is required for most YUI components.
* @module oop
*/
/**
* The following methods are added to the YUI instance
* @class YUI~oop
*/
var L = Y.Lang,
A = Y.Array,
OP = Object.prototype,
CLONE_MARKER = '_~yuim~_',
EACH = 'each',
SOME = 'some',
dispatch = function(o, f, c, proto, action) {
if (o && o[action] && o !== Y) {
return o[action].call(o, f, c);
} else {
switch (A.test(o)) {
case 1:
return A[action](o, f, c);
case 2:
return A[action](Y.Array(o, 0, true), f, c);
default:
return Y.Object[action](o, f, c, proto);
}
}
};
/**
* Applies prototype properties from the supplier to the receiver.
* The receiver can be a constructor or an instance.
* @method augment
* @param {function} r the object to receive the augmentation.
* @param {function} s the object that supplies the properties to augment.
* @param {boolean} ov if true, properties already on the receiver
* will be overwritten if found on the supplier.
* @param {string[]} wl a whitelist. If supplied, only properties in
* this list will be applied to the receiver.
* @param {Array | Any} args arg or arguments to apply to the supplier
* constructor when initializing.
* @return {object} the augmented object.
*
* @todo constructor optional?
* @todo understanding what an instance is augmented with
* @todo best practices for overriding sequestered methods.
*/
Y.augment = function(r, s, ov, wl, args) {
var sProto = s.prototype,
newProto = null,
construct = s,
a = (args) ? Y.Array(args) : [],
rProto = r.prototype,
target = rProto || r,
applyConstructor = false,
sequestered, replacements;
// working on a class, so apply constructor infrastructure
if (rProto && construct) {
sequestered = {};
replacements = {};
newProto = {};
// sequester all of the functions in the supplier and replace with
// one that will restore all of them.
Y.Object.each(sProto, function(v, k) {
replacements[k] = function() {
// overwrite the prototype with all of the sequestered functions,
// but only if it hasn't been overridden
for (var i in sequestered) {
if (sequestered.hasOwnProperty(i) &&
(this[i] === replacements[i])) {
this[i] = sequestered[i];
}
}
// apply the constructor
construct.apply(this, a);
// apply the original sequestered function
return sequestered[k].apply(this, arguments);
};
if ((!wl || (k in wl)) && (ov || !(k in this))) {
if (L.isFunction(v)) {
// sequester the function
sequestered[k] = v;
// replace the sequestered function with a function that will
// restore all sequestered functions and exectue the constructor.
this[k] = replacements[k];
} else {
this[k] = v;
}
}
}, newProto, true);
// augmenting an instance, so apply the constructor immediately
} else {
applyConstructor = true;
}
Y.mix(target, newProto || sProto, ov, wl);
if (applyConstructor) {
s.apply(target, a);
}
return r;
};
/**
* Applies object properties from the supplier to the receiver. If
* the target has the property, and the property is an object, the target
* object will be augmented with the supplier's value. If the property
* is an array, the suppliers value will be appended to the target.
* @method aggregate
* @param {function} r the object to receive the augmentation.
* @param {function} s the object that supplies the properties to augment.
* @param {boolean} ov if true, properties already on the receiver
* will be overwritten if found on the supplier.
* @param {string[]} wl a whitelist. If supplied, only properties in
* this list will be applied to the receiver.
* @return {object} the extended object.
*/
Y.aggregate = function(r, s, ov, wl) {
return Y.mix(r, s, ov, wl, 0, true);
};
/**
* Utility to set up the prototype, constructor and superclass properties to
* support an inheritance strategy that can chain constructors and methods.
* Static members will not be inherited.
*
* @method extend
* @param {function} r the object to modify.
* @param {function} s the object to inherit.
* @param {object} px prototype properties to add/override.
* @param {object} sx static properties to add/override.
* @return {object} the extended object.
*/
Y.extend = function(r, s, px, sx) {
if (!s || !r) {
Y.error('extend failed, verify dependencies');
}
var sp = s.prototype, rp = Y.Object(sp);
r.prototype = rp;
rp.constructor = r;
r.superclass = sp;
// assign constructor property
if (s != Object && sp.constructor == OP.constructor) {
sp.constructor = s;
}
// add prototype overrides
if (px) {
Y.mix(rp, px, true);
}
// add object overrides
if (sx) {
Y.mix(r, sx, true);
}
return r;
};
/**
* Executes the supplied function for each item in
* a collection. Supports arrays, objects, and
* Y.NodeLists
* @method each
* @param {object} o the object to iterate.
* @param {function} f the function to execute. This function
* receives the value, key, and object as parameters.
* @param {object} c the execution context for the function.
* @param {boolean} proto if true, prototype properties are
* iterated on objects.
* @return {YUI} the YUI instance.
*/
Y.each = function(o, f, c, proto) {
return dispatch(o, f, c, proto, EACH);
};
/**
* Executes the supplied function for each item in
* a collection. The operation stops if the function
* returns true. Supports arrays, objects, and
* Y.NodeLists.
* @method some
* @param {object} o the object to iterate.
* @param {function} f the function to execute. This function
* receives the value, key, and object as parameters.
* @param {object} c the execution context for the function.
* @param {boolean} proto if true, prototype properties are
* iterated on objects.
* @return {boolean} true if the function ever returns true,
* false otherwise.
*/
Y.some = function(o, f, c, proto) {
return dispatch(o, f, c, proto, SOME);
};
/**
* Deep obj/array copy. Function clones are actually
* wrappers around the original function.
* Array-like objects are treated as arrays.
* Primitives are returned untouched. Optionally, a
* function can be provided to handle other data types,
* filter keys, validate values, etc.
*
* @method clone
* @param {object} o what to clone.
* @param {boolean} safe if true, objects will not have prototype
* items from the source. If false, they will. In this case, the
* original is initially protected, but the clone is not completely
* immune from changes to the source object prototype. Also, cloned
* prototype items that are deleted from the clone will result
* in the value of the source prototype being exposed. If operating
* on a non-safe clone, items should be nulled out rather than deleted.
* @param {function} f optional function to apply to each item in a
* collection; it will be executed prior to applying the value to
* the new object. Return false to prevent the copy.
* @param {object} c optional execution context for f.
* @param {object} owner Owner object passed when clone is iterating
* an object. Used to set up context for cloned functions.
* @param {object} cloned hash of previously cloned objects to avoid
* multiple clones.
* @return {Array|Object} the cloned object.
*/
Y.clone = function(o, safe, f, c, owner, cloned) {
if (!L.isObject(o)) {
return o;
}
// @todo cloning YUI instances doesn't currently work
if (Y.instanceOf(o, YUI)) {
return o;
}
var o2, marked = cloned || {}, stamp,
yeach = Y.each;
switch (L.type(o)) {
case 'date':
return new Date(o);
case 'regexp':
// if we do this we need to set the flags too
// return new RegExp(o.source);
return o;
case 'function':
// o2 = Y.bind(o, owner);
// break;
return o;
case 'array':
o2 = [];
break;
default:
// #2528250 only one clone of a given object should be created.
if (o[CLONE_MARKER]) {
return marked[o[CLONE_MARKER]];
}
stamp = Y.guid();
o2 = (safe) ? {} : Y.Object(o);
o[CLONE_MARKER] = stamp;
marked[stamp] = o;
}
// #2528250 don't try to clone element properties
if (!o.addEventListener && !o.attachEvent) {
yeach(o, function(v, k) {
if ((k || k === 0) && (!f || (f.call(c || this, v, k, this, o) !== false))) {
if (k !== CLONE_MARKER) {
if (k == 'prototype') {
// skip the prototype
// } else if (o[k] === o) {
// this[k] = this;
} else {
this[k] =
Y.clone(v, safe, f, c, owner || o, marked);
}
}
}
}, o2);
}
if (!cloned) {
Y.Object.each(marked, function(v, k) {
if (v[CLONE_MARKER]) {
try {
delete v[CLONE_MARKER];
} catch (e) {
v[CLONE_MARKER] = null;
}
}
}, this);
marked = null;
}
return o2;
};
/**
* Returns a function that will execute the supplied function in the
* supplied object's context, optionally adding any additional
* supplied parameters to the beginning of the arguments collection the
* supplied to the function.
*
* @method bind
* @param {Function|String} f the function to bind, or a function name
* to execute on the context object.
* @param {object} c the execution context.
* @param {any} args* 0..n arguments to include before the arguments the
* function is executed with.
* @return {function} the wrapped function.
*/
Y.bind = function(f, c) {
var xargs = arguments.length > 2 ?
Y.Array(arguments, 2, true) : null;
return function() {
var fn = L.isString(f) ? c[f] : f,
args = (xargs) ?
xargs.concat(Y.Array(arguments, 0, true)) : arguments;
return fn.apply(c || fn, args);
};
};
/**
* Returns a function that will execute the supplied function in the
* supplied object's context, optionally adding any additional
* supplied parameters to the end of the arguments the function
* is executed with.
*
* @method rbind
* @param {Function|String} f the function to bind, or a function name
* to execute on the context object.
* @param {object} c the execution context.
* @param {any} args* 0..n arguments to append to the end of
* arguments collection supplied to the function.
* @return {function} the wrapped function.
*/
Y.rbind = function(f, c) {
var xargs = arguments.length > 2 ? Y.Array(arguments, 2, true) : null;
return function() {
var fn = L.isString(f) ? c[f] : f,
args = (xargs) ?
Y.Array(arguments, 0, true).concat(xargs) : arguments;
return fn.apply(c || fn, args);
};
};
}, '3.3.0' );
YUI.add('dom-base', function(Y) {
(function(Y) {
/**
* The DOM utility provides a cross-browser abtraction layer
* normalizing DOM tasks, and adds extra helper functionality
* for other common tasks.
* @module dom
* @submodule dom-base
* @for DOM
*
*/
/**
* Provides DOM helper methods.
* @class DOM
*
*/
var NODE_TYPE = 'nodeType',
OWNER_DOCUMENT = 'ownerDocument',
DOCUMENT_ELEMENT = 'documentElement',
DEFAULT_VIEW = 'defaultView',
PARENT_WINDOW = 'parentWindow',
TAG_NAME = 'tagName',
PARENT_NODE = 'parentNode',
FIRST_CHILD = 'firstChild',
PREVIOUS_SIBLING = 'previousSibling',
NEXT_SIBLING = 'nextSibling',
CONTAINS = 'contains',
COMPARE_DOCUMENT_POSITION = 'compareDocumentPosition',
EMPTY_STRING = '',
EMPTY_ARRAY = [],
documentElement = Y.config.doc.documentElement,
re_tag = /<([a-z]+)/i,
createFromDIV = function(html, tag) {
var div = Y.config.doc.createElement('div'),
ret = true;
div.innerHTML = html;
if (!div.firstChild || div.firstChild.tagName !== tag.toUpperCase()) {
ret = false;
}
return ret;
},
addFeature = Y.Features.add,
testFeature = Y.Features.test,
Y_DOM = {
/**
* Returns the HTMLElement with the given ID (Wrapper for document.getElementById).
* @method byId
* @param {String} id the id attribute
* @param {Object} doc optional The document to search. Defaults to current document
* @return {HTMLElement | null} The HTMLElement with the id, or null if none found.
*/
byId: function(id, doc) {
// handle dupe IDs and IE name collision
return Y_DOM.allById(id, doc)[0] || null;
},
/**
* Returns the text content of the HTMLElement.
* @method getText
* @param {HTMLElement} element The html element.
* @return {String} The text content of the element (includes text of any descending elements).
*/
getText: (documentElement.textContent !== undefined) ?
function(element) {
var ret = '';
if (element) {
ret = element.textContent;
}
return ret || '';
} : function(element) {
var ret = '';
if (element) {
ret = element.innerText || element.nodeValue; // might be a textNode
}
return ret || '';
},
/**
* Sets the text content of the HTMLElement.
* @method setText
* @param {HTMLElement} element The html element.
* @param {String} content The content to add.
*/
setText: (documentElement.textContent !== undefined) ?
function(element, content) {
if (element) {
element.textContent = content;
}
} : function(element, content) {
if ('innerText' in element) {
element.innerText = content;
} else if ('nodeValue' in element) {
element.nodeValue = content;
}
},
/*
* Finds the ancestor of the element.
* @method ancestor
* @param {HTMLElement} element The html element.
* @param {Function} fn optional An optional boolean test to apply.
* The optional function is passed the current DOM node being tested as its only argument.
* If no function is given, the parentNode is returned.
* @param {Boolean} testSelf optional Whether or not to include the element in the scan
* @return {HTMLElement | null} The matching DOM node or null if none found.
*/
ancestor: function(element, fn, testSelf) {
var ret = null;
if (testSelf) {
ret = (!fn || fn(element)) ? element : null;
}
return ret || Y_DOM.elementByAxis(element, PARENT_NODE, fn, null);
},
/*
* Finds the ancestors of the element.
* @method ancestors
* @param {HTMLElement} element The html element.
* @param {Function} fn optional An optional boolean test to apply.
* The optional function is passed the current DOM node being tested as its only argument.
* If no function is given, all ancestors are returned.
* @param {Boolean} testSelf optional Whether or not to include the element in the scan
* @return {Array} An array containing all matching DOM nodes.
*/
ancestors: function(element, fn, testSelf) {
var ancestor = Y_DOM.ancestor.apply(Y_DOM, arguments),
ret = (ancestor) ? [ancestor] : [];
while ((ancestor = Y_DOM.ancestor(ancestor, fn))) {
if (ancestor) {
ret.unshift(ancestor);
}
}
return ret;
},
/**
* Searches the element by the given axis for the first matching element.
* @method elementByAxis
* @param {HTMLElement} element The html element.
* @param {String} axis The axis to search (parentNode, nextSibling, previousSibling).
* @param {Function} fn optional An optional boolean test to apply.
* @param {Boolean} all optional Whether all node types should be returned, or just element nodes.
* The optional function is passed the current HTMLElement being tested as its only argument.
* If no function is given, the first element is returned.
* @return {HTMLElement | null} The matching element or null if none found.
*/
elementByAxis: function(element, axis, fn, all) {
while (element && (element = element[axis])) { // NOTE: assignment
if ( (all || element[TAG_NAME]) && (!fn || fn(element)) ) {
return element;
}
}
return null;
},
/**
* Determines whether or not one HTMLElement is or contains another HTMLElement.
* @method contains
* @param {HTMLElement} element The containing html element.
* @param {HTMLElement} needle The html element that may be contained.
* @return {Boolean} Whether or not the element is or contains the needle.
*/
contains: function(element, needle) {
var ret = false;
if ( !needle || !element || !needle[NODE_TYPE] || !element[NODE_TYPE]) {
ret = false;
} else if (element[CONTAINS]) {
if (Y.UA.opera || needle[NODE_TYPE] === 1) { // IE & SAF contains fail if needle not an ELEMENT_NODE
ret = element[CONTAINS](needle);
} else {
ret = Y_DOM._bruteContains(element, needle);
}
} else if (element[COMPARE_DOCUMENT_POSITION]) { // gecko
if (element === needle || !!(element[COMPARE_DOCUMENT_POSITION](needle) & 16)) {
ret = true;
}
}
return ret;
},
/**
* Determines whether or not the HTMLElement is part of the document.
* @method inDoc
* @param {HTMLElement} element The containing html element.
* @param {HTMLElement} doc optional The document to check.
* @return {Boolean} Whether or not the element is attached to the document.
*/
inDoc: function(element, doc) {
var ret = false,
rootNode;
if (element && element.nodeType) {
(doc) || (doc = element[OWNER_DOCUMENT]);
rootNode = doc[DOCUMENT_ELEMENT];
// contains only works with HTML_ELEMENT
if (rootNode && rootNode.contains && element.tagName) {
ret = rootNode.contains(element);
} else {
ret = Y_DOM.contains(rootNode, element);
}
}
return ret;
},
allById: function(id, root) {
root = root || Y.config.doc;
var nodes = [],
ret = [],
i,
node;
if (root.querySelectorAll) {
ret = root.querySelectorAll('[id="' + id + '"]');
} else if (root.all) {
nodes = root.all(id);
if (nodes) {
// root.all may return HTMLElement or HTMLCollection.
// some elements are also HTMLCollection (FORM, SELECT).
if (nodes.nodeName) {
if (nodes.id === id) { // avoid false positive on name
ret.push(nodes);
nodes = EMPTY_ARRAY; // done, no need to filter
} else { // prep for filtering
nodes = [nodes];
}
}
if (nodes.length) {
// filter out matches on node.name
// and element.id as reference to element with id === 'id'
for (i = 0; node = nodes[i++];) {
if (node.id === id ||
(node.attributes && node.attributes.id &&
node.attributes.id.value === id)) {
ret.push(node);
}
}
}
}
} else {
ret = [Y_DOM._getDoc(root).getElementById(id)];
}
return ret;
},
/**
* Creates a new dom node using the provided markup string.
* @method create
* @param {String} html The markup used to create the element
* @param {HTMLDocument} doc An optional document context
* @return {HTMLElement|DocumentFragment} returns a single HTMLElement
* when creating one node, and a documentFragment when creating
* multiple nodes.
*/
create: function(html, doc) {
if (typeof html === 'string') {
html = Y.Lang.trim(html); // match IE which trims whitespace from innerHTML
}
doc = doc || Y.config.doc;
var m = re_tag.exec(html),
create = Y_DOM._create,
custom = Y_DOM.creators,
ret = null,
creator,
tag, nodes;
if (html != undefined) { // not undefined or null
if (m && m[1]) {
creator = custom[m[1].toLowerCase()];
if (typeof creator === 'function') {
create = creator;
} else {
tag = creator;
}
}
nodes = create(html, doc, tag).childNodes;
if (nodes.length === 1) { // return single node, breaking parentNode ref from "fragment"
ret = nodes[0].parentNode.removeChild(nodes[0]);
} else if (nodes[0] && nodes[0].className === 'yui3-big-dummy') { // using dummy node to preserve some attributes (e.g. OPTION not selected)
if (nodes.length === 2) {
ret = nodes[0].nextSibling;
} else {
nodes[0].parentNode.removeChild(nodes[0]);
ret = Y_DOM._nl2frag(nodes, doc);
}
} else { // return multiple nodes as a fragment
ret = Y_DOM._nl2frag(nodes, doc);
}
}
return ret;
},
_nl2frag: function(nodes, doc) {
var ret = null,
i, len;
if (nodes && (nodes.push || nodes.item) && nodes[0]) {
doc = doc || nodes[0].ownerDocument;
ret = doc.createDocumentFragment();
if (nodes.item) { // convert live list to static array
nodes = Y.Array(nodes, 0, true);
}
for (i = 0, len = nodes.length; i < len; i++) {
ret.appendChild(nodes[i]);
}
} // else inline with log for minification
return ret;
},
CUSTOM_ATTRIBUTES: (!documentElement.hasAttribute) ? { // IE < 8
'for': 'htmlFor',
'class': 'className'
} : { // w3c
'htmlFor': 'for',
'className': 'class'
},
/**
* Provides a normalized attribute interface.
* @method setAttibute
* @param {HTMLElement} el The target element for the attribute.
* @param {String} attr The attribute to set.
* @param {String} val The value of the attribute.
*/
setAttribute: function(el, attr, val, ieAttr) {
if (el && attr && el.setAttribute) {
attr = Y_DOM.CUSTOM_ATTRIBUTES[attr] || attr;
el.setAttribute(attr, val, ieAttr);
}
},
/**
* Provides a normalized attribute interface.
* @method getAttibute
* @param {HTMLElement} el The target element for the attribute.
* @param {String} attr The attribute to get.
* @return {String} The current value of the attribute.
*/
getAttribute: function(el, attr, ieAttr) {
ieAttr = (ieAttr !== undefined) ? ieAttr : 2;
var ret = '';
if (el && attr && el.getAttribute) {
attr = Y_DOM.CUSTOM_ATTRIBUTES[attr] || attr;
ret = el.getAttribute(attr, ieAttr);
if (ret === null) {
ret = ''; // per DOM spec
}
}
return ret;
},
isWindow: function(obj) {
return !!(obj && obj.alert && obj.document);
},
_fragClones: {},
_create: function(html, doc, tag) {
tag = tag || 'div';
var frag = Y_DOM._fragClones[tag];
if (frag) {
frag = frag.cloneNode(false);
} else {
frag = Y_DOM._fragClones[tag] = doc.createElement(tag);
}
frag.innerHTML = html;
return frag;
},
_removeChildNodes: function(node) {
while (node.firstChild) {
node.removeChild(node.firstChild);
}
},
/**
* Inserts content in a node at the given location
* @method addHTML
* @param {HTMLElement} node The node to insert into
* @param {HTMLElement | Array | HTMLCollection} content The content to be inserted
* @param {HTMLElement} where Where to insert the content
* If no "where" is given, content is appended to the node
* Possible values for "where"
* <dl>
* <dt>HTMLElement</dt>
* <dd>The element to insert before</dd>
* <dt>"replace"</dt>
* <dd>Replaces the existing HTML</dd>
* <dt>"before"</dt>
* <dd>Inserts before the existing HTML</dd>
* <dt>"before"</dt>
* <dd>Inserts content before the node</dd>
* <dt>"after"</dt>
* <dd>Inserts content after the node</dd>
* </dl>
*/
addHTML: function(node, content, where) {
var nodeParent = node.parentNode,
i = 0,
item,
ret = content,
newNode;
if (content != undefined) { // not null or undefined (maybe 0)
if (content.nodeType) { // DOM node, just add it
newNode = content;
} else if (typeof content == 'string' || typeof content == 'number') {
ret = newNode = Y_DOM.create(content);
} else if (content[0] && content[0].nodeType) { // array or collection
newNode = Y.config.doc.createDocumentFragment();
while ((item = content[i++])) {
newNode.appendChild(item); // append to fragment for insertion
}
}
}
if (where) {
if (where.nodeType) { // insert regardless of relationship to node
where.parentNode.insertBefore(newNode, where);
} else {
switch (where) {
case 'replace':
while (node.firstChild) {
node.removeChild(node.firstChild);
}
if (newNode) { // allow empty content to clear node
node.appendChild(newNode);
}
break;
case 'before':
nodeParent.insertBefore(newNode, node);
break;
case 'after':
if (node.nextSibling) { // IE errors if refNode is null
nodeParent.insertBefore(newNode, node.nextSibling);
} else {
nodeParent.appendChild(newNode);
}
break;
default:
node.appendChild(newNode);
}
}
} else if (newNode) {
node.appendChild(newNode);
}
return ret;
},
VALUE_SETTERS: {},
VALUE_GETTERS: {},
getValue: function(node) {
var ret = '', // TODO: return null?
getter;
if (node && node[TAG_NAME]) {
getter = Y_DOM.VALUE_GETTERS[node[TAG_NAME].toLowerCase()];
if (getter) {
ret = getter(node);
} else {
ret = node.value;
}
}
// workaround for IE8 JSON stringify bug
// which converts empty string values to null
if (ret === EMPTY_STRING) {
ret = EMPTY_STRING; // for real
}
return (typeof ret === 'string') ? ret : '';
},
setValue: function(node, val) {
var setter;
if (node && node[TAG_NAME]) {
setter = Y_DOM.VALUE_SETTERS[node[TAG_NAME].toLowerCase()];
if (setter) {
setter(node, val);
} else {
node.value = val;
}
}
},
siblings: function(node, fn) {
var nodes = [],
sibling = node;
while ((sibling = sibling[PREVIOUS_SIBLING])) {
if (sibling[TAG_NAME] && (!fn || fn(sibling))) {
nodes.unshift(sibling);
}
}
sibling = node;
while ((sibling = sibling[NEXT_SIBLING])) {
if (sibling[TAG_NAME] && (!fn || fn(sibling))) {
nodes.push(sibling);
}
}
return nodes;
},
/**
* Brute force version of contains.
* Used for browsers without contains support for non-HTMLElement Nodes (textNodes, etc).
* @method _bruteContains
* @private
* @param {HTMLElement} element The containing html element.
* @param {HTMLElement} needle The html element that may be contained.
* @return {Boolean} Whether or not the element is or contains the needle.
*/
_bruteContains: function(element, needle) {
while (needle) {
if (element === needle) {
return true;
}
needle = needle.parentNode;
}
return false;
},
// TODO: move to Lang?
/**
* Memoizes dynamic regular expressions to boost runtime performance.
* @method _getRegExp
* @private
* @param {String} str The string to convert to a regular expression.
* @param {String} flags optional An optinal string of flags.
* @return {RegExp} An instance of RegExp
*/
_getRegExp: function(str, flags) {
flags = flags || '';
Y_DOM._regexCache = Y_DOM._regexCache || {};
if (!Y_DOM._regexCache[str + flags]) {
Y_DOM._regexCache[str + flags] = new RegExp(str, flags);
}
return Y_DOM._regexCache[str + flags];
},
// TODO: make getDoc/Win true privates?
/**
* returns the appropriate document.
* @method _getDoc
* @private
* @param {HTMLElement} element optional Target element.
* @return {Object} The document for the given element or the default document.
*/
_getDoc: function(element) {
var doc = Y.config.doc;
if (element) {
doc = (element[NODE_TYPE] === 9) ? element : // element === document
element[OWNER_DOCUMENT] || // element === DOM node
element.document || // element === window
Y.config.doc; // default
}
return doc;
},
/**
* returns the appropriate window.
* @method _getWin
* @private
* @param {HTMLElement} element optional Target element.
* @return {Object} The window for the given element or the default window.
*/
_getWin: function(element) {
var doc = Y_DOM._getDoc(element);
return doc[DEFAULT_VIEW] || doc[PARENT_WINDOW] || Y.config.win;
},
_batch: function(nodes, fn, arg1, arg2, arg3, etc) {
fn = (typeof fn === 'string') ? Y_DOM[fn] : fn;
var result,
args = Array.prototype.slice.call(arguments, 2),
i = 0,
node,
ret;
if (fn && nodes) {
while ((node = nodes[i++])) {
result = result = fn.call(Y_DOM, node, arg1, arg2, arg3, etc);
if (typeof result !== 'undefined') {
(ret) || (ret = []);
ret.push(result);
}
}
}
return (typeof ret !== 'undefined') ? ret : nodes;
},
wrap: function(node, html) {
var parent = Y.DOM.create(html),
nodes = parent.getElementsByTagName('*');
if (nodes.length) {
parent = nodes[nodes.length - 1];
}
if (node.parentNode) {
node.parentNode.replaceChild(parent, node);
}
parent.appendChild(node);
},
unwrap: function(node) {
var parent = node.parentNode,
lastChild = parent.lastChild,
node = parent.firstChild,
next = node,
grandparent;
if (parent) {
grandparent = parent.parentNode;
if (grandparent) {
while (node !== lastChild) {
next = node.nextSibling;
grandparent.insertBefore(node, parent);
node = next;
}
grandparent.replaceChild(lastChild, parent);
} else {
parent.removeChild(node);
}
}
},
generateID: function(el) {
var id = el.id;
if (!id) {
id = Y.stamp(el);
el.id = id;
}
return id;
},
creators: {}
};
addFeature('innerhtml', 'table', {
test: function() {
var node = Y.config.doc.createElement('table');
try {
node.innerHTML = '<tbody></tbody>';
} catch(e) {
return false;
}
return (node.firstChild && node.firstChild.nodeName === 'TBODY');
}
});
addFeature('innerhtml-div', 'tr', {
test: function() {
return createFromDIV('<tr></tr>', 'tr');
}
});
addFeature('innerhtml-div', 'script', {
test: function() {
return createFromDIV('<script></script>', 'script');
}
});
addFeature('value-set', 'select', {
test: function() {
var node = Y.config.doc.createElement('select');
node.innerHTML = '<option>1</option><option>2</option>';
node.value = '2';
return (node.value && node.value === '2');
}
});
(function(Y) {
var creators = Y_DOM.creators,
create = Y_DOM.create,
re_tbody = /(?:\/(?:thead|tfoot|tbody|caption|col|colgroup)>)+\s*<tbody/,
TABLE_OPEN = '<table>',
TABLE_CLOSE = '</table>';
if (!testFeature('innerhtml', 'table')) {
// TODO: thead/tfoot with nested tbody
// IE adds TBODY when creating TABLE elements (which may share this impl)
creators.tbody = function(html, doc) {
var frag = create(TABLE_OPEN + html + TABLE_CLOSE, doc),
tb = frag.children.tags('tbody')[0];
if (frag.children.length > 1 && tb && !re_tbody.test(html)) {
tb[PARENT_NODE].removeChild(tb); // strip extraneous tbody
}
return frag;
};
}
if (!testFeature('innerhtml-div', 'script')) {
creators.script = function(html, doc) {
var frag = doc.createElement('div');
frag.innerHTML = '-' + html;
frag.removeChild(frag[FIRST_CHILD]);
return frag;
}
Y_DOM.creators.link = Y_DOM.creators.style = Y_DOM.creators.script;
}
if (!testFeature('value-set', 'select')) {
Y_DOM.VALUE_SETTERS.select = function(node, val) {
for (var i = 0, options = node.getElementsByTagName('option'), option;
option = options[i++];) {
if (Y_DOM.getValue(option) === val) {
option.selected = true;
//Y_DOM.setAttribute(option, 'selected', 'selected');
break;
}
}
}
}
Y.mix(Y_DOM.VALUE_GETTERS, {
button: function(node) {
return (node.attributes && node.attributes.value) ? node.attributes.value.value : '';
}
});
Y.mix(Y_DOM.VALUE_SETTERS, {
// IE: node.value changes the button text, which should be handled via innerHTML
button: function(node, val) {
var attr = node.attributes.value;
if (!attr) {
attr = node[OWNER_DOCUMENT].createAttribute('value');
node.setAttributeNode(attr);
}
attr.value = val;
}
});
if (!testFeature('innerhtml-div', 'tr')) {
Y.mix(creators, {
option: function(html, doc) {
return create('<select><option class="yui3-big-dummy" selected></option>' + html + '</select>', doc);
},
tr: function(html, doc) {
return create('<tbody>' + html + '</tbody>', doc);
},
td: function(html, doc) {
return create('<tr>' + html + '</tr>', doc);
},
col: function(html, doc) {
return create('<colgroup>' + html + '</colgroup>', doc);
},
tbody: 'table'
});
Y.mix(creators, {
legend: 'fieldset',
th: creators.td,
thead: creators.tbody,
tfoot: creators.tbody,
caption: creators.tbody,
colgroup: creators.tbody,
optgroup: creators.option
});
}
Y.mix(Y_DOM.VALUE_GETTERS, {
option: function(node) {
var attrs = node.attributes;
return (attrs.value && attrs.value.specified) ? node.value : node.text;
},
select: function(node) {
var val = node.value,
options = node.options;
if (options && options.length) {
// TODO: implement multipe select
if (node.multiple) {
} else {
val = Y_DOM.getValue(options[node.selectedIndex]);
}
}
return val;
}
});
})(Y);
Y.DOM = Y_DOM;
})(Y);
var addClass, hasClass, removeClass;
Y.mix(Y.DOM, {
/**
* Determines whether a DOM element has the given className.
* @method hasClass
* @for DOM
* @param {HTMLElement} element The DOM element.
* @param {String} className the class name to search for
* @return {Boolean} Whether or not the element has the given class.
*/
hasClass: function(node, className) {
var re = Y.DOM._getRegExp('(?:^|\\s+)' + className + '(?:\\s+|$)');
return re.test(node.className);
},
/**
* Adds a class name to a given DOM element.
* @method addClass
* @for DOM
* @param {HTMLElement} element The DOM element.
* @param {String} className the class name to add to the class attribute
*/
addClass: function(node, className) {
if (!Y.DOM.hasClass(node, className)) { // skip if already present
node.className = Y.Lang.trim([node.className, className].join(' '));
}
},
/**
* Removes a class name from a given element.
* @method removeClass
* @for DOM
* @param {HTMLElement} element The DOM element.
* @param {String} className the class name to remove from the class attribute
*/
removeClass: function(node, className) {
if (className && hasClass(node, className)) {
node.className = Y.Lang.trim(node.className.replace(Y.DOM._getRegExp('(?:^|\\s+)' +
className + '(?:\\s+|$)'), ' '));
if ( hasClass(node, className) ) { // in case of multiple adjacent
removeClass(node, className);
}
}
},
/**
* Replace a class with another class for a given element.
* If no oldClassName is present, the newClassName is simply added.
* @method replaceClass
* @for DOM
* @param {HTMLElement} element The DOM element
* @param {String} oldClassName the class name to be replaced
* @param {String} newClassName the class name that will be replacing the old class name
*/
replaceClass: function(node, oldC, newC) {
removeClass(node, oldC); // remove first in case oldC === newC
addClass(node, newC);
},
/**
* If the className exists on the node it is removed, if it doesn't exist it is added.
* @method toggleClass
* @for DOM
* @param {HTMLElement} element The DOM element
* @param {String} className the class name to be toggled
* @param {Boolean} addClass optional boolean to indicate whether class
* should be added or removed regardless of current state
*/
toggleClass: function(node, className, force) {
var add = (force !== undefined) ? force :
!(hasClass(node, className));
if (add) {
addClass(node, className);
} else {
removeClass(node, className);
}
}
});
hasClass = Y.DOM.hasClass;
removeClass = Y.DOM.removeClass;
addClass = Y.DOM.addClass;
Y.mix(Y.DOM, {
/**
* Sets the width of the element to the given size, regardless
* of box model, border, padding, etc.
* @method setWidth
* @param {HTMLElement} element The DOM element.
* @param {String|Int} size The pixel height to size to
*/
setWidth: function(node, size) {
Y.DOM._setSize(node, 'width', size);
},
/**
* Sets the height of the element to the given size, regardless
* of box model, border, padding, etc.
* @method setHeight
* @param {HTMLElement} element The DOM element.
* @param {String|Int} size The pixel height to size to
*/
setHeight: function(node, size) {
Y.DOM._setSize(node, 'height', size);
},
_setSize: function(node, prop, val) {
val = (val > 0) ? val : 0;
var size = 0;
node.style[prop] = val + 'px';
size = (prop === 'height') ? node.offsetHeight : node.offsetWidth;
if (size > val) {
val = val - (size - val);
if (val < 0) {
val = 0;
}
node.style[prop] = val + 'px';
}
}
});
}, '3.3.0' ,{requires:['oop']});
YUI.add('dom-style', function(Y) {
(function(Y) {
/**
* Add style management functionality to DOM.
* @module dom
* @submodule dom-style
* @for DOM
*/
var DOCUMENT_ELEMENT = 'documentElement',
DEFAULT_VIEW = 'defaultView',
OWNER_DOCUMENT = 'ownerDocument',
STYLE = 'style',
FLOAT = 'float',
CSS_FLOAT = 'cssFloat',
STYLE_FLOAT = 'styleFloat',
TRANSPARENT = 'transparent',
GET_COMPUTED_STYLE = 'getComputedStyle',
GET_BOUNDING_CLIENT_RECT = 'getBoundingClientRect',
WINDOW = Y.config.win,
DOCUMENT = Y.config.doc,
UNDEFINED = undefined,
Y_DOM = Y.DOM,
TRANSFORM = 'transform',
VENDOR_TRANSFORM = [
'WebkitTransform',
'MozTransform',
'OTransform'
],
re_color = /color$/i,
re_unit = /width|height|top|left|right|bottom|margin|padding/i;
Y.Array.each(VENDOR_TRANSFORM, function(val) {
if (val in DOCUMENT[DOCUMENT_ELEMENT].style) {
TRANSFORM = val;
}
});
Y.mix(Y_DOM, {
DEFAULT_UNIT: 'px',
CUSTOM_STYLES: {
},
/**
* Sets a style property for a given element.
* @method setStyle
* @param {HTMLElement} An HTMLElement to apply the style to.
* @param {String} att The style property to set.
* @param {String|Number} val The value.
*/
setStyle: function(node, att, val, style) {
style = style || node.style;
var CUSTOM_STYLES = Y_DOM.CUSTOM_STYLES;
if (style) {
if (val === null || val === '') { // normalize unsetting
val = '';
} else if (!isNaN(new Number(val)) && re_unit.test(att)) { // number values may need a unit
val += Y_DOM.DEFAULT_UNIT;
}
if (att in CUSTOM_STYLES) {
if (CUSTOM_STYLES[att].set) {
CUSTOM_STYLES[att].set(node, val, style);
return; // NOTE: return
} else if (typeof CUSTOM_STYLES[att] === 'string') {
att = CUSTOM_STYLES[att];
}
} else if (att === '') { // unset inline styles
att = 'cssText';
val = '';
}
style[att] = val;
}
},
/**
* Returns the current style value for the given property.
* @method getStyle
* @param {HTMLElement} An HTMLElement to get the style from.
* @param {String} att The style property to get.
*/
getStyle: function(node, att, style) {
style = style || node.style;
var CUSTOM_STYLES = Y_DOM.CUSTOM_STYLES,
val = '';
if (style) {
if (att in CUSTOM_STYLES) {
if (CUSTOM_STYLES[att].get) {
return CUSTOM_STYLES[att].get(node, att, style); // NOTE: return
} else if (typeof CUSTOM_STYLES[att] === 'string') {
att = CUSTOM_STYLES[att];
}
}
val = style[att];
if (val === '') { // TODO: is empty string sufficient?
val = Y_DOM[GET_COMPUTED_STYLE](node, att);
}
}
return val;
},
/**
* Sets multiple style properties.
* @method setStyles
* @param {HTMLElement} node An HTMLElement to apply the styles to.
* @param {Object} hash An object literal of property:value pairs.
*/
setStyles: function(node, hash) {
var style = node.style;
Y.each(hash, function(v, n) {
Y_DOM.setStyle(node, n, v, style);
}, Y_DOM);
},
/**
* Returns the computed style for the given node.
* @method getComputedStyle
* @param {HTMLElement} An HTMLElement to get the style from.
* @param {String} att The style property to get.
* @return {String} The computed value of the style property.
*/
getComputedStyle: function(node, att) {
var val = '',
doc = node[OWNER_DOCUMENT];
if (node[STYLE] && doc[DEFAULT_VIEW] && doc[DEFAULT_VIEW][GET_COMPUTED_STYLE]) {
val = doc[DEFAULT_VIEW][GET_COMPUTED_STYLE](node, null)[att];
}
return val;
}
});
// normalize reserved word float alternatives ("cssFloat" or "styleFloat")
if (DOCUMENT[DOCUMENT_ELEMENT][STYLE][CSS_FLOAT] !== UNDEFINED) {
Y_DOM.CUSTOM_STYLES[FLOAT] = CSS_FLOAT;
} else if (DOCUMENT[DOCUMENT_ELEMENT][STYLE][STYLE_FLOAT] !== UNDEFINED) {
Y_DOM.CUSTOM_STYLES[FLOAT] = STYLE_FLOAT;
}
// fix opera computedStyle default color unit (convert to rgb)
if (Y.UA.opera) {
Y_DOM[GET_COMPUTED_STYLE] = function(node, att) {
var view = node[OWNER_DOCUMENT][DEFAULT_VIEW],
val = view[GET_COMPUTED_STYLE](node, '')[att];
if (re_color.test(att)) {
val = Y.Color.toRGB(val);
}
return val;
};
}
// safari converts transparent to rgba(), others use "transparent"
if (Y.UA.webkit) {
Y_DOM[GET_COMPUTED_STYLE] = function(node, att) {
var view = node[OWNER_DOCUMENT][DEFAULT_VIEW],
val = view[GET_COMPUTED_STYLE](node, '')[att];
if (val === 'rgba(0, 0, 0, 0)') {
val = TRANSPARENT;
}
return val;
};
}
Y.DOM._getAttrOffset = function(node, attr) {
var val = Y.DOM[GET_COMPUTED_STYLE](node, attr),
offsetParent = node.offsetParent,
position,
parentOffset,
offset;
if (val === 'auto') {
position = Y.DOM.getStyle(node, 'position');
if (position === 'static' || position === 'relative') {
val = 0;
} else if (offsetParent && offsetParent[GET_BOUNDING_CLIENT_RECT]) {
parentOffset = offsetParent[GET_BOUNDING_CLIENT_RECT]()[attr];
offset = node[GET_BOUNDING_CLIENT_RECT]()[attr];
if (attr === 'left' || attr === 'top') {
val = offset - parentOffset;
} else {
val = parentOffset - node[GET_BOUNDING_CLIENT_RECT]()[attr];
}
}
}
return val;
};
Y.DOM._getOffset = function(node) {
var pos,
xy = null;
if (node) {
pos = Y_DOM.getStyle(node, 'position');
xy = [
parseInt(Y_DOM[GET_COMPUTED_STYLE](node, 'left'), 10),
parseInt(Y_DOM[GET_COMPUTED_STYLE](node, 'top'), 10)
];
if ( isNaN(xy[0]) ) { // in case of 'auto'
xy[0] = parseInt(Y_DOM.getStyle(node, 'left'), 10); // try inline
if ( isNaN(xy[0]) ) { // default to offset value
xy[0] = (pos === 'relative') ? 0 : node.offsetLeft || 0;
}
}
if ( isNaN(xy[1]) ) { // in case of 'auto'
xy[1] = parseInt(Y_DOM.getStyle(node, 'top'), 10); // try inline
if ( isNaN(xy[1]) ) { // default to offset value
xy[1] = (pos === 'relative') ? 0 : node.offsetTop || 0;
}
}
}
return xy;
};
Y_DOM.CUSTOM_STYLES.transform = {
set: function(node, val, style) {
style[TRANSFORM] = val;
},
get: function(node, style) {
return Y_DOM[GET_COMPUTED_STYLE](node, TRANSFORM);
}
};
})(Y);
(function(Y) {
var PARSE_INT = parseInt,
RE = RegExp;
Y.Color = {
KEYWORDS: {
black: '000',
silver: 'c0c0c0',
gray: '808080',
white: 'fff',
maroon: '800000',
red: 'f00',
purple: '800080',
fuchsia: 'f0f',
green: '008000',
lime: '0f0',
olive: '808000',
yellow: 'ff0',
navy: '000080',
blue: '00f',
teal: '008080',
aqua: '0ff'
},
re_RGB: /^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i,
re_hex: /^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i,
re_hex3: /([0-9A-F])/gi,
toRGB: function(val) {
if (!Y.Color.re_RGB.test(val)) {
val = Y.Color.toHex(val);
}
if(Y.Color.re_hex.exec(val)) {
val = 'rgb(' + [
PARSE_INT(RE.$1, 16),
PARSE_INT(RE.$2, 16),
PARSE_INT(RE.$3, 16)
].join(', ') + ')';
}
return val;
},
toHex: function(val) {
val = Y.Color.KEYWORDS[val] || val;
if (Y.Color.re_RGB.exec(val)) {
val = [
Number(RE.$1).toString(16),
Number(RE.$2).toString(16),
Number(RE.$3).toString(16)
];
for (var i = 0; i < val.length; i++) {
if (val[i].length < 2) {
val[i] = '0' + val[i];
}
}
val = val.join('');
}
if (val.length < 6) {
val = val.replace(Y.Color.re_hex3, '$1$1');
}
if (val !== 'transparent' && val.indexOf('#') < 0) {
val = '#' + val;
}
return val.toUpperCase();
}
};
})(Y);
}, '3.3.0' ,{requires:['dom-base']});
YUI.add('dom-screen', function(Y) {
(function(Y) {
/**
* Adds position and region management functionality to DOM.
* @module dom
* @submodule dom-screen
* @for DOM
*/
var DOCUMENT_ELEMENT = 'documentElement',
COMPAT_MODE = 'compatMode',
POSITION = 'position',
FIXED = 'fixed',
RELATIVE = 'relative',
LEFT = 'left',
TOP = 'top',
_BACK_COMPAT = 'BackCompat',
MEDIUM = 'medium',
BORDER_LEFT_WIDTH = 'borderLeftWidth',
BORDER_TOP_WIDTH = 'borderTopWidth',
GET_BOUNDING_CLIENT_RECT = 'getBoundingClientRect',
GET_COMPUTED_STYLE = 'getComputedStyle',
Y_DOM = Y.DOM,
// TODO: how about thead/tbody/tfoot/tr?
// TODO: does caption matter?
RE_TABLE = /^t(?:able|d|h)$/i,
SCROLL_NODE;
if (Y.UA.ie) {
if (Y.config.doc[COMPAT_MODE] !== 'quirks') {
SCROLL_NODE = DOCUMENT_ELEMENT;
} else {
SCROLL_NODE = 'body';
}
}
Y.mix(Y_DOM, {
/**
* Returns the inner height of the viewport (exludes scrollbar).
* @method winHeight
* @return {Number} The current height of the viewport.
*/
winHeight: function(node) {
var h = Y_DOM._getWinSize(node).height;
return h;
},
/**
* Returns the inner width of the viewport (exludes scrollbar).
* @method winWidth
* @return {Number} The current width of the viewport.
*/
winWidth: function(node) {
var w = Y_DOM._getWinSize(node).width;
return w;
},
/**
* Document height
* @method docHeight
* @return {Number} The current height of the document.
*/
docHeight: function(node) {
var h = Y_DOM._getDocSize(node).height;
return Math.max(h, Y_DOM._getWinSize(node).height);
},
/**
* Document width
* @method docWidth
* @return {Number} The current width of the document.
*/
docWidth: function(node) {
var w = Y_DOM._getDocSize(node).width;
return Math.max(w, Y_DOM._getWinSize(node).width);
},
/**
* Amount page has been scroll horizontally
* @method docScrollX
* @return {Number} The current amount the screen is scrolled horizontally.
*/
docScrollX: function(node, doc) {
doc = doc || (node) ? Y_DOM._getDoc(node) : Y.config.doc; // perf optimization
var dv = doc.defaultView,
pageOffset = (dv) ? dv.pageXOffset : 0;
return Math.max(doc[DOCUMENT_ELEMENT].scrollLeft, doc.body.scrollLeft, pageOffset);
},
/**
* Amount page has been scroll vertically
* @method docScrollY
* @return {Number} The current amount the screen is scrolled vertically.
*/
docScrollY: function(node, doc) {
doc = doc || (node) ? Y_DOM._getDoc(node) : Y.config.doc; // perf optimization
var dv = doc.defaultView,
pageOffset = (dv) ? dv.pageYOffset : 0;
return Math.max(doc[DOCUMENT_ELEMENT].scrollTop, doc.body.scrollTop, pageOffset);
},
/**
* Gets the current position of an element based on page coordinates.
* Element must be part of the DOM tree to have page coordinates
* (display:none or elements not appended return false).
* @method getXY
* @param element The target element
* @return {Array} The XY position of the element
TODO: test inDocument/display?
*/
getXY: function() {
if (Y.config.doc[DOCUMENT_ELEMENT][GET_BOUNDING_CLIENT_RECT]) {
return function(node) {
var xy = null,
scrollLeft,
scrollTop,
box,
off1, off2,
bLeft, bTop,
mode,
doc,
inDoc,
rootNode;
if (node && node.tagName) {
doc = node.ownerDocument;
rootNode = doc[DOCUMENT_ELEMENT];
// inline inDoc check for perf
if (rootNode.contains) {
inDoc = rootNode.contains(node);
} else {
inDoc = Y.DOM.contains(rootNode, node);
}
if (inDoc) {
scrollLeft = (SCROLL_NODE) ? doc[SCROLL_NODE].scrollLeft : Y_DOM.docScrollX(node, doc);
scrollTop = (SCROLL_NODE) ? doc[SCROLL_NODE].scrollTop : Y_DOM.docScrollY(node, doc);
box = node[GET_BOUNDING_CLIENT_RECT]();
xy = [box.left, box.top];
if (Y.UA.ie) {
off1 = 2;
off2 = 2;
mode = doc[COMPAT_MODE];
bLeft = Y_DOM[GET_COMPUTED_STYLE](doc[DOCUMENT_ELEMENT], BORDER_LEFT_WIDTH);
bTop = Y_DOM[GET_COMPUTED_STYLE](doc[DOCUMENT_ELEMENT], BORDER_TOP_WIDTH);
if (Y.UA.ie === 6) {
if (mode !== _BACK_COMPAT) {
off1 = 0;
off2 = 0;
}
}
if ((mode == _BACK_COMPAT)) {
if (bLeft !== MEDIUM) {
off1 = parseInt(bLeft, 10);
}
if (bTop !== MEDIUM) {
off2 = parseInt(bTop, 10);
}
}
xy[0] -= off1;
xy[1] -= off2;
}
if ((scrollTop || scrollLeft)) {
if (!Y.UA.ios) {
xy[0] += scrollLeft;
xy[1] += scrollTop;
}
}
} else {
xy = Y_DOM._getOffset(node);
}
}
return xy;
}
} else {
return function(node) { // manually calculate by crawling up offsetParents
//Calculate the Top and Left border sizes (assumes pixels)
var xy = null,
doc,
parentNode,
bCheck,
scrollTop,
scrollLeft;
if (node) {
if (Y_DOM.inDoc(node)) {
xy = [node.offsetLeft, node.offsetTop];
doc = node.ownerDocument;
parentNode = node;
// TODO: refactor with !! or just falsey
bCheck = ((Y.UA.gecko || Y.UA.webkit > 519) ? true : false);
// TODO: worth refactoring for TOP/LEFT only?
while ((parentNode = parentNode.offsetParent)) {
xy[0] += parentNode.offsetLeft;
xy[1] += parentNode.offsetTop;
if (bCheck) {
xy = Y_DOM._calcBorders(parentNode, xy);
}
}
// account for any scrolled ancestors
if (Y_DOM.getStyle(node, POSITION) != FIXED) {
parentNode = node;
while ((parentNode = parentNode.parentNode)) {
scrollTop = parentNode.scrollTop;
scrollLeft = parentNode.scrollLeft;
//Firefox does something funky with borders when overflow is not visible.
if (Y.UA.gecko && (Y_DOM.getStyle(parentNode, 'overflow') !== 'visible')) {
xy = Y_DOM._calcBorders(parentNode, xy);
}
if (scrollTop || scrollLeft) {
xy[0] -= scrollLeft;
xy[1] -= scrollTop;
}
}
xy[0] += Y_DOM.docScrollX(node, doc);
xy[1] += Y_DOM.docScrollY(node, doc);
} else {
//Fix FIXED position -- add scrollbars
xy[0] += Y_DOM.docScrollX(node, doc);
xy[1] += Y_DOM.docScrollY(node, doc);
}
} else {
xy = Y_DOM._getOffset(node);
}
}
return xy;
};
}
}(),// NOTE: Executing for loadtime branching
/**
* Gets the current X position of an element based on page coordinates.
* Element must be part of the DOM tree to have page coordinates
* (display:none or elements not appended return false).
* @method getX
* @param element The target element
* @return {Int} The X position of the element
*/
getX: function(node) {
return Y_DOM.getXY(node)[0];
},
/**
* Gets the current Y position of an element based on page coordinates.
* Element must be part of the DOM tree to have page coordinates
* (display:none or elements not appended return false).
* @method getY
* @param element The target element
* @return {Int} The Y position of the element
*/
getY: function(node) {
return Y_DOM.getXY(node)[1];
},
/**
* Set the position of an html element in page coordinates.
* The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
* @method setXY
* @param element The target element
* @param {Array} xy Contains X & Y values for new position (coordinates are page-based)
* @param {Boolean} noRetry By default we try and set the position a second time if the first fails
*/
setXY: function(node, xy, noRetry) {
var setStyle = Y_DOM.setStyle,
pos,
delta,
newXY,
currentXY;
if (node && xy) {
pos = Y_DOM.getStyle(node, POSITION);
delta = Y_DOM._getOffset(node);
if (pos == 'static') { // default to relative
pos = RELATIVE;
setStyle(node, POSITION, pos);
}
currentXY = Y_DOM.getXY(node);
if (xy[0] !== null) {
setStyle(node, LEFT, xy[0] - currentXY[0] + delta[0] + 'px');
}
if (xy[1] !== null) {
setStyle(node, TOP, xy[1] - currentXY[1] + delta[1] + 'px');
}
if (!noRetry) {
newXY = Y_DOM.getXY(node);
if (newXY[0] !== xy[0] || newXY[1] !== xy[1]) {
Y_DOM.setXY(node, xy, true);
}
}
} else {
}
},
/**
* Set the X position of an html element in page coordinates, regardless of how the element is positioned.
* The element(s) must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
* @method setX
* @param element The target element
* @param {Int} x The X values for new position (coordinates are page-based)
*/
setX: function(node, x) {
return Y_DOM.setXY(node, [x, null]);
},
/**
* Set the Y position of an html element in page coordinates, regardless of how the element is positioned.
* The element(s) must be part of the DOM tree to have page coordinates (display:none or elements not appended return false).
* @method setY
* @param element The target element
* @param {Int} y The Y values for new position (coordinates are page-based)
*/
setY: function(node, y) {
return Y_DOM.setXY(node, [null, y]);
},
/**
* @method swapXY
* @description Swap the xy position with another node
* @param {Node} node The node to swap with
* @param {Node} otherNode The other node to swap with
* @return {Node}
*/
swapXY: function(node, otherNode) {
var xy = Y_DOM.getXY(node);
Y_DOM.setXY(node, Y_DOM.getXY(otherNode));
Y_DOM.setXY(otherNode, xy);
},
_calcBorders: function(node, xy2) {
var t = parseInt(Y_DOM[GET_COMPUTED_STYLE](node, BORDER_TOP_WIDTH), 10) || 0,
l = parseInt(Y_DOM[GET_COMPUTED_STYLE](node, BORDER_LEFT_WIDTH), 10) || 0;
if (Y.UA.gecko) {
if (RE_TABLE.test(node.tagName)) {
t = 0;
l = 0;
}
}
xy2[0] += l;
xy2[1] += t;
return xy2;
},
_getWinSize: function(node, doc) {
doc = doc || (node) ? Y_DOM._getDoc(node) : Y.config.doc;
var win = doc.defaultView || doc.parentWindow,
mode = doc[COMPAT_MODE],
h = win.innerHeight,
w = win.innerWidth,
root = doc[DOCUMENT_ELEMENT];
if ( mode && !Y.UA.opera ) { // IE, Gecko
if (mode != 'CSS1Compat') { // Quirks
root = doc.body;
}
h = root.clientHeight;
w = root.clientWidth;
}
return { height: h, width: w };
},
_getDocSize: function(node) {
var doc = (node) ? Y_DOM._getDoc(node) : Y.config.doc,
root = doc[DOCUMENT_ELEMENT];
if (doc[COMPAT_MODE] != 'CSS1Compat') {
root = doc.body;
}
return { height: root.scrollHeight, width: root.scrollWidth };
}
});
})(Y);
(function(Y) {
var TOP = 'top',
RIGHT = 'right',
BOTTOM = 'bottom',
LEFT = 'left',
getOffsets = function(r1, r2) {
var t = Math.max(r1[TOP], r2[TOP]),
r = Math.min(r1[RIGHT], r2[RIGHT]),
b = Math.min(r1[BOTTOM], r2[BOTTOM]),
l = Math.max(r1[LEFT], r2[LEFT]),
ret = {};
ret[TOP] = t;
ret[RIGHT] = r;
ret[BOTTOM] = b;
ret[LEFT] = l;
return ret;
},
DOM = Y.DOM;
Y.mix(DOM, {
/**
* Returns an Object literal containing the following about this element: (top, right, bottom, left)
* @for DOM
* @method region
* @param {HTMLElement} element The DOM element.
@return {Object} Object literal containing the following about this element: (top, right, bottom, left)
*/
region: function(node) {
var xy = DOM.getXY(node),
ret = false;
if (node && xy) {
ret = DOM._getRegion(
xy[1], // top
xy[0] + node.offsetWidth, // right
xy[1] + node.offsetHeight, // bottom
xy[0] // left
);
}
return ret;
},
/**
* Find the intersect information for the passes nodes.
* @method intersect
* @for DOM
* @param {HTMLElement} element The first element
* @param {HTMLElement | Object} element2 The element or region to check the interect with
* @param {Object} altRegion An object literal containing the region for the first element if we already have the data (for performance i.e. DragDrop)
@return {Object} Object literal containing the following intersection data: (top, right, bottom, left, area, yoff, xoff, inRegion)
*/
intersect: function(node, node2, altRegion) {
var r = altRegion || DOM.region(node), region = {},
n = node2,
off;
if (n.tagName) {
region = DOM.region(n);
} else if (Y.Lang.isObject(node2)) {
region = node2;
} else {
return false;
}
off = getOffsets(region, r);
return {
top: off[TOP],
right: off[RIGHT],
bottom: off[BOTTOM],
left: off[LEFT],
area: ((off[BOTTOM] - off[TOP]) * (off[RIGHT] - off[LEFT])),
yoff: ((off[BOTTOM] - off[TOP])),
xoff: (off[RIGHT] - off[LEFT]),
inRegion: DOM.inRegion(node, node2, false, altRegion)
};
},
/**
* Check if any part of this node is in the passed region
* @method inRegion
* @for DOM
* @param {Object} node2 The node to get the region from or an Object literal of the region
* $param {Boolean} all Should all of the node be inside the region
* @param {Object} altRegion An object literal containing the region for this node if we already have the data (for performance i.e. DragDrop)
* @return {Boolean} True if in region, false if not.
*/
inRegion: function(node, node2, all, altRegion) {
var region = {},
r = altRegion || DOM.region(node),
n = node2,
off;
if (n.tagName) {
region = DOM.region(n);
} else if (Y.Lang.isObject(node2)) {
region = node2;
} else {
return false;
}
if (all) {
return (
r[LEFT] >= region[LEFT] &&
r[RIGHT] <= region[RIGHT] &&
r[TOP] >= region[TOP] &&
r[BOTTOM] <= region[BOTTOM] );
} else {
off = getOffsets(region, r);
if (off[BOTTOM] >= off[TOP] && off[RIGHT] >= off[LEFT]) {
return true;
} else {
return false;
}
}
},
/**
* Check if any part of this element is in the viewport
* @method inViewportRegion
* @for DOM
* @param {HTMLElement} element The DOM element.
* @param {Boolean} all Should all of the node be inside the region
* @param {Object} altRegion An object literal containing the region for this node if we already have the data (for performance i.e. DragDrop)
* @return {Boolean} True if in region, false if not.
*/
inViewportRegion: function(node, all, altRegion) {
return DOM.inRegion(node, DOM.viewportRegion(node), all, altRegion);
},
_getRegion: function(t, r, b, l) {
var region = {};
region[TOP] = region[1] = t;
region[LEFT] = region[0] = l;
region[BOTTOM] = b;
region[RIGHT] = r;
region.width = region[RIGHT] - region[LEFT];
region.height = region[BOTTOM] - region[TOP];
return region;
},
/**
* Returns an Object literal containing the following about the visible region of viewport: (top, right, bottom, left)
* @method viewportRegion
* @for DOM
* @return {Object} Object literal containing the following about the visible region of the viewport: (top, right, bottom, left)
*/
viewportRegion: function(node) {
node = node || Y.config.doc.documentElement;
var ret = false,
scrollX,
scrollY;
if (node) {
scrollX = DOM.docScrollX(node);
scrollY = DOM.docScrollY(node);
ret = DOM._getRegion(scrollY, // top
DOM.winWidth(node) + scrollX, // right
scrollY + DOM.winHeight(node), // bottom
scrollX); // left
}
return ret;
}
});
})(Y);
}, '3.3.0' ,{requires:['dom-base', 'dom-style', 'event-base']});
YUI.add('selector-native', function(Y) {
(function(Y) {
/**
* The selector-native module provides support for native querySelector
* @module dom
* @submodule selector-native
* @for Selector
*/
/**
* Provides support for using CSS selectors to query the DOM
* @class Selector
* @static
* @for Selector
*/
Y.namespace('Selector'); // allow native module to standalone
var COMPARE_DOCUMENT_POSITION = 'compareDocumentPosition',
OWNER_DOCUMENT = 'ownerDocument';
var Selector = {
_foundCache: [],
useNative: true,
_compare: ('sourceIndex' in Y.config.doc.documentElement) ?
function(nodeA, nodeB) {
var a = nodeA.sourceIndex,
b = nodeB.sourceIndex;
if (a === b) {
return 0;
} else if (a > b) {
return 1;
}
return -1;
} : (Y.config.doc.documentElement[COMPARE_DOCUMENT_POSITION] ?
function(nodeA, nodeB) {
if (nodeA[COMPARE_DOCUMENT_POSITION](nodeB) & 4) {
return -1;
} else {
return 1;
}
} :
function(nodeA, nodeB) {
var rangeA, rangeB, compare;
if (nodeA && nodeB) {
rangeA = nodeA[OWNER_DOCUMENT].createRange();
rangeA.setStart(nodeA, 0);
rangeB = nodeB[OWNER_DOCUMENT].createRange();
rangeB.setStart(nodeB, 0);
compare = rangeA.compareBoundaryPoints(1, rangeB); // 1 === Range.START_TO_END
}
return compare;
}),
_sort: function(nodes) {
if (nodes) {
nodes = Y.Array(nodes, 0, true);
if (nodes.sort) {
nodes.sort(Selector._compare);
}
}
return nodes;
},
_deDupe: function(nodes) {
var ret = [],
i, node;
for (i = 0; (node = nodes[i++]);) {
if (!node._found) {
ret[ret.length] = node;
node._found = true;
}
}
for (i = 0; (node = ret[i++]);) {
node._found = null;
node.removeAttribute('_found');
}
return ret;
},
/**
* Retrieves a set of nodes based on a given CSS selector.
* @method query
*
* @param {string} selector The CSS Selector to test the node against.
* @param {HTMLElement} root optional An HTMLElement to start the query from. Defaults to Y.config.doc
* @param {Boolean} firstOnly optional Whether or not to return only the first match.
* @return {Array} An array of nodes that match the given selector.
* @static
*/
query: function(selector, root, firstOnly, skipNative) {
root = root || Y.config.doc;
var ret = [],
useNative = (Y.Selector.useNative && Y.config.doc.querySelector && !skipNative),
queries = [[selector, root]],
query,
result,
i,
fn = (useNative) ? Y.Selector._nativeQuery : Y.Selector._bruteQuery;
if (selector && fn) {
// split group into seperate queries
if (!skipNative && // already done if skipping
(!useNative || root.tagName)) { // split native when element scoping is needed
queries = Selector._splitQueries(selector, root);
}
for (i = 0; (query = queries[i++]);) {
result = fn(query[0], query[1], firstOnly);
if (!firstOnly) { // coerce DOM Collection to Array
result = Y.Array(result, 0, true);
}
if (result) {
ret = ret.concat(result);
}
}
if (queries.length > 1) { // remove dupes and sort by doc order
ret = Selector._sort(Selector._deDupe(ret));
}
}
return (firstOnly) ? (ret[0] || null) : ret;
},
// allows element scoped queries to begin with combinator
// e.g. query('> p', document.body) === query('body > p')
_splitQueries: function(selector, node) {
var groups = selector.split(','),
queries = [],
prefix = '',
i, len;
if (node) {
// enforce for element scoping
if (node.tagName) {
node.id = node.id || Y.guid();
prefix = '[id="' + node.id + '"] ';
}
for (i = 0, len = groups.length; i < len; ++i) {
selector = prefix + groups[i];
queries.push([selector, node]);
}
}
return queries;
},
_nativeQuery: function(selector, root, one) {
if (Y.UA.webkit && selector.indexOf(':checked') > -1 &&
(Y.Selector.pseudos && Y.Selector.pseudos.checked)) { // webkit (chrome, safari) fails to find "selected"
return Y.Selector.query(selector, root, one, true); // redo with skipNative true to try brute query
}
try {
return root['querySelector' + (one ? '' : 'All')](selector);
} catch(e) { // fallback to brute if available
return Y.Selector.query(selector, root, one, true); // redo with skipNative true
}
},
filter: function(nodes, selector) {
var ret = [],
i, node;
if (nodes && selector) {
for (i = 0; (node = nodes[i++]);) {
if (Y.Selector.test(node, selector)) {
ret[ret.length] = node;
}
}
} else {
}
return ret;
},
test: function(node, selector, root) {
var ret = false,
groups = selector.split(','),
useFrag = false,
parent,
item,
items,
frag,
i, j, group;
if (node && node.tagName) { // only test HTMLElements
// we need a root if off-doc
if (!root && !Y.DOM.inDoc(node)) {
parent = node.parentNode;
if (parent) {
root = parent;
} else { // only use frag when no parent to query
frag = node[OWNER_DOCUMENT].createDocumentFragment();
frag.appendChild(node);
root = frag;
useFrag = true;
}
}
root = root || node[OWNER_DOCUMENT];
if (!node.id) {
node.id = Y.guid();
}
for (i = 0; (group = groups[i++]);) { // TODO: off-dom test
group += '[id="' + node.id + '"]';
items = Y.Selector.query(group, root);
for (j = 0; item = items[j++];) {
if (item === node) {
ret = true;
break;
}
}
if (ret) {
break;
}
}
if (useFrag) { // cleanup
frag.removeChild(node);
}
}
return ret;
},
/**
* A convenience function to emulate Y.Node's aNode.ancestor(selector).
* @param {HTMLElement} element An HTMLElement to start the query from.
* @param {String} selector The CSS selector to test the node against.
* @return {HTMLElement} The ancestor node matching the selector, or null.
* @param {Boolean} testSelf optional Whether or not to include the element in the scan
* @static
* @method ancestor
*/
ancestor: function (element, selector, testSelf) {
return Y.DOM.ancestor(element, function(n) {
return Y.Selector.test(n, selector);
}, testSelf);
}
};
Y.mix(Y.Selector, Selector, true);
})(Y);
}, '3.3.0' ,{requires:['dom-base']});
YUI.add('selector-css2', function(Y) {
/**
* The selector module provides helper methods allowing CSS2 Selectors to be used with DOM elements.
* @module dom
* @submodule selector-css2
* @for Selector
*/
/**
* Provides helper methods for collecting and filtering DOM elements.
*/
var PARENT_NODE = 'parentNode',
TAG_NAME = 'tagName',
ATTRIBUTES = 'attributes',
COMBINATOR = 'combinator',
PSEUDOS = 'pseudos',
Selector = Y.Selector,
SelectorCSS2 = {
_reRegExpTokens: /([\^\$\?\[\]\*\+\-\.\(\)\|\\])/, // TODO: move?
SORT_RESULTS: true,
_children: function(node, tag) {
var ret = node.children,
i,
children = [],
childNodes,
child;
if (node.children && tag && node.children.tags) {
children = node.children.tags(tag);
} else if ((!ret && node[TAG_NAME]) || (ret && tag)) { // only HTMLElements have children
childNodes = ret || node.childNodes;
ret = [];
for (i = 0; (child = childNodes[i++]);) {
if (child.tagName) {
if (!tag || tag === child.tagName) {
ret.push(child);
}
}
}
}
return ret || [];
},
_re: {
//attr: /(\[.*\])/g,
attr: /(\[[^\]]*\])/g,
pseudos: /:([\-\w]+(?:\(?:['"]?(.+)['"]?\)))*/i
},
/**
* Mapping of shorthand tokens to corresponding attribute selector
* @property shorthand
* @type object
*/
shorthand: {
'\\#(-?[_a-z]+[-\\w]*)': '[id=$1]',
'\\.(-?[_a-z]+[-\\w]*)': '[className~=$1]'
},
/**
* List of operators and corresponding boolean functions.
* These functions are passed the attribute and the current node's value of the attribute.
* @property operators
* @type object
*/
operators: {
'': function(node, attr) { return Y.DOM.getAttribute(node, attr) !== ''; }, // Just test for existence of attribute
//'': '.+',
//'=': '^{val}$', // equality
'~=': '(?:^|\\s+){val}(?:\\s+|$)', // space-delimited
'|=': '^{val}-?' // optional hyphen-delimited
},
pseudos: {
'first-child': function(node) {
return Y.Selector._children(node[PARENT_NODE])[0] === node;
}
},
_bruteQuery: function(selector, root, firstOnly) {
var ret = [],
nodes = [],
tokens = Selector._tokenize(selector),
token = tokens[tokens.length - 1],
rootDoc = Y.DOM._getDoc(root),
child,
id,
className,
tagName;
// if we have an initial ID, set to root when in document
/*
if (tokens[0] && rootDoc === root &&
(id = tokens[0].id) &&
rootDoc.getElementById(id)) {
root = rootDoc.getElementById(id);
}
*/
if (token) {
// prefilter nodes
id = token.id;
className = token.className;
tagName = token.tagName || '*';
if (root.getElementsByTagName) { // non-IE lacks DOM api on doc frags
// try ID first, unless no root.all && root not in document
// (root.all works off document, but not getElementById)
// TODO: move to allById?
if (id && (root.all || (root.nodeType === 9 || Y.DOM.inDoc(root)))) {
nodes = Y.DOM.allById(id, root);
// try className
} else if (className) {
nodes = root.getElementsByClassName(className);
} else { // default to tagName
nodes = root.getElementsByTagName(tagName);
}
} else { // brute getElementsByTagName('*')
child = root.firstChild;
while (child) {
if (child.tagName) { // only collect HTMLElements
nodes.push(child);
}
child = child.nextSilbing || child.firstChild;
}
}
if (nodes.length) {
ret = Selector._filterNodes(nodes, tokens, firstOnly);
}
}
return ret;
},
_filterNodes: function(nodes, tokens, firstOnly) {
var i = 0,
j,
len = tokens.length,
n = len - 1,
result = [],
node = nodes[0],
tmpNode = node,
getters = Y.Selector.getters,
operator,
combinator,
token,
path,
pass,
//FUNCTION = 'function',
value,
tests,
test;
//do {
for (i = 0; (tmpNode = node = nodes[i++]);) {
n = len - 1;
path = null;
testLoop:
while (tmpNode && tmpNode.tagName) {
token = tokens[n];
tests = token.tests;
j = tests.length;
if (j && !pass) {
while ((test = tests[--j])) {
operator = test[1];
if (getters[test[0]]) {
value = getters[test[0]](tmpNode, test[0]);
} else {
value = tmpNode[test[0]];
// use getAttribute for non-standard attributes
if (value === undefined && tmpNode.getAttribute) {
value = tmpNode.getAttribute(test[0]);
}
}
if ((operator === '=' && value !== test[2]) || // fast path for equality
(typeof operator !== 'string' && // protect against String.test monkey-patch (Moo)
operator.test && !operator.test(value)) || // regex test
(!operator.test && // protect against RegExp as function (webkit)
typeof operator === 'function' && !operator(tmpNode, test[0]))) { // function test
// skip non element nodes or non-matching tags
if ((tmpNode = tmpNode[path])) {
while (tmpNode &&
(!tmpNode.tagName ||
(token.tagName && token.tagName !== tmpNode.tagName))
) {
tmpNode = tmpNode[path];
}
}
continue testLoop;
}
}
}
n--; // move to next token
// now that we've passed the test, move up the tree by combinator
if (!pass && (combinator = token.combinator)) {
path = combinator.axis;
tmpNode = tmpNode[path];
// skip non element nodes
while (tmpNode && !tmpNode.tagName) {
tmpNode = tmpNode[path];
}
if (combinator.direct) { // one pass only
path = null;
}
} else { // success if we made it this far
result.push(node);
if (firstOnly) {
return result;
}
break;
}
}
}// while (tmpNode = node = nodes[++i]);
node = tmpNode = null;
return result;
},
combinators: {
' ': {
axis: 'parentNode'
},
'>': {
axis: 'parentNode',
direct: true
},
'+': {
axis: 'previousSibling',
direct: true
}
},
_parsers: [
{
name: ATTRIBUTES,
re: /^\[(-?[a-z]+[\w\-]*)+([~\|\^\$\*!=]=?)?['"]?([^\]]*?)['"]?\]/i,
fn: function(match, token) {
var operator = match[2] || '',
operators = Y.Selector.operators,
test;
// add prefiltering for ID and CLASS
if ((match[1] === 'id' && operator === '=') ||
(match[1] === 'className' &&
Y.config.doc.documentElement.getElementsByClassName &&
(operator === '~=' || operator === '='))) {
token.prefilter = match[1];
token[match[1]] = match[3];
}
// add tests
if (operator in operators) {
test = operators[operator];
if (typeof test === 'string') {
match[3] = match[3].replace(Y.Selector._reRegExpTokens, '\\$1');
test = Y.DOM._getRegExp(test.replace('{val}', match[3]));
}
match[2] = test;
}
if (!token.last || token.prefilter !== match[1]) {
return match.slice(1);
}
}
},
{
name: TAG_NAME,
re: /^((?:-?[_a-z]+[\w-]*)|\*)/i,
fn: function(match, token) {
var tag = match[1].toUpperCase();
token.tagName = tag;
if (tag !== '*' && (!token.last || token.prefilter)) {
return [TAG_NAME, '=', tag];
}
if (!token.prefilter) {
token.prefilter = 'tagName';
}
}
},
{
name: COMBINATOR,
re: /^\s*([>+~]|\s)\s*/,
fn: function(match, token) {
}
},
{
name: PSEUDOS,
re: /^:([\-\w]+)(?:\(['"]?(.+)['"]?\))*/i,
fn: function(match, token) {
var test = Selector[PSEUDOS][match[1]];
if (test) { // reorder match array
return [match[2], test];
} else { // selector token not supported (possibly missing CSS3 module)
return false;
}
}
}
],
_getToken: function(token) {
return {
tagName: null,
id: null,
className: null,
attributes: {},
combinator: null,
tests: []
};
},
/**
Break selector into token units per simple selector.
Combinator is attached to the previous token.
*/
_tokenize: function(selector) {
selector = selector || '';
selector = Selector._replaceShorthand(Y.Lang.trim(selector));
var token = Selector._getToken(), // one token per simple selector (left selector holds combinator)
query = selector, // original query for debug report
tokens = [], // array of tokens
found = false, // whether or not any matches were found this pass
match, // the regex match
test,
i, parser;
/*
Search for selector patterns, store, and strip them from the selector string
until no patterns match (invalid selector) or we run out of chars.
Multiple attributes and pseudos are allowed, in any order.
for example:
'form:first-child[type=button]:not(button)[lang|=en]'
*/
outer:
do {
found = false; // reset after full pass
for (i = 0; (parser = Selector._parsers[i++]);) {
if ( (match = parser.re.exec(selector)) ) { // note assignment
if (parser.name !== COMBINATOR ) {
token.selector = selector;
}
selector = selector.replace(match[0], ''); // strip current match from selector
if (!selector.length) {
token.last = true;
}
if (Selector._attrFilters[match[1]]) { // convert class to className, etc.
match[1] = Selector._attrFilters[match[1]];
}
test = parser.fn(match, token);
if (test === false) { // selector not supported
found = false;
break outer;
} else if (test) {
token.tests.push(test);
}
if (!selector.length || parser.name === COMBINATOR) {
tokens.push(token);
token = Selector._getToken(token);
if (parser.name === COMBINATOR) {
token.combinator = Y.Selector.combinators[match[1]];
}
}
found = true;
}
}
} while (found && selector.length);
if (!found || selector.length) { // not fully parsed
tokens = [];
}
return tokens;
},
_replaceShorthand: function(selector) {
var shorthand = Selector.shorthand,
attrs = selector.match(Selector._re.attr), // pull attributes to avoid false pos on "." and "#"
pseudos = selector.match(Selector._re.pseudos), // pull attributes to avoid false pos on "." and "#"
re, i, len;
if (pseudos) {
selector = selector.replace(Selector._re.pseudos, '!!REPLACED_PSEUDO!!');
}
if (attrs) {
selector = selector.replace(Selector._re.attr, '!!REPLACED_ATTRIBUTE!!');
}
for (re in shorthand) {
if (shorthand.hasOwnProperty(re)) {
selector = selector.replace(Y.DOM._getRegExp(re, 'gi'), shorthand[re]);
}
}
if (attrs) {
for (i = 0, len = attrs.length; i < len; ++i) {
selector = selector.replace('!!REPLACED_ATTRIBUTE!!', attrs[i]);
}
}
if (pseudos) {
for (i = 0, len = pseudos.length; i < len; ++i) {
selector = selector.replace('!!REPLACED_PSEUDO!!', pseudos[i]);
}
}
return selector;
},
_attrFilters: {
'class': 'className',
'for': 'htmlFor'
},
getters: {
href: function(node, attr) {
return Y.DOM.getAttribute(node, attr);
}
}
};
Y.mix(Y.Selector, SelectorCSS2, true);
Y.Selector.getters.src = Y.Selector.getters.rel = Y.Selector.getters.href;
// IE wants class with native queries
if (Y.Selector.useNative && Y.config.doc.querySelector) {
Y.Selector.shorthand['\\.(-?[_a-z]+[-\\w]*)'] = '[class~=$1]';
}
}, '3.3.0' ,{requires:['selector-native']});
YUI.add('selector', function(Y){}, '3.3.0' ,{use:['selector-native', 'selector-css2']});
YUI.add('dom', function(Y){}, '3.3.0' ,{use:['dom-base', 'dom-style', 'dom-screen', 'selector']});
YUI.add('event-custom-base', function(Y) {
/**
* Custom event engine, DOM event listener abstraction layer, synthetic DOM
* events.
* @module event-custom
*/
Y.Env.evt = {
handles: {},
plugins: {}
};
/**
* Custom event engine, DOM event listener abstraction layer, synthetic DOM
* events.
* @module event-custom
* @submodule event-custom-base
*/
/**
* Allows for the insertion of methods that are executed before or after
* a specified method
* @class Do
* @static
*/
var DO_BEFORE = 0,
DO_AFTER = 1,
DO = {
/**
* Cache of objects touched by the utility
* @property objs
* @static
*/
objs: {},
/**
* Execute the supplied method before the specified function
* @method before
* @param fn {Function} the function to execute
* @param obj the object hosting the method to displace
* @param sFn {string} the name of the method to displace
* @param c The execution context for fn
* @param arg* {mixed} 0..n additional arguments to supply to the subscriber
* when the event fires.
* @return {string} handle for the subscription
* @static
*/
before: function(fn, obj, sFn, c) {
var f = fn, a;
if (c) {
a = [fn, c].concat(Y.Array(arguments, 4, true));
f = Y.rbind.apply(Y, a);
}
return this._inject(DO_BEFORE, f, obj, sFn);
},
/**
* Execute the supplied method after the specified function
* @method after
* @param fn {Function} the function to execute
* @param obj the object hosting the method to displace
* @param sFn {string} the name of the method to displace
* @param c The execution context for fn
* @param arg* {mixed} 0..n additional arguments to supply to the subscriber
* @return {string} handle for the subscription
* @static
*/
after: function(fn, obj, sFn, c) {
var f = fn, a;
if (c) {
a = [fn, c].concat(Y.Array(arguments, 4, true));
f = Y.rbind.apply(Y, a);
}
return this._inject(DO_AFTER, f, obj, sFn);
},
/**
* Execute the supplied method after the specified function
* @method _inject
* @param when {string} before or after
* @param fn {Function} the function to execute
* @param obj the object hosting the method to displace
* @param sFn {string} the name of the method to displace
* @param c The execution context for fn
* @return {string} handle for the subscription
* @private
* @static
*/
_inject: function(when, fn, obj, sFn) {
// object id
var id = Y.stamp(obj), o, sid;
if (! this.objs[id]) {
// create a map entry for the obj if it doesn't exist
this.objs[id] = {};
}
o = this.objs[id];
if (! o[sFn]) {
// create a map entry for the method if it doesn't exist
o[sFn] = new Y.Do.Method(obj, sFn);
// re-route the method to our wrapper
obj[sFn] =
function() {
return o[sFn].exec.apply(o[sFn], arguments);
};
}
// subscriber id
sid = id + Y.stamp(fn) + sFn;
// register the callback
o[sFn].register(sid, fn, when);
return new Y.EventHandle(o[sFn], sid);
},
/**
* Detach a before or after subscription
* @method detach
* @param handle {string} the subscription handle
*/
detach: function(handle) {
if (handle.detach) {
handle.detach();
}
},
_unload: function(e, me) {
}
};
Y.Do = DO;
//////////////////////////////////////////////////////////////////////////
/**
* Contains the return value from the wrapped method, accessible
* by 'after' event listeners.
*
* @property Do.originalRetVal
* @static
* @since 2.3.0
*/
/**
* Contains the current state of the return value, consumable by
* 'after' event listeners, and updated if an after subscriber
* changes the return value generated by the wrapped function.
*
* @property Do.currentRetVal
* @static
* @since 2.3.0
*/
//////////////////////////////////////////////////////////////////////////
/**
* Wrapper for a displaced method with aop enabled
* @class Do.Method
* @constructor
* @param obj The object to operate on
* @param sFn The name of the method to displace
*/
DO.Method = function(obj, sFn) {
this.obj = obj;
this.methodName = sFn;
this.method = obj[sFn];
this.before = {};
this.after = {};
};
/**
* Register a aop subscriber
* @method register
* @param sid {string} the subscriber id
* @param fn {Function} the function to execute
* @param when {string} when to execute the function
*/
DO.Method.prototype.register = function (sid, fn, when) {
if (when) {
this.after[sid] = fn;
} else {
this.before[sid] = fn;
}
};
/**
* Unregister a aop subscriber
* @method delete
* @param sid {string} the subscriber id
* @param fn {Function} the function to execute
* @param when {string} when to execute the function
*/
DO.Method.prototype._delete = function (sid) {
delete this.before[sid];
delete this.after[sid];
};
/**
* Execute the wrapped method
* @method exec
*/
DO.Method.prototype.exec = function () {
var args = Y.Array(arguments, 0, true),
i, ret, newRet,
bf = this.before,
af = this.after,
prevented = false;
// execute before
for (i in bf) {
if (bf.hasOwnProperty(i)) {
ret = bf[i].apply(this.obj, args);
if (ret) {
switch (ret.constructor) {
case DO.Halt:
return ret.retVal;
case DO.AlterArgs:
args = ret.newArgs;
break;
case DO.Prevent:
prevented = true;
break;
default:
}
}
}
}
// execute method
if (!prevented) {
ret = this.method.apply(this.obj, args);
}
DO.originalRetVal = ret;
DO.currentRetVal = ret;
// execute after methods.
for (i in af) {
if (af.hasOwnProperty(i)) {
newRet = af[i].apply(this.obj, args);
// Stop processing if a Halt object is returned
if (newRet && newRet.constructor == DO.Halt) {
return newRet.retVal;
// Check for a new return value
} else if (newRet && newRet.constructor == DO.AlterReturn) {
ret = newRet.newRetVal;
// Update the static retval state
DO.currentRetVal = ret;
}
}
}
return ret;
};
//////////////////////////////////////////////////////////////////////////
/**
* Return an AlterArgs object when you want to change the arguments that
* were passed into the function. An example would be a service that scrubs
* out illegal characters prior to executing the core business logic.
* @class Do.AlterArgs
*/
DO.AlterArgs = function(msg, newArgs) {
this.msg = msg;
this.newArgs = newArgs;
};
/**
* Return an AlterReturn object when you want to change the result returned
* from the core method to the caller
* @class Do.AlterReturn
*/
DO.AlterReturn = function(msg, newRetVal) {
this.msg = msg;
this.newRetVal = newRetVal;
};
/**
* Return a Halt object when you want to terminate the execution
* of all subsequent subscribers as well as the wrapped method
* if it has not exectued yet.
* @class Do.Halt
*/
DO.Halt = function(msg, retVal) {
this.msg = msg;
this.retVal = retVal;
};
/**
* Return a Prevent object when you want to prevent the wrapped function
* from executing, but want the remaining listeners to execute
* @class Do.Prevent
*/
DO.Prevent = function(msg) {
this.msg = msg;
};
/**
* Return an Error object when you want to terminate the execution
* of all subsequent method calls.
* @class Do.Error
* @deprecated use Y.Do.Halt or Y.Do.Prevent
*/
DO.Error = DO.Halt;
//////////////////////////////////////////////////////////////////////////
// Y["Event"] && Y.Event.addListener(window, "unload", Y.Do._unload, Y.Do);
/**
* Custom event engine, DOM event listener abstraction layer, synthetic DOM
* events.
* @module event-custom
* @submodule event-custom-base
*/
// var onsubscribeType = "_event:onsub",
var AFTER = 'after',
CONFIGS = [
'broadcast',
'monitored',
'bubbles',
'context',
'contextFn',
'currentTarget',
'defaultFn',
'defaultTargetOnly',
'details',
'emitFacade',
'fireOnce',
'async',
'host',
'preventable',
'preventedFn',
'queuable',
'silent',
'stoppedFn',
'target',
'type'
],
YUI3_SIGNATURE = 9,
YUI_LOG = 'yui:log';
/**
* Return value from all subscribe operations
* @class EventHandle
* @constructor
* @param {CustomEvent} evt the custom event.
* @param {Subscriber} sub the subscriber.
*/
Y.EventHandle = function(evt, sub) {
/**
* The custom event
* @type CustomEvent
*/
this.evt = evt;
/**
* The subscriber object
* @type Subscriber
*/
this.sub = sub;
};
Y.EventHandle.prototype = {
batch: function(f, c) {
f.call(c || this, this);
if (Y.Lang.isArray(this.evt)) {
Y.Array.each(this.evt, function(h) {
h.batch.call(c || h, f);
});
}
},
/**
* Detaches this subscriber
* @method detach
* @return {int} the number of detached listeners
*/
detach: function() {
var evt = this.evt, detached = 0, i;
if (evt) {
if (Y.Lang.isArray(evt)) {
for (i = 0; i < evt.length; i++) {
detached += evt[i].detach();
}
} else {
evt._delete(this.sub);
detached = 1;
}
}
return detached;
},
/**
* Monitor the event state for the subscribed event. The first parameter
* is what should be monitored, the rest are the normal parameters when
* subscribing to an event.
* @method monitor
* @param what {string} what to monitor ('attach', 'detach', 'publish').
* @return {EventHandle} return value from the monitor event subscription.
*/
monitor: function(what) {
return this.evt.monitor.apply(this.evt, arguments);
}
};
/**
* The CustomEvent class lets you define events for your application
* that can be subscribed to by one or more independent component.
*
* @param {String} type The type of event, which is passed to the callback
* when the event fires.
* @param {object} o configuration object.
* @class CustomEvent
* @constructor
*/
Y.CustomEvent = function(type, o) {
// if (arguments.length > 2) {
// this.log('CustomEvent context and silent are now in the config', 'warn', 'Event');
// }
o = o || {};
this.id = Y.stamp(this);
/**
* The type of event, returned to subscribers when the event fires
* @property type
* @type string
*/
this.type = type;
/**
* The context the the event will fire from by default. Defaults to the YUI
* instance.
* @property context
* @type object
*/
this.context = Y;
/**
* Monitor when an event is attached or detached.
*
* @property monitored
* @type boolean
*/
// this.monitored = false;
this.logSystem = (type == YUI_LOG);
/**
* If 0, this event does not broadcast. If 1, the YUI instance is notified
* every time this event fires. If 2, the YUI instance and the YUI global
* (if event is enabled on the global) are notified every time this event
* fires.
* @property broadcast
* @type int
*/
// this.broadcast = 0;
/**
* By default all custom events are logged in the debug build, set silent
* to true to disable debug outpu for this event.
* @property silent
* @type boolean
*/
this.silent = this.logSystem;
/**
* Specifies whether this event should be queued when the host is actively
* processing an event. This will effect exectution order of the callbacks
* for the various events.
* @property queuable
* @type boolean
* @default false
*/
// this.queuable = false;
/**
* The subscribers to this event
* @property subscribers
* @type Subscriber {}
*/
this.subscribers = {};
/**
* 'After' subscribers
* @property afters
* @type Subscriber {}
*/
this.afters = {};
/**
* This event has fired if true
*
* @property fired
* @type boolean
* @default false;
*/
// this.fired = false;
/**
* An array containing the arguments the custom event
* was last fired with.
* @property firedWith
* @type Array
*/
// this.firedWith;
/**
* This event should only fire one time if true, and if
* it has fired, any new subscribers should be notified
* immediately.
*
* @property fireOnce
* @type boolean
* @default false;
*/
// this.fireOnce = false;
/**
* fireOnce listeners will fire syncronously unless async
* is set to true
* @property async
* @type boolean
* @default false
*/
//this.async = false;
/**
* Flag for stopPropagation that is modified during fire()
* 1 means to stop propagation to bubble targets. 2 means
* to also stop additional subscribers on this target.
* @property stopped
* @type int
*/
// this.stopped = 0;
/**
* Flag for preventDefault that is modified during fire().
* if it is not 0, the default behavior for this event
* @property prevented
* @type int
*/
// this.prevented = 0;
/**
* Specifies the host for this custom event. This is used
* to enable event bubbling
* @property host
* @type EventTarget
*/
// this.host = null;
/**
* The default function to execute after event listeners
* have fire, but only if the default action was not
* prevented.
* @property defaultFn
* @type Function
*/
// this.defaultFn = null;
/**
* The function to execute if a subscriber calls
* stopPropagation or stopImmediatePropagation
* @property stoppedFn
* @type Function
*/
// this.stoppedFn = null;
/**
* The function to execute if a subscriber calls
* preventDefault
* @property preventedFn
* @type Function
*/
// this.preventedFn = null;
/**
* Specifies whether or not this event's default function
* can be cancelled by a subscriber by executing preventDefault()
* on the event facade
* @property preventable
* @type boolean
* @default true
*/
this.preventable = true;
/**
* Specifies whether or not a subscriber can stop the event propagation
* via stopPropagation(), stopImmediatePropagation(), or halt()
*
* Events can only bubble if emitFacade is true.
*
* @property bubbles
* @type boolean
* @default true
*/
this.bubbles = true;
/**
* Supports multiple options for listener signatures in order to
* port YUI 2 apps.
* @property signature
* @type int
* @default 9
*/
this.signature = YUI3_SIGNATURE;
this.subCount = 0;
this.afterCount = 0;
// this.hasSubscribers = false;
// this.hasAfters = false;
/**
* If set to true, the custom event will deliver an EventFacade object
* that is similar to a DOM event object.
* @property emitFacade
* @type boolean
* @default false
*/
// this.emitFacade = false;
this.applyConfig(o, true);
// this.log("Creating " + this.type);
};
Y.CustomEvent.prototype = {
hasSubs: function(when) {
var s = this.subCount, a = this.afterCount, sib = this.sibling;
if (sib) {
s += sib.subCount;
a += sib.afterCount;
}
if (when) {
return (when == 'after') ? a : s;
}
return (s + a);
},
/**
* Monitor the event state for the subscribed event. The first parameter
* is what should be monitored, the rest are the normal parameters when
* subscribing to an event.
* @method monitor
* @param what {string} what to monitor ('detach', 'attach', 'publish').
* @return {EventHandle} return value from the monitor event subscription.
*/
monitor: function(what) {
this.monitored = true;
var type = this.id + '|' + this.type + '_' + what,
args = Y.Array(arguments, 0, true);
args[0] = type;
return this.host.on.apply(this.host, args);
},
/**
* Get all of the subscribers to this event and any sibling event
* @method getSubs
* @return {Array} first item is the on subscribers, second the after.
*/
getSubs: function() {
var s = Y.merge(this.subscribers), a = Y.merge(this.afters), sib = this.sibling;
if (sib) {
Y.mix(s, sib.subscribers);
Y.mix(a, sib.afters);
}
return [s, a];
},
/**
* Apply configuration properties. Only applies the CONFIG whitelist
* @method applyConfig
* @param o hash of properties to apply.
* @param force {boolean} if true, properties that exist on the event
* will be overwritten.
*/
applyConfig: function(o, force) {
if (o) {
Y.mix(this, o, force, CONFIGS);
}
},
_on: function(fn, context, args, when) {
if (!fn) {
this.log('Invalid callback for CE: ' + this.type);
}
var s = new Y.Subscriber(fn, context, args, when);
if (this.fireOnce && this.fired) {
if (this.async) {
setTimeout(Y.bind(this._notify, this, s, this.firedWith), 0);
} else {
this._notify(s, this.firedWith);
}
}
if (when == AFTER) {
this.afters[s.id] = s;
this.afterCount++;
} else {
this.subscribers[s.id] = s;
this.subCount++;
}
return new Y.EventHandle(this, s);
},
/**
* Listen for this event
* @method subscribe
* @param {Function} fn The function to execute.
* @return {EventHandle} Unsubscribe handle.
* @deprecated use on.
*/
subscribe: function(fn, context) {
var a = (arguments.length > 2) ? Y.Array(arguments, 2, true) : null;
return this._on(fn, context, a, true);
},
/**
* Listen for this event
* @method on
* @param {Function} fn The function to execute.
* @param {object} context optional execution context.
* @param {mixed} arg* 0..n additional arguments to supply to the subscriber
* when the event fires.
* @return {EventHandle} An object with a detach method to detch the handler(s).
*/
on: function(fn, context) {
var a = (arguments.length > 2) ? Y.Array(arguments, 2, true) : null;
if (this.host) {
this.host._monitor('attach', this.type, {
args: arguments
});
}
return this._on(fn, context, a, true);
},
/**
* Listen for this event after the normal subscribers have been notified and
* the default behavior has been applied. If a normal subscriber prevents the
* default behavior, it also prevents after listeners from firing.
* @method after
* @param {Function} fn The function to execute.
* @param {object} context optional execution context.
* @param {mixed} arg* 0..n additional arguments to supply to the subscriber
* when the event fires.
* @return {EventHandle} handle Unsubscribe handle.
*/
after: function(fn, context) {
var a = (arguments.length > 2) ? Y.Array(arguments, 2, true) : null;
return this._on(fn, context, a, AFTER);
},
/**
* Detach listeners.
* @method detach
* @param {Function} fn The subscribed function to remove, if not supplied
* all will be removed.
* @param {Object} context The context object passed to subscribe.
* @return {int} returns the number of subscribers unsubscribed.
*/
detach: function(fn, context) {
// unsubscribe handle
if (fn && fn.detach) {
return fn.detach();
}
var i, s,
found = 0,
subs = Y.merge(this.subscribers, this.afters);
for (i in subs) {
if (subs.hasOwnProperty(i)) {
s = subs[i];
if (s && (!fn || fn === s.fn)) {
this._delete(s);
found++;
}
}
}
return found;
},
/**
* Detach listeners.
* @method unsubscribe
* @param {Function} fn The subscribed function to remove, if not supplied
* all will be removed.
* @param {Object} context The context object passed to subscribe.
* @return {int|undefined} returns the number of subscribers unsubscribed.
* @deprecated use detach.
*/
unsubscribe: function() {
return this.detach.apply(this, arguments);
},
/**
* Notify a single subscriber
* @method _notify
* @param {Subscriber} s the subscriber.
* @param {Array} args the arguments array to apply to the listener.
* @private
*/
_notify: function(s, args, ef) {
this.log(this.type + '->' + 'sub: ' + s.id);
var ret;
ret = s.notify(args, this);
if (false === ret || this.stopped > 1) {
this.log(this.type + ' cancelled by subscriber');
return false;
}
return true;
},
/**
* Logger abstraction to centralize the application of the silent flag
* @method log
* @param {string} msg message to log.
* @param {string} cat log category.
*/
log: function(msg, cat) {
if (!this.silent) {
}
},
/**
* Notifies the subscribers. The callback functions will be executed
* from the context specified when the event was created, and with the
* following parameters:
* <ul>
* <li>The type of event</li>
* <li>All of the arguments fire() was executed with as an array</li>
* <li>The custom object (if any) that was passed into the subscribe()
* method</li>
* </ul>
* @method fire
* @param {Object*} arguments an arbitrary set of parameters to pass to
* the handler.
* @return {boolean} false if one of the subscribers returned false,
* true otherwise.
*
*/
fire: function() {
if (this.fireOnce && this.fired) {
this.log('fireOnce event: ' + this.type + ' already fired');
return true;
} else {
var args = Y.Array(arguments, 0, true);
// this doesn't happen if the event isn't published
// this.host._monitor('fire', this.type, args);
this.fired = true;
this.firedWith = args;
if (this.emitFacade) {
return this.fireComplex(args);
} else {
return this.fireSimple(args);
}
}
},
fireSimple: function(args) {
this.stopped = 0;
this.prevented = 0;
if (this.hasSubs()) {
// this._procSubs(Y.merge(this.subscribers, this.afters), args);
var subs = this.getSubs();
this._procSubs(subs[0], args);
this._procSubs(subs[1], args);
}
this._broadcast(args);
return this.stopped ? false : true;
},
// Requires the event-custom-complex module for full funcitonality.
fireComplex: function(args) {
args[0] = args[0] || {};
return this.fireSimple(args);
},
_procSubs: function(subs, args, ef) {
var s, i;
for (i in subs) {
if (subs.hasOwnProperty(i)) {
s = subs[i];
if (s && s.fn) {
if (false === this._notify(s, args, ef)) {
this.stopped = 2;
}
if (this.stopped == 2) {
return false;
}
}
}
}
return true;
},
_broadcast: function(args) {
if (!this.stopped && this.broadcast) {
var a = Y.Array(args);
a.unshift(this.type);
if (this.host !== Y) {
Y.fire.apply(Y, a);
}
if (this.broadcast == 2) {
Y.Global.fire.apply(Y.Global, a);
}
}
},
/**
* Removes all listeners
* @method unsubscribeAll
* @return {int} The number of listeners unsubscribed.
* @deprecated use detachAll.
*/
unsubscribeAll: function() {
return this.detachAll.apply(this, arguments);
},
/**
* Removes all listeners
* @method detachAll
* @return {int} The number of listeners unsubscribed.
*/
detachAll: function() {
return this.detach();
},
/**
* @method _delete
* @param subscriber object.
* @private
*/
_delete: function(s) {
if (s) {
if (this.subscribers[s.id]) {
delete this.subscribers[s.id];
this.subCount--;
}
if (this.afters[s.id]) {
delete this.afters[s.id];
this.afterCount--;
}
}
if (this.host) {
this.host._monitor('detach', this.type, {
ce: this,
sub: s
});
}
if (s) {
// delete s.fn;
// delete s.context;
s.deleted = true;
}
}
};
/////////////////////////////////////////////////////////////////////
/**
* Stores the subscriber information to be used when the event fires.
* @param {Function} fn The wrapped function to execute.
* @param {Object} context The value of the keyword 'this' in the listener.
* @param {Array} args* 0..n additional arguments to supply the listener.
*
* @class Subscriber
* @constructor
*/
Y.Subscriber = function(fn, context, args) {
/**
* The callback that will be execute when the event fires
* This is wrapped by Y.rbind if obj was supplied.
* @property fn
* @type Function
*/
this.fn = fn;
/**
* Optional 'this' keyword for the listener
* @property context
* @type Object
*/
this.context = context;
/**
* Unique subscriber id
* @property id
* @type String
*/
this.id = Y.stamp(this);
/**
* Additional arguments to propagate to the subscriber
* @property args
* @type Array
*/
this.args = args;
/**
* Custom events for a given fire transaction.
* @property events
* @type {EventTarget}
*/
// this.events = null;
/**
* This listener only reacts to the event once
* @property once
*/
// this.once = false;
};
Y.Subscriber.prototype = {
_notify: function(c, args, ce) {
if (this.deleted && !this.postponed) {
if (this.postponed) {
delete this.fn;
delete this.context;
} else {
delete this.postponed;
return null;
}
}
var a = this.args, ret;
switch (ce.signature) {
case 0:
ret = this.fn.call(c, ce.type, args, c);
break;
case 1:
ret = this.fn.call(c, args[0] || null, c);
break;
default:
if (a || args) {
args = args || [];
a = (a) ? args.concat(a) : args;
ret = this.fn.apply(c, a);
} else {
ret = this.fn.call(c);
}
}
if (this.once) {
ce._delete(this);
}
return ret;
},
/**
* Executes the subscriber.
* @method notify
* @param args {Array} Arguments array for the subscriber.
* @param ce {CustomEvent} The custom event that sent the notification.
*/
notify: function(args, ce) {
var c = this.context,
ret = true;
if (!c) {
c = (ce.contextFn) ? ce.contextFn() : ce.context;
}
// only catch errors if we will not re-throw them.
if (Y.config.throwFail) {
ret = this._notify(c, args, ce);
} else {
try {
ret = this._notify(c, args, ce);
} catch (e) {
Y.error(this + ' failed: ' + e.message, e);
}
}
return ret;
},
/**
* Returns true if the fn and obj match this objects properties.
* Used by the unsubscribe method to match the right subscriber.
*
* @method contains
* @param {Function} fn the function to execute.
* @param {Object} context optional 'this' keyword for the listener.
* @return {boolean} true if the supplied arguments match this
* subscriber's signature.
*/
contains: function(fn, context) {
if (context) {
return ((this.fn == fn) && this.context == context);
} else {
return (this.fn == fn);
}
}
};
/**
* Custom event engine, DOM event listener abstraction layer, synthetic DOM
* events.
* @module event-custom
* @submodule event-custom-base
*/
/**
* EventTarget provides the implementation for any object to
* publish, subscribe and fire to custom events, and also
* alows other EventTargets to target the object with events
* sourced from the other object.
* EventTarget is designed to be used with Y.augment to wrap
* EventCustom in an interface that allows events to be listened to
* and fired by name. This makes it possible for implementing code to
* subscribe to an event that either has not been created yet, or will
* not be created at all.
* @class EventTarget
* @param opts a configuration object
* @config emitFacade {boolean} if true, all events will emit event
* facade payloads by default (default false)
* @config prefix {string} the prefix to apply to non-prefixed event names
* @config chain {boolean} if true, on/after/detach return the host to allow
* chaining, otherwise they return an EventHandle (default false)
*/
var L = Y.Lang,
PREFIX_DELIMITER = ':',
CATEGORY_DELIMITER = '|',
AFTER_PREFIX = '~AFTER~',
YArray = Y.Array,
_wildType = Y.cached(function(type) {
return type.replace(/(.*)(:)(.*)/, "*$2$3");
}),
/**
* If the instance has a prefix attribute and the
* event type is not prefixed, the instance prefix is
* applied to the supplied type.
* @method _getType
* @private
*/
_getType = Y.cached(function(type, pre) {
if (!pre || !L.isString(type) || type.indexOf(PREFIX_DELIMITER) > -1) {
return type;
}
return pre + PREFIX_DELIMITER + type;
}),
/**
* Returns an array with the detach key (if provided),
* and the prefixed event name from _getType
* Y.on('detachcategory| menu:click', fn)
* @method _parseType
* @private
*/
_parseType = Y.cached(function(type, pre) {
var t = type, detachcategory, after, i;
if (!L.isString(t)) {
return t;
}
i = t.indexOf(AFTER_PREFIX);
if (i > -1) {
after = true;
t = t.substr(AFTER_PREFIX.length);
}
i = t.indexOf(CATEGORY_DELIMITER);
if (i > -1) {
detachcategory = t.substr(0, (i));
t = t.substr(i+1);
if (t == '*') {
t = null;
}
}
// detach category, full type with instance prefix, is this an after listener, short type
return [detachcategory, (pre) ? _getType(t, pre) : t, after, t];
}),
ET = function(opts) {
var o = (L.isObject(opts)) ? opts : {};
this._yuievt = this._yuievt || {
id: Y.guid(),
events: {},
targets: {},
config: o,
chain: ('chain' in o) ? o.chain : Y.config.chain,
bubbling: false,
defaults: {
context: o.context || this,
host: this,
emitFacade: o.emitFacade,
fireOnce: o.fireOnce,
queuable: o.queuable,
monitored: o.monitored,
broadcast: o.broadcast,
defaultTargetOnly: o.defaultTargetOnly,
bubbles: ('bubbles' in o) ? o.bubbles : true
}
};
};
ET.prototype = {
/**
* Listen to a custom event hosted by this object one time.
* This is the equivalent to <code>on</code> except the
* listener is immediatelly detached when it is executed.
* @method once
* @param type {string} The type of the event
* @param fn {Function} The callback
* @param context {object} optional execution context.
* @param arg* {mixed} 0..n additional arguments to supply to the subscriber
* @return the event target or a detach handle per 'chain' config
*/
once: function() {
var handle = this.on.apply(this, arguments);
handle.batch(function(hand) {
if (hand.sub) {
hand.sub.once = true;
}
});
return handle;
},
/**
* Takes the type parameter passed to 'on' and parses out the
* various pieces that could be included in the type. If the
* event type is passed without a prefix, it will be expanded
* to include the prefix one is supplied or the event target
* is configured with a default prefix.
* @method parseType
* @param {string} type the type
* @param {string} [pre=this._yuievt.config.prefix] the prefix
* @since 3.3.0
* @return {Array} an array containing:
* * the detach category, if supplied,
* * the prefixed event type,
* * whether or not this is an after listener,
* * the supplied event type
*/
parseType: function(type, pre) {
return _parseType(type, pre || this._yuievt.config.prefix);
},
/**
* Subscribe to a custom event hosted by this object
* @method on
* @param type {string} The type of the event
* @param fn {Function} The callback
* @param context {object} optional execution context.
* @param arg* {mixed} 0..n additional arguments to supply to the subscriber
* @return the event target or a detach handle per 'chain' config
*/
on: function(type, fn, context) {
var parts = _parseType(type, this._yuievt.config.prefix), f, c, args, ret, ce,
detachcategory, handle, store = Y.Env.evt.handles, after, adapt, shorttype,
Node = Y.Node, n, domevent, isArr;
// full name, args, detachcategory, after
this._monitor('attach', parts[1], {
args: arguments,
category: parts[0],
after: parts[2]
});
if (L.isObject(type)) {
if (L.isFunction(type)) {
return Y.Do.before.apply(Y.Do, arguments);
}
f = fn;
c = context;
args = YArray(arguments, 0, true);
ret = [];
if (L.isArray(type)) {
isArr = true;
}
after = type._after;
delete type._after;
Y.each(type, function(v, k) {
if (L.isObject(v)) {
f = v.fn || ((L.isFunction(v)) ? v : f);
c = v.context || c;
}
var nv = (after) ? AFTER_PREFIX : '';
args[0] = nv + ((isArr) ? v : k);
args[1] = f;
args[2] = c;
ret.push(this.on.apply(this, args));
}, this);
return (this._yuievt.chain) ? this : new Y.EventHandle(ret);
}
detachcategory = parts[0];
after = parts[2];
shorttype = parts[3];
// extra redirection so we catch adaptor events too. take a look at this.
if (Node && Y.instanceOf(this, Node) && (shorttype in Node.DOM_EVENTS)) {
args = YArray(arguments, 0, true);
args.splice(2, 0, Node.getDOMNode(this));
return Y.on.apply(Y, args);
}
type = parts[1];
if (Y.instanceOf(this, YUI)) {
adapt = Y.Env.evt.plugins[type];
args = YArray(arguments, 0, true);
args[0] = shorttype;
if (Node) {
n = args[2];
if (Y.instanceOf(n, Y.NodeList)) {
n = Y.NodeList.getDOMNodes(n);
} else if (Y.instanceOf(n, Node)) {
n = Node.getDOMNode(n);
}
domevent = (shorttype in Node.DOM_EVENTS);
// Captures both DOM events and event plugins.
if (domevent) {
args[2] = n;
}
}
// check for the existance of an event adaptor
if (adapt) {
handle = adapt.on.apply(Y, args);
} else if ((!type) || domevent) {
handle = Y.Event._attach(args);
}
}
if (!handle) {
ce = this._yuievt.events[type] || this.publish(type);
handle = ce._on(fn, context, (arguments.length > 3) ? YArray(arguments, 3, true) : null, (after) ? 'after' : true);
}
if (detachcategory) {
store[detachcategory] = store[detachcategory] || {};
store[detachcategory][type] = store[detachcategory][type] || [];
store[detachcategory][type].push(handle);
}
return (this._yuievt.chain) ? this : handle;
},
/**
* subscribe to an event
* @method subscribe
* @deprecated use on
*/
subscribe: function() {
return this.on.apply(this, arguments);
},
/**
* Detach one or more listeners the from the specified event
* @method detach
* @param type {string|Object} Either the handle to the subscriber or the
* type of event. If the type
* is not specified, it will attempt to remove
* the listener from all hosted events.
* @param fn {Function} The subscribed function to unsubscribe, if not
* supplied, all subscribers will be removed.
* @param context {Object} The custom object passed to subscribe. This is
* optional, but if supplied will be used to
* disambiguate multiple listeners that are the same
* (e.g., you subscribe many object using a function
* that lives on the prototype)
* @return {EventTarget} the host
*/
detach: function(type, fn, context) {
var evts = this._yuievt.events, i,
Node = Y.Node, isNode = Node && (Y.instanceOf(this, Node));
// detachAll disabled on the Y instance.
if (!type && (this !== Y)) {
for (i in evts) {
if (evts.hasOwnProperty(i)) {
evts[i].detach(fn, context);
}
}
if (isNode) {
Y.Event.purgeElement(Node.getDOMNode(this));
}
return this;
}
var parts = _parseType(type, this._yuievt.config.prefix),
detachcategory = L.isArray(parts) ? parts[0] : null,
shorttype = (parts) ? parts[3] : null,
adapt, store = Y.Env.evt.handles, detachhost, cat, args,
ce,
keyDetacher = function(lcat, ltype, host) {
var handles = lcat[ltype], ce, i;
if (handles) {
for (i = handles.length - 1; i >= 0; --i) {
ce = handles[i].evt;
if (ce.host === host || ce.el === host) {
handles[i].detach();
}
}
}
};
if (detachcategory) {
cat = store[detachcategory];
type = parts[1];
detachhost = (isNode) ? Y.Node.getDOMNode(this) : this;
if (cat) {
if (type) {
keyDetacher(cat, type, detachhost);
} else {
for (i in cat) {
if (cat.hasOwnProperty(i)) {
keyDetacher(cat, i, detachhost);
}
}
}
return this;
}
// If this is an event handle, use it to detach
} else if (L.isObject(type) && type.detach) {
type.detach();
return this;
// extra redirection so we catch adaptor events too. take a look at this.
} else if (isNode && ((!shorttype) || (shorttype in Node.DOM_EVENTS))) {
args = YArray(arguments, 0, true);
args[2] = Node.getDOMNode(this);
Y.detach.apply(Y, args);
return this;
}
adapt = Y.Env.evt.plugins[shorttype];
// The YUI instance handles DOM events and adaptors
if (Y.instanceOf(this, YUI)) {
args = YArray(arguments, 0, true);
// use the adaptor specific detach code if
if (adapt && adapt.detach) {
adapt.detach.apply(Y, args);
return this;
// DOM event fork
} else if (!type || (!adapt && Node && (type in Node.DOM_EVENTS))) {
args[0] = type;
Y.Event.detach.apply(Y.Event, args);
return this;
}
}
// ce = evts[type];
ce = evts[parts[1]];
if (ce) {
ce.detach(fn, context);
}
return this;
},
/**
* detach a listener
* @method unsubscribe
* @deprecated use detach
*/
unsubscribe: function() {
return this.detach.apply(this, arguments);
},
/**
* Removes all listeners from the specified event. If the event type
* is not specified, all listeners from all hosted custom events will
* be removed.
* @method detachAll
* @param type {string} The type, or name of the event
*/
detachAll: function(type) {
return this.detach(type);
},
/**
* Removes all listeners from the specified event. If the event type
* is not specified, all listeners from all hosted custom events will
* be removed.
* @method unsubscribeAll
* @param type {string} The type, or name of the event
* @deprecated use detachAll
*/
unsubscribeAll: function() {
return this.detachAll.apply(this, arguments);
},
/**
* Creates a new custom event of the specified type. If a custom event
* by that name already exists, it will not be re-created. In either
* case the custom event is returned.
*
* @method publish
*
* @param type {string} the type, or name of the event
* @param opts {object} optional config params. Valid properties are:
*
* <ul>
* <li>
* 'broadcast': whether or not the YUI instance and YUI global are notified when the event is fired (false)
* </li>
* <li>
* 'bubbles': whether or not this event bubbles (true)
* Events can only bubble if emitFacade is true.
* </li>
* <li>
* 'context': the default execution context for the listeners (this)
* </li>
* <li>
* 'defaultFn': the default function to execute when this event fires if preventDefault was not called
* </li>
* <li>
* 'emitFacade': whether or not this event emits a facade (false)
* </li>
* <li>
* 'prefix': the prefix for this targets events, e.g., 'menu' in 'menu:click'
* </li>
* <li>
* 'fireOnce': if an event is configured to fire once, new subscribers after
* the fire will be notified immediately.
* </li>
* <li>
* 'async': fireOnce event listeners will fire synchronously if the event has already
* fired unless async is true.
* </li>
* <li>
* 'preventable': whether or not preventDefault() has an effect (true)
* </li>
* <li>
* 'preventedFn': a function that is executed when preventDefault is called
* </li>
* <li>
* 'queuable': whether or not this event can be queued during bubbling (false)
* </li>
* <li>
* 'silent': if silent is true, debug messages are not provided for this event.
* </li>
* <li>
* 'stoppedFn': a function that is executed when stopPropagation is called
* </li>
*
* <li>
* 'monitored': specifies whether or not this event should send notifications about
* when the event has been attached, detached, or published.
* </li>
* <li>
* 'type': the event type (valid option if not provided as the first parameter to publish)
* </li>
* </ul>
*
* @return {CustomEvent} the custom event
*
*/
publish: function(type, opts) {
var events, ce, ret, defaults,
edata = this._yuievt,
pre = edata.config.prefix;
type = (pre) ? _getType(type, pre) : type;
this._monitor('publish', type, {
args: arguments
});
if (L.isObject(type)) {
ret = {};
Y.each(type, function(v, k) {
ret[k] = this.publish(k, v || opts);
}, this);
return ret;
}
events = edata.events;
ce = events[type];
if (ce) {
// ce.log("publish applying new config to published event: '"+type+"' exists", 'info', 'event');
if (opts) {
ce.applyConfig(opts, true);
}
} else {
defaults = edata.defaults;
// apply defaults
ce = new Y.CustomEvent(type,
(opts) ? Y.merge(defaults, opts) : defaults);
events[type] = ce;
}
// make sure we turn the broadcast flag off if this
// event was published as a result of bubbling
// if (opts instanceof Y.CustomEvent) {
// events[type].broadcast = false;
// }
return events[type];
},
/**
* This is the entry point for the event monitoring system.
* You can monitor 'attach', 'detach', 'fire', and 'publish'.
* When configured, these events generate an event. click ->
* click_attach, click_detach, click_publish -- these can
* be subscribed to like other events to monitor the event
* system. Inividual published events can have monitoring
* turned on or off (publish can't be turned off before it
* it published) by setting the events 'monitor' config.
*
* @private
*/
_monitor: function(what, type, o) {
var monitorevt, ce = this.getEvent(type);
if ((this._yuievt.config.monitored && (!ce || ce.monitored)) || (ce && ce.monitored)) {
monitorevt = type + '_' + what;
o.monitored = what;
this.fire.call(this, monitorevt, o);
}
},
/**
* Fire a custom event by name. The callback functions will be executed
* from the context specified when the event was created, and with the
* following parameters.
*
* If the custom event object hasn't been created, then the event hasn't
* been published and it has no subscribers. For performance sake, we
* immediate exit in this case. This means the event won't bubble, so
* if the intention is that a bubble target be notified, the event must
* be published on this object first.
*
* The first argument is the event type, and any additional arguments are
* passed to the listeners as parameters. If the first of these is an
* object literal, and the event is configured to emit an event facade,
* that object is mixed into the event facade and the facade is provided
* in place of the original object.
*
* @method fire
* @param type {String|Object} The type of the event, or an object that contains
* a 'type' property.
* @param arguments {Object*} an arbitrary set of parameters to pass to
* the handler. If the first of these is an object literal and the event is
* configured to emit an event facade, the event facade will replace that
* parameter after the properties the object literal contains are copied to
* the event facade.
* @return {EventTarget} the event host
*
*/
fire: function(type) {
var typeIncluded = L.isString(type),
t = (typeIncluded) ? type : (type && type.type),
ce, ret, pre = this._yuievt.config.prefix, ce2,
args = (typeIncluded) ? YArray(arguments, 1, true) : arguments;
t = (pre) ? _getType(t, pre) : t;
this._monitor('fire', t, {
args: args
});
ce = this.getEvent(t, true);
ce2 = this.getSibling(t, ce);
if (ce2 && !ce) {
ce = this.publish(t);
}
// this event has not been published or subscribed to
if (!ce) {
if (this._yuievt.hasTargets) {
return this.bubble({ type: t }, args, this);
}
// otherwise there is nothing to be done
ret = true;
} else {
ce.sibling = ce2;
ret = ce.fire.apply(ce, args);
}
return (this._yuievt.chain) ? this : ret;
},
getSibling: function(type, ce) {
var ce2;
// delegate to *:type events if there are subscribers
if (type.indexOf(PREFIX_DELIMITER) > -1) {
type = _wildType(type);
// console.log(type);
ce2 = this.getEvent(type, true);
if (ce2) {
// console.log("GOT ONE: " + type);
ce2.applyConfig(ce);
ce2.bubbles = false;
ce2.broadcast = 0;
// ret = ce2.fire.apply(ce2, a);
}
}
return ce2;
},
/**
* Returns the custom event of the provided type has been created, a
* falsy value otherwise
* @method getEvent
* @param type {string} the type, or name of the event
* @param prefixed {string} if true, the type is prefixed already
* @return {CustomEvent} the custom event or null
*/
getEvent: function(type, prefixed) {
var pre, e;
if (!prefixed) {
pre = this._yuievt.config.prefix;
type = (pre) ? _getType(type, pre) : type;
}
e = this._yuievt.events;
return e[type] || null;
},
/**
* Subscribe to a custom event hosted by this object. The
* supplied callback will execute after any listeners add
* via the subscribe method, and after the default function,
* if configured for the event, has executed.
* @method after
* @param type {string} The type of the event
* @param fn {Function} The callback
* @param context {object} optional execution context.
* @param arg* {mixed} 0..n additional arguments to supply to the subscriber
* @return the event target or a detach handle per 'chain' config
*/
after: function(type, fn) {
var a = YArray(arguments, 0, true);
switch (L.type(type)) {
case 'function':
return Y.Do.after.apply(Y.Do, arguments);
case 'array':
// YArray.each(a[0], function(v) {
// v = AFTER_PREFIX + v;
// });
// break;
case 'object':
a[0]._after = true;
break;
default:
a[0] = AFTER_PREFIX + type;
}
return this.on.apply(this, a);
},
/**
* Executes the callback before a DOM event, custom event
* or method. If the first argument is a function, it
* is assumed the target is a method. For DOM and custom
* events, this is an alias for Y.on.
*
* For DOM and custom events:
* type, callback, context, 0-n arguments
*
* For methods:
* callback, object (method host), methodName, context, 0-n arguments
*
* @method before
* @return detach handle
*/
before: function() {
return this.on.apply(this, arguments);
}
};
Y.EventTarget = ET;
// make Y an event target
Y.mix(Y, ET.prototype, false, false, {
bubbles: false
});
ET.call(Y);
YUI.Env.globalEvents = YUI.Env.globalEvents || new ET();
/**
* Hosts YUI page level events. This is where events bubble to
* when the broadcast config is set to 2. This property is
* only available if the custom event module is loaded.
* @property Global
* @type EventTarget
* @for YUI
*/
Y.Global = YUI.Env.globalEvents;
// @TODO implement a global namespace function on Y.Global?
/**
* <code>YUI</code>'s <code>on</code> method is a unified interface for subscribing to
* most events exposed by YUI. This includes custom events, DOM events, and
* function events. <code>detach</code> is also provided to remove listeners
* serviced by this function.
*
* The signature that <code>on</code> accepts varies depending on the type
* of event being consumed. Refer to the specific methods that will
* service a specific request for additional information about subscribing
* to that type of event.
*
* <ul>
* <li>Custom events. These events are defined by various
* modules in the library. This type of event is delegated to
* <code>EventTarget</code>'s <code>on</code> method.
* <ul>
* <li>The type of the event</li>
* <li>The callback to execute</li>
* <li>An optional context object</li>
* <li>0..n additional arguments to supply the callback.</li>
* </ul>
* Example:
* <code>Y.on('drag:drophit', function() { // start work });</code>
* </li>
* <li>DOM events. These are moments reported by the browser related
* to browser functionality and user interaction.
* This type of event is delegated to <code>Event</code>'s
* <code>attach</code> method.
* <ul>
* <li>The type of the event</li>
* <li>The callback to execute</li>
* <li>The specification for the Node(s) to attach the listener
* to. This can be a selector, collections, or Node/Element
* refereces.</li>
* <li>An optional context object</li>
* <li>0..n additional arguments to supply the callback.</li>
* </ul>
* Example:
* <code>Y.on('click', function(e) { // something was clicked }, '#someelement');</code>
* </li>
* <li>Function events. These events can be used to react before or after a
* function is executed. This type of event is delegated to <code>Event.Do</code>'s
* <code>before</code> method.
* <ul>
* <li>The callback to execute</li>
* <li>The object that has the function that will be listened for.</li>
* <li>The name of the function to listen for.</li>
* <li>An optional context object</li>
* <li>0..n additional arguments to supply the callback.</li>
* </ul>
* Example <code>Y.on(function(arg1, arg2, etc) { // obj.methodname was executed }, obj 'methodname');</code>
* </li>
* </ul>
*
* <code>on</code> corresponds to the moment before any default behavior of
* the event. <code>after</code> works the same way, but these listeners
* execute after the event's default behavior. <code>before</code> is an
* alias for <code>on</code>.
*
* @method on
* @param type event type (this parameter does not apply for function events)
* @param fn the callback
* @param context optionally change the value of 'this' in the callback
* @param args* 0..n additional arguments to pass to the callback.
* @return the event target or a detach handle per 'chain' config
* @for YUI
*/
/**
* Listen for an event one time. Equivalent to <code>on</code>, except that
* the listener is immediately detached when executed.
* @see on
* @method once
* @param type event type (this parameter does not apply for function events)
* @param fn the callback
* @param context optionally change the value of 'this' in the callback
* @param args* 0..n additional arguments to pass to the callback.
* @return the event target or a detach handle per 'chain' config
* @for YUI
*/
/**
* after() is a unified interface for subscribing to
* most events exposed by YUI. This includes custom events,
* DOM events, and AOP events. This works the same way as
* the on() function, only it operates after any default
* behavior for the event has executed. @see <code>on</code> for more
* information.
* @method after
* @param type event type (this parameter does not apply for function events)
* @param fn the callback
* @param context optionally change the value of 'this' in the callback
* @param args* 0..n additional arguments to pass to the callback.
* @return the event target or a detach handle per 'chain' config
* @for YUI
*/
}, '3.3.0' ,{requires:['oop']});
var GLOBAL_ENV = YUI.Env;
if (!GLOBAL_ENV._ready) {
GLOBAL_ENV._ready = function() {
GLOBAL_ENV.DOMReady = true;
GLOBAL_ENV.remove(YUI.config.doc, 'DOMContentLoaded', GLOBAL_ENV._ready);
};
// if (!YUI.UA.ie) {
GLOBAL_ENV.add(YUI.config.doc, 'DOMContentLoaded', GLOBAL_ENV._ready);
// }
}
YUI.add('event-base', function(Y) {
/*
* DOM event listener abstraction layer
* @module event
* @submodule event-base
*/
/**
* The domready event fires at the moment the browser's DOM is
* usable. In most cases, this is before images are fully
* downloaded, allowing you to provide a more responsive user
* interface.
*
* In YUI 3, domready subscribers will be notified immediately if
* that moment has already passed when the subscription is created.
*
* One exception is if the yui.js file is dynamically injected into
* the page. If this is done, you must tell the YUI instance that
* you did this in order for DOMReady (and window load events) to
* fire normally. That configuration option is 'injected' -- set
* it to true if the yui.js script is not included inline.
*
* This method is part of the 'event-ready' module, which is a
* submodule of 'event'.
*
* @event domready
* @for YUI
*/
Y.publish('domready', {
fireOnce: true,
async: true
});
if (GLOBAL_ENV.DOMReady) {
Y.fire('domready');
} else {
Y.Do.before(function() { Y.fire('domready'); }, YUI.Env, '_ready');
}
/**
* Custom event engine, DOM event listener abstraction layer, synthetic DOM
* events.
* @module event
* @submodule event-base
*/
/**
* Wraps a DOM event, properties requiring browser abstraction are
* fixed here. Provids a security layer when required.
* @class DOMEventFacade
* @param ev {Event} the DOM event
* @param currentTarget {HTMLElement} the element the listener was attached to
* @param wrapper {Event.Custom} the custom event wrapper for this DOM event
*/
var ua = Y.UA,
EMPTY = {},
/**
* webkit key remapping required for Safari < 3.1
* @property webkitKeymap
* @private
*/
webkitKeymap = {
63232: 38, // up
63233: 40, // down
63234: 37, // left
63235: 39, // right
63276: 33, // page up
63277: 34, // page down
25: 9, // SHIFT-TAB (Safari provides a different key code in
// this case, even though the shiftKey modifier is set)
63272: 46, // delete
63273: 36, // home
63275: 35 // end
},
/**
* Returns a wrapped node. Intended to be used on event targets,
* so it will return the node's parent if the target is a text
* node.
*
* If accessing a property of the node throws an error, this is
* probably the anonymous div wrapper Gecko adds inside text
* nodes. This likely will only occur when attempting to access
* the relatedTarget. In this case, we now return null because
* the anonymous div is completely useless and we do not know
* what the related target was because we can't even get to
* the element's parent node.
*
* @method resolve
* @private
*/
resolve = function(n) {
if (!n) {
return n;
}
try {
if (n && 3 == n.nodeType) {
n = n.parentNode;
}
} catch(e) {
return null;
}
return Y.one(n);
},
DOMEventFacade = function(ev, currentTarget, wrapper) {
this._event = ev;
this._currentTarget = currentTarget;
this._wrapper = wrapper || EMPTY;
// if not lazy init
this.init();
};
Y.extend(DOMEventFacade, Object, {
init: function() {
var e = this._event,
overrides = this._wrapper.overrides,
x = e.pageX,
y = e.pageY,
c,
currentTarget = this._currentTarget;
this.altKey = e.altKey;
this.ctrlKey = e.ctrlKey;
this.metaKey = e.metaKey;
this.shiftKey = e.shiftKey;
this.type = (overrides && overrides.type) || e.type;
this.clientX = e.clientX;
this.clientY = e.clientY;
this.pageX = x;
this.pageY = y;
c = e.keyCode || e.charCode;
if (ua.webkit && (c in webkitKeymap)) {
c = webkitKeymap[c];
}
this.keyCode = c;
this.charCode = c;
this.which = e.which || e.charCode || c;
// this.button = e.button;
this.button = this.which;
this.target = resolve(e.target);
this.currentTarget = resolve(currentTarget);
this.relatedTarget = resolve(e.relatedTarget);
if (e.type == "mousewheel" || e.type == "DOMMouseScroll") {
this.wheelDelta = (e.detail) ? (e.detail * -1) : Math.round(e.wheelDelta / 80) || ((e.wheelDelta < 0) ? -1 : 1);
}
if (this._touch) {
this._touch(e, currentTarget, this._wrapper);
}
},
stopPropagation: function() {
this._event.stopPropagation();
this._wrapper.stopped = 1;
this.stopped = 1;
},
stopImmediatePropagation: function() {
var e = this._event;
if (e.stopImmediatePropagation) {
e.stopImmediatePropagation();
} else {
this.stopPropagation();
}
this._wrapper.stopped = 2;
this.stopped = 2;
},
preventDefault: function(returnValue) {
var e = this._event;
e.preventDefault();
e.returnValue = returnValue || false;
this._wrapper.prevented = 1;
this.prevented = 1;
},
halt: function(immediate) {
if (immediate) {
this.stopImmediatePropagation();
} else {
this.stopPropagation();
}
this.preventDefault();
}
});
DOMEventFacade.resolve = resolve;
Y.DOM2EventFacade = DOMEventFacade;
Y.DOMEventFacade = DOMEventFacade;
/**
* The native event
* @property _event
*/
/**
* The X location of the event on the page (including scroll)
* @property pageX
* @type int
*/
/**
* The Y location of the event on the page (including scroll)
* @property pageY
* @type int
*/
/**
* The keyCode for key events. Uses charCode if keyCode is not available
* @property keyCode
* @type int
*/
/**
* The charCode for key events. Same as keyCode
* @property charCode
* @type int
*/
/**
* The button that was pushed.
* @property button
* @type int
*/
/**
* The button that was pushed. Same as button.
* @property which
* @type int
*/
/**
* Node reference for the targeted element
* @propery target
* @type Node
*/
/**
* Node reference for the element that the listener was attached to.
* @propery currentTarget
* @type Node
*/
/**
* Node reference to the relatedTarget
* @propery relatedTarget
* @type Node
*/
/**
* Number representing the direction and velocity of the movement of the mousewheel.
* Negative is down, the higher the number, the faster. Applies to the mousewheel event.
* @property wheelDelta
* @type int
*/
/**
* Stops the propagation to the next bubble target
* @method stopPropagation
*/
/**
* Stops the propagation to the next bubble target and
* prevents any additional listeners from being exectued
* on the current target.
* @method stopImmediatePropagation
*/
/**
* Prevents the event's default behavior
* @method preventDefault
* @param returnValue {string} sets the returnValue of the event to this value
* (rather than the default false value). This can be used to add a customized
* confirmation query to the beforeunload event).
*/
/**
* Stops the event propagation and prevents the default
* event behavior.
* @method halt
* @param immediate {boolean} if true additional listeners
* on the current target will not be executed
*/
(function() {
/**
* DOM event listener abstraction layer
* @module event
* @submodule event-base
*/
/**
* The event utility provides functions to add and remove event listeners,
* event cleansing. It also tries to automatically remove listeners it
* registers during the unload event.
*
* @class Event
* @static
*/
Y.Env.evt.dom_wrappers = {};
Y.Env.evt.dom_map = {};
var _eventenv = Y.Env.evt,
config = Y.config,
win = config.win,
add = YUI.Env.add,
remove = YUI.Env.remove,
onLoad = function() {
YUI.Env.windowLoaded = true;
Y.Event._load();
remove(win, "load", onLoad);
},
onUnload = function() {
Y.Event._unload();
},
EVENT_READY = 'domready',
COMPAT_ARG = '~yui|2|compat~',
shouldIterate = function(o) {
try {
return (o && typeof o !== "string" && Y.Lang.isNumber(o.length) &&
!o.tagName && !o.alert);
} catch(ex) {
return false;
}
},
Event = function() {
/**
* True after the onload event has fired
* @property _loadComplete
* @type boolean
* @static
* @private
*/
var _loadComplete = false,
/**
* The number of times to poll after window.onload. This number is
* increased if additional late-bound handlers are requested after
* the page load.
* @property _retryCount
* @static
* @private
*/
_retryCount = 0,
/**
* onAvailable listeners
* @property _avail
* @static
* @private
*/
_avail = [],
/**
* Custom event wrappers for DOM events. Key is
* 'event:' + Element uid stamp + event type
* @property _wrappers
* @type Y.Event.Custom
* @static
* @private
*/
_wrappers = _eventenv.dom_wrappers,
_windowLoadKey = null,
/**
* Custom event wrapper map DOM events. Key is
* Element uid stamp. Each item is a hash of custom event
* wrappers as provided in the _wrappers collection. This
* provides the infrastructure for getListeners.
* @property _el_events
* @static
* @private
*/
_el_events = _eventenv.dom_map;
return {
/**
* The number of times we should look for elements that are not
* in the DOM at the time the event is requested after the document
* has been loaded. The default is 1000@amp;40 ms, so it will poll
* for 40 seconds or until all outstanding handlers are bound
* (whichever comes first).
* @property POLL_RETRYS
* @type int
* @static
* @final
*/
POLL_RETRYS: 1000,
/**
* The poll interval in milliseconds
* @property POLL_INTERVAL
* @type int
* @static
* @final
*/
POLL_INTERVAL: 40,
/**
* addListener/removeListener can throw errors in unexpected scenarios.
* These errors are suppressed, the method returns false, and this property
* is set
* @property lastError
* @static
* @type Error
*/
lastError: null,
/**
* poll handle
* @property _interval
* @static
* @private
*/
_interval: null,
/**
* document readystate poll handle
* @property _dri
* @static
* @private
*/
_dri: null,
/**
* True when the document is initially usable
* @property DOMReady
* @type boolean
* @static
*/
DOMReady: false,
/**
* @method startInterval
* @static
* @private
*/
startInterval: function() {
if (!Event._interval) {
Event._interval = setInterval(Event._poll, Event.POLL_INTERVAL);
}
},
/**
* Executes the supplied callback when the item with the supplied
* id is found. This is meant to be used to execute behavior as
* soon as possible as the page loads. If you use this after the
* initial page load it will poll for a fixed time for the element.
* The number of times it will poll and the frequency are
* configurable. By default it will poll for 10 seconds.
*
* <p>The callback is executed with a single parameter:
* the custom object parameter, if provided.</p>
*
* @method onAvailable
*
* @param {string||string[]} id the id of the element, or an array
* of ids to look for.
* @param {function} fn what to execute when the element is found.
* @param {object} p_obj an optional object to be passed back as
* a parameter to fn.
* @param {boolean|object} p_override If set to true, fn will execute
* in the context of p_obj, if set to an object it
* will execute in the context of that object
* @param checkContent {boolean} check child node readiness (onContentReady)
* @static
* @deprecated Use Y.on("available")
*/
// @TODO fix arguments
onAvailable: function(id, fn, p_obj, p_override, checkContent, compat) {
var a = Y.Array(id), i, availHandle;
for (i=0; i<a.length; i=i+1) {
_avail.push({
id: a[i],
fn: fn,
obj: p_obj,
override: p_override,
checkReady: checkContent,
compat: compat
});
}
_retryCount = this.POLL_RETRYS;
// We want the first test to be immediate, but async
setTimeout(Event._poll, 0);
availHandle = new Y.EventHandle({
_delete: function() {
// set by the event system for lazy DOM listeners
if (availHandle.handle) {
availHandle.handle.detach();
return;
}
var i, j;
// otherwise try to remove the onAvailable listener(s)
for (i = 0; i < a.length; i++) {
for (j = 0; j < _avail.length; j++) {
if (a[i] === _avail[j].id) {
_avail.splice(j, 1);
}
}
}
}
});
return availHandle;
},
/**
* Works the same way as onAvailable, but additionally checks the
* state of sibling elements to determine if the content of the
* available element is safe to modify.
*
* <p>The callback is executed with a single parameter:
* the custom object parameter, if provided.</p>
*
* @method onContentReady
*
* @param {string} id the id of the element to look for.
* @param {function} fn what to execute when the element is ready.
* @param {object} obj an optional object to be passed back as
* a parameter to fn.
* @param {boolean|object} override If set to true, fn will execute
* in the context of p_obj. If an object, fn will
* exectute in the context of that object
*
* @static
* @deprecated Use Y.on("contentready")
*/
// @TODO fix arguments
onContentReady: function(id, fn, obj, override, compat) {
return Event.onAvailable(id, fn, obj, override, true, compat);
},
/**
* Adds an event listener
*
* @method attach
*
* @param {String} type The type of event to append
* @param {Function} fn The method the event invokes
* @param {String|HTMLElement|Array|NodeList} el An id, an element
* reference, or a collection of ids and/or elements to assign the
* listener to.
* @param {Object} context optional context object
* @param {Boolean|object} args 0..n arguments to pass to the callback
* @return {EventHandle} an object to that can be used to detach the listener
*
* @static
*/
attach: function(type, fn, el, context) {
return Event._attach(Y.Array(arguments, 0, true));
},
_createWrapper: function (el, type, capture, compat, facade) {
var cewrapper,
ek = Y.stamp(el),
key = 'event:' + ek + type;
if (false === facade) {
key += 'native';
}
if (capture) {
key += 'capture';
}
cewrapper = _wrappers[key];
if (!cewrapper) {
// create CE wrapper
cewrapper = Y.publish(key, {
silent: true,
bubbles: false,
contextFn: function() {
if (compat) {
return cewrapper.el;
} else {
cewrapper.nodeRef = cewrapper.nodeRef || Y.one(cewrapper.el);
return cewrapper.nodeRef;
}
}
});
cewrapper.overrides = {};
// for later removeListener calls
cewrapper.el = el;
cewrapper.key = key;
cewrapper.domkey = ek;
cewrapper.type = type;
cewrapper.fn = function(e) {
cewrapper.fire(Event.getEvent(e, el, (compat || (false === facade))));
};
cewrapper.capture = capture;
if (el == win && type == "load") {
// window load happens once
cewrapper.fireOnce = true;
_windowLoadKey = key;
}
_wrappers[key] = cewrapper;
_el_events[ek] = _el_events[ek] || {};
_el_events[ek][key] = cewrapper;
add(el, type, cewrapper.fn, capture);
}
return cewrapper;
},
_attach: function(args, conf) {
var compat,
handles, oEl, cewrapper, context,
fireNow = false, ret,
type = args[0],
fn = args[1],
el = args[2] || win,
facade = conf && conf.facade,
capture = conf && conf.capture,
overrides = conf && conf.overrides;
if (args[args.length-1] === COMPAT_ARG) {
compat = true;
// trimmedArgs.pop();
}
if (!fn || !fn.call) {
// throw new TypeError(type + " attach call failed, callback undefined");
return false;
}
// The el argument can be an array of elements or element ids.
if (shouldIterate(el)) {
handles=[];
Y.each(el, function(v, k) {
args[2] = v;
handles.push(Event._attach(args, conf));
});
// return (handles.length === 1) ? handles[0] : handles;
return new Y.EventHandle(handles);
// If the el argument is a string, we assume it is
// actually the id of the element. If the page is loaded
// we convert el to the actual element, otherwise we
// defer attaching the event until the element is
// ready
} else if (Y.Lang.isString(el)) {
// oEl = (compat) ? Y.DOM.byId(el) : Y.Selector.query(el);
if (compat) {
oEl = Y.DOM.byId(el);
} else {
oEl = Y.Selector.query(el);
switch (oEl.length) {
case 0:
oEl = null;
break;
case 1:
oEl = oEl[0];
break;
default:
args[2] = oEl;
return Event._attach(args, conf);
}
}
if (oEl) {
el = oEl;
// Not found = defer adding the event until the element is available
} else {
ret = Event.onAvailable(el, function() {
ret.handle = Event._attach(args, conf);
}, Event, true, false, compat);
return ret;
}
}
// Element should be an html element or node
if (!el) {
return false;
}
if (Y.Node && Y.instanceOf(el, Y.Node)) {
el = Y.Node.getDOMNode(el);
}
cewrapper = Event._createWrapper(el, type, capture, compat, facade);
if (overrides) {
Y.mix(cewrapper.overrides, overrides);
}
if (el == win && type == "load") {
// if the load is complete, fire immediately.
// all subscribers, including the current one
// will be notified.
if (YUI.Env.windowLoaded) {
fireNow = true;
}
}
if (compat) {
args.pop();
}
context = args[3];
// set context to the Node if not specified
// ret = cewrapper.on.apply(cewrapper, trimmedArgs);
ret = cewrapper._on(fn, context, (args.length > 4) ? args.slice(4) : null);
if (fireNow) {
cewrapper.fire();
}
return ret;
},
/**
* Removes an event listener. Supports the signature the event was bound
* with, but the preferred way to remove listeners is using the handle
* that is returned when using Y.on
*
* @method detach
*
* @param {String} type the type of event to remove.
* @param {Function} fn the method the event invokes. If fn is
* undefined, then all event handlers for the type of event are
* removed.
* @param {String|HTMLElement|Array|NodeList|EventHandle} el An
* event handle, an id, an element reference, or a collection
* of ids and/or elements to remove the listener from.
* @return {boolean} true if the unbind was successful, false otherwise.
* @static
*/
detach: function(type, fn, el, obj) {
var args=Y.Array(arguments, 0, true), compat, l, ok, i,
id, ce;
if (args[args.length-1] === COMPAT_ARG) {
compat = true;
// args.pop();
}
if (type && type.detach) {
return type.detach();
}
// The el argument can be a string
if (typeof el == "string") {
// el = (compat) ? Y.DOM.byId(el) : Y.all(el);
if (compat) {
el = Y.DOM.byId(el);
} else {
el = Y.Selector.query(el);
l = el.length;
if (l < 1) {
el = null;
} else if (l == 1) {
el = el[0];
}
}
// return Event.detach.apply(Event, args);
}
if (!el) {
return false;
}
if (el.detach) {
args.splice(2, 1);
return el.detach.apply(el, args);
// The el argument can be an array of elements or element ids.
} else if (shouldIterate(el)) {
ok = true;
for (i=0, l=el.length; i<l; ++i) {
args[2] = el[i];
ok = ( Y.Event.detach.apply(Y.Event, args) && ok );
}
return ok;
}
if (!type || !fn || !fn.call) {
return Event.purgeElement(el, false, type);
}
id = 'event:' + Y.stamp(el) + type;
ce = _wrappers[id];
if (ce) {
return ce.detach(fn);
} else {
return false;
}
},
/**
* Finds the event in the window object, the caller's arguments, or
* in the arguments of another method in the callstack. This is
* executed automatically for events registered through the event
* manager, so the implementer should not normally need to execute
* this function at all.
* @method getEvent
* @param {Event} e the event parameter from the handler
* @param {HTMLElement} el the element the listener was attached to
* @return {Event} the event
* @static
*/
getEvent: function(e, el, noFacade) {
var ev = e || win.event;
return (noFacade) ? ev :
new Y.DOMEventFacade(ev, el, _wrappers['event:' + Y.stamp(el) + e.type]);
},
/**
* Generates an unique ID for the element if it does not already
* have one.
* @method generateId
* @param el the element to create the id for
* @return {string} the resulting id of the element
* @static
*/
generateId: function(el) {
return Y.DOM.generateID(el);
},
/**
* We want to be able to use getElementsByTagName as a collection
* to attach a group of events to. Unfortunately, different
* browsers return different types of collections. This function
* tests to determine if the object is array-like. It will also
* fail if the object is an array, but is empty.
* @method _isValidCollection
* @param o the object to test
* @return {boolean} true if the object is array-like and populated
* @deprecated was not meant to be used directly
* @static
* @private
*/
_isValidCollection: shouldIterate,
/**
* hook up any deferred listeners
* @method _load
* @static
* @private
*/
_load: function(e) {
if (!_loadComplete) {
_loadComplete = true;
// Just in case DOMReady did not go off for some reason
// E._ready();
if (Y.fire) {
Y.fire(EVENT_READY);
}
// Available elements may not have been detected before the
// window load event fires. Try to find them now so that the
// the user is more likely to get the onAvailable notifications
// before the window load notification
Event._poll();
}
},
/**
* Polling function that runs before the onload event fires,
* attempting to attach to DOM Nodes as soon as they are
* available
* @method _poll
* @static
* @private
*/
_poll: function() {
if (Event.locked) {
return;
}
if (Y.UA.ie && !YUI.Env.DOMReady) {
// Hold off if DOMReady has not fired and check current
// readyState to protect against the IE operation aborted
// issue.
Event.startInterval();
return;
}
Event.locked = true;
// keep trying until after the page is loaded. We need to
// check the page load state prior to trying to bind the
// elements so that we can be certain all elements have been
// tested appropriately
var i, len, item, el, notAvail, executeItem,
tryAgain = !_loadComplete;
if (!tryAgain) {
tryAgain = (_retryCount > 0);
}
// onAvailable
notAvail = [];
executeItem = function (el, item) {
var context, ov = item.override;
if (item.compat) {
if (item.override) {
if (ov === true) {
context = item.obj;
} else {
context = ov;
}
} else {
context = el;
}
item.fn.call(context, item.obj);
} else {
context = item.obj || Y.one(el);
item.fn.apply(context, (Y.Lang.isArray(ov)) ? ov : []);
}
};
// onAvailable
for (i=0,len=_avail.length; i<len; ++i) {
item = _avail[i];
if (item && !item.checkReady) {
// el = (item.compat) ? Y.DOM.byId(item.id) : Y.one(item.id);
el = (item.compat) ? Y.DOM.byId(item.id) : Y.Selector.query(item.id, null, true);
if (el) {
executeItem(el, item);
_avail[i] = null;
} else {
notAvail.push(item);
}
}
}
// onContentReady
for (i=0,len=_avail.length; i<len; ++i) {
item = _avail[i];
if (item && item.checkReady) {
// el = (item.compat) ? Y.DOM.byId(item.id) : Y.one(item.id);
el = (item.compat) ? Y.DOM.byId(item.id) : Y.Selector.query(item.id, null, true);
if (el) {
// The element is available, but not necessarily ready
// @todo should we test parentNode.nextSibling?
if (_loadComplete || (el.get && el.get('nextSibling')) || el.nextSibling) {
executeItem(el, item);
_avail[i] = null;
}
} else {
notAvail.push(item);
}
}
}
_retryCount = (notAvail.length === 0) ? 0 : _retryCount - 1;
if (tryAgain) {
// we may need to strip the nulled out items here
Event.startInterval();
} else {
clearInterval(Event._interval);
Event._interval = null;
}
Event.locked = false;
return;
},
/**
* Removes all listeners attached to the given element via addListener.
* Optionally, the node's children can also be purged.
* Optionally, you can specify a specific type of event to remove.
* @method purgeElement
* @param {HTMLElement} el the element to purge
* @param {boolean} recurse recursively purge this element's children
* as well. Use with caution.
* @param {string} type optional type of listener to purge. If
* left out, all listeners will be removed
* @static
*/
purgeElement: function(el, recurse, type) {
// var oEl = (Y.Lang.isString(el)) ? Y.one(el) : el,
var oEl = (Y.Lang.isString(el)) ? Y.Selector.query(el, null, true) : el,
lis = Event.getListeners(oEl, type), i, len, props, children, child;
if (recurse && oEl) {
lis = lis || [];
children = Y.Selector.query('*', oEl);
i = 0;
len = children.length;
for (; i < len; ++i) {
child = Event.getListeners(children[i], type);
if (child) {
lis = lis.concat(child);
}
}
}
if (lis) {
i = 0;
len = lis.length;
for (; i < len; ++i) {
props = lis[i];
props.detachAll();
remove(props.el, props.type, props.fn, props.capture);
delete _wrappers[props.key];
delete _el_events[props.domkey][props.key];
}
}
},
/**
* Returns all listeners attached to the given element via addListener.
* Optionally, you can specify a specific type of event to return.
* @method getListeners
* @param el {HTMLElement|string} the element or element id to inspect
* @param type {string} optional type of listener to return. If
* left out, all listeners will be returned
* @return {Y.Custom.Event} the custom event wrapper for the DOM event(s)
* @static
*/
getListeners: function(el, type) {
var ek = Y.stamp(el, true), evts = _el_events[ek],
results=[] , key = (type) ? 'event:' + ek + type : null,
adapters = _eventenv.plugins;
if (!evts) {
return null;
}
if (key) {
// look for synthetic events
if (adapters[type] && adapters[type].eventDef) {
key += '_synth';
}
if (evts[key]) {
results.push(evts[key]);
}
// get native events as well
key += 'native';
if (evts[key]) {
results.push(evts[key]);
}
} else {
Y.each(evts, function(v, k) {
results.push(v);
});
}
return (results.length) ? results : null;
},
/**
* Removes all listeners registered by pe.event. Called
* automatically during the unload event.
* @method _unload
* @static
* @private
*/
_unload: function(e) {
Y.each(_wrappers, function(v, k) {
v.detachAll();
remove(v.el, v.type, v.fn, v.capture);
delete _wrappers[k];
delete _el_events[v.domkey][k];
});
remove(win, "unload", onUnload);
},
/**
* Adds a DOM event directly without the caching, cleanup, context adj, etc
*
* @method nativeAdd
* @param {HTMLElement} el the element to bind the handler to
* @param {string} type the type of event handler
* @param {function} fn the callback to invoke
* @param {boolen} capture capture or bubble phase
* @static
* @private
*/
nativeAdd: add,
/**
* Basic remove listener
*
* @method nativeRemove
* @param {HTMLElement} el the element to bind the handler to
* @param {string} type the type of event handler
* @param {function} fn the callback to invoke
* @param {boolen} capture capture or bubble phase
* @static
* @private
*/
nativeRemove: remove
};
}();
Y.Event = Event;
if (config.injected || YUI.Env.windowLoaded) {
onLoad();
} else {
add(win, "load", onLoad);
}
// Process onAvailable/onContentReady items when when the DOM is ready in IE
if (Y.UA.ie) {
Y.on(EVENT_READY, Event._poll);
}
add(win, "unload", onUnload);
Event.Custom = Y.CustomEvent;
Event.Subscriber = Y.Subscriber;
Event.Target = Y.EventTarget;
Event.Handle = Y.EventHandle;
Event.Facade = Y.EventFacade;
Event._poll();
})();
/**
* DOM event listener abstraction layer
* @module event
* @submodule event-base
*/
/**
* Executes the callback as soon as the specified element
* is detected in the DOM. This function expects a selector
* string for the element(s) to detect. If you already have
* an element reference, you don't need this event.
* @event available
* @param type {string} 'available'
* @param fn {function} the callback function to execute.
* @param el {string} an selector for the element(s) to attach
* @param context optional argument that specifies what 'this' refers to.
* @param args* 0..n additional arguments to pass on to the callback function.
* These arguments will be added after the event object.
* @return {EventHandle} the detach handle
* @for YUI
*/
Y.Env.evt.plugins.available = {
on: function(type, fn, id, o) {
var a = arguments.length > 4 ? Y.Array(arguments, 4, true) : null;
return Y.Event.onAvailable.call(Y.Event, id, fn, o, a);
}
};
/**
* Executes the callback as soon as the specified element
* is detected in the DOM with a nextSibling property
* (indicating that the element's children are available).
* This function expects a selector
* string for the element(s) to detect. If you already have
* an element reference, you don't need this event.
* @event contentready
* @param type {string} 'contentready'
* @param fn {function} the callback function to execute.
* @param el {string} an selector for the element(s) to attach.
* @param context optional argument that specifies what 'this' refers to.
* @param args* 0..n additional arguments to pass on to the callback function.
* These arguments will be added after the event object.
* @return {EventHandle} the detach handle
* @for YUI
*/
Y.Env.evt.plugins.contentready = {
on: function(type, fn, id, o) {
var a = arguments.length > 4 ? Y.Array(arguments, 4, true) : null;
return Y.Event.onContentReady.call(Y.Event, id, fn, o, a);
}
};
}, '3.3.0' ,{requires:['event-custom-base']});
(function() {
var stateChangeListener,
GLOBAL_ENV = YUI.Env,
config = YUI.config,
doc = config.doc,
docElement = doc && doc.documentElement,
EVENT_NAME = 'onreadystatechange',
pollInterval = config.pollInterval || 40;
if (docElement.doScroll && !GLOBAL_ENV._ieready) {
GLOBAL_ENV._ieready = function() {
GLOBAL_ENV._ready();
};
/*! DOMReady: based on work by: Dean Edwards/John Resig/Matthias Miller/Diego Perini */
// Internet Explorer: use the doScroll() method on the root element.
// This isolates what appears to be a safe moment to manipulate the
// DOM prior to when the document's readyState suggests it is safe to do so.
if (self !== self.top) {
stateChangeListener = function() {
if (doc.readyState == 'complete') {
GLOBAL_ENV.remove(doc, EVENT_NAME, stateChangeListener);
GLOBAL_ENV.ieready();
}
};
GLOBAL_ENV.add(doc, EVENT_NAME, stateChangeListener);
} else {
GLOBAL_ENV._dri = setInterval(function() {
try {
docElement.doScroll('left');
clearInterval(GLOBAL_ENV._dri);
GLOBAL_ENV._dri = null;
GLOBAL_ENV._ieready();
} catch (domNotReady) { }
}, pollInterval);
}
}
})();
YUI.add('event-base-ie', function(Y) {
/*
* Custom event engine, DOM event listener abstraction layer, synthetic DOM
* events.
* @module event
* @submodule event-base
*/
var IEEventFacade = function() {
// IEEventFacade.superclass.constructor.apply(this, arguments);
Y.DOM2EventFacade.apply(this, arguments);
};
Y.extend(IEEventFacade, Y.DOM2EventFacade, {
init: function() {
IEEventFacade.superclass.init.apply(this, arguments);
var e = this._event,
resolve = Y.DOM2EventFacade.resolve,
x, y, d, b, de, t;
this.target = resolve(e.srcElement);
if (('clientX' in e) && (!x) && (0 !== x)) {
x = e.clientX;
y = e.clientY;
d = Y.config.doc;
b = d.body;
de = d.documentElement;
x += (de.scrollLeft || (b && b.scrollLeft) || 0);
y += (de.scrollTop || (b && b.scrollTop) || 0);
this.pageX = x;
this.pageY = y;
}
if (e.type == "mouseout") {
t = e.toElement;
} else if (e.type == "mouseover") {
t = e.fromElement;
}
this.relatedTarget = resolve(t);
// which should contain the unicode key code if this is a key event
// if (e.charCode) {
// this.which = e.charCode;
// }
// for click events, which is normalized for which mouse button was
// clicked.
if (e.button) {
switch (e.button) {
case 2:
this.which = 3;
break;
case 4:
this.which = 2;
break;
default:
this.which = e.button;
}
this.button = this.which;
}
},
stopPropagation: function() {
var e = this._event;
e.cancelBubble = true;
this._wrapper.stopped = 1;
this.stopped = 1;
},
stopImmediatePropagation: function() {
this.stopPropagation();
this._wrapper.stopped = 2;
this.stopped = 2;
},
preventDefault: function(returnValue) {
this._event.returnValue = returnValue || false;
this._wrapper.prevented = 1;
this.prevented = 1;
}
});
var imp = Y.config.doc && Y.config.doc.implementation;
if (imp && (!imp.hasFeature('Events', '2.0'))) {
Y.DOMEventFacade = IEEventFacade;
}
}, '3.3.0' );
YUI.add('pluginhost-base', function(Y) {
/**
* Provides the augmentable PluginHost interface, which can be added to any class.
* @module pluginhost
*/
/**
* Provides the augmentable PluginHost interface, which can be added to any class.
* @module pluginhost-base
*/
/**
* <p>
* An augmentable class, which provides the augmented class with the ability to host plugins.
* It adds <a href="#method_plug">plug</a> and <a href="#method_unplug">unplug</a> methods to the augmented class, which can
* be used to add or remove plugins from instances of the class.
* </p>
*
* <p>Plugins can also be added through the constructor configuration object passed to the host class' constructor using
* the "plugins" property. Supported values for the "plugins" property are those defined by the <a href="#method_plug">plug</a> method.
*
* For example the following code would add the AnimPlugin and IOPlugin to Overlay (the plugin host):
* <xmp>
* var o = new Overlay({plugins: [ AnimPlugin, {fn:IOPlugin, cfg:{section:"header"}}]});
* </xmp>
* </p>
* <p>
* Plug.Host's protected <a href="#method_initPlugins">_initPlugins</a> and <a href="#method_destroyPlugins">_destroyPlugins</a>
* methods should be invoked by the host class at the appropriate point in the host's lifecyle.
* </p>
*
* @class Plugin.Host
*/
var L = Y.Lang;
function PluginHost() {
this._plugins = {};
}
PluginHost.prototype = {
/**
* Adds a plugin to the host object. This will instantiate the
* plugin and attach it to the configured namespace on the host object.
*
* @method plug
* @chainable
* @param P {Function | Object |Array} Accepts the plugin class, or an
* object with a "fn" property specifying the plugin class and
* a "cfg" property specifying the configuration for the Plugin.
* <p>
* Additionally an Array can also be passed in, with the above function or
* object values, allowing the user to add multiple plugins in a single call.
* </p>
* @param config (Optional) If the first argument is the plugin class, the second argument
* can be the configuration for the plugin.
* @return {Base} A reference to the host object
*/
plug: function(Plugin, config) {
var i, ln, ns;
if (L.isArray(Plugin)) {
for (i = 0, ln = Plugin.length; i < ln; i++) {
this.plug(Plugin[i]);
}
} else {
if (Plugin && !L.isFunction(Plugin)) {
config = Plugin.cfg;
Plugin = Plugin.fn;
}
// Plugin should be fn by now
if (Plugin && Plugin.NS) {
ns = Plugin.NS;
config = config || {};
config.host = this;
if (this.hasPlugin(ns)) {
// Update config
this[ns].setAttrs(config);
} else {
// Create new instance
this[ns] = new Plugin(config);
this._plugins[ns] = Plugin;
}
}
}
return this;
},
/**
* Removes a plugin from the host object. This will destroy the
* plugin instance and delete the namepsace from the host object.
*
* @method unplug
* @param {String | Function} plugin The namespace of the plugin, or the plugin class with the static NS namespace property defined. If not provided,
* all registered plugins are unplugged.
* @return {Base} A reference to the host object
* @chainable
*/
unplug: function(plugin) {
var ns = plugin,
plugins = this._plugins;
if (plugin) {
if (L.isFunction(plugin)) {
ns = plugin.NS;
if (ns && (!plugins[ns] || plugins[ns] !== plugin)) {
ns = null;
}
}
if (ns) {
if (this[ns]) {
this[ns].destroy();
delete this[ns];
}
if (plugins[ns]) {
delete plugins[ns];
}
}
} else {
for (ns in this._plugins) {
if (this._plugins.hasOwnProperty(ns)) {
this.unplug(ns);
}
}
}
return this;
},
/**
* Determines if a plugin has plugged into this host.
*
* @method hasPlugin
* @param {String} ns The plugin's namespace
* @return {boolean} returns true, if the plugin has been plugged into this host, false otherwise.
*/
hasPlugin : function(ns) {
return (this._plugins[ns] && this[ns]);
},
/**
* Initializes static plugins registered on the host (using the
* Base.plug static method) and any plugins passed to the
* instance through the "plugins" configuration property.
*
* @method _initPlugins
* @param {Config} config The configuration object with property name/value pairs.
* @private
*/
_initPlugins: function(config) {
this._plugins = this._plugins || {};
if (this._initConfigPlugins) {
this._initConfigPlugins(config);
}
},
/**
* Unplugs and destroys all plugins on the host
* @method _destroyPlugins
* @private
*/
_destroyPlugins: function() {
this.unplug();
}
};
Y.namespace("Plugin").Host = PluginHost;
}, '3.3.0' ,{requires:['yui-base']});
YUI.add('pluginhost-config', function(Y) {
/**
* Adds pluginhost constructor configuration and static configuration support
* @submodule pluginhost-config
*/
/**
* Constructor and static configuration support for plugins
*
* @for Plugin.Host
*/
var PluginHost = Y.Plugin.Host,
L = Y.Lang;
PluginHost.prototype._initConfigPlugins = function(config) {
// Class Configuration
var classes = (this._getClasses) ? this._getClasses() : [this.constructor],
plug = [],
unplug = {},
constructor, i, classPlug, classUnplug, pluginClassName;
// TODO: Room for optimization. Can we apply statically/unplug in same pass?
for (i = classes.length - 1; i >= 0; i--) {
constructor = classes[i];
classUnplug = constructor._UNPLUG;
if (classUnplug) {
// subclasses over-write
Y.mix(unplug, classUnplug, true);
}
classPlug = constructor._PLUG;
if (classPlug) {
// subclasses over-write
Y.mix(plug, classPlug, true);
}
}
for (pluginClassName in plug) {
if (plug.hasOwnProperty(pluginClassName)) {
if (!unplug[pluginClassName]) {
this.plug(plug[pluginClassName]);
}
}
}
// User Configuration
if (config && config.plugins) {
this.plug(config.plugins);
}
};
/**
* Registers plugins to be instantiated at the class level (plugins
* which should be plugged into every instance of the class by default).
*
* @method Plugin.Host.plug
* @static
*
* @param {Function} hostClass The host class on which to register the plugins
* @param {Function | Array} plugin Either the plugin class, an array of plugin classes or an array of objects (with fn and cfg properties defined)
* @param {Object} config (Optional) If plugin is the plugin class, the configuration for the plugin
*/
PluginHost.plug = function(hostClass, plugin, config) {
// Cannot plug into Base, since Plugins derive from Base [ will cause infinite recurrsion ]
var p, i, l, name;
if (hostClass !== Y.Base) {
hostClass._PLUG = hostClass._PLUG || {};
if (!L.isArray(plugin)) {
if (config) {
plugin = {fn:plugin, cfg:config};
}
plugin = [plugin];
}
for (i = 0, l = plugin.length; i < l;i++) {
p = plugin[i];
name = p.NAME || p.fn.NAME;
hostClass._PLUG[name] = p;
}
}
};
/**
* Unregisters any class level plugins which have been registered by the host class, or any
* other class in the hierarchy.
*
* @method Plugin.Host.unplug
* @static
*
* @param {Function} hostClass The host class from which to unregister the plugins
* @param {Function | Array} plugin The plugin class, or an array of plugin classes
*/
PluginHost.unplug = function(hostClass, plugin) {
var p, i, l, name;
if (hostClass !== Y.Base) {
hostClass._UNPLUG = hostClass._UNPLUG || {};
if (!L.isArray(plugin)) {
plugin = [plugin];
}
for (i = 0, l = plugin.length; i < l; i++) {
p = plugin[i];
name = p.NAME;
if (!hostClass._PLUG[name]) {
hostClass._UNPLUG[name] = p;
} else {
delete hostClass._PLUG[name];
}
}
}
};
}, '3.3.0' ,{requires:['pluginhost-base']});
YUI.add('pluginhost', function(Y){}, '3.3.0' ,{use:['pluginhost-base', 'pluginhost-config']});
YUI.add('node-base', function(Y) {
/**
* The Node Utility provides a DOM-like interface for interacting with DOM nodes.
* @module node
* @submodule node-base
*/
/**
* The Node class provides a wrapper for manipulating DOM Nodes.
* Node properties can be accessed via the set/get methods.
* Use Y.get() to retrieve Node instances.
*
* <strong>NOTE:</strong> Node properties are accessed using
* the <code>set</code> and <code>get</code> methods.
*
* @class Node
* @constructor
* @param {DOMNode} node the DOM node to be mapped to the Node instance.
* @for Node
*/
// "globals"
var DOT = '.',
NODE_NAME = 'nodeName',
NODE_TYPE = 'nodeType',
OWNER_DOCUMENT = 'ownerDocument',
TAG_NAME = 'tagName',
UID = '_yuid',
_slice = Array.prototype.slice,
Y_DOM = Y.DOM,
Y_Node = function(node) {
var uid = (node.nodeType !== 9) ? node.uniqueID : node[UID];
if (uid && Y_Node._instances[uid] && Y_Node._instances[uid]._node !== node) {
node[UID] = null; // unset existing uid to prevent collision (via clone or hack)
}
uid = uid || Y.stamp(node);
if (!uid) { // stamp failed; likely IE non-HTMLElement
uid = Y.guid();
}
this[UID] = uid;
/**
* The underlying DOM node bound to the Y.Node instance
* @property _node
* @private
*/
this._node = node;
Y_Node._instances[uid] = this;
this._stateProxy = node; // when augmented with Attribute
Y.EventTarget.call(this, {emitFacade:true});
if (this._initPlugins) { // when augmented with Plugin.Host
this._initPlugins();
}
this.SHOW_TRANSITION = Y_Node.SHOW_TRANSITION;
this.HIDE_TRANSITION = Y_Node.HIDE_TRANSITION;
},
// used with previous/next/ancestor tests
_wrapFn = function(fn) {
var ret = null;
if (fn) {
ret = (typeof fn == 'string') ?
function(n) {
return Y.Selector.test(n, fn);
} :
function(n) {
return fn(Y.one(n));
};
}
return ret;
};
// end "globals"
/**
* The name of the component
* @static
* @property NAME
*/
Y_Node.NAME = 'node';
/*
* The pattern used to identify ARIA attributes
*/
Y_Node.re_aria = /^(?:role$|aria-)/;
Y_Node.SHOW_TRANSITION = 'fadeIn';
Y_Node.HIDE_TRANSITION = 'fadeOut';
/**
* List of events that route to DOM events
* @static
* @property DOM_EVENTS
*/
Y_Node.DOM_EVENTS = {
abort: 1,
beforeunload: 1,
blur: 1,
change: 1,
click: 1,
close: 1,
command: 1,
contextmenu: 1,
dblclick: 1,
DOMMouseScroll: 1,
drag: 1,
dragstart: 1,
dragenter: 1,
dragover: 1,
dragleave: 1,
dragend: 1,
drop: 1,
error: 1,
focus: 1,
key: 1,
keydown: 1,
keypress: 1,
keyup: 1,
load: 1,
message: 1,
mousedown: 1,
mouseenter: 1,
mouseleave: 1,
mousemove: 1,
mousemultiwheel: 1,
mouseout: 1,
mouseover: 1,
mouseup: 1,
mousewheel: 1,
orientationchange: 1,
reset: 1,
resize: 1,
select: 1,
selectstart: 1,
submit: 1,
scroll: 1,
textInput: 1,
unload: 1
};
// Add custom event adaptors to this list. This will make it so
// that delegate, key, available, contentready, etc all will
// be available through Node.on
Y.mix(Y_Node.DOM_EVENTS, Y.Env.evt.plugins);
/**
* A list of Node instances that have been created
* @private
* @property _instances
* @static
*
*/
Y_Node._instances = {};
/**
* Retrieves the DOM node bound to a Node instance
* @method getDOMNode
* @static
*
* @param {Y.Node || HTMLNode} node The Node instance or an HTMLNode
* @return {HTMLNode} The DOM node bound to the Node instance. If a DOM node is passed
* as the node argument, it is simply returned.
*/
Y_Node.getDOMNode = function(node) {
if (node) {
return (node.nodeType) ? node : node._node || null;
}
return null;
};
/**
* Checks Node return values and wraps DOM Nodes as Y.Node instances
* and DOM Collections / Arrays as Y.NodeList instances.
* Other return values just pass thru. If undefined is returned (e.g. no return)
* then the Node instance is returned for chainability.
* @method scrubVal
* @static
*
* @param {any} node The Node instance or an HTMLNode
* @return {Y.Node | Y.NodeList | any} Depends on what is returned from the DOM node.
*/
Y_Node.scrubVal = function(val, node) {
if (val) { // only truthy values are risky
if (typeof val == 'object' || typeof val == 'function') { // safari nodeList === function
if (NODE_TYPE in val || Y_DOM.isWindow(val)) {// node || window
val = Y.one(val);
} else if ((val.item && !val._nodes) || // dom collection or Node instance
(val[0] && val[0][NODE_TYPE])) { // array of DOM Nodes
val = Y.all(val);
}
}
} else if (typeof val === 'undefined') {
val = node; // for chaining
} else if (val === null) {
val = null; // IE: DOM null not the same as null
}
return val;
};
/**
* Adds methods to the Y.Node prototype, routing through scrubVal.
* @method addMethod
* @static
*
* @param {String} name The name of the method to add
* @param {Function} fn The function that becomes the method
* @param {Object} context An optional context to call the method with
* (defaults to the Node instance)
* @return {any} Depends on what is returned from the DOM node.
*/
Y_Node.addMethod = function(name, fn, context) {
if (name && fn && typeof fn == 'function') {
Y_Node.prototype[name] = function() {
var args = _slice.call(arguments),
node = this,
ret;
if (args[0] && Y.instanceOf(args[0], Y_Node)) {
args[0] = args[0]._node;
}
if (args[1] && Y.instanceOf(args[1], Y_Node)) {
args[1] = args[1]._node;
}
args.unshift(node._node);
ret = fn.apply(node, args);
if (ret) { // scrub truthy
ret = Y_Node.scrubVal(ret, node);
}
(typeof ret != 'undefined') || (ret = node);
return ret;
};
} else {
}
};
/**
* Imports utility methods to be added as Y.Node methods.
* @method importMethod
* @static
*
* @param {Object} host The object that contains the method to import.
* @param {String} name The name of the method to import
* @param {String} altName An optional name to use in place of the host name
* @param {Object} context An optional context to call the method with
*/
Y_Node.importMethod = function(host, name, altName) {
if (typeof name == 'string') {
altName = altName || name;
Y_Node.addMethod(altName, host[name], host);
} else {
Y.Array.each(name, function(n) {
Y_Node.importMethod(host, n);
});
}
};
/**
* Returns a single Node instance bound to the node or the
* first element matching the given selector. Returns null if no match found.
* <strong>Note:</strong> For chaining purposes you may want to
* use <code>Y.all</code>, which returns a NodeList when no match is found.
* @method Y.one
* @static
* @param {String | HTMLElement} node a node or Selector
* @return {Y.Node | null} a Node instance or null if no match found.
*/
Y_Node.one = function(node) {
var instance = null,
cachedNode,
uid;
if (node) {
if (typeof node == 'string') {
if (node.indexOf('doc') === 0) { // doc OR document
node = Y.config.doc;
} else if (node.indexOf('win') === 0) { // win OR window
node = Y.config.win;
} else {
node = Y.Selector.query(node, null, true);
}
if (!node) {
return null;
}
} else if (Y.instanceOf(node, Y_Node)) {
return node; // NOTE: return
}
if (node.nodeType || Y.DOM.isWindow(node)) { // avoid bad input (numbers, boolean, etc)
uid = (node.uniqueID && node.nodeType !== 9) ? node.uniqueID : node._yuid;
instance = Y_Node._instances[uid]; // reuse exising instances
cachedNode = instance ? instance._node : null;
if (!instance || (cachedNode && node !== cachedNode)) { // new Node when nodes don't match
instance = new Y_Node(node);
}
}
}
return instance;
};
/**
* Returns a new dom node using the provided markup string.
* @method create
* @static
* @param {String} html The markup used to create the element
* @param {HTMLDocument} doc An optional document context
* @return {Node} A Node instance bound to a DOM node or fragment
*/
Y_Node.create = function(html, doc) {
if (doc && doc._node) {
doc = doc._node;
}
return Y.one(Y_DOM.create(html, doc));
};
/**
* Static collection of configuration attributes for special handling
* @property ATTRS
* @static
* @type object
*/
Y_Node.ATTRS = {
/**
* Allows for getting and setting the text of an element.
* Formatting is preserved and special characters are treated literally.
* @config text
* @type String
*/
text: {
getter: function() {
return Y_DOM.getText(this._node);
},
setter: function(content) {
Y_DOM.setText(this._node, content);
return content;
}
},
'options': {
getter: function() {
return this._node.getElementsByTagName('option');
}
},
/**
* Returns a NodeList instance of all HTMLElement children.
* @readOnly
* @config children
* @type NodeList
*/
'children': {
getter: function() {
var node = this._node,
children = node.children,
childNodes, i, len;
if (!children) {
childNodes = node.childNodes;
children = [];
for (i = 0, len = childNodes.length; i < len; ++i) {
if (childNodes[i][TAG_NAME]) {
children[children.length] = childNodes[i];
}
}
}
return Y.all(children);
}
},
value: {
getter: function() {
return Y_DOM.getValue(this._node);
},
setter: function(val) {
Y_DOM.setValue(this._node, val);
return val;
}
}
};
/**
* The default setter for DOM properties
* Called with instance context (this === the Node instance)
* @method DEFAULT_SETTER
* @static
* @param {String} name The attribute/property being set
* @param {any} val The value to be set
* @return {any} The value
*/
Y_Node.DEFAULT_SETTER = function(name, val) {
var node = this._stateProxy,
strPath;
if (name.indexOf(DOT) > -1) {
strPath = name;
name = name.split(DOT);
// only allow when defined on node
Y.Object.setValue(node, name, val);
} else if (typeof node[name] != 'undefined') { // pass thru DOM properties
node[name] = val;
}
return val;
};
/**
* The default getter for DOM properties
* Called with instance context (this === the Node instance)
* @method DEFAULT_GETTER
* @static
* @param {String} name The attribute/property to look up
* @return {any} The current value
*/
Y_Node.DEFAULT_GETTER = function(name) {
var node = this._stateProxy,
val;
if (name.indexOf && name.indexOf(DOT) > -1) {
val = Y.Object.getValue(node, name.split(DOT));
} else if (typeof node[name] != 'undefined') { // pass thru from DOM
val = node[name];
}
return val;
};
// Basic prototype augment - no lazy constructor invocation.
Y.mix(Y_Node, Y.EventTarget, false, null, 1);
Y.mix(Y_Node.prototype, {
/**
* The method called when outputting Node instances as strings
* @method toString
* @return {String} A string representation of the Node instance
*/
toString: function() {
var str = this[UID] + ': not bound to a node',
node = this._node,
attrs, id, className;
if (node) {
attrs = node.attributes;
id = (attrs && attrs.id) ? node.getAttribute('id') : null;
className = (attrs && attrs.className) ? node.getAttribute('className') : null;
str = node[NODE_NAME];
if (id) {
str += '#' + id;
}
if (className) {
str += '.' + className.replace(' ', '.');
}
// TODO: add yuid?
str += ' ' + this[UID];
}
return str;
},
/**
* Returns an attribute value on the Node instance.
* Unless pre-configured (via Node.ATTRS), get hands
* off to the underlying DOM node. Only valid
* attributes/properties for the node will be set.
* @method get
* @param {String} attr The attribute
* @return {any} The current value of the attribute
*/
get: function(attr) {
var val;
if (this._getAttr) { // use Attribute imple
val = this._getAttr(attr);
} else {
val = this._get(attr);
}
if (val) {
val = Y_Node.scrubVal(val, this);
} else if (val === null) {
val = null; // IE: DOM null is not true null (even though they ===)
}
return val;
},
/**
* Helper method for get.
* @method _get
* @private
* @param {String} attr The attribute
* @return {any} The current value of the attribute
*/
_get: function(attr) {
var attrConfig = Y_Node.ATTRS[attr],
val;
if (attrConfig && attrConfig.getter) {
val = attrConfig.getter.call(this);
} else if (Y_Node.re_aria.test(attr)) {
val = this._node.getAttribute(attr, 2);
} else {
val = Y_Node.DEFAULT_GETTER.apply(this, arguments);
}
return val;
},
/**
* Sets an attribute on the Node instance.
* Unless pre-configured (via Node.ATTRS), set hands
* off to the underlying DOM node. Only valid
* attributes/properties for the node will be set.
* To set custom attributes use setAttribute.
* @method set
* @param {String} attr The attribute to be set.
* @param {any} val The value to set the attribute to.
* @chainable
*/
set: function(attr, val) {
var attrConfig = Y_Node.ATTRS[attr];
if (this._setAttr) { // use Attribute imple
this._setAttr.apply(this, arguments);
} else { // use setters inline
if (attrConfig && attrConfig.setter) {
attrConfig.setter.call(this, val, attr);
} else if (Y_Node.re_aria.test(attr)) { // special case Aria
this._node.setAttribute(attr, val);
} else {
Y_Node.DEFAULT_SETTER.apply(this, arguments);
}
}
return this;
},
/**
* Sets multiple attributes.
* @method setAttrs
* @param {Object} attrMap an object of name/value pairs to set
* @chainable
*/
setAttrs: function(attrMap) {
if (this._setAttrs) { // use Attribute imple
this._setAttrs(attrMap);
} else { // use setters inline
Y.Object.each(attrMap, function(v, n) {
this.set(n, v);
}, this);
}
return this;
},
/**
* Returns an object containing the values for the requested attributes.
* @method getAttrs
* @param {Array} attrs an array of attributes to get values
* @return {Object} An object with attribute name/value pairs.
*/
getAttrs: function(attrs) {
var ret = {};
if (this._getAttrs) { // use Attribute imple
this._getAttrs(attrs);
} else { // use setters inline
Y.Array.each(attrs, function(v, n) {
ret[v] = this.get(v);
}, this);
}
return ret;
},
/**
* Creates a new Node using the provided markup string.
* @method create
* @param {String} html The markup used to create the element
* @param {HTMLDocument} doc An optional document context
* @return {Node} A Node instance bound to a DOM node or fragment
*/
create: Y_Node.create,
/**
* Compares nodes to determine if they match.
* Node instances can be compared to each other and/or HTMLElements.
* @method compareTo
* @param {HTMLElement | Node} refNode The reference node to compare to the node.
* @return {Boolean} True if the nodes match, false if they do not.
*/
compareTo: function(refNode) {
var node = this._node;
if (Y.instanceOf(refNode, Y_Node)) {
refNode = refNode._node;
}
return node === refNode;
},
/**
* Determines whether the node is appended to the document.
* @method inDoc
* @param {Node|HTMLElement} doc optional An optional document to check against.
* Defaults to current document.
* @return {Boolean} Whether or not this node is appended to the document.
*/
inDoc: function(doc) {
var node = this._node;
doc = (doc) ? doc._node || doc : node[OWNER_DOCUMENT];
if (doc.documentElement) {
return Y_DOM.contains(doc.documentElement, node);
}
},
getById: function(id) {
var node = this._node,
ret = Y_DOM.byId(id, node[OWNER_DOCUMENT]);
if (ret && Y_DOM.contains(node, ret)) {
ret = Y.one(ret);
} else {
ret = null;
}
return ret;
},
/**
* Returns the nearest ancestor that passes the test applied by supplied boolean method.
* @method ancestor
* @param {String | Function} fn A selector string or boolean method for testing elements.
* @param {Boolean} testSelf optional Whether or not to include the element in the scan
* If a function is used, it receives the current node being tested as the only argument.
* @return {Node} The matching Node instance or null if not found
*/
ancestor: function(fn, testSelf) {
return Y.one(Y_DOM.ancestor(this._node, _wrapFn(fn), testSelf));
},
/**
* Returns the ancestors that pass the test applied by supplied boolean method.
* @method ancestors
* @param {String | Function} fn A selector string or boolean method for testing elements.
* @param {Boolean} testSelf optional Whether or not to include the element in the scan
* If a function is used, it receives the current node being tested as the only argument.
* @return {NodeList} A NodeList instance containing the matching elements
*/
ancestors: function(fn, testSelf) {
return Y.all(Y_DOM.ancestors(this._node, _wrapFn(fn), testSelf));
},
/**
* Returns the previous matching sibling.
* Returns the nearest element node sibling if no method provided.
* @method previous
* @param {String | Function} fn A selector or boolean method for testing elements.
* If a function is used, it receives the current node being tested as the only argument.
* @return {Node} Node instance or null if not found
*/
previous: function(fn, all) {
return Y.one(Y_DOM.elementByAxis(this._node, 'previousSibling', _wrapFn(fn), all));
},
/**
* Returns the next matching sibling.
* Returns the nearest element node sibling if no method provided.
* @method next
* @param {String | Function} fn A selector or boolean method for testing elements.
* If a function is used, it receives the current node being tested as the only argument.
* @return {Node} Node instance or null if not found
*/
next: function(fn, all) {
return Y.one(Y_DOM.elementByAxis(this._node, 'nextSibling', _wrapFn(fn), all));
},
/**
* Returns all matching siblings.
* Returns all siblings if no method provided.
* @method siblings
* @param {String | Function} fn A selector or boolean method for testing elements.
* If a function is used, it receives the current node being tested as the only argument.
* @return {NodeList} NodeList instance bound to found siblings
*/
siblings: function(fn) {
return Y.all(Y_DOM.siblings(this._node, _wrapFn(fn)));
},
/**
* Retrieves a Node instance of nodes based on the given CSS selector.
* @method one
*
* @param {string} selector The CSS selector to test against.
* @return {Node} A Node instance for the matching HTMLElement.
*/
one: function(selector) {
return Y.one(Y.Selector.query(selector, this._node, true));
},
/**
* Retrieves a nodeList based on the given CSS selector.
* @method all
*
* @param {string} selector The CSS selector to test against.
* @return {NodeList} A NodeList instance for the matching HTMLCollection/Array.
*/
all: function(selector) {
var nodelist = Y.all(Y.Selector.query(selector, this._node));
nodelist._query = selector;
nodelist._queryRoot = this._node;
return nodelist;
},
// TODO: allow fn test
/**
* Test if the supplied node matches the supplied selector.
* @method test
*
* @param {string} selector The CSS selector to test against.
* @return {boolean} Whether or not the node matches the selector.
*/
test: function(selector) {
return Y.Selector.test(this._node, selector);
},
/**
* Removes the node from its parent.
* Shortcut for myNode.get('parentNode').removeChild(myNode);
* @method remove
* @param {Boolean} destroy whether or not to call destroy() on the node
* after removal.
* @chainable
*
*/
remove: function(destroy) {
var node = this._node,
parentNode = node.parentNode;
if (parentNode) {
parentNode.removeChild(node);
}
if (destroy) {
this.destroy();
}
return this;
},
/**
* Replace the node with the other node. This is a DOM update only
* and does not change the node bound to the Node instance.
* Shortcut for myNode.get('parentNode').replaceChild(newNode, myNode);
* @method replace
* @param {Y.Node || HTMLNode} newNode Node to be inserted
* @chainable
*
*/
replace: function(newNode) {
var node = this._node;
if (typeof newNode == 'string') {
newNode = Y_Node.create(newNode);
}
node.parentNode.replaceChild(Y_Node.getDOMNode(newNode), node);
return this;
},
/**
* @method replaceChild
* @for Node
* @param {String | HTMLElement | Node} node Node to be inserted
* @param {HTMLElement | Node} refNode Node to be replaced
* @return {Node} The replaced node
*/
replaceChild: function(node, refNode) {
if (typeof node == 'string') {
node = Y_DOM.create(node);
}
return Y.one(this._node.replaceChild(Y_Node.getDOMNode(node), Y_Node.getDOMNode(refNode)));
},
/**
* @method appendChild
* @param {String | HTMLElement | Node} node Node to be appended
* @return {Node} The appended node
*/
appendChild: function(node) {
return Y_Node.scrubVal(this._insert(node));
},
/**
* @method insertBefore
* @param {String | HTMLElement | Node} newNode Node to be appended
* @param {HTMLElement | Node} refNode Node to be inserted before
* @return {Node} The inserted node
*/
insertBefore: function(newNode, refNode) {
return Y.Node.scrubVal(this._insert(newNode, refNode));
},
/**
* Removes event listeners from the node and (optionally) its subtree
* @method purge
* @param {Boolean} recurse (optional) Whether or not to remove listeners from the
* node's subtree
* @param {String} type (optional) Only remove listeners of the specified type
* @chainable
*
*/
purge: function(recurse, type) {
Y.Event.purgeElement(this._node, recurse, type);
return this;
},
/**
* Nulls internal node references, removes any plugins and event listeners
* @method destroy
* @param {Boolean} recursivePurge (optional) Whether or not to remove listeners from the
* node's subtree (default is false)
*
*/
destroy: function(recursive) {
this.purge(); // TODO: only remove events add via this Node
if (this.unplug) { // may not be a PluginHost
this.unplug();
}
this.clearData();
if (recursive) {
this.all('*').destroy();
}
this._node = null;
this._stateProxy = null;
delete Y_Node._instances[this[UID]];
},
/**
* Invokes a method on the Node instance
* @method invoke
* @param {String} method The name of the method to invoke
* @param {Any} a, b, c, etc. Arguments to invoke the method with.
* @return Whatever the underly method returns.
* DOM Nodes and Collections return values
* are converted to Node/NodeList instances.
*
*/
invoke: function(method, a, b, c, d, e) {
var node = this._node,
ret;
if (a && Y.instanceOf(a, Y_Node)) {
a = a._node;
}
if (b && Y.instanceOf(b, Y_Node)) {
b = b._node;
}
ret = node[method](a, b, c, d, e);
return Y_Node.scrubVal(ret, this);
},
/**
* Inserts the content before the reference node.
* @method insert
* @param {String | Y.Node | HTMLElement | Y.NodeList | HTMLCollection} content The content to insert
* @param {Int | Y.Node | HTMLElement | String} where The position to insert at.
* Possible "where" arguments
* <dl>
* <dt>Y.Node</dt>
* <dd>The Node to insert before</dd>
* <dt>HTMLElement</dt>
* <dd>The element to insert before</dd>
* <dt>Int</dt>
* <dd>The index of the child element to insert before</dd>
* <dt>"replace"</dt>
* <dd>Replaces the existing HTML</dd>
* <dt>"before"</dt>
* <dd>Inserts before the existing HTML</dd>
* <dt>"before"</dt>
* <dd>Inserts content before the node</dd>
* <dt>"after"</dt>
* <dd>Inserts content after the node</dd>
* </dl>
* @chainable
*/
insert: function(content, where) {
this._insert(content, where);
return this;
},
_insert: function(content, where) {
var node = this._node,
ret = null;
if (typeof where == 'number') { // allow index
where = this._node.childNodes[where];
} else if (where && where._node) { // Node
where = where._node;
}
if (content && typeof content != 'string') { // allow Node or NodeList/Array instances
content = content._node || content._nodes || content;
}
ret = Y_DOM.addHTML(node, content, where);
return ret;
},
/**
* Inserts the content as the firstChild of the node.
* @method prepend
* @param {String | Y.Node | HTMLElement} content The content to insert
* @chainable
*/
prepend: function(content) {
return this.insert(content, 0);
},
/**
* Inserts the content as the lastChild of the node.
* @method append
* @param {String | Y.Node | HTMLElement} content The content to insert
* @chainable
*/
append: function(content) {
return this.insert(content, null);
},
/**
* Appends the node to the given node.
* @method appendTo
* @param {Y.Node | HTMLElement} node The node to append to
* @chainable
*/
appendTo: function(node) {
Y.one(node).append(this);
},
/**
* Replaces the node's current content with the content.
* @method setContent
* @param {String | Y.Node | HTMLElement | Y.NodeList | HTMLCollection} content The content to insert
* @chainable
*/
setContent: function(content) {
this._insert(content, 'replace');
return this;
},
/**
* Returns the node's current content (e.g. innerHTML)
* @method getContent
* @return {String} The current content
*/
getContent: function(content) {
return this.get('innerHTML');
},
/**
* @method swap
* @description Swap DOM locations with the given node.
* This does not change which DOM node each Node instance refers to.
* @param {Node} otherNode The node to swap with
* @chainable
*/
swap: Y.config.doc.documentElement.swapNode ?
function(otherNode) {
this._node.swapNode(Y_Node.getDOMNode(otherNode));
} :
function(otherNode) {
otherNode = Y_Node.getDOMNode(otherNode);
var node = this._node,
parent = otherNode.parentNode,
nextSibling = otherNode.nextSibling;
if (nextSibling === node) {
parent.insertBefore(node, otherNode);
} else if (otherNode === node.nextSibling) {
parent.insertBefore(otherNode, node);
} else {
node.parentNode.replaceChild(otherNode, node);
Y_DOM.addHTML(parent, node, nextSibling);
}
return this;
},
/**
* @method getData
* @description Retrieves arbitrary data stored on a Node instance.
* This is not stored with the DOM node.
* @param {string} name Optional name of the data field to retrieve.
* If no name is given, all data is returned.
* @return {any | Object} Whatever is stored at the given field,
* or an object hash of all fields.
*/
getData: function(name) {
var ret;
this._data = this._data || {};
if (arguments.length) {
ret = this._data[name];
} else {
ret = this._data;
}
return ret;
},
/**
* @method setData
* @description Stores arbitrary data on a Node instance.
* This is not stored with the DOM node.
* @param {string} name The name of the field to set. If no name
* is given, name is treated as the data and overrides any existing data.
* @param {any} val The value to be assigned to the field.
* @chainable
*/
setData: function(name, val) {
this._data = this._data || {};
if (arguments.length > 1) {
this._data[name] = val;
} else {
this._data = name;
}
return this;
},
/**
* @method clearData
* @description Clears stored data.
* @param {string} name The name of the field to clear. If no name
* is given, all data is cleared.
* @chainable
*/
clearData: function(name) {
if ('_data' in this) {
if (name) {
delete this._data[name];
} else {
delete this._data;
}
}
return this;
},
hasMethod: function(method) {
var node = this._node;
return !!(node && method in node &&
typeof node[method] != 'unknown' &&
(typeof node[method] == 'function' ||
String(node[method]).indexOf('function') === 1)); // IE reports as object, prepends space
},
SHOW_TRANSITION: null,
HIDE_TRANSITION: null,
/**
* Makes the node visible.
* If the "transition" module is loaded, show optionally
* animates the showing of the node using either the default
* transition effect ('fadeIn'), or the given named effect.
* @method show
* @param {String} name A named Transition effect to use as the show effect.
* @param {Object} config Options to use with the transition.
* @param {Function} callback An optional function to run after the transition completes.
* @chainable
*/
show: function(callback) {
callback = arguments[arguments.length - 1];
this.toggleView(true, callback);
return this;
},
/**
* The implementation for showing nodes.
* Default is to toggle the style.display property.
* @protected
* @chainable
*/
_show: function() {
this.setStyle('display', '');
},
_isHidden: function() {
return Y.DOM.getStyle(this._node, 'display') === 'none';
},
toggleView: function(on, callback) {
this._toggleView.apply(this, arguments);
},
_toggleView: function(on, callback) {
callback = arguments[arguments.length - 1];
// base on current state if not forcing
if (typeof on != 'boolean') {
on = (this._isHidden()) ? 1 : 0;
}
if (on) {
this._show();
} else {
this._hide();
}
if (typeof callback == 'function') {
callback.call(this);
}
return this;
},
/**
* Hides the node.
* If the "transition" module is loaded, hide optionally
* animates the hiding of the node using either the default
* transition effect ('fadeOut'), or the given named effect.
* @method hide
* @param {String} name A named Transition effect to use as the show effect.
* @param {Object} config Options to use with the transition.
* @param {Function} callback An optional function to run after the transition completes.
* @chainable
*/
hide: function(callback) {
callback = arguments[arguments.length - 1];
this.toggleView(false, callback);
return this;
},
/**
* The implementation for hiding nodes.
* Default is to toggle the style.display property.
* @protected
* @chainable
*/
_hide: function() {
this.setStyle('display', 'none');
},
isFragment: function() {
return (this.get('nodeType') === 11);
},
/**
* Removes all of the child nodes from the node.
* @param {Boolean} destroy Whether the nodes should also be destroyed.
* @chainable
*/
empty: function(destroy) {
this.get('childNodes').remove(destroy);
return this;
}
}, true);
Y.Node = Y_Node;
Y.one = Y.Node.one;
/**
* The NodeList module provides support for managing collections of Nodes.
* @module node
* @submodule nodelist
*/
/**
* The NodeList class provides a wrapper for manipulating DOM NodeLists.
* NodeList properties can be accessed via the set/get methods.
* Use Y.all() to retrieve NodeList instances.
*
* @class NodeList
* @constructor
*/
var NodeList = function(nodes) {
var tmp = [];
if (typeof nodes === 'string') { // selector query
this._query = nodes;
nodes = Y.Selector.query(nodes);
} else if (nodes.nodeType || Y_DOM.isWindow(nodes)) { // domNode || window
nodes = [nodes];
} else if (Y.instanceOf(nodes, Y.Node)) {
nodes = [nodes._node];
} else if (Y.instanceOf(nodes[0], Y.Node)) { // allow array of Y.Nodes
Y.Array.each(nodes, function(node) {
if (node._node) {
tmp.push(node._node);
}
});
nodes = tmp;
} else { // array of domNodes or domNodeList (no mixed array of Y.Node/domNodes)
nodes = Y.Array(nodes, 0, true);
}
/**
* The underlying array of DOM nodes bound to the Y.NodeList instance
* @property _nodes
* @private
*/
this._nodes = nodes;
};
NodeList.NAME = 'NodeList';
/**
* Retrieves the DOM nodes bound to a NodeList instance
* @method NodeList.getDOMNodes
* @static
*
* @param {Y.NodeList} nodelist The NodeList instance
* @return {Array} The array of DOM nodes bound to the NodeList
*/
NodeList.getDOMNodes = function(nodelist) {
return (nodelist && nodelist._nodes) ? nodelist._nodes : nodelist;
};
NodeList.each = function(instance, fn, context) {
var nodes = instance._nodes;
if (nodes && nodes.length) {
Y.Array.each(nodes, fn, context || instance);
} else {
}
};
NodeList.addMethod = function(name, fn, context) {
if (name && fn) {
NodeList.prototype[name] = function() {
var ret = [],
args = arguments;
Y.Array.each(this._nodes, function(node) {
var UID = (node.uniqueID && node.nodeType !== 9 ) ? 'uniqueID' : '_yuid',
instance = Y.Node._instances[node[UID]],
ctx,
result;
if (!instance) {
instance = NodeList._getTempNode(node);
}
ctx = context || instance;
result = fn.apply(ctx, args);
if (result !== undefined && result !== instance) {
ret[ret.length] = result;
}
});
// TODO: remove tmp pointer
return ret.length ? ret : this;
};
} else {
}
};
NodeList.importMethod = function(host, name, altName) {
if (typeof name === 'string') {
altName = altName || name;
NodeList.addMethod(name, host[name]);
} else {
Y.Array.each(name, function(n) {
NodeList.importMethod(host, n);
});
}
};
NodeList._getTempNode = function(node) {
var tmp = NodeList._tempNode;
if (!tmp) {
tmp = Y.Node.create('<div></div>');
NodeList._tempNode = tmp;
}
tmp._node = node;
tmp._stateProxy = node;
return tmp;
};
Y.mix(NodeList.prototype, {
/**
* Retrieves the Node instance at the given index.
* @method item
*
* @param {Number} index The index of the target Node.
* @return {Node} The Node instance at the given index.
*/
item: function(index) {
return Y.one((this._nodes || [])[index]);
},
/**
* Applies the given function to each Node in the NodeList.
* @method each
* @param {Function} fn The function to apply. It receives 3 arguments:
* the current node instance, the node's index, and the NodeList instance
* @param {Object} context optional An optional context to apply the function with
* Default context is the current Node instance
* @chainable
*/
each: function(fn, context) {
var instance = this;
Y.Array.each(this._nodes, function(node, index) {
node = Y.one(node);
return fn.call(context || node, node, index, instance);
});
return instance;
},
batch: function(fn, context) {
var nodelist = this;
Y.Array.each(this._nodes, function(node, index) {
var instance = Y.Node._instances[node[UID]];
if (!instance) {
instance = NodeList._getTempNode(node);
}
return fn.call(context || instance, instance, index, nodelist);
});
return nodelist;
},
/**
* Executes the function once for each node until a true value is returned.
* @method some
* @param {Function} fn The function to apply. It receives 3 arguments:
* the current node instance, the node's index, and the NodeList instance
* @param {Object} context optional An optional context to execute the function from.
* Default context is the current Node instance
* @return {Boolean} Whether or not the function returned true for any node.
*/
some: function(fn, context) {
var instance = this;
return Y.Array.some(this._nodes, function(node, index) {
node = Y.one(node);
context = context || node;
return fn.call(context, node, index, instance);
});
},
/**
* Creates a documenFragment from the nodes bound to the NodeList instance
* @method toFrag
* @return Node a Node instance bound to the documentFragment
*/
toFrag: function() {
return Y.one(Y.DOM._nl2frag(this._nodes));
},
/**
* Returns the index of the node in the NodeList instance
* or -1 if the node isn't found.
* @method indexOf
* @param {Y.Node || DOMNode} node the node to search for
* @return {Int} the index of the node value or -1 if not found
*/
indexOf: function(node) {
return Y.Array.indexOf(this._nodes, Y.Node.getDOMNode(node));
},
/**
* Filters the NodeList instance down to only nodes matching the given selector.
* @method filter
* @param {String} selector The selector to filter against
* @return {NodeList} NodeList containing the updated collection
* @see Selector
*/
filter: function(selector) {
return Y.all(Y.Selector.filter(this._nodes, selector));
},
/**
* Creates a new NodeList containing all nodes at every n indices, where
* remainder n % index equals r.
* (zero-based index).
* @method modulus
* @param {Int} n The offset to use (return every nth node)
* @param {Int} r An optional remainder to use with the modulus operation (defaults to zero)
* @return {NodeList} NodeList containing the updated collection
*/
modulus: function(n, r) {
r = r || 0;
var nodes = [];
NodeList.each(this, function(node, i) {
if (i % n === r) {
nodes.push(node);
}
});
return Y.all(nodes);
},
/**
* Creates a new NodeList containing all nodes at odd indices
* (zero-based index).
* @method odd
* @return {NodeList} NodeList containing the updated collection
*/
odd: function() {
return this.modulus(2, 1);
},
/**
* Creates a new NodeList containing all nodes at even indices
* (zero-based index), including zero.
* @method even
* @return {NodeList} NodeList containing the updated collection
*/
even: function() {
return this.modulus(2);
},
destructor: function() {
},
/**
* Reruns the initial query, when created using a selector query
* @method refresh
* @chainable
*/
refresh: function() {
var doc,
nodes = this._nodes,
query = this._query,
root = this._queryRoot;
if (query) {
if (!root) {
if (nodes && nodes[0] && nodes[0].ownerDocument) {
root = nodes[0].ownerDocument;
}
}
this._nodes = Y.Selector.query(query, root);
}
return this;
},
_prepEvtArgs: function(type, fn, context) {
// map to Y.on/after signature (type, fn, nodes, context, arg1, arg2, etc)
var args = Y.Array(arguments, 0, true);
if (args.length < 2) { // type only (event hash) just add nodes
args[2] = this._nodes;
} else {
args.splice(2, 0, this._nodes);
}
args[3] = context || this; // default to NodeList instance as context
return args;
},
/**
* Applies an event listener to each Node bound to the NodeList.
* @method on
* @param {String} type The event being listened for
* @param {Function} fn The handler to call when the event fires
* @param {Object} context The context to call the handler with.
* Default is the NodeList instance.
* @param {Object} context The context to call the handler with.
* param {mixed} arg* 0..n additional arguments to supply to the subscriber
* when the event fires.
* @return {Object} Returns an event handle that can later be use to detach().
* @see Event.on
*/
on: function(type, fn, context) {
return Y.on.apply(Y, this._prepEvtArgs.apply(this, arguments));
},
/**
* Applies an one-time event listener to each Node bound to the NodeList.
* @method once
* @param {String} type The event being listened for
* @param {Function} fn The handler to call when the event fires
* @param {Object} context The context to call the handler with.
* Default is the NodeList instance.
* @return {Object} Returns an event handle that can later be use to detach().
* @see Event.on
*/
once: function(type, fn, context) {
return Y.once.apply(Y, this._prepEvtArgs.apply(this, arguments));
},
/**
* Applies an event listener to each Node bound to the NodeList.
* The handler is called only after all on() handlers are called
* and the event is not prevented.
* @method after
* @param {String} type The event being listened for
* @param {Function} fn The handler to call when the event fires
* @param {Object} context The context to call the handler with.
* Default is the NodeList instance.
* @return {Object} Returns an event handle that can later be use to detach().
* @see Event.on
*/
after: function(type, fn, context) {
return Y.after.apply(Y, this._prepEvtArgs.apply(this, arguments));
},
/**
* Returns the current number of items in the NodeList.
* @method size
* @return {Int} The number of items in the NodeList.
*/
size: function() {
return this._nodes.length;
},
/**
* Determines if the instance is bound to any nodes
* @method isEmpty
* @return {Boolean} Whether or not the NodeList is bound to any nodes
*/
isEmpty: function() {
return this._nodes.length < 1;
},
toString: function() {
var str = '',
errorMsg = this[UID] + ': not bound to any nodes',
nodes = this._nodes,
node;
if (nodes && nodes[0]) {
node = nodes[0];
str += node[NODE_NAME];
if (node.id) {
str += '#' + node.id;
}
if (node.className) {
str += '.' + node.className.replace(' ', '.');
}
if (nodes.length > 1) {
str += '...[' + nodes.length + ' items]';
}
}
return str || errorMsg;
}
}, true);
NodeList.importMethod(Y.Node.prototype, [
/**
* Called on each Node instance
* @for NodeList
* @method append
* @see Node.append
*/
'append',
/** Called on each Node instance
* @method destroy
* @see Node.destroy
*/
'destroy',
/**
* Called on each Node instance
* @method detach
* @see Node.detach
*/
'detach',
/** Called on each Node instance
* @method detachAll
* @see Node.detachAll
*/
'detachAll',
/** Called on each Node instance
* @method empty
* @see Node.empty
*/
'empty',
/** Called on each Node instance
* @method insert
* @see Node.insert
*/
'insert',
/** Called on each Node instance
* @method prepend
* @see Node.prepend
*/
'prepend',
/** Called on each Node instance
* @method remove
* @see Node.remove
*/
'remove',
/** Called on each Node instance
* @method set
* @see Node.set
*/
'set',
/** Called on each Node instance
* @method setContent
* @see Node.setContent
*/
'setContent',
/**
* Makes each node visible.
* If the "transition" module is loaded, show optionally
* animates the showing of the node using either the default
* transition effect ('fadeIn'), or the given named effect.
* @method show
* @param {String} name A named Transition effect to use as the show effect.
* @param {Object} config Options to use with the transition.
* @param {Function} callback An optional function to run after the transition completes.
* @chainable
*/
'show',
/**
* Hides each node.
* If the "transition" module is loaded, hide optionally
* animates the hiding of the node using either the default
* transition effect ('fadeOut'), or the given named effect.
* @method hide
* @param {String} name A named Transition effect to use as the show effect.
* @param {Object} config Options to use with the transition.
* @param {Function} callback An optional function to run after the transition completes.
* @chainable
*/
'hide',
'toggleView'
]);
// one-off implementation to convert array of Nodes to NodeList
// e.g. Y.all('input').get('parentNode');
/** Called on each Node instance
* @method get
* @see Node
*/
NodeList.prototype.get = function(attr) {
var ret = [],
nodes = this._nodes,
isNodeList = false,
getTemp = NodeList._getTempNode,
instance,
val;
if (nodes[0]) {
instance = Y.Node._instances[nodes[0]._yuid] || getTemp(nodes[0]);
val = instance._get(attr);
if (val && val.nodeType) {
isNodeList = true;
}
}
Y.Array.each(nodes, function(node) {
instance = Y.Node._instances[node._yuid];
if (!instance) {
instance = getTemp(node);
}
val = instance._get(attr);
if (!isNodeList) { // convert array of Nodes to NodeList
val = Y.Node.scrubVal(val, instance);
}
ret.push(val);
});
return (isNodeList) ? Y.all(ret) : ret;
};
Y.NodeList = NodeList;
Y.all = function(nodes) {
return new NodeList(nodes);
};
Y.Node.all = Y.all;
Y.Array.each([
/**
* Passes through to DOM method.
* @for Node
* @method removeChild
* @param {HTMLElement | Node} node Node to be removed
* @return {Node} The removed node
*/
'removeChild',
/**
* Passes through to DOM method.
* @method hasChildNodes
* @return {Boolean} Whether or not the node has any childNodes
*/
'hasChildNodes',
/**
* Passes through to DOM method.
* @method cloneNode
* @param {Boolean} deep Whether or not to perform a deep clone, which includes
* subtree and attributes
* @return {Node} The clone
*/
'cloneNode',
/**
* Passes through to DOM method.
* @method hasAttribute
* @param {String} attribute The attribute to test for
* @return {Boolean} Whether or not the attribute is present
*/
'hasAttribute',
/**
* Passes through to DOM method.
* @method removeAttribute
* @param {String} attribute The attribute to be removed
* @chainable
*/
'removeAttribute',
/**
* Passes through to DOM method.
* @method scrollIntoView
* @chainable
*/
'scrollIntoView',
/**
* Passes through to DOM method.
* @method getElementsByTagName
* @param {String} tagName The tagName to collect
* @return {NodeList} A NodeList representing the HTMLCollection
*/
'getElementsByTagName',
/**
* Passes through to DOM method.
* @method focus
* @chainable
*/
'focus',
/**
* Passes through to DOM method.
* @method blur
* @chainable
*/
'blur',
/**
* Passes through to DOM method.
* Only valid on FORM elements
* @method submit
* @chainable
*/
'submit',
/**
* Passes through to DOM method.
* Only valid on FORM elements
* @method reset
* @chainable
*/
'reset',
/**
* Passes through to DOM method.
* @method select
* @chainable
*/
'select',
/**
* Passes through to DOM method.
* Only valid on TABLE elements
* @method createCaption
* @chainable
*/
'createCaption'
], function(method) {
Y.Node.prototype[method] = function(arg1, arg2, arg3) {
var ret = this.invoke(method, arg1, arg2, arg3);
return ret;
};
});
Y.Node.importMethod(Y.DOM, [
/**
* Determines whether the node is an ancestor of another HTML element in the DOM hierarchy.
* @method contains
* @param {Node | HTMLElement} needle The possible node or descendent
* @return {Boolean} Whether or not this node is the needle its ancestor
*/
'contains',
/**
* Allows setting attributes on DOM nodes, normalizing in some cases.
* This passes through to the DOM node, allowing for custom attributes.
* @method setAttribute
* @for Node
* @for NodeList
* @chainable
* @param {string} name The attribute name
* @param {string} value The value to set
*/
'setAttribute',
/**
* Allows getting attributes on DOM nodes, normalizing in some cases.
* This passes through to the DOM node, allowing for custom attributes.
* @method getAttribute
* @for Node
* @for NodeList
* @param {string} name The attribute name
* @return {string} The attribute value
*/
'getAttribute',
/**
* Wraps the given HTML around the node.
* @method wrap
* @param {String} html The markup to wrap around the node.
* @chainable
*/
'wrap',
/**
* Removes the node's parent node.
* @method unwrap
* @chainable
*/
'unwrap',
/**
* Applies a unique ID to the node if none exists
* @method generateID
* @return {String} The existing or generated ID
*/
'generateID'
]);
Y.NodeList.importMethod(Y.Node.prototype, [
/**
* Allows getting attributes on DOM nodes, normalizing in some cases.
* This passes through to the DOM node, allowing for custom attributes.
* @method getAttribute
* @see Node
* @for NodeList
* @param {string} name The attribute name
* @return {string} The attribute value
*/
'getAttribute',
/**
* Allows setting attributes on DOM nodes, normalizing in some cases.
* This passes through to the DOM node, allowing for custom attributes.
* @method setAttribute
* @see Node
* @for NodeList
* @chainable
* @param {string} name The attribute name
* @param {string} value The value to set
*/
'setAttribute',
/**
* Allows for removing attributes on DOM nodes.
* This passes through to the DOM node, allowing for custom attributes.
* @method removeAttribute
* @see Node
* @for NodeList
* @param {string} name The attribute to remove
*/
'removeAttribute',
/**
* Removes the parent node from node in the list.
* @method unwrap
* @chainable
*/
'unwrap',
/**
* Wraps the given HTML around each node.
* @method wrap
* @param {String} html The markup to wrap around the node.
* @chainable
*/
'wrap',
/**
* Applies a unique ID to each node if none exists
* @method generateID
* @return {String} The existing or generated ID
*/
'generateID'
]);
(function(Y) {
var methods = [
/**
* Determines whether each node has the given className.
* @method hasClass
* @for Node
* @param {String} className the class name to search for
* @return {Boolean} Whether or not the element has the specified class
*/
'hasClass',
/**
* Adds a class name to each node.
* @method addClass
* @param {String} className the class name to add to the node's class attribute
* @chainable
*/
'addClass',
/**
* Removes a class name from each node.
* @method removeClass
* @param {String} className the class name to remove from the node's class attribute
* @chainable
*/
'removeClass',
/**
* Replace a class with another class for each node.
* If no oldClassName is present, the newClassName is simply added.
* @method replaceClass
* @param {String} oldClassName the class name to be replaced
* @param {String} newClassName the class name that will be replacing the old class name
* @chainable
*/
'replaceClass',
/**
* If the className exists on the node it is removed, if it doesn't exist it is added.
* @method toggleClass
* @param {String} className the class name to be toggled
* @param {Boolean} force Option to force adding or removing the class.
* @chainable
*/
'toggleClass'
];
Y.Node.importMethod(Y.DOM, methods);
/**
* Determines whether each node has the given className.
* @method hasClass
* @see Node.hasClass
* @for NodeList
* @param {String} className the class name to search for
* @return {Array} An array of booleans for each node bound to the NodeList.
*/
/**
* Adds a class name to each node.
* @method addClass
* @see Node.addClass
* @param {String} className the class name to add to the node's class attribute
* @chainable
*/
/**
* Removes a class name from each node.
* @method removeClass
* @see Node.removeClass
* @param {String} className the class name to remove from the node's class attribute
* @chainable
*/
/**
* Replace a class with another class for each node.
* If no oldClassName is present, the newClassName is simply added.
* @method replaceClass
* @see Node.replaceClass
* @param {String} oldClassName the class name to be replaced
* @param {String} newClassName the class name that will be replacing the old class name
* @chainable
*/
/**
* If the className exists on the node it is removed, if it doesn't exist it is added.
* @method toggleClass
* @see Node.toggleClass
* @param {String} className the class name to be toggled
* @chainable
*/
Y.NodeList.importMethod(Y.Node.prototype, methods);
})(Y);
if (!Y.config.doc.documentElement.hasAttribute) { // IE < 8
Y.Node.prototype.hasAttribute = function(attr) {
if (attr === 'value') {
if (this.get('value') !== "") { // IE < 8 fails to populate specified when set in HTML
return true;
}
}
return !!(this._node.attributes[attr] &&
this._node.attributes[attr].specified);
};
}
// IE throws an error when calling focus() on an element that's invisible, not
// displayed, or disabled.
Y.Node.prototype.focus = function () {
try {
this._node.focus();
} catch (e) {
}
};
// IE throws error when setting input.type = 'hidden',
// input.setAttribute('type', 'hidden') and input.attributes.type.value = 'hidden'
Y.Node.ATTRS.type = {
setter: function(val) {
if (val === 'hidden') {
try {
this._node.type = 'hidden';
} catch(e) {
this.setStyle('display', 'none');
this._inputType = 'hidden';
}
} else {
try { // IE errors when changing the type from "hidden'
this._node.type = val;
} catch (e) {
}
}
return val;
},
getter: function() {
return this._inputType || this._node.type;
},
_bypassProxy: true // don't update DOM when using with Attribute
};
if (Y.config.doc.createElement('form').elements.nodeType) {
// IE: elements collection is also FORM node which trips up scrubVal.
Y.Node.ATTRS.elements = {
getter: function() {
return this.all('input, textarea, button, select');
}
};
}
Y.mix(Y.Node.ATTRS, {
offsetHeight: {
setter: function(h) {
Y.DOM.setHeight(this._node, h);
return h;
},
getter: function() {
return this._node.offsetHeight;
}
},
offsetWidth: {
setter: function(w) {
Y.DOM.setWidth(this._node, w);
return w;
},
getter: function() {
return this._node.offsetWidth;
}
}
});
Y.mix(Y.Node.prototype, {
sizeTo: function(w, h) {
var node;
if (arguments.length < 2) {
node = Y.one(w);
w = node.get('offsetWidth');
h = node.get('offsetHeight');
}
this.setAttrs({
offsetWidth: w,
offsetHeight: h
});
}
});
var Y_NodeList = Y.NodeList,
ArrayProto = Array.prototype,
ArrayMethods = [
/** Returns a new NodeList combining the given NodeList(s)
* @for NodeList
* @method concat
* @param {NodeList | Array} valueN Arrays/NodeLists and/or values to
* concatenate to the resulting NodeList
* @return {NodeList} A new NodeList comprised of this NodeList joined with the input.
*/
'concat',
/** Removes the first last from the NodeList and returns it.
* @for NodeList
* @method pop
* @return {Node} The last item in the NodeList.
*/
'pop',
/** Adds the given Node(s) to the end of the NodeList.
* @for NodeList
* @method push
* @param {Node | DOMNode} nodeN One or more nodes to add to the end of the NodeList.
*/
'push',
/** Removes the first item from the NodeList and returns it.
* @for NodeList
* @method shift
* @return {Node} The first item in the NodeList.
*/
'shift',
/** Returns a new NodeList comprising the Nodes in the given range.
* @for NodeList
* @method slice
* @param {Number} begin Zero-based index at which to begin extraction.
As a negative index, start indicates an offset from the end of the sequence. slice(-2) extracts the second-to-last element and the last element in the sequence.
* @param {Number} end Zero-based index at which to end extraction. slice extracts up to but not including end.
slice(1,4) extracts the second element through the fourth element (elements indexed 1, 2, and 3).
As a negative index, end indicates an offset from the end of the sequence. slice(2,-1) extracts the third element through the second-to-last element in the sequence.
If end is omitted, slice extracts to the end of the sequence.
* @return {NodeList} A new NodeList comprised of this NodeList joined with the input.
*/
'slice',
/** Changes the content of the NodeList, adding new elements while removing old elements.
* @for NodeList
* @method splice
* @param {Number} index Index at which to start changing the array. If negative, will begin that many elements from the end.
* @param {Number} howMany An integer indicating the number of old array elements to remove. If howMany is 0, no elements are removed. In this case, you should specify at least one new element. If no howMany parameter is specified (second syntax above, which is a SpiderMonkey extension), all elements after index are removed.
* {Node | DOMNode| element1, ..., elementN
The elements to add to the array. If you don't specify any elements, splice simply removes elements from the array.
* @return {NodeList} The element(s) removed.
*/
'splice',
/** Adds the given Node(s) to the beginning of the NodeList.
* @for NodeList
* @method push
* @param {Node | DOMNode} nodeN One or more nodes to add to the NodeList.
*/
'unshift'
];
Y.Array.each(ArrayMethods, function(name) {
Y_NodeList.prototype[name] = function() {
var args = [],
i = 0,
arg;
while ((arg = arguments[i++])) { // use DOM nodes/nodeLists
args.push(arg._node || arg._nodes || arg);
}
return Y.Node.scrubVal(ArrayProto[name].apply(this._nodes, args));
};
});
}, '3.3.0' ,{requires:['dom-base', 'selector-css2', 'event-base']});
YUI.add('node-style', function(Y) {
(function(Y) {
/**
* Extended Node interface for managing node styles.
* @module node
* @submodule node-style
*/
var methods = [
/**
* Returns the style's current value.
* @method getStyle
* @for Node
* @param {String} attr The style attribute to retrieve.
* @return {String} The current value of the style property for the element.
*/
'getStyle',
/**
* Returns the computed value for the given style property.
* @method getComputedStyle
* @param {String} attr The style attribute to retrieve.
* @return {String} The computed value of the style property for the element.
*/
'getComputedStyle',
/**
* Sets a style property of the node.
* @method setStyle
* @param {String} attr The style attribute to set.
* @param {String|Number} val The value.
* @chainable
*/
'setStyle',
/**
* Sets multiple style properties on the node.
* @method setStyles
* @param {Object} hash An object literal of property:value pairs.
* @chainable
*/
'setStyles'
];
Y.Node.importMethod(Y.DOM, methods);
/**
* Returns an array of values for each node.
* @method getStyle
* @for NodeList
* @see Node.getStyle
* @param {String} attr The style attribute to retrieve.
* @return {Array} The current values of the style property for the element.
*/
/**
* Returns an array of the computed value for each node.
* @method getComputedStyle
* @see Node.getComputedStyle
* @param {String} attr The style attribute to retrieve.
* @return {Array} The computed values for each node.
*/
/**
* Sets a style property on each node.
* @method setStyle
* @see Node.setStyle
* @param {String} attr The style attribute to set.
* @param {String|Number} val The value.
* @chainable
*/
/**
* Sets multiple style properties on each node.
* @method setStyles
* @see Node.setStyles
* @param {Object} hash An object literal of property:value pairs.
* @chainable
*/
Y.NodeList.importMethod(Y.Node.prototype, methods);
})(Y);
}, '3.3.0' ,{requires:['dom-style', 'node-base']});
YUI.add('node-screen', function(Y) {
/**
* Extended Node interface for managing regions and screen positioning.
* Adds support for positioning elements and normalizes window size and scroll detection.
* @module node
* @submodule node-screen
*/
// these are all "safe" returns, no wrapping required
Y.each([
/**
* Returns the inner width of the viewport (exludes scrollbar).
* @config winWidth
* @for Node
* @type {Int}
*/
'winWidth',
/**
* Returns the inner height of the viewport (exludes scrollbar).
* @config winHeight
* @type {Int}
*/
'winHeight',
/**
* Document width
* @config winHeight
* @type {Int}
*/
'docWidth',
/**
* Document height
* @config docHeight
* @type {Int}
*/
'docHeight',
/**
* Amount page has been scroll vertically
* @config docScrollX
* @type {Int}
*/
'docScrollX',
/**
* Amount page has been scroll horizontally
* @config docScrollY
* @type {Int}
*/
'docScrollY'
],
function(name) {
Y.Node.ATTRS[name] = {
getter: function() {
var args = Array.prototype.slice.call(arguments);
args.unshift(Y.Node.getDOMNode(this));
return Y.DOM[name].apply(this, args);
}
};
}
);
Y.Node.ATTRS.scrollLeft = {
getter: function() {
var node = Y.Node.getDOMNode(this);
return ('scrollLeft' in node) ? node.scrollLeft : Y.DOM.docScrollX(node);
},
setter: function(val) {
var node = Y.Node.getDOMNode(this);
if (node) {
if ('scrollLeft' in node) {
node.scrollLeft = val;
} else if (node.document || node.nodeType === 9) {
Y.DOM._getWin(node).scrollTo(val, Y.DOM.docScrollY(node)); // scroll window if win or doc
}
} else {
}
}
};
Y.Node.ATTRS.scrollTop = {
getter: function() {
var node = Y.Node.getDOMNode(this);
return ('scrollTop' in node) ? node.scrollTop : Y.DOM.docScrollY(node);
},
setter: function(val) {
var node = Y.Node.getDOMNode(this);
if (node) {
if ('scrollTop' in node) {
node.scrollTop = val;
} else if (node.document || node.nodeType === 9) {
Y.DOM._getWin(node).scrollTo(Y.DOM.docScrollX(node), val); // scroll window if win or doc
}
} else {
}
}
};
Y.Node.importMethod(Y.DOM, [
/**
* Gets the current position of the node in page coordinates.
* @method getXY
* @for Node
* @return {Array} The XY position of the node
*/
'getXY',
/**
* Set the position of the node in page coordinates, regardless of how the node is positioned.
* @method setXY
* @param {Array} xy Contains X & Y values for new position (coordinates are page-based)
* @chainable
*/
'setXY',
/**
* Gets the current position of the node in page coordinates.
* @method getX
* @return {Int} The X position of the node
*/
'getX',
/**
* Set the position of the node in page coordinates, regardless of how the node is positioned.
* @method setX
* @param {Int} x X value for new position (coordinates are page-based)
* @chainable
*/
'setX',
/**
* Gets the current position of the node in page coordinates.
* @method getY
* @return {Int} The Y position of the node
*/
'getY',
/**
* Set the position of the node in page coordinates, regardless of how the node is positioned.
* @method setY
* @param {Int} y Y value for new position (coordinates are page-based)
* @chainable
*/
'setY',
/**
* Swaps the XY position of this node with another node.
* @method swapXY
* @param {Y.Node || HTMLElement} otherNode The node to swap with.
* @chainable
*/
'swapXY'
]);
/**
* Returns a region object for the node
* @config region
* @for Node
* @type Node
*/
Y.Node.ATTRS.region = {
getter: function() {
var node = Y.Node.getDOMNode(this),
region;
if (node && !node.tagName) {
if (node.nodeType === 9) { // document
node = node.documentElement;
}
}
if (node.alert) {
region = Y.DOM.viewportRegion(node);
} else {
region = Y.DOM.region(node);
}
return region;
}
};
/**
* Returns a region object for the node's viewport
* @config viewportRegion
* @type Node
*/
Y.Node.ATTRS.viewportRegion = {
getter: function() {
return Y.DOM.viewportRegion(Y.Node.getDOMNode(this));
}
};
Y.Node.importMethod(Y.DOM, 'inViewportRegion');
// these need special treatment to extract 2nd node arg
/**
* Compares the intersection of the node with another node or region
* @method intersect
* @for Node
* @param {Node|Object} node2 The node or region to compare with.
* @param {Object} altRegion An alternate region to use (rather than this node's).
* @return {Object} An object representing the intersection of the regions.
*/
Y.Node.prototype.intersect = function(node2, altRegion) {
var node1 = Y.Node.getDOMNode(this);
if (Y.instanceOf(node2, Y.Node)) { // might be a region object
node2 = Y.Node.getDOMNode(node2);
}
return Y.DOM.intersect(node1, node2, altRegion);
};
/**
* Determines whether or not the node is within the giving region.
* @method inRegion
* @param {Node|Object} node2 The node or region to compare with.
* @param {Boolean} all Whether or not all of the node must be in the region.
* @param {Object} altRegion An alternate region to use (rather than this node's).
* @return {Object} An object representing the intersection of the regions.
*/
Y.Node.prototype.inRegion = function(node2, all, altRegion) {
var node1 = Y.Node.getDOMNode(this);
if (Y.instanceOf(node2, Y.Node)) { // might be a region object
node2 = Y.Node.getDOMNode(node2);
}
return Y.DOM.inRegion(node1, node2, all, altRegion);
};
}, '3.3.0' ,{requires:['dom-screen']});
YUI.add('node-pluginhost', function(Y) {
/**
* Registers plugins to be instantiated at the class level (plugins
* which should be plugged into every instance of Node by default).
*
* @method Node.plug
* @static
*
* @param {Function | Array} plugin Either the plugin class, an array of plugin classes or an array of objects (with fn and cfg properties defined)
* @param {Object} config (Optional) If plugin is the plugin class, the configuration for the plugin
*/
Y.Node.plug = function() {
var args = Y.Array(arguments);
args.unshift(Y.Node);
Y.Plugin.Host.plug.apply(Y.Base, args);
return Y.Node;
};
/**
* Unregisters any class level plugins which have been registered by the Node
*
* @method Node.unplug
* @static
*
* @param {Function | Array} plugin The plugin class, or an array of plugin classes
*/
Y.Node.unplug = function() {
var args = Y.Array(arguments);
args.unshift(Y.Node);
Y.Plugin.Host.unplug.apply(Y.Base, args);
return Y.Node;
};
Y.mix(Y.Node, Y.Plugin.Host, false, null, 1);
// allow batching of plug/unplug via NodeList
// doesn't use NodeList.importMethod because we need real Nodes (not tmpNode)
Y.NodeList.prototype.plug = function() {
var args = arguments;
Y.NodeList.each(this, function(node) {
Y.Node.prototype.plug.apply(Y.one(node), args);
});
};
Y.NodeList.prototype.unplug = function() {
var args = arguments;
Y.NodeList.each(this, function(node) {
Y.Node.prototype.unplug.apply(Y.one(node), args);
});
};
}, '3.3.0' ,{requires:['node-base', 'pluginhost']});
YUI.add('node-event-delegate', function(Y) {
/**
* Functionality to make the node a delegated event container
* @module node
* @submodule node-event-delegate
*/
/**
* <p>Sets up a delegation listener for an event occurring inside the Node.
* The delegated event will be verified against a supplied selector or
* filtering function to test if the event references at least one node that
* should trigger the subscription callback.</p>
*
* <p>Selector string filters will trigger the callback if the event originated
* from a node that matches it or is contained in a node that matches it.
* Function filters are called for each Node up the parent axis to the
* subscribing container node, and receive at each level the Node and the event
* object. The function should return true (or a truthy value) if that Node
* should trigger the subscription callback. Note, it is possible for filters
* to match multiple Nodes for a single event. In this case, the delegate
* callback will be executed for each matching Node.</p>
*
* <p>For each matching Node, the callback will be executed with its 'this'
* object set to the Node matched by the filter (unless a specific context was
* provided during subscription), and the provided event's
* <code>currentTarget</code> will also be set to the matching Node. The
* containing Node from which the subscription was originally made can be
* referenced as <code>e.container</code>.
*
* @method delegate
* @param type {String} the event type to delegate
* @param fn {Function} the callback function to execute. This function
* will be provided the event object for the delegated event.
* @param spec {String|Function} a selector that must match the target of the
* event or a function to test target and its parents for a match
* @param context {Object} optional argument that specifies what 'this' refers to.
* @param args* {any} 0..n additional arguments to pass on to the callback function.
* These arguments will be added after the event object.
* @return {EventHandle} the detach handle
* @for Node
*/
Y.Node.prototype.delegate = function(type) {
var args = Y.Array(arguments, 0, true),
index = (Y.Lang.isObject(type) && !Y.Lang.isArray(type)) ? 1 : 2;
args.splice(index, 0, this._node);
return Y.delegate.apply(Y, args);
};
}, '3.3.0' ,{requires:['node-base', 'event-delegate']});
YUI.add('node', function(Y){}, '3.3.0' ,{skinnable:false, requires:['dom', 'event-base', 'event-delegate', 'pluginhost'], use:['node-base', 'node-style', 'node-screen', 'node-pluginhost', 'node-event-delegate']});
YUI.add('event-delegate', function(Y) {
/**
* Adds event delegation support to the library.
*
* @module event
* @submodule event-delegate
*/
var toArray = Y.Array,
YLang = Y.Lang,
isString = YLang.isString,
isObject = YLang.isObject,
isArray = YLang.isArray,
selectorTest = Y.Selector.test,
detachCategories = Y.Env.evt.handles;
/**
* <p>Sets up event delegation on a container element. The delegated event
* will use a supplied selector or filtering function to test if the event
* references at least one node that should trigger the subscription
* callback.</p>
*
* <p>Selector string filters will trigger the callback if the event originated
* from a node that matches it or is contained in a node that matches it.
* Function filters are called for each Node up the parent axis to the
* subscribing container node, and receive at each level the Node and the event
* object. The function should return true (or a truthy value) if that Node
* should trigger the subscription callback. Note, it is possible for filters
* to match multiple Nodes for a single event. In this case, the delegate
* callback will be executed for each matching Node.</p>
*
* <p>For each matching Node, the callback will be executed with its 'this'
* object set to the Node matched by the filter (unless a specific context was
* provided during subscription), and the provided event's
* <code>currentTarget</code> will also be set to the matching Node. The
* containing Node from which the subscription was originally made can be
* referenced as <code>e.container</code>.
*
* @method delegate
* @param type {String} the event type to delegate
* @param fn {Function} the callback function to execute. This function
* will be provided the event object for the delegated event.
* @param el {String|node} the element that is the delegation container
* @param spec {string|Function} a selector that must match the target of the
* event or a function to test target and its parents for a match
* @param context optional argument that specifies what 'this' refers to.
* @param args* 0..n additional arguments to pass on to the callback function.
* These arguments will be added after the event object.
* @return {EventHandle} the detach handle
* @for YUI
*/
function delegate(type, fn, el, filter) {
var args = toArray(arguments, 0, true),
query = isString(el) ? el : null,
typeBits, synth, container, categories, cat, i, len, handles, handle;
// Support Y.delegate({ click: fnA, key: fnB }, context, filter, ...);
// and Y.delegate(['click', 'key'], fn, context, filter, ...);
if (isObject(type)) {
handles = [];
if (isArray(type)) {
for (i = 0, len = type.length; i < len; ++i) {
args[0] = type[i];
handles.push(Y.delegate.apply(Y, args));
}
} else {
// Y.delegate({'click', fn}, context, filter) =>
// Y.delegate('click', fn, context, filter)
args.unshift(null); // one arg becomes two; need to make space
for (i in type) {
if (type.hasOwnProperty(i)) {
args[0] = i;
args[1] = type[i];
handles.push(Y.delegate.apply(Y, args));
}
}
}
return new Y.EventHandle(handles);
}
typeBits = type.split(/\|/);
if (typeBits.length > 1) {
cat = typeBits.shift();
type = typeBits.shift();
}
synth = Y.Node.DOM_EVENTS[type];
if (isObject(synth) && synth.delegate) {
handle = synth.delegate.apply(synth, arguments);
}
if (!handle) {
if (!type || !fn || !el || !filter) {
return;
}
container = (query) ? Y.Selector.query(query, null, true) : el;
if (!container && isString(el)) {
handle = Y.on('available', function () {
Y.mix(handle, Y.delegate.apply(Y, args), true);
}, el);
}
if (!handle && container) {
args.splice(2, 2, container); // remove the filter
handle = Y.Event._attach(args, { facade: false });
handle.sub.filter = filter;
handle.sub._notify = delegate.notifySub;
}
}
if (handle && cat) {
categories = detachCategories[cat] || (detachCategories[cat] = {});
categories = categories[type] || (categories[type] = []);
categories.push(handle);
}
return handle;
}
/**
* Overrides the <code>_notify</code> method on the normal DOM subscription to
* inject the filtering logic and only proceed in the case of a match.
*
* @method delegate.notifySub
* @param thisObj {Object} default 'this' object for the callback
* @param args {Array} arguments passed to the event's <code>fire()</code>
* @param ce {CustomEvent} the custom event managing the DOM subscriptions for
* the subscribed event on the subscribing node.
* @return {Boolean} false if the event was stopped
* @private
* @static
* @since 3.2.0
*/
delegate.notifySub = function (thisObj, args, ce) {
// Preserve args for other subscribers
args = args.slice();
if (this.args) {
args.push.apply(args, this.args);
}
// Only notify subs if the event occurred on a targeted element
var currentTarget = delegate._applyFilter(this.filter, args, ce),
//container = e.currentTarget,
e, i, len, ret;
if (currentTarget) {
// Support multiple matches up the the container subtree
currentTarget = toArray(currentTarget);
// The second arg is the currentTarget, but we'll be reusing this
// facade, replacing the currentTarget for each use, so it doesn't
// matter what element we seed it with.
e = args[0] = new Y.DOMEventFacade(args[0], ce.el, ce);
e.container = Y.one(ce.el);
for (i = 0, len = currentTarget.length; i < len && !e.stopped; ++i) {
e.currentTarget = Y.one(currentTarget[i]);
ret = this.fn.apply(this.context || e.currentTarget, args);
if (ret === false) { // stop further notifications
break;
}
}
return ret;
}
};
/**
* <p>Compiles a selector string into a filter function to identify whether
* Nodes along the parent axis of an event's target should trigger event
* notification.</p>
*
* <p>This function is memoized, so previously compiled filter functions are
* returned if the same selector string is provided.</p>
*
* <p>This function may be useful when defining synthetic events for delegate
* handling.</p>
*
* @method delegate.compileFilter
* @param selector {String} the selector string to base the filtration on
* @return {Function}
* @since 3.2.0
* @static
*/
delegate.compileFilter = Y.cached(function (selector) {
return function (target, e) {
return selectorTest(target._node, selector, e.currentTarget._node);
};
});
/**
* Walks up the parent axis of an event's target, and tests each element
* against a supplied filter function. If any Nodes, including the container,
* satisfy the filter, the delegated callback will be triggered for each.
*
* @method delegate._applyFilter
* @param filter {Function} boolean function to test for inclusion in event
* notification
* @param args {Array} the arguments that would be passed to subscribers
* @param ce {CustomEvent} the DOM event wrapper
* @return {Node|Node[]|undefined} The Node or Nodes that satisfy the filter
* @protected
*/
delegate._applyFilter = function (filter, args, ce) {
var e = args[0],
container = ce.el, // facadeless events in IE, have no e.currentTarget
target = e.target || e.srcElement,
match = [],
isContainer = false;
// Resolve text nodes to their containing element
if (target.nodeType === 3) {
target = target.parentNode;
}
// passing target as the first arg rather than leaving well enough alone
// making 'this' in the filter function refer to the target. This is to
// support bound filter functions.
args.unshift(target);
if (isString(filter)) {
while (target) {
isContainer = (target === container);
if (selectorTest(target, filter, (isContainer ?null: container))) {
match.push(target);
}
if (isContainer) {
break;
}
target = target.parentNode;
}
} else {
// filter functions are implementer code and should receive wrappers
args[0] = Y.one(target);
args[1] = new Y.DOMEventFacade(e, container, ce);
while (target) {
// filter(target, e, extra args...) - this === target
if (filter.apply(args[0], args)) {
match.push(target);
}
if (target === container) {
break;
}
target = target.parentNode;
args[0] = Y.one(target);
}
args[1] = e; // restore the raw DOM event
}
if (match.length <= 1) {
match = match[0]; // single match or undefined
}
// remove the target
args.shift();
return match;
};
/**
* Sets up event delegation on a container element. The delegated event
* will use a supplied filter to test if the callback should be executed.
* This filter can be either a selector string or a function that returns
* a Node to use as the currentTarget for the event.
*
* The event object for the delegated event is supplied to the callback
* function. It is modified slightly in order to support all properties
* that may be needed for event delegation. 'currentTarget' is set to
* the element that matched the selector string filter or the Node returned
* from the filter function. 'container' is set to the element that the
* listener is delegated from (this normally would be the 'currentTarget').
*
* Filter functions will be called with the arguments that would be passed to
* the callback function, including the event object as the first parameter.
* The function should return false (or a falsey value) if the success criteria
* aren't met, and the Node to use as the event's currentTarget and 'this'
* object if they are.
*
* @method delegate
* @param type {string} the event type to delegate
* @param fn {function} the callback function to execute. This function
* will be provided the event object for the delegated event.
* @param el {string|node} the element that is the delegation container
* @param filter {string|function} a selector that must match the target of the
* event or a function that returns a Node or false.
* @param context optional argument that specifies what 'this' refers to.
* @param args* 0..n additional arguments to pass on to the callback function.
* These arguments will be added after the event object.
* @return {EventHandle} the detach handle
* @for YUI
*/
Y.delegate = Y.Event.delegate = delegate;
}, '3.3.0' ,{requires:['node-base']});
YUI.add('io-base', function(Y) {
/**
* Base IO functionality. Provides basic XHR transport support.
* @module io
* @submodule io-base
*/
/**
* The io class is a utility that brokers HTTP requests through a simplified
* interface. Specifically, it allows JavaScript to make HTTP requests to
* a resource without a page reload. The underlying transport for making
* same-domain requests is the XMLHttpRequest object. YUI.io can also use
* Flash, if specified as a transport, for cross-domain requests.
*
* @class io
*/
/**
* @event io:start
* @description This event is fired by YUI.io when a transaction is initiated.
* @type Event Custom
*/
var E_START = 'io:start',
/**
* @event io:complete
* @description This event is fired by YUI.io when a transaction is complete.
* Response status and data are accessible, if available.
* @type Event Custom
*/
E_COMPLETE = 'io:complete',
/**
* @event io:success
* @description This event is fired by YUI.io when a transaction is complete, and
* the HTTP status resolves to HTTP2xx.
* @type Event Custom
*/
E_SUCCESS = 'io:success',
/**
* @event io:failure
* @description This event is fired by YUI.io when a transaction is complete, and
* the HTTP status resolves to HTTP4xx, 5xx and above.
* @type Event Custom
*/
E_FAILURE = 'io:failure',
/**
* @event io:end
* @description This event signifies the end of the transaction lifecycle. The
* transaction transport is destroyed.
* @type Event Custom
*/
E_END = 'io:end',
//--------------------------------------
// Properties
//--------------------------------------
/**
* @description A transaction counter that increments for each transaction.
*
* @property transactionId
* @private
* @static
* @type int
*/
transactionId = 0,
/**
* @description Object of default HTTP headers to be initialized and sent
* for all transactions.
*
* @property _headers
* @private
* @static
* @type object
*/
_headers = {
'X-Requested-With' : 'XMLHttpRequest'
},
/**
* @description Object that stores timeout values for any transaction with
* a defined "timeout" configuration property.
*
* @property _timeout
* @private
* @static
* @type object
*/
_timeout = {},
// Window reference
w = Y.config.win;
//--------------------------------------
// Methods
//--------------------------------------
/**
* @description Method that creates the XMLHttpRequest transport
*
* @method _xhr
* @private
* @static
* @return object
*/
function _xhr() {
return w.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP');
}
/**
* @description Method that increments _transactionId for each transaction.
*
* @method _id
* @private
* @static
* @return int
*/
function _id() {
var id = transactionId;
transactionId++;
return id;
}
/**
* @description Method that creates a unique transaction object for each
* request.
*
* @method _create
* @private
* @static
* @param {number} c - configuration object subset to determine if
* the transaction is an XDR or file upload,
* requiring an alternate transport.
* @param {number} i - transaction id
* @return object
*/
function _create(c, i) {
var o = {};
o.id = Y.Lang.isNumber(i) ? i : _id();
c = c || {};
if (!c.use && !c.upload) {
o.c = _xhr();
}
else if (c.use) {
if (c.use === 'native') {
if (w.XDomainRequest) {
o.c = new XDomainRequest();
o.t = c.use;
}
else {
o.c = _xhr();
}
}
else {
o.c = Y.io._transport[c.use];
o.t = c.use;
}
}
else {
o.c = {};
}
return o;
}
function _destroy(o) {
if (w) {
if (o.c && w.XMLHttpRequest) {
o.c.onreadystatechange = null;
}
else if (Y.UA.ie === 6 && !o.t) {
// IE, when using XMLHttpRequest as an ActiveX Object, will throw
// a "Type Mismatch" error if the event handler is set to "null".
o.c.abort();
}
}
o.c = null;
o = null;
}
/**
* @description Method for creating and subscribing transaction events.
*
* @method _tE
* @private
* @static
* @param {string} e - event to be published
* @param {object} c - configuration data subset for event subscription.
*
* @return void
*/
function _tE(e, c) {
var eT = new Y.EventTarget().publish('transaction:' + e),
a = c.arguments,
cT = c.context || Y;
if (a) {
eT.on(c.on[e], cT, a);
}
else {
eT.on(c.on[e], cT);
}
return eT;
}
/**
* @description Fires event "io:start" and creates, fires a
* transaction-specific start event, if config.on.start is
* defined.
*
* @method _ioStart
* @private
* @static
* @param {number} id - transaction id
* @param {object} c - configuration object for the transaction.
*
* @return void
*/
function _ioStart(id, c) {
var a = c.arguments;
if (a) {
Y.fire(E_START, id, a);
}
else {
Y.fire(E_START, id);
}
if (c.on && c.on.start) {
_tE('start', c).fire(id);
}
}
/**
* @description Fires event "io:complete" and creates, fires a
* transaction-specific "complete" event, if config.on.complete is
* defined.
*
* @method _ioComplete
* @private
* @static
* @param {object} o - transaction object.
* @param {object} c - configuration object for the transaction.
*
* @return void
*/
function _ioComplete(o, c) {
var r = o.e ? { status: 0, statusText: o.e } : o.c,
a = c.arguments;
if (a) {
Y.fire(E_COMPLETE, o.id, r, a);
}
else {
Y.fire(E_COMPLETE, o.id, r);
}
if (c.on && c.on.complete) {
_tE('complete', c).fire(o.id, r);
}
}
/**
* @description Fires event "io:end" and creates, fires a
* transaction-specific "end" event, if config.on.end is
* defined.
*
* @method _ioEnd
* @private
* @static
* @param {object} o - transaction object.
* @param {object} c - configuration object for the transaction.
*
* @return void
*/
function _ioEnd(o, c) {
var a = c.arguments;
if (a) {
Y.fire(E_END, o.id, a);
}
else {
Y.fire(E_END, o.id);
}
if (c.on && c.on.end) {
_tE('end', c).fire(o.id);
}
_destroy(o);
}
/**
* @description Fires event "io:success" and creates, fires a
* transaction-specific "success" event, if config.on.success is
* defined.
*
* @method _ioSuccess
* @private
* @static
* @param {object} o - transaction object.
* @param {object} c - configuration object for the transaction.
*
* @return void
*/
function _ioSuccess(o, c) {
var a = c.arguments;
if (a) {
Y.fire(E_SUCCESS, o.id, o.c, a);
}
else {
Y.fire(E_SUCCESS, o.id, o.c);
}
if (c.on && c.on.success) {
_tE('success', c).fire(o.id, o.c);
}
_ioEnd(o, c);
}
/**
* @description Fires event "io:failure" and creates, fires a
* transaction-specific "failure" event, if config.on.failure is
* defined.
*
* @method _ioFailure
* @private
* @static
* @param {object} o - transaction object.
* @param {object} c - configuration object for the transaction.
*
* @return void
*/
function _ioFailure(o, c) {
var r = o.e ? { status: 0, statusText: o.e } : o.c,
a = c.arguments;
if (a) {
Y.fire(E_FAILURE, o.id, r, a);
}
else {
Y.fire(E_FAILURE, o.id, r);
}
if (c.on && c.on.failure) {
_tE('failure', c).fire(o.id, r);
}
_ioEnd(o, c);
}
/**
* @description Resends an XDR transaction, using the Flash tranport,
* if the native transport fails.
*
* @method _resend
* @private
* @static
* @param {object} o - Transaction object generated by _create().
* @param {string} uri - qualified path to transaction resource.
* @param {object} c - configuration object for the transaction.
*
* @return void
*/
function _resend(o, uri, c, d) {
_destroy(o);
c.xdr.use = 'flash';
// If the original request included serialized form data and
// additional data are defined in configuration.data, it must
// be reset to prevent data duplication.
c.data = c.form && d ? d : null;
return Y.io(uri, c, o.id);
}
/**
* @description Method that concatenates string data for HTTP GET transactions.
*
* @method _concat
* @private
* @static
* @param {string} s - URI or root data.
* @param {string} d - data to be concatenated onto URI.
* @return int
*/
function _concat(s, d) {
s += ((s.indexOf('?') == -1) ? '?' : '&') + d;
return s;
}
/**
* @description Method that stores default client headers for all transactions.
* If a label is passed with no value argument, the header will be deleted.
*
* @method _setHeader
* @private
* @static
* @param {string} l - HTTP header
* @param {string} v - HTTP header value
* @return int
*/
function _setHeader(l, v) {
if (v) {
_headers[l] = v;
}
else {
delete _headers[l];
}
}
/**
* @description Method that sets all HTTP headers to be sent in a transaction.
*
* @method _setHeaders
* @private
* @static
* @param {object} o - XHR instance for the specific transaction.
* @param {object} h - HTTP headers for the specific transaction, as defined
* in the configuration object passed to YUI.io().
* @return void
*/
function _setHeaders(o, h) {
var p;
h = h || {};
for (p in _headers) {
if (_headers.hasOwnProperty(p)) {
/*
if (h[p]) {
// Configuration headers will supersede preset io headers,
// if headers match.
continue;
}
else {
h[p] = _headers[p];
}
*/
if (!h[p]) {
h[p] = _headers[p];
}
}
}
for (p in h) {
if (h.hasOwnProperty(p)) {
if (h[p] !== 'disable') {
o.setRequestHeader(p, h[p]);
}
}
}
}
/**
* @description Terminates a transaction due to an explicit abort or
* timeout.
*
* @method _ioCancel
* @private
* @static
* @param {object} o - Transaction object generated by _create().
* @param {string} s - Identifies timed out or aborted transaction.
*
* @return void
*/
function _ioCancel(o, s) {
if (o && o.c) {
o.e = s;
o.c.abort();
}
}
/**
* @description Starts timeout count if the configuration object
* has a defined timeout property.
*
* @method _startTimeout
* @private
* @static
* @param {object} o - Transaction object generated by _create().
* @param {object} t - Timeout in milliseconds.
* @return void
*/
function _startTimeout(o, t) {
_timeout[o.id] = w.setTimeout(function() { _ioCancel(o, 'timeout'); }, t);
}
/**
* @description Clears the timeout interval started by _startTimeout().
*
* @method _clearTimeout
* @private
* @static
* @param {number} id - Transaction id.
* @return void
*/
function _clearTimeout(id) {
w.clearTimeout(_timeout[id]);
delete _timeout[id];
}
/**
* @description Method that determines if a transaction response qualifies
* as success or failure, based on the response HTTP status code, and
* fires the appropriate success or failure events.
*
* @method _handleResponse
* @private
* @static
* @param {object} o - Transaction object generated by _create().
* @param {object} c - Configuration object passed to io().
* @return void
*/
function _handleResponse(o, c) {
var status;
try {
status = (o.c.status && o.c.status !== 0) ? o.c.status : 0;
}
catch(e) {
status = 0;
}
// IE reports HTTP 204 as HTTP 1223.
if (status >= 200 && status < 300 || status === 1223) {
_ioSuccess(o, c);
}
else {
_ioFailure(o, c);
}
}
/**
* @description Event handler bound to onreadystatechange.
*
* @method _readyState
* @private
* @static
* @param {object} o - Transaction object generated by _create().
* @param {object} c - Configuration object passed to YUI.io().
* @return void
*/
function _readyState(o, c) {
if (o.c.readyState === 4) {
if (c.timeout) {
_clearTimeout(o.id);
}
w.setTimeout(
function() {
_ioComplete(o, c);
_handleResponse(o, c);
}, 0);
}
}
/**
* @description Method for requesting a transaction. _io() is implemented as
* yui.io(). Each transaction may include a configuration object. Its
* properties are:
*
* method: HTTP method verb (e.g., GET or POST). If this property is not
* not defined, the default value will be GET.
*
* data: This is the name-value string that will be sent as the transaction
* data. If the request is HTTP GET, the data become part of
* querystring. If HTTP POST, the data are sent in the message body.
*
* xdr: Defines the transport to be used for cross-domain requests. By
* setting this property, the transaction will use the specified
* transport instead of XMLHttpRequest.
* The properties are:
* {
* use: Specify the transport to be used: 'flash' and 'native'
* dataType: Set the value to 'XML' if that is the expected
* response content type.
* }
*
*
* form: This is a defined object used to process HTML form as data. The
* properties are:
* {
* id: Node object or id of HTML form.
* useDisabled: Boolean value to allow disabled HTML form field
* values to be sent as part of the data.
* }
*
* on: This is a defined object used to create and handle specific
* events during a transaction lifecycle. These events will fire in
* addition to the global io events. The events are:
* start - This event is fired when a request is sent to a resource.
* complete - This event fires when the transaction is complete.
* success - This event fires when the response status resolves to
* HTTP 2xx.
* failure - This event fires when the response status resolves to
* HTTP 4xx, 5xx; and, for all transaction exceptions,
* including aborted transactions and transaction timeouts.
* end - This even is fired at the conclusion of the transaction
* lifecycle, after a success or failure resolution.
*
* The properties are:
* {
* start: function(id, arguments){},
* complete: function(id, responseobject, arguments){},
* success: function(id, responseobject, arguments){},
* failure: function(id, responseobject, arguments){},
* end: function(id, arguments){}
* }
* Each property can reference a function or be written as an
* inline function.
*
* sync: To enable synchronous transactions, set the configuration property
* "sync" to true; the default behavior is false. Synchronous
* transactions are limited to same-domain requests only.
*
* context: Object reference for all defined transaction event handlers
* when it is implemented as a method of a base object. Defining
* "context" will set the reference of "this," used in the
* event handlers, to the context value. In the case where
* different event handlers all have different contexts,
* use Y.bind() to set the execution context, bypassing this
* configuration.
*
* headers: This is a defined object of client headers, as many as.
* desired for the transaction. The object pattern is:
* { 'header': 'value' }.
*
* timeout: This value, defined as milliseconds, is a time threshold for the
* transaction. When this threshold is reached, and the transaction's
* Complete event has not yet fired, the transaction will be aborted.
*
* arguments: Object, array, string, or number passed to all registered
* event handlers. This value is available as the second
* argument in the "start" and "abort" event handlers; and, it is
* the third argument in the "complete", "success", and "failure"
* event handlers.
*
* @method _io
* @private
* @static
* @param {string} uri - qualified path to transaction resource.
* @param {object} c - configuration object for the transaction.
* @param {number} i - transaction id, if already set.
* @return object
*/
function _io(uri, c, i) {
var f, o, d, m, r, s, oD, a, j,
u = uri;
c = Y.Object(c);
o = _create(c.xdr || c.form, i);
m = c.method ? c.method = c.method.toUpperCase() : c.method = 'GET';
s = c.sync;
oD = c.data;
//To serialize an object into a key-value string, add the
//QueryString module to the YUI instance's 'use' method.
if (Y.Lang.isObject(c.data) && Y.QueryString) {
c.data = Y.QueryString.stringify(c.data);
}
if (c.form) {
if (c.form.upload) {
// This is a file upload transaction, calling
// upload() in io-upload-iframe.
return Y.io.upload(o, uri, c);
}
else {
// Serialize HTML form data.
f = Y.io._serialize(c.form, c.data);
if (m === 'POST' || m === 'PUT') {
c.data = f;
}
else if (m === 'GET') {
uri = _concat(uri, f);
}
}
}
if (c.data && m === 'GET') {
uri = _concat(uri, c.data);
}
if (c.data && m === 'POST') {
c.headers = Y.merge({ 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' }, c.headers);
}
if (o.t) {
return Y.io.xdr(uri, o, c);
}
if (!s) {
o.c.onreadystatechange = function() { _readyState(o, c); };
}
try {
o.c.open(m, uri, s ? false : true);
// Will work only in browsers that implement the
// Cross-Origin Resource Sharing draft.
if (c.xdr && c.xdr.credentials) {
o.c.withCredentials = true;
}
}
catch(e1) {
if (c.xdr) {
// This exception is usually thrown by browsers
// that do not support native XDR transactions.
return _resend(o, u, c, oD);
}
}
_setHeaders(o.c, c.headers);
_ioStart(o.id, c);
try {
// Using "null" with HTTP POST will result in a request
// with no Content-Length header defined.
o.c.send(c.data || '');
if (s) {
d = o.c;
a = ['status', 'statusText', 'responseText', 'responseXML'];
r = c.arguments ? { id: o.id, arguments: c.arguments } : { id: o.id };
for (j = 0; j < 4; j++) {
r[a[j]] = o.c[a[j]];
}
r.getAllResponseHeaders = function() { return d.getAllResponseHeaders(); };
r.getResponseHeader = function(h) { return d.getResponseHeader(h); };
_ioComplete(o, c);
_handleResponse(o, c);
return r;
}
}
catch(e2) {
if (c.xdr) {
// This exception is usually thrown by browsers
// that do not support native XDR transactions.
return _resend(o, u, c, oD);
}
}
// If config.timeout is defined, and the request is standard XHR,
// initialize timeout polling.
if (c.timeout) {
_startTimeout(o, c.timeout);
}
return {
id: o.id,
abort: function() {
return o.c ? _ioCancel(o, 'abort') : false;
},
isInProgress: function() {
return o.c ? o.c.readyState !== 4 && o.c.readyState !== 0 : false;
}
};
}
_io.start = _ioStart;
_io.complete = _ioComplete;
_io.success = _ioSuccess;
_io.failure = _ioFailure;
_io.end = _ioEnd;
_io._id = _id;
_io._timeout = _timeout;
//--------------------------------------
// Begin public interface definition
//--------------------------------------
/**
* @description Method that stores default client headers for all transactions.
* If a label is passed with no value argument, the header will be deleted.
* This is the interface for _setHeader().
*
* @method header
* @public
* @static
* @param {string} l - HTTP header
* @param {string} v - HTTP header value
* @return int
*/
_io.header = _setHeader;
/**
* @description Method for requesting a transaction. This
* is the interface for _io().
*
* @method io
* @public
* @static
* @param {string} uri - qualified path to transaction resource.
* @param {object} c - configuration object for the transaction.
* @return object
*/
Y.io = _io;
Y.io.http = _io;
}, '3.3.0' ,{requires:['event-custom-base', 'querystring-stringify-simple']});
YUI.add('querystring-stringify-simple', function(Y) {
/*global Y */
/**
* <p>Provides Y.QueryString.stringify method for converting objects to Query Strings.
* This is a subset implementation of the full querystring-stringify.</p>
* <p>This module provides the bare minimum functionality (encoding a hash of simple values),
* without the additional support for nested data structures. Every key-value pair is
* encoded by encodeURIComponent.</p>
* <p>This module provides a minimalistic way for io to handle single-level objects
* as transaction data.</p>
*
* @module querystring
* @submodule querystring-stringify-simple
* @for QueryString
* @static
*/
var QueryString = Y.namespace("QueryString"),
EUC = encodeURIComponent;
/**
* <p>Converts a simple object to a Query String representation.</p>
* <p>Nested objects, Arrays, and so on, are not supported.</p>
*
* @method stringify
* @for QueryString
* @public
* @submodule querystring-stringify-simple
* @param obj {Object} A single-level object to convert to a querystring.
* @param cfg {Object} (optional) Configuration object. In the simple
* module, only the arrayKey setting is
* supported. When set to true, the key of an
* array will have the '[]' notation appended
* to the key;.
* @static
*/
QueryString.stringify = function (obj, c) {
var qs = [],
// Default behavior is false; standard key notation.
s = c && c.arrayKey ? true : false,
key, i, l;
for (key in obj) {
if (obj.hasOwnProperty(key)) {
if (Y.Lang.isArray(obj[key])) {
for (i = 0, l = obj[key].length; i < l; i++) {
qs.push(EUC(s ? key + '[]' : key) + '=' + EUC(obj[key][i]));
}
}
else {
qs.push(EUC(key) + '=' + EUC(obj[key]));
}
}
}
return qs.join('&');
};
}, '3.3.0' );
YUI.add('json-parse', function(Y) {
/**
* <p>The JSON module adds support for serializing JavaScript objects into
* JSON strings and parsing JavaScript objects from strings in JSON format.</p>
*
* <p>The JSON namespace is added to your YUI instance including static methods
* Y.JSON.parse(..) and Y.JSON.stringify(..).</p>
*
* <p>The functionality and method signatures follow the ECMAScript 5
* specification. In browsers with native JSON support, the native
* implementation is used.</p>
*
* <p>The <code>json</code> module is a rollup of <code>json-parse</code> and
* <code>json-stringify</code>.</p>
*
* <p>As their names suggest, <code>json-parse</code> adds support for parsing
* JSON data (Y.JSON.parse) and <code>json-stringify</code> for serializing
* JavaScript data into JSON strings (Y.JSON.stringify). You may choose to
* include either of the submodules individually if you don't need the
* complementary functionality, or include the rollup for both.</p>
*
* @module json
* @class JSON
* @static
*/
/**
* Provides Y.JSON.parse method to accept JSON strings and return native
* JavaScript objects.
*
* @module json
* @submodule json-parse
* @for JSON
* @static
*/
// All internals kept private for security reasons
function fromGlobal(ref) {
return (Y.config.win || this || {})[ref];
}
/**
* Alias to native browser implementation of the JSON object if available.
*
* @property Native
* @type {Object}
* @private
*/
var _JSON = fromGlobal('JSON'),
// Create an indirect reference to eval to allow for minification
_eval = fromGlobal('eval'),
Native = (Object.prototype.toString.call(_JSON) === '[object JSON]' && _JSON),
useNative = !!Native,
/**
* Replace certain Unicode characters that JavaScript may handle incorrectly
* during eval--either by deleting them or treating them as line
* endings--with escape sequences.
* IMPORTANT NOTE: This regex will be used to modify the input if a match is
* found.
*
* @property _UNICODE_EXCEPTIONS
* @type {RegExp}
* @private
*/
_UNICODE_EXCEPTIONS = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
/**
* First step in the safety evaluation. Regex used to replace all escape
* sequences (i.e. "\\", etc) with '@' characters (a non-JSON character).
*
* @property _ESCAPES
* @type {RegExp}
* @private
*/
_ESCAPES = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
/**
* Second step in the safety evaluation. Regex used to replace all simple
* values with ']' characters.
*
* @property _VALUES
* @type {RegExp}
* @private
*/
_VALUES = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
/**
* Third step in the safety evaluation. Regex used to remove all open
* square brackets following a colon, comma, or at the beginning of the
* string.
*
* @property _BRACKETS
* @type {RegExp}
* @private
*/
_BRACKETS = /(?:^|:|,)(?:\s*\[)+/g,
/**
* Final step in the safety evaluation. Regex used to test the string left
* after all previous replacements for invalid characters.
*
* @property _UNSAFE
* @type {RegExp}
* @private
*/
_UNSAFE = /[^\],:{}\s]/,
/**
* Replaces specific unicode characters with their appropriate \unnnn
* format. Some browsers ignore certain characters during eval.
*
* @method escapeException
* @param c {String} Unicode character
* @return {String} the \unnnn escapement of the character
* @private
*/
_escapeException = function (c) {
return '\\u'+('0000'+(+(c.charCodeAt(0))).toString(16)).slice(-4);
},
/**
* Traverses nested objects, applying a reviver function to each (key,value)
* from the scope if the key:value's containing object. The value returned
* from the function will replace the original value in the key:value pair.
* If the value returned is undefined, the key will be omitted from the
* returned object.
*
* @method _revive
* @param data {MIXED} Any JavaScript data
* @param reviver {Function} filter or mutation function
* @return {MIXED} The results of the filtered data
* @private
*/
_revive = function (data, reviver) {
var walk = function (o,key) {
var k,v,value = o[key];
if (value && typeof value === 'object') {
for (k in value) {
if (value.hasOwnProperty(k)) {
v = walk(value, k);
if (v === undefined) {
delete value[k];
} else {
value[k] = v;
}
}
}
}
return reviver.call(o,key,value);
};
return typeof reviver === 'function' ? walk({'':data},'') : data;
},
/**
* Parse a JSON string, returning the native JavaScript representation.
*
* @param s {string} JSON string data
* @param reviver {function} (optional) function(k,v) passed each key value
* pair of object literals, allowing pruning or altering values
* @return {MIXED} the native JavaScript representation of the JSON string
* @throws SyntaxError
* @method parse
* @static
*/
// JavaScript implementation in lieu of native browser support. Based on
// the json2.js library from http://json.org
_parse = function (s,reviver) {
// Replace certain Unicode characters that are otherwise handled
// incorrectly by some browser implementations.
// NOTE: This modifies the input if such characters are found!
s = s.replace(_UNICODE_EXCEPTIONS, _escapeException);
// Test for any remaining invalid characters
if (!_UNSAFE.test(s.replace(_ESCAPES,'@').
replace(_VALUES,']').
replace(_BRACKETS,''))) {
// Eval the text into a JavaScript data structure, apply any
// reviver function, and return
return _revive( _eval('(' + s + ')'), reviver );
}
throw new SyntaxError('JSON.parse');
};
Y.namespace('JSON').parse = function (s,reviver) {
if (typeof s !== 'string') {
s += '';
}
return Native && Y.JSON.useNativeParse ?
Native.parse(s,reviver) : _parse(s,reviver);
};
function workingNative( k, v ) {
return k === "ok" ? true : v;
}
// Double check basic functionality. This is mainly to catch early broken
// implementations of the JSON API in Firefox 3.1 beta1 and beta2
if ( Native ) {
try {
useNative = ( Native.parse( '{"ok":false}', workingNative ) ).ok;
}
catch ( e ) {
useNative = false;
}
}
/**
* Leverage native JSON parse if the browser has a native implementation.
* In general, this is a good idea. See the Known Issues section in the
* JSON user guide for caveats. The default value is true for browsers with
* native JSON support.
*
* @property useNativeParse
* @type Boolean
* @default true
* @static
*/
Y.JSON.useNativeParse = useNative;
}, '3.3.0' );
YUI.add('transition-native', function(Y) {
/**
* Provides the transition method for Node.
* Transition has no API of its own, but adds the transition method to Node.
*
* @module transition
* @requires node-style
*/
var TRANSITION = '-webkit-transition',
TRANSITION_CAMEL = 'WebkitTransition',
TRANSITION_PROPERTY_CAMEL = 'WebkitTransitionProperty',
TRANSITION_PROPERTY = '-webkit-transition-property',
TRANSITION_DURATION = '-webkit-transition-duration',
TRANSITION_TIMING_FUNCTION = '-webkit-transition-timing-function',
TRANSITION_DELAY = '-webkit-transition-delay',
TRANSITION_END = 'webkitTransitionEnd',
ON_TRANSITION_END = 'onwebkittransitionend',
TRANSFORM_CAMEL = 'WebkitTransform',
EMPTY_OBJ = {},
/**
* A class for constructing transition instances.
* Adds the "transition" method to Node.
* @class Transition
* @constructor
*/
Transition = function() {
this.init.apply(this, arguments);
};
Transition.fx = {};
Transition.toggles = {};
Transition._hasEnd = {};
Transition._toCamel = function(property) {
property = property.replace(/-([a-z])/gi, function(m0, m1) {
return m1.toUpperCase();
});
return property;
};
Transition._toHyphen = function(property) {
property = property.replace(/([A-Z]?)([a-z]+)([A-Z]?)/g, function(m0, m1, m2, m3) {
var str = '';
if (m1) {
str += '-' + m1.toLowerCase();
}
str += m2;
if (m3) {
str += '-' + m3.toLowerCase();
}
return str;
});
return property;
};
Transition._reKeywords = /^(?:node|duration|iterations|easing|delay|on|onstart|onend)$/i;
Transition.useNative = false;
if (TRANSITION in Y.config.doc.documentElement.style) {
Transition.useNative = true;
Transition.supported = true; // TODO: remove
}
Y.Node.DOM_EVENTS[TRANSITION_END] = 1;
Transition.NAME = 'transition';
Transition.DEFAULT_EASING = 'ease';
Transition.DEFAULT_DURATION = 0.5;
Transition.DEFAULT_DELAY = 0;
Transition._nodeAttrs = {};
Transition.prototype = {
constructor: Transition,
init: function(node, config) {
var anim = this;
anim._node = node;
if (!anim._running && config) {
anim._config = config;
node._transition = anim; // cache for reuse
anim._duration = ('duration' in config) ?
config.duration: anim.constructor.DEFAULT_DURATION;
anim._delay = ('delay' in config) ?
config.delay: anim.constructor.DEFAULT_DELAY;
anim._easing = config.easing || anim.constructor.DEFAULT_EASING;
anim._count = 0; // track number of animated properties
anim._running = false;
}
return anim;
},
addProperty: function(prop, config) {
var anim = this,
node = this._node,
uid = Y.stamp(node),
nodeInstance = Y.one(node),
attrs = Transition._nodeAttrs[uid],
computed,
compareVal,
dur,
attr,
val;
if (!attrs) {
attrs = Transition._nodeAttrs[uid] = {};
}
attr = attrs[prop];
// might just be a value
if (config && config.value !== undefined) {
val = config.value;
} else if (config !== undefined) {
val = config;
config = EMPTY_OBJ;
}
if (typeof val === 'function') {
val = val.call(nodeInstance, nodeInstance);
}
if (attr && attr.transition) {
// take control if another transition owns this property
if (attr.transition !== anim) {
attr.transition._count--; // remapping attr to this transition
}
}
anim._count++; // properties per transition
// make 0 async and fire events
dur = ((typeof config.duration != 'undefined') ? config.duration :
anim._duration) || 0.0001;
attrs[prop] = {
value: val,
duration: dur,
delay: (typeof config.delay != 'undefined') ? config.delay :
anim._delay,
easing: config.easing || anim._easing,
transition: anim
};
// native end event doesnt fire when setting to same value
// supplementing with timer
// val may be a string or number (height: 0, etc), but computedStyle is always string
computed = Y.DOM.getComputedStyle(node, prop);
compareVal = (typeof val === 'string') ? computed : parseFloat(computed);
if (Transition.useNative && compareVal === val) {
setTimeout(function() {
anim._onNativeEnd.call(node, {
propertyName: prop,
elapsedTime: dur
});
}, dur * 1000);
}
},
removeProperty: function(prop) {
var anim = this,
attrs = Transition._nodeAttrs[Y.stamp(anim._node)];
if (attrs && attrs[prop]) {
delete attrs[prop];
anim._count--;
}
},
initAttrs: function(config) {
var attr,
node = this._node;
if (config.transform && !config[TRANSFORM_CAMEL]) {
config[TRANSFORM_CAMEL] = config.transform;
delete config.transform; // TODO: copy
}
for (attr in config) {
if (config.hasOwnProperty(attr) && !Transition._reKeywords.test(attr)) {
this.addProperty(attr, config[attr]);
// when size is auto or % webkit starts from zero instead of computed
// (https://bugs.webkit.org/show_bug.cgi?id=16020)
// TODO: selective set
if (node.style[attr] === '') {
Y.DOM.setStyle(node, attr, Y.DOM.getComputedStyle(node, attr));
}
}
}
},
/**
* Starts or an animation.
* @method run
* @chainable
* @private
*/
run: function(callback) {
var anim = this,
node = anim._node,
config = anim._config,
data = {
type: 'transition:start',
config: config
};
if (!anim._running) {
anim._running = true;
//anim._node.fire('transition:start', data);
if (config.on && config.on.start) {
config.on.start.call(Y.one(node), data);
}
anim.initAttrs(anim._config);
anim._callback = callback;
anim._start();
}
return anim;
},
_start: function() {
this._runNative();
},
_prepDur: function(dur) {
dur = parseFloat(dur);
return dur + 's';
},
_runNative: function(time) {
var anim = this,
node = anim._node,
uid = Y.stamp(node),
style = node.style,
computed = getComputedStyle(node),
attrs = Transition._nodeAttrs[uid],
cssText = '',
cssTransition = computed[TRANSITION_PROPERTY],
transitionText = TRANSITION_PROPERTY + ': ',
duration = TRANSITION_DURATION + ': ',
easing = TRANSITION_TIMING_FUNCTION + ': ',
delay = TRANSITION_DELAY + ': ',
hyphy,
attr,
name;
// preserve existing transitions
if (cssTransition !== 'all') {
transitionText += cssTransition + ',';
duration += computed[TRANSITION_DURATION] + ',';
easing += computed[TRANSITION_TIMING_FUNCTION] + ',';
delay += computed[TRANSITION_DELAY] + ',';
}
// run transitions mapped to this instance
for (name in attrs) {
hyphy = Transition._toHyphen(name);
attr = attrs[name];
if (attrs.hasOwnProperty(name) && attr.transition === anim) {
if (name in node.style) { // only native styles allowed
duration += anim._prepDur(attr.duration) + ',';
delay += anim._prepDur(attr.delay) + ',';
easing += (attr.easing) + ',';
transitionText += hyphy + ',';
cssText += hyphy + ': ' + attr.value + '; ';
} else {
this.removeProperty(name);
}
}
}
transitionText = transitionText.replace(/,$/, ';');
duration = duration.replace(/,$/, ';');
easing = easing.replace(/,$/, ';');
delay = delay.replace(/,$/, ';');
// only one native end event per node
if (!Transition._hasEnd[uid]) {
//anim._detach = Y.on(TRANSITION_END, anim._onNativeEnd, node);
//node[ON_TRANSITION_END] = anim._onNativeEnd;
node.addEventListener(TRANSITION_END, anim._onNativeEnd, false);
Transition._hasEnd[uid] = true;
}
//setTimeout(function() { // allow updates to apply (size fix, onstart, etc)
style.cssText += transitionText + duration + easing + delay + cssText;
//}, 1);
},
_end: function(elapsed) {
var anim = this,
node = anim._node,
callback = anim._callback,
config = anim._config,
data = {
type: 'transition:end',
config: config,
elapsedTime: elapsed
},
nodeInstance = Y.one(node);
anim._running = false;
anim._callback = null;
if (node) {
if (config.on && config.on.end) {
setTimeout(function() { // IE: allow previous update to finish
config.on.end.call(nodeInstance, data);
// nested to ensure proper fire order
if (callback) {
callback.call(nodeInstance, data);
}
}, 1);
} else if (callback) {
setTimeout(function() { // IE: allow previous update to finish
callback.call(nodeInstance, data);
}, 1);
}
//node.fire('transition:end', data);
}
},
_endNative: function(name) {
var node = this._node,
value = node.ownerDocument.defaultView.getComputedStyle(node, '')[TRANSITION_PROPERTY];
if (typeof value === 'string') {
value = value.replace(new RegExp('(?:^|,\\s)' + name + ',?'), ',');
value = value.replace(/^,|,$/, '');
node.style[TRANSITION_CAMEL] = value;
}
},
_onNativeEnd: function(e) {
var node = this,
uid = Y.stamp(node),
event = e,//e._event,
name = Transition._toCamel(event.propertyName),
elapsed = event.elapsedTime,
attrs = Transition._nodeAttrs[uid],
attr = attrs[name],
anim = (attr) ? attr.transition : null,
data,
config;
if (anim) {
anim.removeProperty(name);
anim._endNative(name);
config = anim._config[name];
data = {
type: 'propertyEnd',
propertyName: name,
elapsedTime: elapsed,
config: config
};
if (config && config.on && config.on.end) {
config.on.end.call(Y.one(node), data);
}
//node.fire('transition:propertyEnd', data);
if (anim._count <= 0) { // after propertyEnd fires
anim._end(elapsed);
}
}
},
destroy: function() {
var anim = this;
/*
if (anim._detach) {
anim._detach.detach();
}
*/
//anim._node[ON_TRANSITION_END] = null;
node.removeEventListener(TRANSITION_END, anim._onNativeEnd, false);
anim._node = null;
}
};
Y.Transition = Transition;
Y.TransitionNative = Transition; // TODO: remove
/**
* Animate one or more css properties to a given value. Requires the "transition" module.
* <pre>example usage:
* Y.one('#demo').transition({
* duration: 1, // in seconds, default is 0.5
* easing: 'ease-out', // default is 'ease'
* delay: '1', // delay start for 1 second, default is 0
*
* height: '10px',
* width: '10px',
*
* opacity: { // per property
* value: 0,
* duration: 2,
* delay: 2,
* easing: 'ease-in'
* }
* });
* </pre>
* @for Node
* @method transition
* @param {Object} config An object containing one or more style properties, a duration and an easing.
* @param {Function} callback A function to run after the transition has completed.
* @chainable
*/
Y.Node.prototype.transition = function(name, config, callback) {
var
transitionAttrs = Transition._nodeAttrs[Y.stamp(this._node)],
anim = (transitionAttrs) ? transitionAttrs.transition || null : null,
fxConfig,
prop;
if (typeof name === 'string') { // named effect, pull config from registry
if (typeof config === 'function') {
callback = config;
config = null;
}
fxConfig = Transition.fx[name];
if (config && typeof config !== 'boolean') {
config = Y.clone(config);
for (prop in fxConfig) {
if (fxConfig.hasOwnProperty(prop)) {
if (! (prop in config)) {
config[prop] = fxConfig[prop];
}
}
}
} else {
config = fxConfig;
}
} else { // name is a config, config is a callback or undefined
callback = config;
config = name;
}
if (anim && !anim._running) {
anim.init(this, config);
} else {
anim = new Transition(this._node, config);
}
anim.run(callback);
return this;
};
Y.Node.prototype.show = function(name, config, callback) {
this._show(); // show prior to transition
if (name && Y.Transition) {
if (typeof name !== 'string' && !name.push) { // named effect or array of effects supercedes default
if (typeof config === 'function') {
callback = config;
config = name;
}
name = this.SHOW_TRANSITION;
}
this.transition(name, config, callback);
}
return this;
};
var _wrapCallBack = function(anim, fn, callback) {
return function() {
if (fn) {
fn.call(anim);
}
if (callback) {
callback.apply(anim._node, arguments);
}
};
};
Y.Node.prototype.hide = function(name, config, callback) {
if (name && Y.Transition) {
if (typeof config === 'function') {
callback = config;
config = null;
}
callback = _wrapCallBack(this, this._hide, callback); // wrap with existing callback
if (typeof name !== 'string' && !name.push) { // named effect or array of effects supercedes default
if (typeof config === 'function') {
callback = config;
config = name;
}
name = this.HIDE_TRANSITION;
}
this.transition(name, config, callback);
} else {
this._hide();
}
return this;
};
/**
* Animate one or more css properties to a given value. Requires the "transition" module.
* <pre>example usage:
* Y.all('.demo').transition({
* duration: 1, // in seconds, default is 0.5
* easing: 'ease-out', // default is 'ease'
* delay: '1', // delay start for 1 second, default is 0
*
* height: '10px',
* width: '10px',
*
* opacity: { // per property
* value: 0,
* duration: 2,
* delay: 2,
* easing: 'ease-in'
* }
* });
* </pre>
* @for NodeList
* @method transition
* @param {Object} config An object containing one or more style properties, a duration and an easing.
* @param {Function} callback A function to run after the transition has completed. The callback fires
* once per item in the NodeList.
* @chainable
*/
Y.NodeList.prototype.transition = function(config, callback) {
var nodes = this._nodes,
i = 0,
node;
while ((node = nodes[i++])) {
Y.one(node).transition(config, callback);
}
return this;
};
Y.Node.prototype.toggleView = function(name, on) {
var callback;
this._toggles = this._toggles || [];
if (typeof name == 'boolean') { // no transition, just toggle
on = name;
}
if (typeof on === 'undefined' && name in this._toggles) {
on = ! this._toggles[name];
}
on = (on) ? 1 : 0;
if (on) {
this._show();
} else {
callback = _wrapCallBack(anim, this._hide);
}
this._toggles[name] = on;
this.transition(Y.Transition.toggles[name][on], callback);
};
Y.NodeList.prototype.toggleView = function(config, callback) {
var nodes = this._nodes,
i = 0,
node;
while ((node = nodes[i++])) {
Y.one(node).toggleView(config, callback);
}
return this;
};
Y.mix(Transition.fx, {
fadeOut: {
opacity: 0,
duration: 0.5,
easing: 'ease-out'
},
fadeIn: {
opacity: 1,
duration: 0.5,
easing: 'ease-in'
},
sizeOut: {
height: 0,
width: 0,
duration: 0.75,
easing: 'ease-out'
},
sizeIn: {
height: function(node) {
return node.get('scrollHeight') + 'px';
},
width: function(node) {
return node.get('scrollWidth') + 'px';
},
duration: 0.5,
easing: 'ease-in',
on: {
start: function() {
var overflow = this.getStyle('overflow');
if (overflow !== 'hidden') { // enable scrollHeight/Width
this.setStyle('overflow', 'hidden');
this._transitionOverflow = overflow;
}
},
end: function() {
if (this._transitionOverflow) { // revert overridden value
this.setStyle('overflow', this._transitionOverflow);
}
}
}
}
});
Y.mix(Transition.toggles, {
size: ['sizeIn', 'sizeOut'],
fade: ['fadeOut', 'fadeIn']
});
}, '3.3.0' ,{requires:['node-base']});
YUI.add('transition-timer', function(Y) {
/*
* The Transition Utility provides an API for creating advanced transitions.
* @module transition
*/
/*
* Provides the base Transition class, for animating numeric properties.
*
* @module transition
* @submodule transition-timer
*/
var Transition = Y.Transition;
Y.mix(Transition.prototype, {
_start: function() {
if (Transition.useNative) {
this._runNative();
} else {
this._runTimer();
}
},
_runTimer: function() {
var anim = this;
anim._initAttrs();
Transition._running[Y.stamp(anim)] = anim;
anim._startTime = new Date();
Transition._startTimer();
},
_endTimer: function() {
var anim = this;
delete Transition._running[Y.stamp(anim)];
anim._startTime = null;
},
_runFrame: function() {
var t = new Date() - this._startTime;
this._runAttrs(t);
},
_runAttrs: function(time) {
var anim = this,
node = anim._node,
config = anim._config,
uid = Y.stamp(node),
attrs = Transition._nodeAttrs[uid],
customAttr = Transition.behaviors,
done = false,
allDone = false,
data,
name,
attribute,
setter,
elapsed,
delay,
d,
t,
i;
for (name in attrs) {
attribute = attrs[name];
if ((attribute && attribute.transition === anim)) {
d = attribute.duration;
delay = attribute.delay;
elapsed = (time - delay) / 1000;
t = time;
data = {
type: 'propertyEnd',
propertyName: name,
config: config,
elapsedTime: elapsed
};
setter = (i in customAttr && 'set' in customAttr[i]) ?
customAttr[i].set : Transition.DEFAULT_SETTER;
done = (t >= d);
if (t > d) {
t = d;
}
if (!delay || time >= delay) {
setter(anim, name, attribute.from, attribute.to, t - delay, d - delay,
attribute.easing, attribute.unit);
if (done) {
delete attrs[name];
anim._count--;
if (config[name] && config[name].on && config[name].on.end) {
config[name].on.end.call(Y.one(node), data);
}
//node.fire('transition:propertyEnd', data);
if (!allDone && anim._count <= 0) {
allDone = true;
anim._end(elapsed);
anim._endTimer();
}
}
}
}
}
},
_initAttrs: function() {
var anim = this,
customAttr = Transition.behaviors,
uid = Y.stamp(anim._node),
attrs = Transition._nodeAttrs[uid],
attribute,
duration,
delay,
easing,
val,
name,
mTo,
mFrom,
unit, begin, end;
for (name in attrs) {
attribute = attrs[name];
if (attrs.hasOwnProperty(name) && (attribute && attribute.transition === anim)) {
duration = attribute.duration * 1000;
delay = attribute.delay * 1000;
easing = attribute.easing;
val = attribute.value;
// only allow supported properties
if (name in anim._node.style || name in Y.DOM.CUSTOM_STYLES) {
begin = (name in customAttr && 'get' in customAttr[name]) ?
customAttr[name].get(anim, name) : Transition.DEFAULT_GETTER(anim, name);
mFrom = Transition.RE_UNITS.exec(begin);
mTo = Transition.RE_UNITS.exec(val);
begin = mFrom ? mFrom[1] : begin;
end = mTo ? mTo[1] : val;
unit = mTo ? mTo[2] : mFrom ? mFrom[2] : ''; // one might be zero TODO: mixed units
if (!unit && Transition.RE_DEFAULT_UNIT.test(name)) {
unit = Transition.DEFAULT_UNIT;
}
if (typeof easing === 'string') {
if (easing.indexOf('cubic-bezier') > -1) {
easing = easing.substring(13, easing.length - 1).split(',');
} else if (Transition.easings[easing]) {
easing = Transition.easings[easing];
}
}
attribute.from = Number(begin);
attribute.to = Number(end);
attribute.unit = unit;
attribute.easing = easing;
attribute.duration = duration + delay;
attribute.delay = delay;
} else {
delete attrs[name];
anim._count--;
}
}
}
},
destroy: function() {
this.detachAll();
this._node = null;
}
}, true);
Y.mix(Y.Transition, {
_runtimeAttrs: {},
/*
* Regex of properties that should use the default unit.
*
* @property RE_DEFAULT_UNIT
* @static
*/
RE_DEFAULT_UNIT: /^width|height|top|right|bottom|left|margin.*|padding.*|border.*$/i,
/*
* The default unit to use with properties that pass the RE_DEFAULT_UNIT test.
*
* @property DEFAULT_UNIT
* @static
*/
DEFAULT_UNIT: 'px',
/*
* Time in milliseconds passed to setInterval for frame processing
*
* @property intervalTime
* @default 20
* @static
*/
intervalTime: 20,
/*
* Bucket for custom getters and setters
*
* @property behaviors
* @static
*/
behaviors: {
left: {
get: function(anim, attr) {
return Y.DOM._getAttrOffset(anim._node, attr);
}
}
},
/*
* The default setter to use when setting object properties.
*
* @property DEFAULT_SETTER
* @static
*/
DEFAULT_SETTER: function(anim, att, from, to, elapsed, duration, fn, unit) {
from = Number(from);
to = Number(to);
var node = anim._node,
val = Transition.cubicBezier(fn, elapsed / duration);
val = from + val[0] * (to - from);
if (node) {
if (att in node.style || att in Y.DOM.CUSTOM_STYLES) {
unit = unit || '';
Y.DOM.setStyle(node, att, val + unit);
}
} else {
anim._end();
}
},
/*
* The default getter to use when getting object properties.
*
* @property DEFAULT_GETTER
* @static
*/
DEFAULT_GETTER: function(anim, att) {
var node = anim._node,
val = '';
if (att in node.style || att in Y.DOM.CUSTOM_STYLES) {
val = Y.DOM.getComputedStyle(node, att);
}
return val;
},
_startTimer: function() {
if (!Transition._timer) {
Transition._timer = setInterval(Transition._runFrame, Transition.intervalTime);
}
},
_stopTimer: function() {
clearInterval(Transition._timer);
Transition._timer = null;
},
/*
* Called per Interval to handle each animation frame.
* @method _runFrame
* @private
* @static
*/
_runFrame: function() {
var done = true,
anim;
for (anim in Transition._running) {
if (Transition._running[anim]._runFrame) {
done = false;
Transition._running[anim]._runFrame();
}
}
if (done) {
Transition._stopTimer();
}
},
cubicBezier: function(p, t) {
var x0 = 0,
y0 = 0,
x1 = p[0],
y1 = p[1],
x2 = p[2],
y2 = p[3],
x3 = 1,
y3 = 0,
A = x3 - 3 * x2 + 3 * x1 - x0,
B = 3 * x2 - 6 * x1 + 3 * x0,
C = 3 * x1 - 3 * x0,
D = x0,
E = y3 - 3 * y2 + 3 * y1 - y0,
F = 3 * y2 - 6 * y1 + 3 * y0,
G = 3 * y1 - 3 * y0,
H = y0,
x = (((A*t) + B)*t + C)*t + D,
y = (((E*t) + F)*t + G)*t + H;
return [x, y];
},
easings: {
ease: [0.25, 0, 1, 0.25],
linear: [0, 0, 1, 1],
'ease-in': [0.42, 0, 1, 1],
'ease-out': [0, 0, 0.58, 1],
'ease-in-out': [0.42, 0, 0.58, 1]
},
_running: {},
_timer: null,
RE_UNITS: /^(-?\d*\.?\d*){1}(em|ex|px|in|cm|mm|pt|pc|%)*$/
}, true);
Transition.behaviors.top = Transition.behaviors.bottom = Transition.behaviors.right = Transition.behaviors.left;
Y.Transition = Transition;
}, '3.3.0' ,{requires:['transition-native', 'node-style']});
YUI.add('transition', function(Y){}, '3.3.0' ,{use:['transition-native', 'transition-timer']});
YUI.add('selector-css3', function(Y) {
/**
* The selector css3 module provides support for css3 selectors.
* @module dom
* @submodule selector-css3
* @for Selector
*/
/*
an+b = get every _a_th node starting at the _b_th
0n+b = no repeat ("0" and "n" may both be omitted (together) , e.g. "0n+1" or "1", not "0+1"), return only the _b_th element
1n+b = get every element starting from b ("1" may may be omitted, e.g. "1n+0" or "n+0" or "n")
an+0 = get every _a_th element, "0" may be omitted
*/
Y.Selector._reNth = /^(?:([\-]?\d*)(n){1}|(odd|even)$)*([\-+]?\d*)$/;
Y.Selector._getNth = function(node, expr, tag, reverse) {
Y.Selector._reNth.test(expr);
var a = parseInt(RegExp.$1, 10), // include every _a_ elements (zero means no repeat, just first _a_)
n = RegExp.$2, // "n"
oddeven = RegExp.$3, // "odd" or "even"
b = parseInt(RegExp.$4, 10) || 0, // start scan from element _b_
result = [],
siblings = Y.Selector._children(node.parentNode, tag),
op;
if (oddeven) {
a = 2; // always every other
op = '+';
n = 'n';
b = (oddeven === 'odd') ? 1 : 0;
} else if ( isNaN(a) ) {
a = (n) ? 1 : 0; // start from the first or no repeat
}
if (a === 0) { // just the first
if (reverse) {
b = siblings.length - b + 1;
}
if (siblings[b - 1] === node) {
return true;
} else {
return false;
}
} else if (a < 0) {
reverse = !!reverse;
a = Math.abs(a);
}
if (!reverse) {
for (var i = b - 1, len = siblings.length; i < len; i += a) {
if ( i >= 0 && siblings[i] === node ) {
return true;
}
}
} else {
for (var i = siblings.length - b, len = siblings.length; i >= 0; i -= a) {
if ( i < len && siblings[i] === node ) {
return true;
}
}
}
return false;
};
Y.mix(Y.Selector.pseudos, {
'root': function(node) {
return node === node.ownerDocument.documentElement;
},
'nth-child': function(node, expr) {
return Y.Selector._getNth(node, expr);
},
'nth-last-child': function(node, expr) {
return Y.Selector._getNth(node, expr, null, true);
},
'nth-of-type': function(node, expr) {
return Y.Selector._getNth(node, expr, node.tagName);
},
'nth-last-of-type': function(node, expr) {
return Y.Selector._getNth(node, expr, node.tagName, true);
},
'last-child': function(node) {
var children = Y.Selector._children(node.parentNode);
return children[children.length - 1] === node;
},
'first-of-type': function(node) {
return Y.Selector._children(node.parentNode, node.tagName)[0] === node;
},
'last-of-type': function(node) {
var children = Y.Selector._children(node.parentNode, node.tagName);
return children[children.length - 1] === node;
},
'only-child': function(node) {
var children = Y.Selector._children(node.parentNode);
return children.length === 1 && children[0] === node;
},
'only-of-type': function(node) {
var children = Y.Selector._children(node.parentNode, node.tagName);
return children.length === 1 && children[0] === node;
},
'empty': function(node) {
return node.childNodes.length === 0;
},
'not': function(node, expr) {
return !Y.Selector.test(node, expr);
},
'contains': function(node, expr) {
var text = node.innerText || node.textContent || '';
return text.indexOf(expr) > -1;
},
'checked': function(node) {
return (node.checked === true || node.selected === true);
},
enabled: function(node) {
return (node.disabled !== undefined && !node.disabled);
},
disabled: function(node) {
return (node.disabled);
}
});
Y.mix(Y.Selector.operators, {
'^=': '^{val}', // Match starts with value
'$=': '{val}$', // Match ends with value
'*=': '{val}' // Match contains value as substring
});
Y.Selector.combinators['~'] = {
axis: 'previousSibling'
};
}, '3.3.0' ,{requires:['dom-base', 'selector-native', 'selector-css2']});
YUI.add('dom-style-ie', function(Y) {
(function(Y) {
var HAS_LAYOUT = 'hasLayout',
PX = 'px',
FILTER = 'filter',
FILTERS = 'filters',
OPACITY = 'opacity',
AUTO = 'auto',
BORDER_WIDTH = 'borderWidth',
BORDER_TOP_WIDTH = 'borderTopWidth',
BORDER_RIGHT_WIDTH = 'borderRightWidth',
BORDER_BOTTOM_WIDTH = 'borderBottomWidth',
BORDER_LEFT_WIDTH = 'borderLeftWidth',
WIDTH = 'width',
HEIGHT = 'height',
TRANSPARENT = 'transparent',
VISIBLE = 'visible',
GET_COMPUTED_STYLE = 'getComputedStyle',
UNDEFINED = undefined,
documentElement = Y.config.doc.documentElement,
testFeature = Y.Features.test,
addFeature = Y.Features.add,
// TODO: unit-less lineHeight (e.g. 1.22)
re_unit = /^(\d[.\d]*)+(em|ex|px|gd|rem|vw|vh|vm|ch|mm|cm|in|pt|pc|deg|rad|ms|s|hz|khz|%){1}?/i,
isIE8 = (Y.UA.ie >= 8),
_getStyleObj = function(node) {
return node.currentStyle || node.style;
},
ComputedStyle = {
CUSTOM_STYLES: {},
get: function(el, property) {
var value = '',
current;
if (el) {
current = _getStyleObj(el)[property];
if (property === OPACITY && Y.DOM.CUSTOM_STYLES[OPACITY]) {
value = Y.DOM.CUSTOM_STYLES[OPACITY].get(el);
} else if (!current || (current.indexOf && current.indexOf(PX) > -1)) { // no need to convert
value = current;
} else if (Y.DOM.IE.COMPUTED[property]) { // use compute function
value = Y.DOM.IE.COMPUTED[property](el, property);
} else if (re_unit.test(current)) { // convert to pixel
value = ComputedStyle.getPixel(el, property) + PX;
} else {
value = current;
}
}
return value;
},
sizeOffsets: {
width: ['Left', 'Right'],
height: ['Top', 'Bottom'],
top: ['Top'],
bottom: ['Bottom']
},
getOffset: function(el, prop) {
var current = _getStyleObj(el)[prop], // value of "width", "top", etc.
capped = prop.charAt(0).toUpperCase() + prop.substr(1), // "Width", "Top", etc.
offset = 'offset' + capped, // "offsetWidth", "offsetTop", etc.
pixel = 'pixel' + capped, // "pixelWidth", "pixelTop", etc.
sizeOffsets = ComputedStyle.sizeOffsets[prop],
mode = el.ownerDocument.compatMode,
value = '';
// IE pixelWidth incorrect for percent
// manually compute by subtracting padding and border from offset size
// NOTE: clientWidth/Height (size minus border) is 0 when current === AUTO so offsetHeight is used
// reverting to auto from auto causes position stacking issues (old impl)
if (current === AUTO || current.indexOf('%') > -1) {
value = el['offset' + capped];
if (mode !== 'BackCompat') {
if (sizeOffsets[0]) {
value -= ComputedStyle.getPixel(el, 'padding' + sizeOffsets[0]);
value -= ComputedStyle.getBorderWidth(el, 'border' + sizeOffsets[0] + 'Width', 1);
}
if (sizeOffsets[1]) {
value -= ComputedStyle.getPixel(el, 'padding' + sizeOffsets[1]);
value -= ComputedStyle.getBorderWidth(el, 'border' + sizeOffsets[1] + 'Width', 1);
}
}
} else { // use style.pixelWidth, etc. to convert to pixels
// need to map style.width to currentStyle (no currentStyle.pixelWidth)
if (!el.style[pixel] && !el.style[prop]) {
el.style[prop] = current;
}
value = el.style[pixel];
}
return value + PX;
},
borderMap: {
thin: (isIE8) ? '1px' : '2px',
medium: (isIE8) ? '3px': '4px',
thick: (isIE8) ? '5px' : '6px'
},
getBorderWidth: function(el, property, omitUnit) {
var unit = omitUnit ? '' : PX,
current = el.currentStyle[property];
if (current.indexOf(PX) < 0) { // look up keywords if a border exists
if (ComputedStyle.borderMap[current] &&
el.currentStyle.borderStyle !== 'none') {
current = ComputedStyle.borderMap[current];
} else { // otherwise no border (default is "medium")
current = 0;
}
}
return (omitUnit) ? parseFloat(current) : current;
},
getPixel: function(node, att) {
// use pixelRight to convert to px
var val = null,
style = _getStyleObj(node),
styleRight = style.right,
current = style[att];
node.style.right = current;
val = node.style.pixelRight;
node.style.right = styleRight; // revert
return val;
},
getMargin: function(node, att) {
var val,
style = _getStyleObj(node);
if (style[att] == AUTO) {
val = 0;
} else {
val = ComputedStyle.getPixel(node, att);
}
return val + PX;
},
getVisibility: function(node, att) {
var current;
while ( (current = node.currentStyle) && current[att] == 'inherit') { // NOTE: assignment in test
node = node.parentNode;
}
return (current) ? current[att] : VISIBLE;
},
getColor: function(node, att) {
var current = _getStyleObj(node)[att];
if (!current || current === TRANSPARENT) {
Y.DOM.elementByAxis(node, 'parentNode', null, function(parent) {
current = _getStyleObj(parent)[att];
if (current && current !== TRANSPARENT) {
node = parent;
return true;
}
});
}
return Y.Color.toRGB(current);
},
getBorderColor: function(node, att) {
var current = _getStyleObj(node),
val = current[att] || current.color;
return Y.Color.toRGB(Y.Color.toHex(val));
}
},
//fontSize: getPixelFont,
IEComputed = {};
addFeature('style', 'computedStyle', {
test: function() {
return 'getComputedStyle' in Y.config.win;
}
});
addFeature('style', 'opacity', {
test: function() {
return 'opacity' in documentElement.style;
}
});
addFeature('style', 'filter', {
test: function() {
return 'filters' in documentElement;
}
});
// use alpha filter for IE opacity
if (!testFeature('style', 'opacity') && testFeature('style', 'filter')) {
Y.DOM.CUSTOM_STYLES[OPACITY] = {
get: function(node) {
var val = 100;
try { // will error if no DXImageTransform
val = node[FILTERS]['DXImageTransform.Microsoft.Alpha'][OPACITY];
} catch(e) {
try { // make sure its in the document
val = node[FILTERS]('alpha')[OPACITY];
} catch(err) {
}
}
return val / 100;
},
set: function(node, val, style) {
var current,
styleObj = _getStyleObj(node),
currentFilter = styleObj[FILTER];
style = style || node.style;
if (val === '') { // normalize inline style behavior
current = (OPACITY in styleObj) ? styleObj[OPACITY] : 1; // revert to original opacity
val = current;
}
if (typeof currentFilter == 'string') { // in case not appended
style[FILTER] = currentFilter.replace(/alpha([^)]*\))/gi, '') +
((val < 1) ? 'alpha(' + OPACITY + '=' + val * 100 + ')' : '');
if (!style[FILTER]) {
style.removeAttribute(FILTER);
}
if (!styleObj[HAS_LAYOUT]) {
style.zoom = 1; // needs layout
}
}
}
};
}
try {
Y.config.doc.createElement('div').style.height = '-1px';
} catch(e) { // IE throws error on invalid style set; trap common cases
Y.DOM.CUSTOM_STYLES.height = {
set: function(node, val, style) {
var floatVal = parseFloat(val);
if (floatVal >= 0 || val === 'auto' || val === '') {
style.height = val;
} else {
}
}
};
Y.DOM.CUSTOM_STYLES.width = {
set: function(node, val, style) {
var floatVal = parseFloat(val);
if (floatVal >= 0 || val === 'auto' || val === '') {
style.width = val;
} else {
}
}
};
}
if (!testFeature('style', 'computedStyle')) {
// TODO: top, right, bottom, left
IEComputed[WIDTH] = IEComputed[HEIGHT] = ComputedStyle.getOffset;
IEComputed.color = IEComputed.backgroundColor = ComputedStyle.getColor;
IEComputed[BORDER_WIDTH] = IEComputed[BORDER_TOP_WIDTH] = IEComputed[BORDER_RIGHT_WIDTH] =
IEComputed[BORDER_BOTTOM_WIDTH] = IEComputed[BORDER_LEFT_WIDTH] =
ComputedStyle.getBorderWidth;
IEComputed.marginTop = IEComputed.marginRight = IEComputed.marginBottom =
IEComputed.marginLeft = ComputedStyle.getMargin;
IEComputed.visibility = ComputedStyle.getVisibility;
IEComputed.borderColor = IEComputed.borderTopColor =
IEComputed.borderRightColor = IEComputed.borderBottomColor =
IEComputed.borderLeftColor = ComputedStyle.getBorderColor;
Y.DOM[GET_COMPUTED_STYLE] = ComputedStyle.get;
Y.namespace('DOM.IE');
Y.DOM.IE.COMPUTED = IEComputed;
Y.DOM.IE.ComputedStyle = ComputedStyle;
}
})(Y);
}, '3.3.0' ,{requires:['dom-style']});
YUI.add('simpleyui', function(Y) {
// empty
}, '3.3.0' ,{use:['yui','oop','dom','event-custom-base','event-base','pluginhost','node','event-delegate','io-base','json-parse','transition','selector-css3','dom-style-ie','querystring-stringify-simple']});
var Y = YUI().use('*');
|
src/components/Guild/components/Applications/views/ApplicationsView.js
|
chanpod/bosscollectionReact
|
/**
* @flow
*/
import React from 'react'
import { AppStyles, primaryColor, secondaryColor } from '../../../../../shared';
import { Button } from 'react-bootstrap';
const styles = {
container: {
margin: '0 auto',
padding: '1rem',
backgroundColor: primaryColor
}
};
export default class Applications extends React.Component {
constructor(props) {
super(props);
}
render() {
console.log(this.props)
return (
<div style={styles.container} >
<div>
<span> <h2> Applications </h2> </span>
</div>
</div>
)
}
}
Applications.propTypes = {
}
|
app/main.js
|
apache/couchdb-fauxton
|
// 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.
import app from './app';
import React from 'react';
import ReactDOM from 'react-dom';
import FauxtonAPI from './core/api';
import LoadAddons from './load_addons';
import Backbone from 'backbone';
import $ from 'jquery';
import AppWrapper from './addons/fauxton/appwrapper';
import { createStore, applyMiddleware, combineReducers } from 'redux';
import thunk from 'redux-thunk';
import { Provider } from 'react-redux';
FauxtonAPI.addMiddleware(thunk);
const store = createStore(
combineReducers(FauxtonAPI.reducers),
applyMiddleware(...FauxtonAPI.middlewares)
);
FauxtonAPI.reduxDispatch = (action) => {
store.dispatch(action);
};
FauxtonAPI.reduxState = () => {
return store.getState();
};
app.addons = LoadAddons;
FauxtonAPI.router = app.router = new FauxtonAPI.Router(app.addons);
// Trigger the initial route and enable HTML5 History API support, set the
// root folder to '/' by default. Change in app.js.
Backbone.history.start({ pushState: false, root: app.root });
// feature detect IE
if ('ActiveXObject' in window) {
$.ajaxSetup({ cache: false });
}
// Walks up the element tree to look for a link to see if it is part
// of the click nodes
const findLink = (target) => {
if (!target) {
return null;
}
if (target.tagName === 'A') {
return target;
}
return findLink(target.parentNode);
};
// All navigation that is relative should be passed through the navigate
// method, to be processed by the router. If the link has a `data-bypass`
// attribute, bypass the delegation completely.
document.addEventListener("click", evt => {
const target = findLink(evt.target);
if (!target) {
return;
}
//"a:not([data-bypass])"
const dataBypass = target.getAttribute('data-bypass');
if (dataBypass) {
return;
}
// Get the absolute anchor href.
const href = { prop: target.href, attr: target.getAttribute("href") };
if (!href.prop) {
return;
}
// Get the absolute root
const root = location.protocol + "//" + location.host;
// Ensure the root is part of the anchor href, meaning it's relative
if (href.prop && href.prop.slice(0, root.length) === root) {
// Stop the default event to ensure the link will not cause a page
// refresh.
evt.preventDefault();
//User app navigate so that navigate goes through a central place
app.router.navigate(href.attr, true);
}
});
ReactDOM.render(
<Provider store={store}>
<AppWrapper router={app.router}/>
</Provider>,
document.getElementById('app')
);
|
Samples/Provisioning.Cloud.Workflow/Provisioning.Cloud.WorkflowWeb/Scripts/jquery-1.9.1.min.js
|
Chowdarysandhya/PnPTest
|
/* NUGET: BEGIN LICENSE TEXT
jQuery v1.9.1
Microsoft grants you the right to use these script files for the sole purpose of either: (i) interacting through your browser with the Microsoft website, subject to the website's terms of use; or (ii) using the files as included with a Microsoft product subject to that product's license terms. Microsoft reserves all other rights to the files not expressly granted by Microsoft, whether by implication, estoppel or otherwise. The notices and licenses below are for informational purposes only.
***************************************************
* jQuery JavaScript Library v1.9.1
* http://jquery.com/
* Copyright 2005, 2012 jQuery Foundation, Inc. and other contributors
********************************
* Includes Sizzle CSS Selector Engine
* http://sizzlejs.com/
* Copyright 2012 jQuery Foundation and other contributors
********************************************************
Provided for Informational Purposes Only
MIT License
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 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.
* NUGET: END LICENSE TEXT */
/*! jQuery v1.9.1 | (c) 2005, 2012 jQuery Foundation, Inc. | jquery.org/license
//@ sourceMappingURL=jquery.min.map
*/(function(e,t){var n,r,i=typeof t,o=e.document,a=e.location,s=e.jQuery,u=e.$,l={},c=[],p="1.9.1",f=c.concat,d=c.push,h=c.slice,g=c.indexOf,m=l.toString,y=l.hasOwnProperty,v=p.trim,b=function(e,t){return new b.fn.init(e,t,r)},x=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,w=/\S+/g,T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,k=/^[\],:{}\s]*$/,E=/(?:^|:|,)(?:\s*\[)+/g,S=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,A=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,j=/^-ms-/,D=/-([\da-z])/gi,L=function(e,t){return t.toUpperCase()},H=function(e){(o.addEventListener||"load"===e.type||"complete"===o.readyState)&&(q(),b.ready())},q=function(){o.addEventListener?(o.removeEventListener("DOMContentLoaded",H,!1),e.removeEventListener("load",H,!1)):(o.detachEvent("onreadystatechange",H),e.detachEvent("onload",H))};b.fn=b.prototype={jquery:p,constructor:b,init:function(e,n,r){var i,a;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!i||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof b?n[0]:n,b.merge(this,b.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:o,!0)),C.test(i[1])&&b.isPlainObject(n))for(i in n)b.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(a=o.getElementById(i[2]),a&&a.parentNode){if(a.id!==i[2])return r.find(e);this.length=1,this[0]=a}return this.context=o,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):b.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),b.makeArray(e,this))},selector:"",length:0,size:function(){return this.length},toArray:function(){return h.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=b.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return b.each(this,e,t)},ready:function(e){return b.ready.promise().done(e),this},slice:function(){return this.pushStack(h.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(b.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:d,sort:[].sort,splice:[].splice},b.fn.init.prototype=b.fn,b.extend=b.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},u=1,l=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},u=2),"object"==typeof s||b.isFunction(s)||(s={}),l===u&&(s=this,--u);l>u;u++)if(null!=(o=arguments[u]))for(i in o)e=s[i],r=o[i],s!==r&&(c&&r&&(b.isPlainObject(r)||(n=b.isArray(r)))?(n?(n=!1,a=e&&b.isArray(e)?e:[]):a=e&&b.isPlainObject(e)?e:{},s[i]=b.extend(c,a,r)):r!==t&&(s[i]=r));return s},b.extend({noConflict:function(t){return e.$===b&&(e.$=u),t&&e.jQuery===b&&(e.jQuery=s),b},isReady:!1,readyWait:1,holdReady:function(e){e?b.readyWait++:b.ready(!0)},ready:function(e){if(e===!0?!--b.readyWait:!b.isReady){if(!o.body)return setTimeout(b.ready);b.isReady=!0,e!==!0&&--b.readyWait>0||(n.resolveWith(o,[b]),b.fn.trigger&&b(o).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===b.type(e)},isArray:Array.isArray||function(e){return"array"===b.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[m.call(e)]||"object":typeof e},isPlainObject:function(e){if(!e||"object"!==b.type(e)||e.nodeType||b.isWindow(e))return!1;try{if(e.constructor&&!y.call(e,"constructor")&&!y.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||y.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||o;var r=C.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=b.buildFragment([e],t,i),i&&b(i).remove(),b.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=b.trim(n),n&&k.test(n.replace(S,"@").replace(A,"]").replace(E,"")))?Function("return "+n)():(b.error("Invalid JSON: "+n),t)},parseXML:function(n){var r,i;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||b.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&b.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(j,"ms-").replace(D,L)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,a=M(e);if(n){if(a){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(a){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:v&&!v.call("\ufeff\u00a0")?function(e){return null==e?"":v.call(e)}:function(e){return null==e?"":(e+"").replace(T,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(M(Object(e))?b.merge(n,"string"==typeof e?[e]:e):d.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(g)return g.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r)for(;r>o;o++)e[i++]=n[o];else while(n[o]!==t)e[i++]=n[o++];return e.length=i,e},grep:function(e,t,n){var r,i=[],o=0,a=e.length;for(n=!!n;a>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,a=M(e),s=[];if(a)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(s[s.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(s[s.length]=r);return f.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),b.isFunction(e)?(r=h.call(arguments,2),i=function(){return e.apply(n||this,r.concat(h.call(arguments)))},i.guid=e.guid=e.guid||b.guid++,i):t},access:function(e,n,r,i,o,a,s){var u=0,l=e.length,c=null==r;if("object"===b.type(r)){o=!0;for(u in r)b.access(e,n,u,r[u],!0,a,s)}else if(i!==t&&(o=!0,b.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(b(e),n)})),n))for(;l>u;u++)n(e[u],r,s?i:i.call(e[u],u,n(e[u],r)));return o?e:c?n.call(e):l?n(e[0],r):a},now:function(){return(new Date).getTime()}}),b.ready.promise=function(t){if(!n)if(n=b.Deferred(),"complete"===o.readyState)setTimeout(b.ready);else if(o.addEventListener)o.addEventListener("DOMContentLoaded",H,!1),e.addEventListener("load",H,!1);else{o.attachEvent("onreadystatechange",H),e.attachEvent("onload",H);var r=!1;try{r=null==e.frameElement&&o.documentElement}catch(i){}r&&r.doScroll&&function a(){if(!b.isReady){try{r.doScroll("left")}catch(e){return setTimeout(a,50)}q(),b.ready()}}()}return n.promise(t)},b.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function M(e){var t=e.length,n=b.type(e);return b.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=b(o);var _={};function F(e){var t=_[e]={};return b.each(e.match(w)||[],function(e,n){t[n]=!0}),t}b.Callbacks=function(e){e="string"==typeof e?_[e]||F(e):b.extend({},e);var n,r,i,o,a,s,u=[],l=!e.once&&[],c=function(t){for(r=e.memory&&t,i=!0,a=s||0,s=0,o=u.length,n=!0;u&&o>a;a++)if(u[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}n=!1,u&&(l?l.length&&c(l.shift()):r?u=[]:p.disable())},p={add:function(){if(u){var t=u.length;(function i(t){b.each(t,function(t,n){var r=b.type(n);"function"===r?e.unique&&p.has(n)||u.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=u.length:r&&(s=t,c(r))}return this},remove:function(){return u&&b.each(arguments,function(e,t){var r;while((r=b.inArray(t,u,r))>-1)u.splice(r,1),n&&(o>=r&&o--,a>=r&&a--)}),this},has:function(e){return e?b.inArray(e,u)>-1:!(!u||!u.length)},empty:function(){return u=[],this},disable:function(){return u=l=r=t,this},disabled:function(){return!u},lock:function(){return l=t,r||p.disable(),this},locked:function(){return!l},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],!u||i&&!l||(n?l.push(t):c(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!i}};return p},b.extend({Deferred:function(e){var t=[["resolve","done",b.Callbacks("once memory"),"resolved"],["reject","fail",b.Callbacks("once memory"),"rejected"],["notify","progress",b.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return b.Deferred(function(n){b.each(t,function(t,o){var a=o[0],s=b.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&b.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?b.extend(e,r):r}},i={};return r.pipe=r.then,b.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=h.call(arguments),r=n.length,i=1!==r||e&&b.isFunction(e.promise)?r:0,o=1===i?e:b.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?h.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,u,l;if(r>1)for(s=Array(r),u=Array(r),l=Array(r);r>t;t++)n[t]&&b.isFunction(n[t].promise)?n[t].promise().done(a(t,l,n)).fail(o.reject).progress(a(t,u,s)):--i;return i||o.resolveWith(l,n),o.promise()}}),b.support=function(){var t,n,r,a,s,u,l,c,p,f,d=o.createElement("div");if(d.setAttribute("className","t"),d.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=d.getElementsByTagName("*"),r=d.getElementsByTagName("a")[0],!n||!r||!n.length)return{};s=o.createElement("select"),l=s.appendChild(o.createElement("option")),a=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t={getSetAttribute:"t"!==d.className,leadingWhitespace:3===d.firstChild.nodeType,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:"/a"===r.getAttribute("href"),opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:!!a.value,optSelected:l.selected,enctype:!!o.createElement("form").enctype,html5Clone:"<:nav></:nav>"!==o.createElement("nav").cloneNode(!0).outerHTML,boxModel:"CSS1Compat"===o.compatMode,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},a.checked=!0,t.noCloneChecked=a.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!l.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}a=o.createElement("input"),a.setAttribute("value",""),t.input=""===a.getAttribute("value"),a.value="t",a.setAttribute("type","radio"),t.radioValue="t"===a.value,a.setAttribute("checked","t"),a.setAttribute("name","t"),u=o.createDocumentFragment(),u.appendChild(a),t.appendChecked=a.checked,t.checkClone=u.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(f in{submit:!0,change:!0,focusin:!0})d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||d.attributes[c].expando===!1;return d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip,b(function(){var n,r,a,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",u=o.getElementsByTagName("body")[0];u&&(n=o.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",u.appendChild(n).appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",a=d.getElementsByTagName("td"),a[0].style.cssText="padding:0;margin:0;border:0;display:none",p=0===a[0].offsetHeight,a[0].style.display="",a[1].style.display="none",t.reliableHiddenOffsets=p&&0===a[0].offsetHeight,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",t.boxSizing=4===d.offsetWidth,t.doesNotIncludeMarginInBodyOffset=1!==u.offsetTop,e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(d,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(d,null)||{width:"4px"}).width,r=d.appendChild(o.createElement("div")),r.style.cssText=d.style.cssText=s,r.style.marginRight=r.style.width="0",d.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),typeof d.style.zoom!==i&&(d.innerHTML="",d.style.cssText=s+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===d.offsetWidth,d.style.display="block",d.innerHTML="<div></div>",d.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==d.offsetWidth,t.inlineBlockNeedsLayout&&(u.style.zoom=1)),u.removeChild(n),n=d=a=r=null)}),n=s=u=l=r=a=null,t}();var O=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,B=/([A-Z])/g;function P(e,n,r,i){if(b.acceptData(e)){var o,a,s=b.expando,u="string"==typeof n,l=e.nodeType,p=l?b.cache:e,f=l?e[s]:e[s]&&s;if(f&&p[f]&&(i||p[f].data)||!u||r!==t)return f||(l?e[s]=f=c.pop()||b.guid++:f=s),p[f]||(p[f]={},l||(p[f].toJSON=b.noop)),("object"==typeof n||"function"==typeof n)&&(i?p[f]=b.extend(p[f],n):p[f].data=b.extend(p[f].data,n)),o=p[f],i||(o.data||(o.data={}),o=o.data),r!==t&&(o[b.camelCase(n)]=r),u?(a=o[n],null==a&&(a=o[b.camelCase(n)])):a=o,a}}function R(e,t,n){if(b.acceptData(e)){var r,i,o,a=e.nodeType,s=a?b.cache:e,u=a?e[b.expando]:b.expando;if(s[u]){if(t&&(o=n?s[u]:s[u].data)){b.isArray(t)?t=t.concat(b.map(t,b.camelCase)):t in o?t=[t]:(t=b.camelCase(t),t=t in o?[t]:t.split(" "));for(r=0,i=t.length;i>r;r++)delete o[t[r]];if(!(n?$:b.isEmptyObject)(o))return}(n||(delete s[u].data,$(s[u])))&&(a?b.cleanData([e],!0):b.support.deleteExpando||s!=s.window?delete s[u]:s[u]=null)}}}b.extend({cache:{},expando:"jQuery"+(p+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?b.cache[e[b.expando]]:e[b.expando],!!e&&!$(e)},data:function(e,t,n){return P(e,t,n)},removeData:function(e,t){return R(e,t)},_data:function(e,t,n){return P(e,t,n,!0)},_removeData:function(e,t){return R(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&b.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),b.fn.extend({data:function(e,n){var r,i,o=this[0],a=0,s=null;if(e===t){if(this.length&&(s=b.data(o),1===o.nodeType&&!b._data(o,"parsedAttrs"))){for(r=o.attributes;r.length>a;a++)i=r[a].name,i.indexOf("data-")||(i=b.camelCase(i.slice(5)),W(o,i,s[i]));b._data(o,"parsedAttrs",!0)}return s}return"object"==typeof e?this.each(function(){b.data(this,e)}):b.access(this,function(n){return n===t?o?W(o,e,b.data(o,e)):null:(this.each(function(){b.data(this,e,n)}),t)},null,n,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){b.removeData(this,e)})}});function W(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(B,"-$1").toLowerCase();if(r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:O.test(r)?b.parseJSON(r):r}catch(o){}b.data(e,n,r)}else r=t}return r}function $(e){var t;for(t in e)if(("data"!==t||!b.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}b.extend({queue:function(e,n,r){var i;return e?(n=(n||"fx")+"queue",i=b._data(e,n),r&&(!i||b.isArray(r)?i=b._data(e,n,b.makeArray(r)):i.push(r)),i||[]):t},dequeue:function(e,t){t=t||"fx";var n=b.queue(e,t),r=n.length,i=n.shift(),o=b._queueHooks(e,t),a=function(){b.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),o.cur=i,i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return b._data(e,n)||b._data(e,n,{empty:b.Callbacks("once memory").add(function(){b._removeData(e,t+"queue"),b._removeData(e,n)})})}}),b.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?b.queue(this[0],e):n===t?this:this.each(function(){var t=b.queue(this,e,n);b._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&b.dequeue(this,e)})},dequeue:function(e){return this.each(function(){b.dequeue(this,e)})},delay:function(e,t){return e=b.fx?b.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,o=b.Deferred(),a=this,s=this.length,u=function(){--i||o.resolveWith(a,[a])};"string"!=typeof e&&(n=e,e=t),e=e||"fx";while(s--)r=b._data(a[s],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(u));return u(),o.promise(n)}});var I,z,X=/[\t\r\n]/g,U=/\r/g,V=/^(?:input|select|textarea|button|object)$/i,Y=/^(?:a|area)$/i,J=/^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i,G=/^(?:checked|selected)$/i,Q=b.support.getSetAttribute,K=b.support.input;b.fn.extend({attr:function(e,t){return b.access(this,b.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){b.removeAttr(this,e)})},prop:function(e,t){return b.access(this,b.prop,e,t,arguments.length>1)},removeProp:function(e){return e=b.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,o,a=0,s=this.length,u="string"==typeof e&&e;if(b.isFunction(e))return this.each(function(t){b(this).addClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(X," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=b.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,a=0,s=this.length,u=0===arguments.length||"string"==typeof e&&e;if(b.isFunction(e))return this.each(function(t){b(this).removeClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(X," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?b.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e,r="boolean"==typeof t;return b.isFunction(e)?this.each(function(n){b(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var o,a=0,s=b(this),u=t,l=e.match(w)||[];while(o=l[a++])u=r?u:!s.hasClass(o),s[u?"addClass":"removeClass"](o)}else(n===i||"boolean"===n)&&(this.className&&b._data(this,"__className__",this.className),this.className=this.className||e===!1?"":b._data(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(X," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,o=this[0];{if(arguments.length)return i=b.isFunction(e),this.each(function(n){var o,a=b(this);1===this.nodeType&&(o=i?e.call(this,n,a.val()):e,null==o?o="":"number"==typeof o?o+="":b.isArray(o)&&(o=b.map(o,function(e){return null==e?"":e+""})),r=b.valHooks[this.type]||b.valHooks[this.nodeName.toLowerCase()],r&&"set"in r&&r.set(this,o,"value")!==t||(this.value=o))});if(o)return r=b.valHooks[o.type]||b.valHooks[o.nodeName.toLowerCase()],r&&"get"in r&&(n=r.get(o,"value"))!==t?n:(n=o.value,"string"==typeof n?n.replace(U,""):null==n?"":n)}}}),b.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,a=o?null:[],s=o?i+1:r.length,u=0>i?s:o?i:0;for(;s>u;u++)if(n=r[u],!(!n.selected&&u!==i||(b.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&b.nodeName(n.parentNode,"optgroup"))){if(t=b(n).val(),o)return t;a.push(t)}return a},set:function(e,t){var n=b.makeArray(t);return b(e).find("option").each(function(){this.selected=b.inArray(b(this).val(),n)>=0}),n.length||(e.selectedIndex=-1),n}}},attr:function(e,n,r){var o,a,s,u=e.nodeType;if(e&&3!==u&&8!==u&&2!==u)return typeof e.getAttribute===i?b.prop(e,n,r):(a=1!==u||!b.isXMLDoc(e),a&&(n=n.toLowerCase(),o=b.attrHooks[n]||(J.test(n)?z:I)),r===t?o&&a&&"get"in o&&null!==(s=o.get(e,n))?s:(typeof e.getAttribute!==i&&(s=e.getAttribute(n)),null==s?t:s):null!==r?o&&a&&"set"in o&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,r+""),r):(b.removeAttr(e,n),t))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(w);if(o&&1===e.nodeType)while(n=o[i++])r=b.propFix[n]||n,J.test(n)?!Q&&G.test(n)?e[b.camelCase("default-"+n)]=e[r]=!1:e[r]=!1:b.attr(e,n,""),e.removeAttribute(Q?n:r)},attrHooks:{type:{set:function(e,t){if(!b.support.radioValue&&"radio"===t&&b.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(e,n,r){var i,o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return a=1!==s||!b.isXMLDoc(e),a&&(n=b.propFix[n]||n,o=b.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&null!==(i=o.get(e,n))?i:e[n]},propHooks:{tabIndex:{get:function(e){var n=e.getAttributeNode("tabindex");return n&&n.specified?parseInt(n.value,10):V.test(e.nodeName)||Y.test(e.nodeName)&&e.href?0:t}}}}),z={get:function(e,n){var r=b.prop(e,n),i="boolean"==typeof r&&e.getAttribute(n),o="boolean"==typeof r?K&&Q?null!=i:G.test(n)?e[b.camelCase("default-"+n)]:!!i:e.getAttributeNode(n);return o&&o.value!==!1?n.toLowerCase():t},set:function(e,t,n){return t===!1?b.removeAttr(e,n):K&&Q||!G.test(n)?e.setAttribute(!Q&&b.propFix[n]||n,n):e[b.camelCase("default-"+n)]=e[n]=!0,n}},K&&Q||(b.attrHooks.value={get:function(e,n){var r=e.getAttributeNode(n);return b.nodeName(e,"input")?e.defaultValue:r&&r.specified?r.value:t},set:function(e,n,r){return b.nodeName(e,"input")?(e.defaultValue=n,t):I&&I.set(e,n,r)}}),Q||(I=b.valHooks.button={get:function(e,n){var r=e.getAttributeNode(n);return r&&("id"===n||"name"===n||"coords"===n?""!==r.value:r.specified)?r.value:t},set:function(e,n,r){var i=e.getAttributeNode(r);return i||e.setAttributeNode(i=e.ownerDocument.createAttribute(r)),i.value=n+="","value"===r||n===e.getAttribute(r)?n:t}},b.attrHooks.contenteditable={get:I.get,set:function(e,t,n){I.set(e,""===t?!1:t,n)}},b.each(["width","height"],function(e,n){b.attrHooks[n]=b.extend(b.attrHooks[n],{set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}})})),b.support.hrefNormalized||(b.each(["href","src","width","height"],function(e,n){b.attrHooks[n]=b.extend(b.attrHooks[n],{get:function(e){var r=e.getAttribute(n,2);return null==r?t:r}})}),b.each(["href","src"],function(e,t){b.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}})),b.support.style||(b.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}),b.support.optSelected||(b.propHooks.selected=b.extend(b.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),b.support.enctype||(b.propFix.enctype="encoding"),b.support.checkOn||b.each(["radio","checkbox"],function(){b.valHooks[this]={get:function(e){return null===e.getAttribute("value")?"on":e.value}}}),b.each(["radio","checkbox"],function(){b.valHooks[this]=b.extend(b.valHooks[this],{set:function(e,n){return b.isArray(n)?e.checked=b.inArray(b(e).val(),n)>=0:t}})});var Z=/^(?:input|select|textarea)$/i,et=/^key/,tt=/^(?:mouse|contextmenu)|click/,nt=/^(?:focusinfocus|focusoutblur)$/,rt=/^([^.]*)(?:\.(.+)|)$/;function it(){return!0}function ot(){return!1}b.event={global:{},add:function(e,n,r,o,a){var s,u,l,c,p,f,d,h,g,m,y,v=b._data(e);if(v){r.handler&&(c=r,r=c.handler,a=c.selector),r.guid||(r.guid=b.guid++),(u=v.events)||(u=v.events={}),(f=v.handle)||(f=v.handle=function(e){return typeof b===i||e&&b.event.triggered===e.type?t:b.event.dispatch.apply(f.elem,arguments)},f.elem=e),n=(n||"").match(w)||[""],l=n.length;while(l--)s=rt.exec(n[l])||[],g=y=s[1],m=(s[2]||"").split(".").sort(),p=b.event.special[g]||{},g=(a?p.delegateType:p.bindType)||g,p=b.event.special[g]||{},d=b.extend({type:g,origType:y,data:o,handler:r,guid:r.guid,selector:a,needsContext:a&&b.expr.match.needsContext.test(a),namespace:m.join(".")},c),(h=u[g])||(h=u[g]=[],h.delegateCount=0,p.setup&&p.setup.call(e,o,m,f)!==!1||(e.addEventListener?e.addEventListener(g,f,!1):e.attachEvent&&e.attachEvent("on"+g,f))),p.add&&(p.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),a?h.splice(h.delegateCount++,0,d):h.push(d),b.event.global[g]=!0;e=null}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,p,f,d,h,g,m=b.hasData(e)&&b._data(e);if(m&&(c=m.events)){t=(t||"").match(w)||[""],l=t.length;while(l--)if(s=rt.exec(t[l])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){p=b.event.special[d]||{},d=(r?p.delegateType:p.bindType)||d,f=c[d]||[],s=s[2]&&RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),u=o=f.length;while(o--)a=f[o],!i&&g!==a.origType||n&&n.guid!==a.guid||s&&!s.test(a.namespace)||r&&r!==a.selector&&("**"!==r||!a.selector)||(f.splice(o,1),a.selector&&f.delegateCount--,p.remove&&p.remove.call(e,a));u&&!f.length&&(p.teardown&&p.teardown.call(e,h,m.handle)!==!1||b.removeEvent(e,d,m.handle),delete c[d])}else for(d in c)b.event.remove(e,d+t[l],n,r,!0);b.isEmptyObject(c)&&(delete m.handle,b._removeData(e,"events"))}},trigger:function(n,r,i,a){var s,u,l,c,p,f,d,h=[i||o],g=y.call(n,"type")?n.type:n,m=y.call(n,"namespace")?n.namespace.split("."):[];if(l=f=i=i||o,3!==i.nodeType&&8!==i.nodeType&&!nt.test(g+b.event.triggered)&&(g.indexOf(".")>=0&&(m=g.split("."),g=m.shift(),m.sort()),u=0>g.indexOf(":")&&"on"+g,n=n[b.expando]?n:new b.Event(g,"object"==typeof n&&n),n.isTrigger=!0,n.namespace=m.join("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=i),r=null==r?[n]:b.makeArray(r,[n]),p=b.event.special[g]||{},a||!p.trigger||p.trigger.apply(i,r)!==!1)){if(!a&&!p.noBubble&&!b.isWindow(i)){for(c=p.delegateType||g,nt.test(c+g)||(l=l.parentNode);l;l=l.parentNode)h.push(l),f=l;f===(i.ownerDocument||o)&&h.push(f.defaultView||f.parentWindow||e)}d=0;while((l=h[d++])&&!n.isPropagationStopped())n.type=d>1?c:p.bindType||g,s=(b._data(l,"events")||{})[n.type]&&b._data(l,"handle"),s&&s.apply(l,r),s=u&&l[u],s&&b.acceptData(l)&&s.apply&&s.apply(l,r)===!1&&n.preventDefault();if(n.type=g,!(a||n.isDefaultPrevented()||p._default&&p._default.apply(i.ownerDocument,r)!==!1||"click"===g&&b.nodeName(i,"a")||!b.acceptData(i)||!u||!i[g]||b.isWindow(i))){f=i[u],f&&(i[u]=null),b.event.triggered=g;try{i[g]()}catch(v){}b.event.triggered=t,f&&(i[u]=f)}return n.result}},dispatch:function(e){e=b.event.fix(e);var n,r,i,o,a,s=[],u=h.call(arguments),l=(b._data(this,"events")||{})[e.type]||[],c=b.event.special[e.type]||{};if(u[0]=e,e.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,e)!==!1){s=b.event.handlers.call(this,e,l),n=0;while((o=s[n++])&&!e.isPropagationStopped()){e.currentTarget=o.elem,a=0;while((i=o.handlers[a++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(i.namespace))&&(e.handleObj=i,e.data=i.data,r=((b.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,u),r!==t&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,n){var r,i,o,a,s=[],u=n.delegateCount,l=e.target;if(u&&l.nodeType&&(!e.button||"click"!==e.type))for(;l!=this;l=l.parentNode||this)if(1===l.nodeType&&(l.disabled!==!0||"click"!==e.type)){for(o=[],a=0;u>a;a++)i=n[a],r=i.selector+" ",o[r]===t&&(o[r]=i.needsContext?b(r,this).index(l)>=0:b.find(r,this,null,[l]).length),o[r]&&o.push(i);o.length&&s.push({elem:l,handlers:o})}return n.length>u&&s.push({elem:this,handlers:n.slice(u)}),s},fix:function(e){if(e[b.expando])return e;var t,n,r,i=e.type,a=e,s=this.fixHooks[i];s||(this.fixHooks[i]=s=tt.test(i)?this.mouseHooks:et.test(i)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,e=new b.Event(a),t=r.length;while(t--)n=r[t],e[n]=a[n];return e.target||(e.target=a.srcElement||o),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,a):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,a,s=n.button,u=n.fromElement;return null==e.pageX&&null!=n.clientX&&(i=e.target.ownerDocument||o,a=i.documentElement,r=i.body,e.pageX=n.clientX+(a&&a.scrollLeft||r&&r.scrollLeft||0)-(a&&a.clientLeft||r&&r.clientLeft||0),e.pageY=n.clientY+(a&&a.scrollTop||r&&r.scrollTop||0)-(a&&a.clientTop||r&&r.clientTop||0)),!e.relatedTarget&&u&&(e.relatedTarget=u===e.target?n.toElement:u),e.which||s===t||(e.which=1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},click:{trigger:function(){return b.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):t}},focus:{trigger:function(){if(this!==o.activeElement&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===o.activeElement&&this.blur?(this.blur(),!1):t},delegateType:"focusout"},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=b.extend(new b.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?b.event.trigger(i,null,t):b.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},b.removeEvent=o.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]===i&&(e[r]=null),e.detachEvent(r,n))},b.Event=function(e,n){return this instanceof b.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?it:ot):this.type=e,n&&b.extend(this,n),this.timeStamp=e&&e.timeStamp||b.now(),this[b.expando]=!0,t):new b.Event(e,n)},b.Event.prototype={isDefaultPrevented:ot,isPropagationStopped:ot,isImmediatePropagationStopped:ot,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=it,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=it,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=it,this.stopPropagation()}},b.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){b.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;
return(!i||i!==r&&!b.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),b.support.submitBubbles||(b.event.special.submit={setup:function(){return b.nodeName(this,"form")?!1:(b.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=b.nodeName(n,"input")||b.nodeName(n,"button")?n.form:t;r&&!b._data(r,"submitBubbles")&&(b.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),b._data(r,"submitBubbles",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&b.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return b.nodeName(this,"form")?!1:(b.event.remove(this,"._submit"),t)}}),b.support.changeBubbles||(b.event.special.change={setup:function(){return Z.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(b.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),b.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),b.event.simulate("change",this,e,!0)})),!1):(b.event.add(this,"beforeactivate._change",function(e){var t=e.target;Z.test(t.nodeName)&&!b._data(t,"changeBubbles")&&(b.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||b.event.simulate("change",this.parentNode,e,!0)}),b._data(t,"changeBubbles",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return b.event.remove(this,"._change"),!Z.test(this.nodeName)}}),b.support.focusinBubbles||b.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){b.event.simulate(t,e.target,b.event.fix(e),!0)};b.event.special[t]={setup:function(){0===n++&&o.addEventListener(e,r,!0)},teardown:function(){0===--n&&o.removeEventListener(e,r,!0)}}}),b.fn.extend({on:function(e,n,r,i,o){var a,s;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(a in e)this.on(a,n,r,e[a],o);return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),i===!1)i=ot;else if(!i)return this;return 1===o&&(s=i,i=function(e){return b().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=b.guid++)),this.each(function(){b.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,b(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(o in e)this.off(o,n,e[o]);return this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=ot),this.each(function(){b.event.remove(this,e,r,n)})},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},trigger:function(e,t){return this.each(function(){b.event.trigger(e,t,this)})},triggerHandler:function(e,n){var r=this[0];return r?b.event.trigger(e,n,r,!0):t}}),function(e,t){var n,r,i,o,a,s,u,l,c,p,f,d,h,g,m,y,v,x="sizzle"+-new Date,w=e.document,T={},N=0,C=0,k=it(),E=it(),S=it(),A=typeof t,j=1<<31,D=[],L=D.pop,H=D.push,q=D.slice,M=D.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},_="[\\x20\\t\\r\\n\\f]",F="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=F.replace("w","w#"),B="([*^$|!~]?=)",P="\\["+_+"*("+F+")"+_+"*(?:"+B+_+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+O+")|)|)"+_+"*\\]",R=":("+F+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+P.replace(3,8)+")*)|.*)\\)|)",W=RegExp("^"+_+"+|((?:^|[^\\\\])(?:\\\\.)*)"+_+"+$","g"),$=RegExp("^"+_+"*,"+_+"*"),I=RegExp("^"+_+"*([\\x20\\t\\r\\n\\f>+~])"+_+"*"),z=RegExp(R),X=RegExp("^"+O+"$"),U={ID:RegExp("^#("+F+")"),CLASS:RegExp("^\\.("+F+")"),NAME:RegExp("^\\[name=['\"]?("+F+")['\"]?\\]"),TAG:RegExp("^("+F.replace("w","w*")+")"),ATTR:RegExp("^"+P),PSEUDO:RegExp("^"+R),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+_+"*(even|odd|(([+-]|)(\\d*)n|)"+_+"*(?:([+-]|)"+_+"*(\\d+)|))"+_+"*\\)|)","i"),needsContext:RegExp("^"+_+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+_+"*((?:-\\d)?\\d*)"+_+"*\\)|)(?=[^-]|$)","i")},V=/[\x20\t\r\n\f]*[+~]/,Y=/^[^{]+\{\s*\[native code/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,G=/^(?:input|select|textarea|button)$/i,Q=/^h\d$/i,K=/'|\\/g,Z=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,et=/\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,tt=function(e,t){var n="0x"+t-65536;return n!==n?t:0>n?String.fromCharCode(n+65536):String.fromCharCode(55296|n>>10,56320|1023&n)};try{q.call(w.documentElement.childNodes,0)[0].nodeType}catch(nt){q=function(e){var t,n=[];while(t=this[e++])n.push(t);return n}}function rt(e){return Y.test(e+"")}function it(){var e,t=[];return e=function(n,r){return t.push(n+=" ")>i.cacheLength&&delete e[t.shift()],e[n]=r}}function ot(e){return e[x]=!0,e}function at(e){var t=p.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}}function st(e,t,n,r){var i,o,a,s,u,l,f,g,m,v;if((t?t.ownerDocument||t:w)!==p&&c(t),t=t||p,n=n||[],!e||"string"!=typeof e)return n;if(1!==(s=t.nodeType)&&9!==s)return[];if(!d&&!r){if(i=J.exec(e))if(a=i[1]){if(9===s){if(o=t.getElementById(a),!o||!o.parentNode)return n;if(o.id===a)return n.push(o),n}else if(t.ownerDocument&&(o=t.ownerDocument.getElementById(a))&&y(t,o)&&o.id===a)return n.push(o),n}else{if(i[2])return H.apply(n,q.call(t.getElementsByTagName(e),0)),n;if((a=i[3])&&T.getByClassName&&t.getElementsByClassName)return H.apply(n,q.call(t.getElementsByClassName(a),0)),n}if(T.qsa&&!h.test(e)){if(f=!0,g=x,m=t,v=9===s&&e,1===s&&"object"!==t.nodeName.toLowerCase()){l=ft(e),(f=t.getAttribute("id"))?g=f.replace(K,"\\$&"):t.setAttribute("id",g),g="[id='"+g+"'] ",u=l.length;while(u--)l[u]=g+dt(l[u]);m=V.test(e)&&t.parentNode||t,v=l.join(",")}if(v)try{return H.apply(n,q.call(m.querySelectorAll(v),0)),n}catch(b){}finally{f||t.removeAttribute("id")}}}return wt(e.replace(W,"$1"),t,n,r)}a=st.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},c=st.setDocument=function(e){var n=e?e.ownerDocument||e:w;return n!==p&&9===n.nodeType&&n.documentElement?(p=n,f=n.documentElement,d=a(n),T.tagNameNoComments=at(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),T.attributes=at(function(e){e.innerHTML="<select></select>";var t=typeof e.lastChild.getAttribute("multiple");return"boolean"!==t&&"string"!==t}),T.getByClassName=at(function(e){return e.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",e.getElementsByClassName&&e.getElementsByClassName("e").length?(e.lastChild.className="e",2===e.getElementsByClassName("e").length):!1}),T.getByName=at(function(e){e.id=x+0,e.innerHTML="<a name='"+x+"'></a><div name='"+x+"'></div>",f.insertBefore(e,f.firstChild);var t=n.getElementsByName&&n.getElementsByName(x).length===2+n.getElementsByName(x+0).length;return T.getIdNotName=!n.getElementById(x),f.removeChild(e),t}),i.attrHandle=at(function(e){return e.innerHTML="<a href='#'></a>",e.firstChild&&typeof e.firstChild.getAttribute!==A&&"#"===e.firstChild.getAttribute("href")})?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},T.getIdNotName?(i.find.ID=function(e,t){if(typeof t.getElementById!==A&&!d){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},i.filter.ID=function(e){var t=e.replace(et,tt);return function(e){return e.getAttribute("id")===t}}):(i.find.ID=function(e,n){if(typeof n.getElementById!==A&&!d){var r=n.getElementById(e);return r?r.id===e||typeof r.getAttributeNode!==A&&r.getAttributeNode("id").value===e?[r]:t:[]}},i.filter.ID=function(e){var t=e.replace(et,tt);return function(e){var n=typeof e.getAttributeNode!==A&&e.getAttributeNode("id");return n&&n.value===t}}),i.find.TAG=T.tagNameNoComments?function(e,n){return typeof n.getElementsByTagName!==A?n.getElementsByTagName(e):t}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},i.find.NAME=T.getByName&&function(e,n){return typeof n.getElementsByName!==A?n.getElementsByName(name):t},i.find.CLASS=T.getByClassName&&function(e,n){return typeof n.getElementsByClassName===A||d?t:n.getElementsByClassName(e)},g=[],h=[":focus"],(T.qsa=rt(n.querySelectorAll))&&(at(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||h.push("\\["+_+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||h.push(":checked")}),at(function(e){e.innerHTML="<input type='hidden' i=''/>",e.querySelectorAll("[i^='']").length&&h.push("[*^$]="+_+"*(?:\"\"|'')"),e.querySelectorAll(":enabled").length||h.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),h.push(",.*:")})),(T.matchesSelector=rt(m=f.matchesSelector||f.mozMatchesSelector||f.webkitMatchesSelector||f.oMatchesSelector||f.msMatchesSelector))&&at(function(e){T.disconnectedMatch=m.call(e,"div"),m.call(e,"[s!='']:x"),g.push("!=",R)}),h=RegExp(h.join("|")),g=RegExp(g.join("|")),y=rt(f.contains)||f.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},v=f.compareDocumentPosition?function(e,t){var r;return e===t?(u=!0,0):(r=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t))?1&r||e.parentNode&&11===e.parentNode.nodeType?e===n||y(w,e)?-1:t===n||y(w,t)?1:0:4&r?-1:1:e.compareDocumentPosition?-1:1}:function(e,t){var r,i=0,o=e.parentNode,a=t.parentNode,s=[e],l=[t];if(e===t)return u=!0,0;if(!o||!a)return e===n?-1:t===n?1:o?-1:a?1:0;if(o===a)return ut(e,t);r=e;while(r=r.parentNode)s.unshift(r);r=t;while(r=r.parentNode)l.unshift(r);while(s[i]===l[i])i++;return i?ut(s[i],l[i]):s[i]===w?-1:l[i]===w?1:0},u=!1,[0,0].sort(v),T.detectDuplicates=u,p):p},st.matches=function(e,t){return st(e,null,null,t)},st.matchesSelector=function(e,t){if((e.ownerDocument||e)!==p&&c(e),t=t.replace(Z,"='$1']"),!(!T.matchesSelector||d||g&&g.test(t)||h.test(t)))try{var n=m.call(e,t);if(n||T.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(r){}return st(t,p,null,[e]).length>0},st.contains=function(e,t){return(e.ownerDocument||e)!==p&&c(e),y(e,t)},st.attr=function(e,t){var n;return(e.ownerDocument||e)!==p&&c(e),d||(t=t.toLowerCase()),(n=i.attrHandle[t])?n(e):d||T.attributes?e.getAttribute(t):((n=e.getAttributeNode(t))||e.getAttribute(t))&&e[t]===!0?t:n&&n.specified?n.value:null},st.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},st.uniqueSort=function(e){var t,n=[],r=1,i=0;if(u=!T.detectDuplicates,e.sort(v),u){for(;t=e[r];r++)t===e[r-1]&&(i=n.push(r));while(i--)e.splice(n[i],1)}return e};function ut(e,t){var n=t&&e,r=n&&(~t.sourceIndex||j)-(~e.sourceIndex||j);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function lt(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function ct(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function pt(e){return ot(function(t){return t=+t,ot(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}o=st.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=o(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=o(t);return n},i=st.selectors={cacheLength:50,createPseudo:ot,match:U,find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(et,tt),e[3]=(e[4]||e[5]||"").replace(et,tt),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||st.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&st.error(e[0]),e},PSEUDO:function(e){var t,n=!e[5]&&e[2];return U.CHILD.test(e[0])?null:(e[4]?e[2]=e[4]:n&&z.test(n)&&(t=ft(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){return"*"===e?function(){return!0}:(e=e.replace(et,tt).toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=k[e+" "];return t||(t=RegExp("(^|"+_+")"+e+"("+_+"|$)"))&&k(e,function(e){return t.test(e.className||typeof e.getAttribute!==A&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=st.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,p,f,d,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!u&&!s;if(m){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===y:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&v){c=m[x]||(m[x]={}),l=c[e]||[],d=l[0]===N&&l[1],f=l[0]===N&&l[2],p=d&&m.childNodes[d];while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if(1===p.nodeType&&++f&&p===t){c[e]=[N,d,f];break}}else if(v&&(l=(t[x]||(t[x]={}))[e])&&l[0]===N)f=l[1];else while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===y:1===p.nodeType)&&++f&&(v&&((p[x]||(p[x]={}))[e]=[N,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||st.error("unsupported pseudo: "+e);return r[x]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?ot(function(e,n){var i,o=r(e,t),a=o.length;while(a--)i=M.call(e,o[a]),e[i]=!(n[i]=o[a])}):function(e){return r(e,0,n)}):r}},pseudos:{not:ot(function(e){var t=[],n=[],r=s(e.replace(W,"$1"));return r[x]?ot(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:ot(function(e){return function(t){return st(e,t).length>0}}),contains:ot(function(e){return function(t){return(t.textContent||t.innerText||o(t)).indexOf(e)>-1}}),lang:ot(function(e){return X.test(e||"")||st.error("unsupported lang: "+e),e=e.replace(et,tt).toLowerCase(),function(t){var n;do if(n=d?t.getAttribute("xml:lang")||t.getAttribute("lang"):t.lang)return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===f},focus:function(e){return e===p.activeElement&&(!p.hasFocus||p.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!i.pseudos.empty(e)},header:function(e){return Q.test(e.nodeName)},input:function(e){return G.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:pt(function(){return[0]}),last:pt(function(e,t){return[t-1]}),eq:pt(function(e,t,n){return[0>n?n+t:n]}),even:pt(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:pt(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:pt(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:pt(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}};for(n in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})i.pseudos[n]=lt(n);for(n in{submit:!0,reset:!0})i.pseudos[n]=ct(n);function ft(e,t){var n,r,o,a,s,u,l,c=E[e+" "];if(c)return t?0:c.slice(0);s=e,u=[],l=i.preFilter;while(s){(!n||(r=$.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),u.push(o=[])),n=!1,(r=I.exec(s))&&(n=r.shift(),o.push({value:n,type:r[0].replace(W," ")}),s=s.slice(n.length));for(a in i.filter)!(r=U[a].exec(s))||l[a]&&!(r=l[a](r))||(n=r.shift(),o.push({value:n,type:a,matches:r}),s=s.slice(n.length));if(!n)break}return t?s.length:s?st.error(e):E(e,u).slice(0)}function dt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function ht(e,t,n){var i=t.dir,o=n&&"parentNode"===i,a=C++;return t.first?function(t,n,r){while(t=t[i])if(1===t.nodeType||o)return e(t,n,r)}:function(t,n,s){var u,l,c,p=N+" "+a;if(s){while(t=t[i])if((1===t.nodeType||o)&&e(t,n,s))return!0}else while(t=t[i])if(1===t.nodeType||o)if(c=t[x]||(t[x]={}),(l=c[i])&&l[0]===p){if((u=l[1])===!0||u===r)return u===!0}else if(l=c[i]=[p],l[1]=e(t,n,s)||r,l[1]===!0)return!0}}function gt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function mt(e,t,n,r,i){var o,a=[],s=0,u=e.length,l=null!=t;for(;u>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),l&&t.push(s));return a}function yt(e,t,n,r,i,o){return r&&!r[x]&&(r=yt(r)),i&&!i[x]&&(i=yt(i,o)),ot(function(o,a,s,u){var l,c,p,f=[],d=[],h=a.length,g=o||xt(t||"*",s.nodeType?[s]:s,[]),m=!e||!o&&t?g:mt(g,f,e,s,u),y=n?i||(o?e:h||r)?[]:a:m;if(n&&n(m,y,s,u),r){l=mt(y,d),r(l,[],s,u),c=l.length;while(c--)(p=l[c])&&(y[d[c]]=!(m[d[c]]=p))}if(o){if(i||e){if(i){l=[],c=y.length;while(c--)(p=y[c])&&l.push(m[c]=p);i(null,y=[],l,u)}c=y.length;while(c--)(p=y[c])&&(l=i?M.call(o,p):f[c])>-1&&(o[l]=!(a[l]=p))}}else y=mt(y===a?y.splice(h,y.length):y),i?i(null,a,y,u):H.apply(a,y)})}function vt(e){var t,n,r,o=e.length,a=i.relative[e[0].type],s=a||i.relative[" "],u=a?1:0,c=ht(function(e){return e===t},s,!0),p=ht(function(e){return M.call(t,e)>-1},s,!0),f=[function(e,n,r){return!a&&(r||n!==l)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;o>u;u++)if(n=i.relative[e[u].type])f=[ht(gt(f),n)];else{if(n=i.filter[e[u].type].apply(null,e[u].matches),n[x]){for(r=++u;o>r;r++)if(i.relative[e[r].type])break;return yt(u>1&>(f),u>1&&dt(e.slice(0,u-1)).replace(W,"$1"),n,r>u&&vt(e.slice(u,r)),o>r&&vt(e=e.slice(r)),o>r&&dt(e))}f.push(n)}return gt(f)}function bt(e,t){var n=0,o=t.length>0,a=e.length>0,s=function(s,u,c,f,d){var h,g,m,y=[],v=0,b="0",x=s&&[],w=null!=d,T=l,C=s||a&&i.find.TAG("*",d&&u.parentNode||u),k=N+=null==T?1:Math.random()||.1;for(w&&(l=u!==p&&u,r=n);null!=(h=C[b]);b++){if(a&&h){g=0;while(m=e[g++])if(m(h,u,c)){f.push(h);break}w&&(N=k,r=++n)}o&&((h=!m&&h)&&v--,s&&x.push(h))}if(v+=b,o&&b!==v){g=0;while(m=t[g++])m(x,y,u,c);if(s){if(v>0)while(b--)x[b]||y[b]||(y[b]=L.call(f));y=mt(y)}H.apply(f,y),w&&!s&&y.length>0&&v+t.length>1&&st.uniqueSort(f)}return w&&(N=k,l=T),x};return o?ot(s):s}s=st.compile=function(e,t){var n,r=[],i=[],o=S[e+" "];if(!o){t||(t=ft(e)),n=t.length;while(n--)o=vt(t[n]),o[x]?r.push(o):i.push(o);o=S(e,bt(i,r))}return o};function xt(e,t,n){var r=0,i=t.length;for(;i>r;r++)st(e,t[r],n);return n}function wt(e,t,n,r){var o,a,u,l,c,p=ft(e);if(!r&&1===p.length){if(a=p[0]=p[0].slice(0),a.length>2&&"ID"===(u=a[0]).type&&9===t.nodeType&&!d&&i.relative[a[1].type]){if(t=i.find.ID(u.matches[0].replace(et,tt),t)[0],!t)return n;e=e.slice(a.shift().value.length)}o=U.needsContext.test(e)?0:a.length;while(o--){if(u=a[o],i.relative[l=u.type])break;if((c=i.find[l])&&(r=c(u.matches[0].replace(et,tt),V.test(a[0].type)&&t.parentNode||t))){if(a.splice(o,1),e=r.length&&dt(a),!e)return H.apply(n,q.call(r,0)),n;break}}}return s(e,p)(r,t,d,n,V.test(e)),n}i.pseudos.nth=i.pseudos.eq;function Tt(){}i.filters=Tt.prototype=i.pseudos,i.setFilters=new Tt,c(),st.attr=b.attr,b.find=st,b.expr=st.selectors,b.expr[":"]=b.expr.pseudos,b.unique=st.uniqueSort,b.text=st.getText,b.isXMLDoc=st.isXML,b.contains=st.contains}(e);var at=/Until$/,st=/^(?:parents|prev(?:Until|All))/,ut=/^.[^:#\[\.,]*$/,lt=b.expr.match.needsContext,ct={children:!0,contents:!0,next:!0,prev:!0};b.fn.extend({find:function(e){var t,n,r,i=this.length;if("string"!=typeof e)return r=this,this.pushStack(b(e).filter(function(){for(t=0;i>t;t++)if(b.contains(r[t],this))return!0}));for(n=[],t=0;i>t;t++)b.find(e,this[t],n);return n=this.pushStack(i>1?b.unique(n):n),n.selector=(this.selector?this.selector+" ":"")+e,n},has:function(e){var t,n=b(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(b.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e,!1))},filter:function(e){return this.pushStack(ft(this,e,!0))},is:function(e){return!!e&&("string"==typeof e?lt.test(e)?b(e,this.context).index(this[0])>=0:b.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,o=[],a=lt.test(e)||"string"!=typeof e?b(e,t||this.context):0;for(;i>r;r++){n=this[r];while(n&&n.ownerDocument&&n!==t&&11!==n.nodeType){if(a?a.index(n)>-1:b.find.matchesSelector(n,e)){o.push(n);break}n=n.parentNode}}return this.pushStack(o.length>1?b.unique(o):o)},index:function(e){return e?"string"==typeof e?b.inArray(this[0],b(e)):b.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?b(e,t):b.makeArray(e&&e.nodeType?[e]:e),r=b.merge(this.get(),n);return this.pushStack(b.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),b.fn.andSelf=b.fn.addBack;function pt(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}b.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return b.dir(e,"parentNode")},parentsUntil:function(e,t,n){return b.dir(e,"parentNode",n)},next:function(e){return pt(e,"nextSibling")},prev:function(e){return pt(e,"previousSibling")},nextAll:function(e){return b.dir(e,"nextSibling")},prevAll:function(e){return b.dir(e,"previousSibling")},nextUntil:function(e,t,n){return b.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return b.dir(e,"previousSibling",n)},siblings:function(e){return b.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return b.sibling(e.firstChild)},contents:function(e){return b.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:b.merge([],e.childNodes)}},function(e,t){b.fn[e]=function(n,r){var i=b.map(this,t,n);return at.test(e)||(r=n),r&&"string"==typeof r&&(i=b.filter(r,i)),i=this.length>1&&!ct[e]?b.unique(i):i,this.length>1&&st.test(e)&&(i=i.reverse()),this.pushStack(i)}}),b.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),1===t.length?b.find.matchesSelector(t[0],e)?[t[0]]:[]:b.find.matches(e,t)},dir:function(e,n,r){var i=[],o=e[n];while(o&&9!==o.nodeType&&(r===t||1!==o.nodeType||!b(o).is(r)))1===o.nodeType&&i.push(o),o=o[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});function ft(e,t,n){if(t=t||0,b.isFunction(t))return b.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return b.grep(e,function(e){return e===t===n});if("string"==typeof t){var r=b.grep(e,function(e){return 1===e.nodeType});if(ut.test(t))return b.filter(t,r,!n);t=b.filter(t,r)}return b.grep(e,function(e){return b.inArray(e,t)>=0===n})}function dt(e){var t=ht.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}var ht="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",gt=/ jQuery\d+="(?:null|\d+)"/g,mt=RegExp("<(?:"+ht+")[\\s/>]","i"),yt=/^\s+/,vt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bt=/<([\w:]+)/,xt=/<tbody/i,wt=/<|&#?\w+;/,Tt=/<(?:script|style|link)/i,Nt=/^(?:checkbox|radio)$/i,Ct=/checked\s*(?:[^=]|=\s*.checked.)/i,kt=/^$|\/(?:java|ecma)script/i,Et=/^true\/(.*)/,St=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,At={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:b.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},jt=dt(o),Dt=jt.appendChild(o.createElement("div"));At.optgroup=At.option,At.tbody=At.tfoot=At.colgroup=At.caption=At.thead,At.th=At.td,b.fn.extend({text:function(e){return b.access(this,function(e){return e===t?b.text(this):this.empty().append((this[0]&&this[0].ownerDocument||o).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(b.isFunction(e))return this.each(function(t){b(this).wrapAll(e.call(this,t))});if(this[0]){var t=b(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&1===e.firstChild.nodeType)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return b.isFunction(e)?this.each(function(t){b(this).wrapInner(e.call(this,t))}):this.each(function(){var t=b(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=b.isFunction(e);return this.each(function(n){b(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){b.nodeName(this,"body")||b(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.insertBefore(e,this.firstChild)})},before:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=0;for(;null!=(n=this[r]);r++)(!e||b.filter(e,[n]).length>0)&&(t||1!==n.nodeType||b.cleanData(Ot(n)),n.parentNode&&(t&&b.contains(n.ownerDocument,n)&&Mt(Ot(n,"script")),n.parentNode.removeChild(n)));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++){1===e.nodeType&&b.cleanData(Ot(e,!1));while(e.firstChild)e.removeChild(e.firstChild);e.options&&b.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return b.clone(this,e,t)})},html:function(e){return b.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return 1===n.nodeType?n.innerHTML.replace(gt,""):t;if(!("string"!=typeof e||Tt.test(e)||!b.support.htmlSerialize&&mt.test(e)||!b.support.leadingWhitespace&&yt.test(e)||At[(bt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(vt,"<$1></$2>");try{for(;i>r;r++)n=this[r]||{},1===n.nodeType&&(b.cleanData(Ot(n,!1)),n.innerHTML=e);n=0}catch(o){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){var t=b.isFunction(e);return t||"string"==typeof e||(e=b(e).not(this).detach()),this.domManip([e],!0,function(e){var t=this.nextSibling,n=this.parentNode;n&&(b(this).remove(),n.insertBefore(e,t))})},detach:function(e){return this.remove(e,!0)},domManip:function(e,n,r){e=f.apply([],e);var i,o,a,s,u,l,c=0,p=this.length,d=this,h=p-1,g=e[0],m=b.isFunction(g);if(m||!(1>=p||"string"!=typeof g||b.support.checkClone)&&Ct.test(g))return this.each(function(i){var o=d.eq(i);m&&(e[0]=g.call(this,i,n?o.html():t)),o.domManip(e,n,r)});if(p&&(l=b.buildFragment(e,this[0].ownerDocument,!1,this),i=l.firstChild,1===l.childNodes.length&&(l=i),i)){for(n=n&&b.nodeName(i,"tr"),s=b.map(Ot(l,"script"),Ht),a=s.length;p>c;c++)o=l,c!==h&&(o=b.clone(o,!0,!0),a&&b.merge(s,Ot(o,"script"))),r.call(n&&b.nodeName(this[c],"table")?Lt(this[c],"tbody"):this[c],o,c);if(a)for(u=s[s.length-1].ownerDocument,b.map(s,qt),c=0;a>c;c++)o=s[c],kt.test(o.type||"")&&!b._data(o,"globalEval")&&b.contains(u,o)&&(o.src?b.ajax({url:o.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):b.globalEval((o.text||o.textContent||o.innerHTML||"").replace(St,"")));l=i=null}return this}});function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function Ht(e){var t=e.getAttributeNode("type");return e.type=(t&&t.specified)+"/"+e.type,e}function qt(e){var t=Et.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function Mt(e,t){var n,r=0;for(;null!=(n=e[r]);r++)b._data(n,"globalEval",!t||b._data(t[r],"globalEval"))}function _t(e,t){if(1===t.nodeType&&b.hasData(e)){var n,r,i,o=b._data(e),a=b._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)b.event.add(t,n,s[n][r])}a.data&&(a.data=b.extend({},a.data))}}function Ft(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!b.support.noCloneEvent&&t[b.expando]){i=b._data(t);for(r in i.events)b.removeEvent(t,r,i.handle);t.removeAttribute(b.expando)}"script"===n&&t.text!==e.text?(Ht(t).text=e.text,qt(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),b.support.html5Clone&&e.innerHTML&&!b.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Nt.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}b.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){b.fn[e]=function(e){var n,r=0,i=[],o=b(e),a=o.length-1;for(;a>=r;r++)n=r===a?this:this.clone(!0),b(o[r])[t](n),d.apply(i,n.get());return this.pushStack(i)}});function Ot(e,n){var r,o,a=0,s=typeof e.getElementsByTagName!==i?e.getElementsByTagName(n||"*"):typeof e.querySelectorAll!==i?e.querySelectorAll(n||"*"):t;if(!s)for(s=[],r=e.childNodes||e;null!=(o=r[a]);a++)!n||b.nodeName(o,n)?s.push(o):b.merge(s,Ot(o,n));return n===t||n&&b.nodeName(e,n)?b.merge([e],s):s}function Bt(e){Nt.test(e.type)&&(e.defaultChecked=e.checked)}b.extend({clone:function(e,t,n){var r,i,o,a,s,u=b.contains(e.ownerDocument,e);if(b.support.html5Clone||b.isXMLDoc(e)||!mt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(Dt.innerHTML=e.outerHTML,Dt.removeChild(o=Dt.firstChild)),!(b.support.noCloneEvent&&b.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||b.isXMLDoc(e)))for(r=Ot(o),s=Ot(e),a=0;null!=(i=s[a]);++a)r[a]&&Ft(i,r[a]);if(t)if(n)for(s=s||Ot(e),r=r||Ot(o),a=0;null!=(i=s[a]);a++)_t(i,r[a]);else _t(e,o);return r=Ot(o,"script"),r.length>0&&Mt(r,!u&&Ot(e,"script")),r=s=i=null,o},buildFragment:function(e,t,n,r){var i,o,a,s,u,l,c,p=e.length,f=dt(t),d=[],h=0;for(;p>h;h++)if(o=e[h],o||0===o)if("object"===b.type(o))b.merge(d,o.nodeType?[o]:o);else if(wt.test(o)){s=s||f.appendChild(t.createElement("div")),u=(bt.exec(o)||["",""])[1].toLowerCase(),c=At[u]||At._default,s.innerHTML=c[1]+o.replace(vt,"<$1></$2>")+c[2],i=c[0];while(i--)s=s.lastChild;if(!b.support.leadingWhitespace&&yt.test(o)&&d.push(t.createTextNode(yt.exec(o)[0])),!b.support.tbody){o="table"!==u||xt.test(o)?"<table>"!==c[1]||xt.test(o)?0:s:s.firstChild,i=o&&o.childNodes.length;while(i--)b.nodeName(l=o.childNodes[i],"tbody")&&!l.childNodes.length&&o.removeChild(l)
}b.merge(d,s.childNodes),s.textContent="";while(s.firstChild)s.removeChild(s.firstChild);s=f.lastChild}else d.push(t.createTextNode(o));s&&f.removeChild(s),b.support.appendChecked||b.grep(Ot(d,"input"),Bt),h=0;while(o=d[h++])if((!r||-1===b.inArray(o,r))&&(a=b.contains(o.ownerDocument,o),s=Ot(f.appendChild(o),"script"),a&&Mt(s),n)){i=0;while(o=s[i++])kt.test(o.type||"")&&n.push(o)}return s=null,f},cleanData:function(e,t){var n,r,o,a,s=0,u=b.expando,l=b.cache,p=b.support.deleteExpando,f=b.event.special;for(;null!=(n=e[s]);s++)if((t||b.acceptData(n))&&(o=n[u],a=o&&l[o])){if(a.events)for(r in a.events)f[r]?b.event.remove(n,r):b.removeEvent(n,r,a.handle);l[o]&&(delete l[o],p?delete n[u]:typeof n.removeAttribute!==i?n.removeAttribute(u):n[u]=null,c.push(o))}}});var Pt,Rt,Wt,$t=/alpha\([^)]*\)/i,It=/opacity\s*=\s*([^)]*)/,zt=/^(top|right|bottom|left)$/,Xt=/^(none|table(?!-c[ea]).+)/,Ut=/^margin/,Vt=RegExp("^("+x+")(.*)$","i"),Yt=RegExp("^("+x+")(?!px)[a-z%]+$","i"),Jt=RegExp("^([+-])=("+x+")","i"),Gt={BODY:"block"},Qt={position:"absolute",visibility:"hidden",display:"block"},Kt={letterSpacing:0,fontWeight:400},Zt=["Top","Right","Bottom","Left"],en=["Webkit","O","Moz","ms"];function tn(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=en.length;while(i--)if(t=en[i]+n,t in e)return t;return r}function nn(e,t){return e=t||e,"none"===b.css(e,"display")||!b.contains(e.ownerDocument,e)}function rn(e,t){var n,r,i,o=[],a=0,s=e.length;for(;s>a;a++)r=e[a],r.style&&(o[a]=b._data(r,"olddisplay"),n=r.style.display,t?(o[a]||"none"!==n||(r.style.display=""),""===r.style.display&&nn(r)&&(o[a]=b._data(r,"olddisplay",un(r.nodeName)))):o[a]||(i=nn(r),(n&&"none"!==n||!i)&&b._data(r,"olddisplay",i?n:b.css(r,"display"))));for(a=0;s>a;a++)r=e[a],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[a]||"":"none"));return e}b.fn.extend({css:function(e,n){return b.access(this,function(e,n,r){var i,o,a={},s=0;if(b.isArray(n)){for(o=Rt(e),i=n.length;i>s;s++)a[n[s]]=b.css(e,n[s],!1,o);return a}return r!==t?b.style(e,n,r):b.css(e,n)},e,n,arguments.length>1)},show:function(){return rn(this,!0)},hide:function(){return rn(this)},toggle:function(e){var t="boolean"==typeof e;return this.each(function(){(t?e:nn(this))?b(this).show():b(this).hide()})}}),b.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Wt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":b.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,u=b.camelCase(n),l=e.style;if(n=b.cssProps[u]||(b.cssProps[u]=tn(l,u)),s=b.cssHooks[n]||b.cssHooks[u],r===t)return s&&"get"in s&&(o=s.get(e,!1,i))!==t?o:l[n];if(a=typeof r,"string"===a&&(o=Jt.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(b.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||b.cssNumber[u]||(r+="px"),b.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(l[n]="inherit"),s&&"set"in s&&(r=s.set(e,r,i))===t)))try{l[n]=r}catch(c){}}},css:function(e,n,r,i){var o,a,s,u=b.camelCase(n);return n=b.cssProps[u]||(b.cssProps[u]=tn(e.style,u)),s=b.cssHooks[n]||b.cssHooks[u],s&&"get"in s&&(a=s.get(e,!0,r)),a===t&&(a=Wt(e,n,i)),"normal"===a&&n in Kt&&(a=Kt[n]),""===r||r?(o=parseFloat(a),r===!0||b.isNumeric(o)?o||0:a):a},swap:function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i}}),e.getComputedStyle?(Rt=function(t){return e.getComputedStyle(t,null)},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),u=s?s.getPropertyValue(n)||s[n]:t,l=e.style;return s&&(""!==u||b.contains(e.ownerDocument,e)||(u=b.style(e,n)),Yt.test(u)&&Ut.test(n)&&(i=l.width,o=l.minWidth,a=l.maxWidth,l.minWidth=l.maxWidth=l.width=u,u=s.width,l.width=i,l.minWidth=o,l.maxWidth=a)),u}):o.documentElement.currentStyle&&(Rt=function(e){return e.currentStyle},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),u=s?s[n]:t,l=e.style;return null==u&&l&&l[n]&&(u=l[n]),Yt.test(u)&&!zt.test(n)&&(i=l.left,o=e.runtimeStyle,a=o&&o.left,a&&(o.left=e.currentStyle.left),l.left="fontSize"===n?"1em":u,u=l.pixelLeft+"px",l.left=i,a&&(o.left=a)),""===u?"auto":u});function on(e,t,n){var r=Vt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function an(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;for(;4>o;o+=2)"margin"===n&&(a+=b.css(e,n+Zt[o],!0,i)),r?("content"===n&&(a-=b.css(e,"padding"+Zt[o],!0,i)),"margin"!==n&&(a-=b.css(e,"border"+Zt[o]+"Width",!0,i))):(a+=b.css(e,"padding"+Zt[o],!0,i),"padding"!==n&&(a+=b.css(e,"border"+Zt[o]+"Width",!0,i)));return a}function sn(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=Rt(e),a=b.support.boxSizing&&"border-box"===b.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=Wt(e,t,o),(0>i||null==i)&&(i=e.style[t]),Yt.test(i))return i;r=a&&(b.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+an(e,t,n||(a?"border":"content"),r,o)+"px"}function un(e){var t=o,n=Gt[e];return n||(n=ln(e,t),"none"!==n&&n||(Pt=(Pt||b("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement),t=(Pt[0].contentWindow||Pt[0].contentDocument).document,t.write("<!doctype html><html><body>"),t.close(),n=ln(e,t),Pt.detach()),Gt[e]=n),n}function ln(e,t){var n=b(t.createElement(e)).appendTo(t.body),r=b.css(n[0],"display");return n.remove(),r}b.each(["height","width"],function(e,n){b.cssHooks[n]={get:function(e,r,i){return r?0===e.offsetWidth&&Xt.test(b.css(e,"display"))?b.swap(e,Qt,function(){return sn(e,n,i)}):sn(e,n,i):t},set:function(e,t,r){var i=r&&Rt(e);return on(e,t,r?an(e,n,r,b.support.boxSizing&&"border-box"===b.css(e,"boxSizing",!1,i),i):0)}}}),b.support.opacity||(b.cssHooks.opacity={get:function(e,t){return It.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=b.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=r&&r.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===b.trim(o.replace($t,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||r&&!r.filter)||(n.filter=$t.test(o)?o.replace($t,i):o+" "+i)}}),b(function(){b.support.reliableMarginRight||(b.cssHooks.marginRight={get:function(e,n){return n?b.swap(e,{display:"inline-block"},Wt,[e,"marginRight"]):t}}),!b.support.pixelPosition&&b.fn.position&&b.each(["top","left"],function(e,n){b.cssHooks[n]={get:function(e,r){return r?(r=Wt(e,n),Yt.test(r)?b(e).position()[n]+"px":r):t}}})}),b.expr&&b.expr.filters&&(b.expr.filters.hidden=function(e){return 0>=e.offsetWidth&&0>=e.offsetHeight||!b.support.reliableHiddenOffsets&&"none"===(e.style&&e.style.display||b.css(e,"display"))},b.expr.filters.visible=function(e){return!b.expr.filters.hidden(e)}),b.each({margin:"",padding:"",border:"Width"},function(e,t){b.cssHooks[e+t]={expand:function(n){var r=0,i={},o="string"==typeof n?n.split(" "):[n];for(;4>r;r++)i[e+Zt[r]+t]=o[r]||o[r-2]||o[0];return i}},Ut.test(e)||(b.cssHooks[e+t].set=on)});var cn=/%20/g,pn=/\[\]$/,fn=/\r?\n/g,dn=/^(?:submit|button|image|reset|file)$/i,hn=/^(?:input|select|textarea|keygen)/i;b.fn.extend({serialize:function(){return b.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=b.prop(this,"elements");return e?b.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!b(this).is(":disabled")&&hn.test(this.nodeName)&&!dn.test(e)&&(this.checked||!Nt.test(e))}).map(function(e,t){var n=b(this).val();return null==n?null:b.isArray(n)?b.map(n,function(e){return{name:t.name,value:e.replace(fn,"\r\n")}}):{name:t.name,value:n.replace(fn,"\r\n")}}).get()}}),b.param=function(e,n){var r,i=[],o=function(e,t){t=b.isFunction(t)?t():null==t?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(n===t&&(n=b.ajaxSettings&&b.ajaxSettings.traditional),b.isArray(e)||e.jquery&&!b.isPlainObject(e))b.each(e,function(){o(this.name,this.value)});else for(r in e)gn(r,e[r],n,o);return i.join("&").replace(cn,"+")};function gn(e,t,n,r){var i;if(b.isArray(t))b.each(t,function(t,i){n||pn.test(e)?r(e,i):gn(e+"["+("object"==typeof i?t:"")+"]",i,n,r)});else if(n||"object"!==b.type(t))r(e,t);else for(i in t)gn(e+"["+i+"]",t[i],n,r)}b.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){b.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),b.fn.hover=function(e,t){return this.mouseenter(e).mouseleave(t||e)};var mn,yn,vn=b.now(),bn=/\?/,xn=/#.*$/,wn=/([?&])_=[^&]*/,Tn=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Nn=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Cn=/^(?:GET|HEAD)$/,kn=/^\/\//,En=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,Sn=b.fn.load,An={},jn={},Dn="*/".concat("*");try{yn=a.href}catch(Ln){yn=o.createElement("a"),yn.href="",yn=yn.href}mn=En.exec(yn.toLowerCase())||[];function Hn(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(w)||[];if(b.isFunction(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function qn(e,n,r,i){var o={},a=e===jn;function s(u){var l;return o[u]=!0,b.each(e[u]||[],function(e,u){var c=u(n,r,i);return"string"!=typeof c||a||o[c]?a?!(l=c):t:(n.dataTypes.unshift(c),s(c),!1)}),l}return s(n.dataTypes[0])||!o["*"]&&s("*")}function Mn(e,n){var r,i,o=b.ajaxSettings.flatOptions||{};for(i in n)n[i]!==t&&((o[i]?e:r||(r={}))[i]=n[i]);return r&&b.extend(!0,e,r),e}b.fn.load=function(e,n,r){if("string"!=typeof e&&Sn)return Sn.apply(this,arguments);var i,o,a,s=this,u=e.indexOf(" ");return u>=0&&(i=e.slice(u,e.length),e=e.slice(0,u)),b.isFunction(n)?(r=n,n=t):n&&"object"==typeof n&&(a="POST"),s.length>0&&b.ajax({url:e,type:a,dataType:"html",data:n}).done(function(e){o=arguments,s.html(i?b("<div>").append(b.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){s.each(r,o||[e.responseText,t,e])}),this},b.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){b.fn[t]=function(e){return this.on(t,e)}}),b.each(["get","post"],function(e,n){b[n]=function(e,r,i,o){return b.isFunction(r)&&(o=o||i,i=r,r=t),b.ajax({url:e,type:n,dataType:o,data:r,success:i})}}),b.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:yn,type:"GET",isLocal:Nn.test(mn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Dn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":b.parseJSON,"text xml":b.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Mn(Mn(e,b.ajaxSettings),t):Mn(b.ajaxSettings,e)},ajaxPrefilter:Hn(An),ajaxTransport:Hn(jn),ajax:function(e,n){"object"==typeof e&&(n=e,e=t),n=n||{};var r,i,o,a,s,u,l,c,p=b.ajaxSetup({},n),f=p.context||p,d=p.context&&(f.nodeType||f.jquery)?b(f):b.event,h=b.Deferred(),g=b.Callbacks("once memory"),m=p.statusCode||{},y={},v={},x=0,T="canceled",N={readyState:0,getResponseHeader:function(e){var t;if(2===x){if(!c){c={};while(t=Tn.exec(a))c[t[1].toLowerCase()]=t[2]}t=c[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===x?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return x||(e=v[n]=v[n]||e,y[e]=t),this},overrideMimeType:function(e){return x||(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>x)for(t in e)m[t]=[m[t],e[t]];else N.always(e[N.status]);return this},abort:function(e){var t=e||T;return l&&l.abort(t),k(0,t),this}};if(h.promise(N).complete=g.add,N.success=N.done,N.error=N.fail,p.url=((e||p.url||yn)+"").replace(xn,"").replace(kn,mn[1]+"//"),p.type=n.method||n.type||p.method||p.type,p.dataTypes=b.trim(p.dataType||"*").toLowerCase().match(w)||[""],null==p.crossDomain&&(r=En.exec(p.url.toLowerCase()),p.crossDomain=!(!r||r[1]===mn[1]&&r[2]===mn[2]&&(r[3]||("http:"===r[1]?80:443))==(mn[3]||("http:"===mn[1]?80:443)))),p.data&&p.processData&&"string"!=typeof p.data&&(p.data=b.param(p.data,p.traditional)),qn(An,p,n,N),2===x)return N;u=p.global,u&&0===b.active++&&b.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Cn.test(p.type),o=p.url,p.hasContent||(p.data&&(o=p.url+=(bn.test(o)?"&":"?")+p.data,delete p.data),p.cache===!1&&(p.url=wn.test(o)?o.replace(wn,"$1_="+vn++):o+(bn.test(o)?"&":"?")+"_="+vn++)),p.ifModified&&(b.lastModified[o]&&N.setRequestHeader("If-Modified-Since",b.lastModified[o]),b.etag[o]&&N.setRequestHeader("If-None-Match",b.etag[o])),(p.data&&p.hasContent&&p.contentType!==!1||n.contentType)&&N.setRequestHeader("Content-Type",p.contentType),N.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+Dn+"; q=0.01":""):p.accepts["*"]);for(i in p.headers)N.setRequestHeader(i,p.headers[i]);if(p.beforeSend&&(p.beforeSend.call(f,N,p)===!1||2===x))return N.abort();T="abort";for(i in{success:1,error:1,complete:1})N[i](p[i]);if(l=qn(jn,p,n,N)){N.readyState=1,u&&d.trigger("ajaxSend",[N,p]),p.async&&p.timeout>0&&(s=setTimeout(function(){N.abort("timeout")},p.timeout));try{x=1,l.send(y,k)}catch(C){if(!(2>x))throw C;k(-1,C)}}else k(-1,"No Transport");function k(e,n,r,i){var c,y,v,w,T,C=n;2!==x&&(x=2,s&&clearTimeout(s),l=t,a=i||"",N.readyState=e>0?4:0,r&&(w=_n(p,N,r)),e>=200&&300>e||304===e?(p.ifModified&&(T=N.getResponseHeader("Last-Modified"),T&&(b.lastModified[o]=T),T=N.getResponseHeader("etag"),T&&(b.etag[o]=T)),204===e?(c=!0,C="nocontent"):304===e?(c=!0,C="notmodified"):(c=Fn(p,w),C=c.state,y=c.data,v=c.error,c=!v)):(v=C,(e||!C)&&(C="error",0>e&&(e=0))),N.status=e,N.statusText=(n||C)+"",c?h.resolveWith(f,[y,C,N]):h.rejectWith(f,[N,C,v]),N.statusCode(m),m=t,u&&d.trigger(c?"ajaxSuccess":"ajaxError",[N,p,c?y:v]),g.fireWith(f,[N,C]),u&&(d.trigger("ajaxComplete",[N,p]),--b.active||b.event.trigger("ajaxStop")))}return N},getScript:function(e,n){return b.get(e,t,n,"script")},getJSON:function(e,t,n){return b.get(e,t,n,"json")}});function _n(e,n,r){var i,o,a,s,u=e.contents,l=e.dataTypes,c=e.responseFields;for(s in c)s in r&&(n[c[s]]=r[s]);while("*"===l[0])l.shift(),o===t&&(o=e.mimeType||n.getResponseHeader("Content-Type"));if(o)for(s in u)if(u[s]&&u[s].test(o)){l.unshift(s);break}if(l[0]in r)a=l[0];else{for(s in r){if(!l[0]||e.converters[s+" "+l[0]]){a=s;break}i||(i=s)}a=a||i}return a?(a!==l[0]&&l.unshift(a),r[a]):t}function Fn(e,t){var n,r,i,o,a={},s=0,u=e.dataTypes.slice(),l=u[0];if(e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u[1])for(i in e.converters)a[i.toLowerCase()]=e.converters[i];for(;r=u[++s];)if("*"!==r){if("*"!==l&&l!==r){if(i=a[l+" "+r]||a["* "+r],!i)for(n in a)if(o=n.split(" "),o[1]===r&&(i=a[l+" "+o[0]]||a["* "+o[0]])){i===!0?i=a[n]:a[n]!==!0&&(r=o[0],u.splice(s--,0,r));break}if(i!==!0)if(i&&e["throws"])t=i(t);else try{t=i(t)}catch(c){return{state:"parsererror",error:i?c:"No conversion from "+l+" to "+r}}}l=r}return{state:"success",data:t}}b.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return b.globalEval(e),e}}}),b.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),b.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=o.head||b("head")[0]||o.documentElement;return{send:function(t,i){n=o.createElement("script"),n.async=!0,e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,t){(t||!n.readyState||/loaded|complete/.test(n.readyState))&&(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),n=null,t||i(200,"success"))},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(t,!0)}}}});var On=[],Bn=/(=)\?(?=&|$)|\?\?/;b.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=On.pop()||b.expando+"_"+vn++;return this[e]=!0,e}}),b.ajaxPrefilter("json jsonp",function(n,r,i){var o,a,s,u=n.jsonp!==!1&&(Bn.test(n.url)?"url":"string"==typeof n.data&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Bn.test(n.data)&&"data");return u||"jsonp"===n.dataTypes[0]?(o=n.jsonpCallback=b.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,u?n[u]=n[u].replace(Bn,"$1"+o):n.jsonp!==!1&&(n.url+=(bn.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return s||b.error(o+" was not called"),s[0]},n.dataTypes[0]="json",a=e[o],e[o]=function(){s=arguments},i.always(function(){e[o]=a,n[o]&&(n.jsonpCallback=r.jsonpCallback,On.push(o)),s&&b.isFunction(a)&&a(s[0]),s=a=t}),"script"):t});var Pn,Rn,Wn=0,$n=e.ActiveXObject&&function(){var e;for(e in Pn)Pn[e](t,!0)};function In(){try{return new e.XMLHttpRequest}catch(t){}}function zn(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}b.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&In()||zn()}:In,Rn=b.ajaxSettings.xhr(),b.support.cors=!!Rn&&"withCredentials"in Rn,Rn=b.support.ajax=!!Rn,Rn&&b.ajaxTransport(function(n){if(!n.crossDomain||b.support.cors){var r;return{send:function(i,o){var a,s,u=n.xhr();if(n.username?u.open(n.type,n.url,n.async,n.username,n.password):u.open(n.type,n.url,n.async),n.xhrFields)for(s in n.xhrFields)u[s]=n.xhrFields[s];n.mimeType&&u.overrideMimeType&&u.overrideMimeType(n.mimeType),n.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");try{for(s in i)u.setRequestHeader(s,i[s])}catch(l){}u.send(n.hasContent&&n.data||null),r=function(e,i){var s,l,c,p;try{if(r&&(i||4===u.readyState))if(r=t,a&&(u.onreadystatechange=b.noop,$n&&delete Pn[a]),i)4!==u.readyState&&u.abort();else{p={},s=u.status,l=u.getAllResponseHeaders(),"string"==typeof u.responseText&&(p.text=u.responseText);try{c=u.statusText}catch(f){c=""}s||!n.isLocal||n.crossDomain?1223===s&&(s=204):s=p.text?200:404}}catch(d){i||o(-1,d)}p&&o(s,c,p,l)},n.async?4===u.readyState?setTimeout(r):(a=++Wn,$n&&(Pn||(Pn={},b(e).unload($n)),Pn[a]=r),u.onreadystatechange=r):r()},abort:function(){r&&r(t,!0)}}}});var Xn,Un,Vn=/^(?:toggle|show|hide)$/,Yn=RegExp("^(?:([+-])=|)("+x+")([a-z%]*)$","i"),Jn=/queueHooks$/,Gn=[nr],Qn={"*":[function(e,t){var n,r,i=this.createTween(e,t),o=Yn.exec(t),a=i.cur(),s=+a||0,u=1,l=20;if(o){if(n=+o[2],r=o[3]||(b.cssNumber[e]?"":"px"),"px"!==r&&s){s=b.css(i.elem,e,!0)||n||1;do u=u||".5",s/=u,b.style(i.elem,e,s+r);while(u!==(u=i.cur()/a)&&1!==u&&--l)}i.unit=r,i.start=s,i.end=o[1]?s+(o[1]+1)*n:n}return i}]};function Kn(){return setTimeout(function(){Xn=t}),Xn=b.now()}function Zn(e,t){b.each(t,function(t,n){var r=(Qn[t]||[]).concat(Qn["*"]),i=0,o=r.length;for(;o>i;i++)if(r[i].call(e,t,n))return})}function er(e,t,n){var r,i,o=0,a=Gn.length,s=b.Deferred().always(function(){delete u.elem}),u=function(){if(i)return!1;var t=Xn||Kn(),n=Math.max(0,l.startTime+l.duration-t),r=n/l.duration||0,o=1-r,a=0,u=l.tweens.length;for(;u>a;a++)l.tweens[a].run(o);return s.notifyWith(e,[l,o,n]),1>o&&u?n:(s.resolveWith(e,[l]),!1)},l=s.promise({elem:e,props:b.extend({},t),opts:b.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Xn||Kn(),duration:n.duration,tweens:[],createTween:function(t,n){var r=b.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)l.tweens[n].run(1);return t?s.resolveWith(e,[l,t]):s.rejectWith(e,[l,t]),this}}),c=l.props;for(tr(c,l.opts.specialEasing);a>o;o++)if(r=Gn[o].call(l,e,c,l.opts))return r;return Zn(l,c),b.isFunction(l.opts.start)&&l.opts.start.call(e,l),b.fx.timer(b.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always)}function tr(e,t){var n,r,i,o,a;for(i in e)if(r=b.camelCase(i),o=t[r],n=e[i],b.isArray(n)&&(o=n[1],n=e[i]=n[0]),i!==r&&(e[r]=n,delete e[i]),a=b.cssHooks[r],a&&"expand"in a){n=a.expand(n),delete e[r];for(i in n)i in e||(e[i]=n[i],t[i]=o)}else t[r]=o}b.Animation=b.extend(er,{tweener:function(e,t){b.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;i>r;r++)n=e[r],Qn[n]=Qn[n]||[],Qn[n].unshift(t)},prefilter:function(e,t){t?Gn.unshift(e):Gn.push(e)}});function nr(e,t,n){var r,i,o,a,s,u,l,c,p,f=this,d=e.style,h={},g=[],m=e.nodeType&&nn(e);n.queue||(c=b._queueHooks(e,"fx"),null==c.unqueued&&(c.unqueued=0,p=c.empty.fire,c.empty.fire=function(){c.unqueued||p()}),c.unqueued++,f.always(function(){f.always(function(){c.unqueued--,b.queue(e,"fx").length||c.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[d.overflow,d.overflowX,d.overflowY],"inline"===b.css(e,"display")&&"none"===b.css(e,"float")&&(b.support.inlineBlockNeedsLayout&&"inline"!==un(e.nodeName)?d.zoom=1:d.display="inline-block")),n.overflow&&(d.overflow="hidden",b.support.shrinkWrapBlocks||f.always(function(){d.overflow=n.overflow[0],d.overflowX=n.overflow[1],d.overflowY=n.overflow[2]}));for(i in t)if(a=t[i],Vn.exec(a)){if(delete t[i],u=u||"toggle"===a,a===(m?"hide":"show"))continue;g.push(i)}if(o=g.length){s=b._data(e,"fxshow")||b._data(e,"fxshow",{}),"hidden"in s&&(m=s.hidden),u&&(s.hidden=!m),m?b(e).show():f.done(function(){b(e).hide()}),f.done(function(){var t;b._removeData(e,"fxshow");for(t in h)b.style(e,t,h[t])});for(i=0;o>i;i++)r=g[i],l=f.createTween(r,m?s[r]:0),h[r]=s[r]||b.style(e,r),r in s||(s[r]=l.start,m&&(l.end=l.start,l.start="width"===r||"height"===r?1:0))}}function rr(e,t,n,r,i){return new rr.prototype.init(e,t,n,r,i)}b.Tween=rr,rr.prototype={constructor:rr,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(b.cssNumber[n]?"":"px")},cur:function(){var e=rr.propHooks[this.prop];return e&&e.get?e.get(this):rr.propHooks._default.get(this)},run:function(e){var t,n=rr.propHooks[this.prop];return this.pos=t=this.options.duration?b.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):rr.propHooks._default.set(this),this}},rr.prototype.init.prototype=rr.prototype,rr.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=b.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){b.fx.step[e.prop]?b.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[b.cssProps[e.prop]]||b.cssHooks[e.prop])?b.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},rr.propHooks.scrollTop=rr.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},b.each(["toggle","show","hide"],function(e,t){var n=b.fn[t];b.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ir(t,!0),e,r,i)}}),b.fn.extend({fadeTo:function(e,t,n,r){return this.filter(nn).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=b.isEmptyObject(e),o=b.speed(t,n,r),a=function(){var t=er(this,b.extend({},e),o);a.finish=function(){t.stop(!0)},(i||b._data(this,"finish"))&&t.stop(!0)};return a.finish=a,i||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",o=b.timers,a=b._data(this);if(n)a[n]&&a[n].stop&&i(a[n]);else for(n in a)a[n]&&a[n].stop&&Jn.test(n)&&i(a[n]);for(n=o.length;n--;)o[n].elem!==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(r),t=!1,o.splice(n,1));(t||!r)&&b.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=b._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=b.timers,a=r?r.length:0;for(n.finish=!0,b.queue(this,e,[]),i&&i.cur&&i.cur.finish&&i.cur.finish.call(this),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;a>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}});function ir(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=Zt[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}b.each({slideDown:ir("show"),slideUp:ir("hide"),slideToggle:ir("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){b.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),b.speed=function(e,t,n){var r=e&&"object"==typeof e?b.extend({},e):{complete:n||!n&&t||b.isFunction(e)&&e,duration:e,easing:n&&t||t&&!b.isFunction(t)&&t};return r.duration=b.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in b.fx.speeds?b.fx.speeds[r.duration]:b.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){b.isFunction(r.old)&&r.old.call(this),r.queue&&b.dequeue(this,r.queue)},r},b.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},b.timers=[],b.fx=rr.prototype.init,b.fx.tick=function(){var e,n=b.timers,r=0;for(Xn=b.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||b.fx.stop(),Xn=t},b.fx.timer=function(e){e()&&b.timers.push(e)&&b.fx.start()},b.fx.interval=13,b.fx.start=function(){Un||(Un=setInterval(b.fx.tick,b.fx.interval))},b.fx.stop=function(){clearInterval(Un),Un=null},b.fx.speeds={slow:600,fast:200,_default:400},b.fx.step={},b.expr&&b.expr.filters&&(b.expr.filters.animated=function(e){return b.grep(b.timers,function(t){return e===t.elem}).length}),b.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){b.offset.setOffset(this,e,t)});var n,r,o={top:0,left:0},a=this[0],s=a&&a.ownerDocument;if(s)return n=s.documentElement,b.contains(n,a)?(typeof a.getBoundingClientRect!==i&&(o=a.getBoundingClientRect()),r=or(s),{top:o.top+(r.pageYOffset||n.scrollTop)-(n.clientTop||0),left:o.left+(r.pageXOffset||n.scrollLeft)-(n.clientLeft||0)}):o},b.offset={setOffset:function(e,t,n){var r=b.css(e,"position");"static"===r&&(e.style.position="relative");var i=b(e),o=i.offset(),a=b.css(e,"top"),s=b.css(e,"left"),u=("absolute"===r||"fixed"===r)&&b.inArray("auto",[a,s])>-1,l={},c={},p,f;u?(c=i.position(),p=c.top,f=c.left):(p=parseFloat(a)||0,f=parseFloat(s)||0),b.isFunction(t)&&(t=t.call(e,n,o)),null!=t.top&&(l.top=t.top-o.top+p),null!=t.left&&(l.left=t.left-o.left+f),"using"in t?t.using.call(e,l):i.css(l)}},b.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===b.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),b.nodeName(e[0],"html")||(n=e.offset()),n.top+=b.css(e[0],"borderTopWidth",!0),n.left+=b.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-b.css(r,"marginTop",!0),left:t.left-n.left-b.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||o.documentElement;while(e&&!b.nodeName(e,"html")&&"static"===b.css(e,"position"))e=e.offsetParent;return e||o.documentElement})}}),b.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);b.fn[e]=function(i){return b.access(this,function(e,i,o){var a=or(e);return o===t?a?n in a?a[n]:a.document.documentElement[i]:e[i]:(a?a.scrollTo(r?b(a).scrollLeft():o,r?o:b(a).scrollTop()):e[i]=o,t)},e,i,arguments.length,null)}});function or(e){return b.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}b.each({Height:"height",Width:"width"},function(e,n){b.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){b.fn[i]=function(i,o){var a=arguments.length&&(r||"boolean"!=typeof i),s=r||(i===!0||o===!0?"margin":"border");return b.access(this,function(n,r,i){var o;return b.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(o=n.documentElement,Math.max(n.body["scroll"+e],o["scroll"+e],n.body["offset"+e],o["offset"+e],o["client"+e])):i===t?b.css(n,r,s):b.style(n,r,i,s)},n,a?i:t,a,null)}})}),e.jQuery=e.$=b,"function"==typeof define&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return b})})(window);
|
frontend/main.js
|
misterwilliam/gae-channels-sample
|
import React from 'react'
import ReactDOM from 'react-dom'
import { Provider } from 'react-redux'
import Store from './store'
import MainApp from './uiComponents/mainApp'
ReactDOM.render(
<Provider store={Store}>
<MainApp />
</Provider>,
document.getElementById('wrapper')
);
|
src/svg-icons/communication/textsms.js
|
mtsandeep/material-ui
|
import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let CommunicationTextsms = (props) => (
<SvgIcon {...props}>
<path d="M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM9 11H7V9h2v2zm4 0h-2V9h2v2zm4 0h-2V9h2v2z"/>
</SvgIcon>
);
CommunicationTextsms = pure(CommunicationTextsms);
CommunicationTextsms.displayName = 'CommunicationTextsms';
CommunicationTextsms.muiName = 'SvgIcon';
export default CommunicationTextsms;
|
docs/src/app/components/pages/components/DatePicker/ExampleControlled.js
|
IsenrichO/mui-with-arrows
|
import React from 'react';
import DatePicker from 'material-ui/DatePicker';
/**
* `DatePicker` can be implemented as a controlled input,
* where `value` is handled by state in the parent component.
*/
export default class DatePickerExampleControlled extends React.Component {
constructor(props) {
super(props);
this.state = {
controlledDate: null,
};
}
handleChange = (event, date) => {
this.setState({
controlledDate: date,
});
};
render() {
return (
<DatePicker
hintText="Controlled Date Input"
value={this.state.controlledDate}
onChange={this.handleChange}
/>
);
}
}
|
packages/material-ui-icons/src/CancelRounded.js
|
Kagami/material-ui
|
import React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<React.Fragment><path fill="none" d="M0 0h24v24H0V0z" opacity=".87" /><path d="M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm4.3 14.3c-.39.39-1.02.39-1.41 0L12 13.41 9.11 16.3c-.39.39-1.02.39-1.41 0a.9959.9959 0 0 1 0-1.41L10.59 12 7.7 9.11a.9959.9959 0 0 1 0-1.41c.39-.39 1.02-.39 1.41 0L12 10.59l2.89-2.89c.39-.39 1.02-.39 1.41 0 .39.39.39 1.02 0 1.41L13.41 12l2.89 2.89c.38.38.38 1.02 0 1.41z" /></React.Fragment>
, 'CancelRounded');
|
src/containers/RecipeList.js
|
DonHansDampf/whattoeat_website
|
import React from 'react'
import { connect } from 'react-redux'
// import { bindActionCreators } from 'redux'
import {
Block,
Heading,
Text
} from 'rebass'
import GetButton from './GetButton'
import RandomRecipeButton from './RandomRecipeButton'
type Props = {
recipes: React.PropTypes.array.isRequired
}
export class RecipeList extends React.Component {
props: Props;
constructor (props) {
super(props)
this.renderRecipe = this.renderRecipe.bind(this)
}
renderRecipe (recipeData) {
const title = recipeData.title
const desc = recipeData.desc
// const image = recipeData.image
// const tags = recipeData.tags
const id = recipeData._id
return (
<div key={id}>
<Block
borderLeft
px={2}
>
<Heading
level={2}
size={3}
>
{title}
</Heading>
<Text>
{desc}
</Text>
</Block>
</div>
)
}
render () {
return (
<div>
{(typeof this.props.recipes[0] === 'undefined'
? <div className='loading'>
<GetButton />
</div>
: <div>
<RandomRecipeButton />
{this.props.recipes.map(this.renderRecipe)}
</div>
)}
</div>
)
}
}
const mapStateToProps = (state) => {
return {
recipes: state.recipes
}
}
export default connect(
mapStateToProps,
)(RecipeList)
|
src/containers/Home/BookingColumn.js
|
sslash/bookr
|
import React, { Component } from 'react';
const moment = require('moment');
import _range from 'lodash/utility/range';
export default class BookingColumn extends Component {
constructor(props) {
super(props);
this.onBookClicked = this.onBookClicked.bind(this);
}
onBookClicked() {
if (!this.props.user) {
window.location.replace('/login');
}
if (!this.props.available) {
return alert('Denne er allerede booket');
}
const date = moment(this.props.currentDate)
.seconds(0)
.hours(this.props.hour)
.minutes(0)
.toDate();
this.props.save({
bookingTime: date,
facility: this.props.facility,
user: 1337
});
}
render() {
const styles = require('./Home.scss');
const txt = this.props.available ? ' - ' : 'Booket';
//
// if (this.props.available) {
// classes.push(styles.available);
// }
return (
<td onClick={this.onBookClicked} className={this.props.available ? styles.available: ''}>
<span>{txt}</span>
</td>
);
}
}
BookingColumn.propTypes = {
save: React.PropTypes.func
};
|
web/src/configuration/sources/imageSourceTypes.js
|
bolddp/pixerva
|
import React from 'react';
import FolderSource from './FolderSource';
export default [
{
type: 'folder',
newSourceText: 'Folder on image server',
configHeaderText: 'Folder on image server',
createNew: () => {
return {
type: 'folder',
name: '',
config: {
path: ''
}
}
},
getId: (index) => `folder${('00' + index).slice(-2)}`,
component: (source, saveFunction) => {
return (
<FolderSource source={source} onSave={saveFunction} />
);
}
}
];
|
src/layouts/index.js
|
hologram-io/docs
|
import React from 'react'
import Helmet from 'react-helmet'
import { Navbar } from '../components'
import '../scss/main.scss'
import { SEO_DEFAULTS } from '../constants'
const { TITLE, DESCRIPTION, KEYWORDS } = SEO_DEFAULTS;
/*
This layout is applied to any page in the "pages" folder.
*/
class Basic extends React.Component {
constructor(props) {
super(props);
}
render() {
const { children } = this.props;
return (
<div className="full-height row-stacked docs">
<Helmet title={TITLE} meta={this.getMetaData()} />
<Navbar />
{children()}
</div>
)
}
getMetaData() {
return [
{ name: 'description', content: DESCRIPTION },
{ name: 'keywords', content: KEYWORDS }
];
}
}
export default Basic;
|
packages/jsx_orphaned_brackets_transformer/run.js
|
zofuthan/react
|
#!/usr/bin/env node
'use strict';
var FileFinder = require('node-find-files');
var fs = require('graceful-fs');
var jstransform = require('jstransform');
var path = require('path');
var visitReactTag = require('./transforms/react').visitReactTag;
/*eslint-disable no-shadow*/
var S = jstransform.Syntax;
var USAGE =
'Read a file (or directory of files) from disk, transform any orphaned ' +
'} and > characters to avoid parser errors with React 0.13.';
function _visitFbt(node, path, state) {
return false;
}
_visitFbt.test = function(node, path, state) {
return node.type === S.XJSElement
&& node.openingElement.name.name === 'fbt';
};
var VISITORS_LIST = [
_visitFbt,
visitReactTag,
];
function _transformSource(source) {
return jstransform.transform(VISITORS_LIST, source).code;
}
function transformDir(dirPath, exclude) {
var finder = new FileFinder({
rootFolder: dirPath,
filterFunction: function(path, stat) {
return /\.jsx?$/.test(path) && (!exclude || !exclude.test(path));
},
});
var numTransforms = 0;
var completeTransforms = 0;
var findingComplete = false;
function _printProgress() {
process.stdout.clearLine();
process.stdout.cursorTo(0);
process.stdout.write(
completeTransforms + '/' + numTransforms + ' transforms complete'
);
if (findingComplete && completeTransforms === numTransforms) {
console.log('\ndone!');
}
}
finder.on('match', function(pathStr, stat) {
fs.readFile(pathStr, 'utf8', function(err, data) {
if (err) {
err.message = err.message + ' (' + pathStr + ')';
throw err;
}
numTransforms++;
_printProgress();
var transformedData;
try {
transformedData = _transformSource(data);
} catch (e) {
e.message = e.message + ' (' + pathStr + ')';
throw e;
}
if (transformedData !== data) {
fs.writeFile(pathStr, transformedData, function(err) {
if (err) {
err.message = err.message + ' (' + pathStr + ')';
throw err;
}
completeTransforms++;
_printProgress();
});
} else {
completeTransforms++;
_printProgress();
}
});
});
finder.on('error', function(err) {
console.log('\nError: ', err.stack);
throw err;
});
finder.on('complete', function() {
findingComplete = true;
});
finder.startSearch();
}
function transformFile(pathStr) {
fs.readFile(pathStr, 'utf8', function(err, data) {
if (err) {
err.message = err.message + ' (' + pathStr + ')';
throw err;
}
var transformedData;
try {
transformedData = _transformSource(data);
} catch (e) {
e.message = e.message + ' (' + pathStr + ')';
throw e;
}
if (transformedData !== data) {
fs.writeFile(pathStr, transformedData, function(err) {
if (err) {
err.message = err.message + ' (' + pathStr + ')';
throw err;
}
console.log('done!');
});
} else {
console.log('done!');
}
});
}
if (require.main === module) {
var argv = require('optimist')
.usage(USAGE)
.argv;
if (argv._.length === 0) {
throw new Error(
'Please specify a file or directory path as the first arg!'
);
}
argv._.forEach(function(arg) {
var absPath = path.resolve(arg);
fs.stat(absPath, function(err, stat) {
if (err) {
throw err;
}
if (stat.isFile()) {
transformFile(absPath);
} else if (stat.isDirectory()) {
var exclude = null;
if (argv.exclude) {
exclude = new RegExp(argv.exclude);
}
transformDir(absPath, exclude);
} else {
throw new Error('Unknown filesystem node type: ' + absPath);
}
});
});
}
exports.transformDir = transformDir;
|
ajax/libs/ember-data.js/1.13.4/ember-data.js
|
maruilian11/cdnjs
|
(function() {
"use strict";
var ember$data$lib$system$adapter$$get = Ember.get;
/**
An adapter is an object that receives requests from a store and
translates them into the appropriate action to take against your
persistence layer. The persistence layer is usually an HTTP API, but
may be anything, such as the browser's local storage. Typically the
adapter is not invoked directly instead its functionality is accessed
through the `store`.
### Creating an Adapter
Create a new subclass of `DS.Adapter` in the `app/adapters` folder:
```app/adapters/application.js
import DS from 'ember-data';
export default DS.Adapter.extend({
// ...your code here
});
```
Model-specific adapters can be created by putting your adapter
class in an `app/adapters/` + `model-name` + `.js` file of the application.
```app/adapters/post.js
import DS from 'ember-data';
export default DS.Adapter.extend({
// ...Post-specific adapter code goes here
});
```
`DS.Adapter` is an abstract base class that you should override in your
application to customize it for your backend. The minimum set of methods
that you should implement is:
* `findRecord()`
* `createRecord()`
* `updateRecord()`
* `deleteRecord()`
* `findAll()`
* `query()`
To improve the network performance of your application, you can optimize
your adapter by overriding these lower-level methods:
* `findMany()`
For an example implementation, see `DS.RESTAdapter`, the
included REST adapter.
@class Adapter
@namespace DS
@extends Ember.Object
*/
var ember$data$lib$system$adapter$$Adapter = Ember.Object.extend({
/**
If you would like your adapter to use a custom serializer you can
set the `defaultSerializer` property to be the name of the custom
serializer.
Note the `defaultSerializer` serializer has a lower priority than
a model specific serializer (i.e. `PostSerializer`) or the
`application` serializer.
```app/adapters/django.js
import DS from 'ember-data';
export default DS.Adapter.extend({
defaultSerializer: 'django'
});
```
@property defaultSerializer
@type {String}
*/
defaultSerializer: '-default',
/**
The `findRecord()` method is invoked when the store is asked for a record that
has not previously been loaded. In response to `findRecord()` being called, you
should query your persistence layer for a record with the given ID. Once
found, you can asynchronously call the store's `push()` method to push
the record into the store.
Here is an example `findRecord` implementation:
```app/adapters/application.js
import DS from 'ember-data';
export default DS.Adapter.extend({
findRecord: function(store, type, id, snapshot) {
var url = [type.modelName, id].join('/');
return new Ember.RSVP.Promise(function(resolve, reject) {
jQuery.getJSON(url).then(function(data) {
Ember.run(null, resolve, data);
}, function(jqXHR) {
jqXHR.then = null; // tame jQuery's ill mannered promises
Ember.run(null, reject, jqXHR);
});
});
}
});
```
@method findRecord
@param {DS.Store} store
@param {DS.Model} type
@param {String} id
@param {DS.Snapshot} snapshot
@return {Promise} promise
*/
findRecord: null,
/**
The `findAll()` method is used to retrieve all records for a given type.
Example
```app/adapters/application.js
import DS from 'ember-data';
export default DS.Adapter.extend({
findAll: function(store, type, sinceToken) {
var url = type;
var query = { since: sinceToken };
return new Ember.RSVP.Promise(function(resolve, reject) {
jQuery.getJSON(url, query).then(function(data) {
Ember.run(null, resolve, data);
}, function(jqXHR) {
jqXHR.then = null; // tame jQuery's ill mannered promises
Ember.run(null, reject, jqXHR);
});
});
}
});
```
@method findAll
@param {DS.Store} store
@param {DS.Model} type
@param {String} sinceToken
@param {DS.SnapshotRecordArray} snapshotRecordArray
@return {Promise} promise
*/
findAll: null,
/**
This method is called when you call `query` on the store.
Example
```app/adapters/application.js
import DS from 'ember-data';
export default DS.Adapter.extend({
query: function(store, type, query) {
var url = type;
return new Ember.RSVP.Promise(function(resolve, reject) {
jQuery.getJSON(url, query).then(function(data) {
Ember.run(null, resolve, data);
}, function(jqXHR) {
jqXHR.then = null; // tame jQuery's ill mannered promises
Ember.run(null, reject, jqXHR);
});
});
}
});
```
@private
@method query
@param {DS.Store} store
@param {DS.Model} type
@param {Object} query
@param {DS.AdapterPopulatedRecordArray} recordArray
@return {Promise} promise
*/
query: null,
/**
The `queryRecord()` method is invoked when the store is asked for a single
record through a query object.
In response to `queryRecord()` being called, you should always fetch fresh
data. Once found, you can asynchronously call the store's `push()` method
to push the record into the store.
Here is an example `queryRecord` implementation:
Example
```javascript
App.ApplicationAdapter = DS.Adapter.extend({
queryRecord: function(store, typeClass, query) {
var url = [type.typeKey, id].join('/');
return new Ember.RSVP.Promise(function(resolve, reject) {
jQuery.getJSON(url, query).then(function(data) {
Ember.run(null, resolve, data);
}, function(jqXHR) {
jqXHR.then = null; // tame jQuery's ill mannered promises
Ember.run(null, reject, jqXHR);
});
});
}
});
```
@method queryRecord
@param {DS.Store} store
@param {subclass of DS.Model} type
@param {Object} query
@param {String} id
@return {Promise} promise
*/
queryRecord: null,
/**
If the globally unique IDs for your records should be generated on the client,
implement the `generateIdForRecord()` method. This method will be invoked
each time you create a new record, and the value returned from it will be
assigned to the record's `primaryKey`.
Most traditional REST-like HTTP APIs will not use this method. Instead, the ID
of the record will be set by the server, and your adapter will update the store
with the new ID when it calls `didCreateRecord()`. Only implement this method if
you intend to generate record IDs on the client-side.
The `generateIdForRecord()` method will be invoked with the requesting store as
the first parameter and the newly created record as the second parameter:
```javascript
generateIdForRecord: function(store, inputProperties) {
var uuid = App.generateUUIDWithStatisticallyLowOddsOfCollision();
return uuid;
}
```
@method generateIdForRecord
@param {DS.Store} store
@param {DS.Model} type the DS.Model class of the record
@param {Object} inputProperties a hash of properties to set on the
newly created record.
@return {(String|Number)} id
*/
generateIdForRecord: null,
/**
Proxies to the serializer's `serialize` method.
Example
```app/adapters/application.js
import DS from 'ember-data';
export default DS.Adapter.extend({
createRecord: function(store, type, snapshot) {
var data = this.serialize(snapshot, { includeId: true });
var url = type;
// ...
}
});
```
@method serialize
@param {DS.Snapshot} snapshot
@param {Object} options
@return {Object} serialized snapshot
*/
serialize: function (snapshot, options) {
return ember$data$lib$system$adapter$$get(snapshot.record, 'store').serializerFor(snapshot.modelName).serialize(snapshot, options);
},
/**
Implement this method in a subclass to handle the creation of
new records.
Serializes the record and sends it to the server.
Example
```app/adapters/application.js
import DS from 'ember-data';
export default DS.Adapter.extend({
createRecord: function(store, type, snapshot) {
var data = this.serialize(snapshot, { includeId: true });
var url = type;
return new Ember.RSVP.Promise(function(resolve, reject) {
jQuery.ajax({
type: 'POST',
url: url,
dataType: 'json',
data: data
}).then(function(data) {
Ember.run(null, resolve, data);
}, function(jqXHR) {
jqXHR.then = null; // tame jQuery's ill mannered promises
Ember.run(null, reject, jqXHR);
});
});
}
});
```
@method createRecord
@param {DS.Store} store
@param {DS.Model} type the DS.Model class of the record
@param {DS.Snapshot} snapshot
@return {Promise} promise
*/
createRecord: null,
/**
Implement this method in a subclass to handle the updating of
a record.
Serializes the record update and sends it to the server.
Example
```app/adapters/application.js
import DS from 'ember-data';
export default DS.Adapter.extend({
updateRecord: function(store, type, snapshot) {
var data = this.serialize(snapshot, { includeId: true });
var id = snapshot.id;
var url = [type, id].join('/');
return new Ember.RSVP.Promise(function(resolve, reject) {
jQuery.ajax({
type: 'PUT',
url: url,
dataType: 'json',
data: data
}).then(function(data) {
Ember.run(null, resolve, data);
}, function(jqXHR) {
jqXHR.then = null; // tame jQuery's ill mannered promises
Ember.run(null, reject, jqXHR);
});
});
}
});
```
@method updateRecord
@param {DS.Store} store
@param {DS.Model} type the DS.Model class of the record
@param {DS.Snapshot} snapshot
@return {Promise} promise
*/
updateRecord: null,
/**
Implement this method in a subclass to handle the deletion of
a record.
Sends a delete request for the record to the server.
Example
```app/adapters/application.js
import DS from 'ember-data';
export default DS.Adapter.extend({
deleteRecord: function(store, type, snapshot) {
var data = this.serialize(snapshot, { includeId: true });
var id = snapshot.id;
var url = [type, id].join('/');
return new Ember.RSVP.Promise(function(resolve, reject) {
jQuery.ajax({
type: 'DELETE',
url: url,
dataType: 'json',
data: data
}).then(function(data) {
Ember.run(null, resolve, data);
}, function(jqXHR) {
jqXHR.then = null; // tame jQuery's ill mannered promises
Ember.run(null, reject, jqXHR);
});
});
}
});
```
@method deleteRecord
@param {DS.Store} store
@param {DS.Model} type the DS.Model class of the record
@param {DS.Snapshot} snapshot
@return {Promise} promise
*/
deleteRecord: null,
/**
By default the store will try to coalesce all `fetchRecord` calls within the same runloop
into as few requests as possible by calling groupRecordsForFindMany and passing it into a findMany call.
You can opt out of this behaviour by either not implementing the findMany hook or by setting
coalesceFindRequests to false.
@property coalesceFindRequests
@type {boolean}
*/
coalesceFindRequests: true,
/**
Find multiple records at once if coalesceFindRequests is true.
@method findMany
@param {DS.Store} store
@param {DS.Model} type the DS.Model class of the records
@param {Array} ids
@param {Array} snapshots
@return {Promise} promise
*/
/**
Organize records into groups, each of which is to be passed to separate
calls to `findMany`.
For example, if your api has nested URLs that depend on the parent, you will
want to group records by their parent.
The default implementation returns the records as a single group.
@method groupRecordsForFindMany
@param {DS.Store} store
@param {Array} snapshots
@return {Array} an array of arrays of records, each of which is to be
loaded separately by `findMany`.
*/
groupRecordsForFindMany: function (store, snapshots) {
return [snapshots];
},
/**
This method is used by the store to determine if the store should
reload a record from the adapter when a record is requested by
`store.findRecord`.
If this method returns true the store will re fetch a record from
the adapter. If is method returns false the store will resolve
immediately using the cached record.
@method shouldReloadRecord
@param {DS.Store} store
@param {DS.Snapshot} snapshot
@return {Boolean}
*/
shouldReloadRecord: function (store, snapshot) {
return false;
},
/**
This method is used by the store to determine if the store should
reload all records from the adapter when records are requested by
`store.findAll`.
If this method returns true the store will re fetch all records from
the adapter. If is method returns false the store will resolve
immediately using the cached record.
@method shouldReloadRecord
@param {DS.Store} store
@param {DS.SnapshotRecordArray} snapshotRecordArray
@return {Boolean}
*/
shouldReloadAll: function (store, snapshotRecordArray) {
var modelName = snapshotRecordArray.type.modelName;
Ember.deprecate('The default behavior of shouldReloadAll will change in Ember Data 2.0 to always return false when there is at least one "' + modelName + '" record in the store. If you would like to preserve the current behavior please override shouldReloadAll in your adapter:application and return true.');
return true;
},
/**
This method is used by the store to determine if the store should
reload a record after the `store.findRecord` method resolves a
cached record.
This method is *only* checked by the store when the store is
returning a cached record.
If this method returns true the store will re-fetch a record from
the adapter.
@method shouldBackgroundReloadRecord
@param {DS.Store} store
@param {DS.Snapshot} snapshot
@return {Boolean}
*/
shouldBackgroundReloadRecord: function (store, snapshot) {
Ember.deprecate('The default behavior of `shouldBackgroundReloadRecord` will change in Ember Data 2.0 to always return true. If you would like to preserve the current behavior please override `shouldBackgroundReloadRecord` in your adapter:application and return false.');
return false;
},
/**
This method is used by the store to determine if the store should
reload a record array after the `store.findAll` method resolves
with a cached record array.
This method is *only* checked by the store when the store is
returning a cached record array.
If this method returns true the store will re-fetch all records
from the adapter.
@method shouldBackgroundReloadAll
@param {DS.Store} store
@param {DS.SnapshotRecordArray} snapshotRecordArray
@return {Boolean}
*/
shouldBackgroundReloadAll: function (store, snapshotRecordArray) {
return true;
}
});
var ember$data$lib$system$adapter$$default = ember$data$lib$system$adapter$$Adapter;
/**
@module ember-data
*/
var ember$data$lib$adapters$fixture$adapter$$get = Ember.get;
var ember$data$lib$adapters$fixture$adapter$$fmt = Ember.String.fmt;
var ember$data$lib$adapters$fixture$adapter$$indexOf = Ember.ArrayPolyfills.indexOf;
var ember$data$lib$adapters$fixture$adapter$$counter = 0;
var ember$data$lib$adapters$fixture$adapter$$default = ember$data$lib$system$adapter$$default.extend({
// by default, fixtures are already in normalized form
serializer: null,
// The fixture adapter does not support coalesceFindRequests
coalesceFindRequests: false,
/**
If `simulateRemoteResponse` is `true` the `FixtureAdapter` will
wait a number of milliseconds before resolving promises with the
fixture values. The wait time can be configured via the `latency`
property.
@property simulateRemoteResponse
@type {Boolean}
@default true
*/
simulateRemoteResponse: true,
/**
By default the `FixtureAdapter` will simulate a wait of the
`latency` milliseconds before resolving promises with the fixture
values. This behavior can be turned off via the
`simulateRemoteResponse` property.
@property latency
@type {Number}
@default 50
*/
latency: 50,
/**
Implement this method in order to provide data associated with a type
@method fixturesForType
@param {DS.Model} typeClass
@return {Array}
*/
fixturesForType: function (typeClass) {
if (typeClass.FIXTURES) {
var fixtures = Ember.A(typeClass.FIXTURES);
return fixtures.map(function (fixture) {
var fixtureIdType = typeof fixture.id;
if (fixtureIdType !== "number" && fixtureIdType !== "string") {
throw new Error(ember$data$lib$adapters$fixture$adapter$$fmt("the id property must be defined as a number or string for fixture %@", [fixture]));
}
fixture.id = fixture.id + "";
return fixture;
});
}
return null;
},
/**
Implement this method in order to query fixtures data
@method queryFixtures
@param {Array} fixtures
@param {Object} query
@param {DS.Model} typeClass
@return {(Promise|Array)}
*/
queryFixtures: function (fixtures, query, typeClass) {
Ember.assert("Not implemented: You must override the DS.FixtureAdapter::queryFixtures method to support querying the fixture store.");
},
/**
@method updateFixtures
@param {DS.Model} typeClass
@param {Array} fixture
*/
updateFixtures: function (typeClass, fixture) {
if (!typeClass.FIXTURES) {
typeClass.FIXTURES = [];
}
var fixtures = typeClass.FIXTURES;
this.deleteLoadedFixture(typeClass, fixture);
fixtures.push(fixture);
},
/**
Implement this method in order to provide json for CRUD methods
@method mockJSON
@param {DS.Store} store
@param {DS.Model} typeClass
@param {DS.Snapshot} snapshot
*/
mockJSON: function (store, typeClass, snapshot) {
return store.serializerFor(snapshot.modelName).serialize(snapshot, { includeId: true });
},
/**
@method generateIdForRecord
@param {DS.Store} store
@return {String} id
*/
generateIdForRecord: function (store) {
return "fixture-" + ember$data$lib$adapters$fixture$adapter$$counter++;
},
/**
@method find
@param {DS.Store} store
@param {DS.Model} typeClass
@param {String} id
@param {DS.Snapshot} snapshot
@return {Promise} promise
*/
find: function (store, typeClass, id, snapshot) {
var fixtures = this.fixturesForType(typeClass);
var fixture;
Ember.assert("Unable to find fixtures for model type " + typeClass.toString() + ". If you're defining your fixtures using `Model.FIXTURES = ...`, please change it to `Model.reopenClass({ FIXTURES: ... })`.", fixtures);
if (fixtures) {
fixture = Ember.A(fixtures).findBy("id", id);
}
if (fixture) {
return this.simulateRemoteCall(function () {
return fixture;
}, this);
}
},
/**
@method findMany
@param {DS.Store} store
@param {DS.Model} typeClass
@param {Array} ids
@param {Array} snapshots
@return {Promise} promise
*/
findMany: function (store, typeClass, ids, snapshots) {
var fixtures = this.fixturesForType(typeClass);
Ember.assert("Unable to find fixtures for model type " + typeClass.toString(), fixtures);
if (fixtures) {
fixtures = fixtures.filter(function (item) {
return ember$data$lib$adapters$fixture$adapter$$indexOf.call(ids, item.id) !== -1;
});
}
if (fixtures) {
return this.simulateRemoteCall(function () {
return fixtures;
}, this);
}
},
/**
@private
@method findAll
@param {DS.Store} store
@param {DS.Model} typeClass
@return {Promise} promise
*/
findAll: function (store, typeClass) {
var fixtures = this.fixturesForType(typeClass);
Ember.assert("Unable to find fixtures for model type " + typeClass.toString(), fixtures);
return this.simulateRemoteCall(function () {
return fixtures;
}, this);
},
/**
@private
@method findQuery
@param {DS.Store} store
@param {DS.Model} typeClass
@param {Object} query
@param {DS.AdapterPopulatedRecordArray} array
@return {Promise} promise
*/
findQuery: function (store, typeClass, query, array) {
var fixtures = this.fixturesForType(typeClass);
Ember.assert("Unable to find fixtures for model type " + typeClass.toString(), fixtures);
fixtures = this.queryFixtures(fixtures, query, typeClass);
if (fixtures) {
return this.simulateRemoteCall(function () {
return fixtures;
}, this);
}
},
/**
@method createRecord
@param {DS.Store} store
@param {DS.Model} typeClass
@param {DS.Snapshot} snapshot
@return {Promise} promise
*/
createRecord: function (store, typeClass, snapshot) {
var fixture = this.mockJSON(store, typeClass, snapshot);
this.updateFixtures(typeClass, fixture);
return this.simulateRemoteCall(function () {
return fixture;
}, this);
},
/**
@method updateRecord
@param {DS.Store} store
@param {DS.Model} typeClass
@param {DS.Snapshot} snapshot
@return {Promise} promise
*/
updateRecord: function (store, typeClass, snapshot) {
var fixture = this.mockJSON(store, typeClass, snapshot);
this.updateFixtures(typeClass, fixture);
return this.simulateRemoteCall(function () {
return fixture;
}, this);
},
/**
@method deleteRecord
@param {DS.Store} store
@param {DS.Model} typeClass
@param {DS.Snapshot} snapshot
@return {Promise} promise
*/
deleteRecord: function (store, typeClass, snapshot) {
this.deleteLoadedFixture(typeClass, snapshot);
return this.simulateRemoteCall(function () {
// no payload in a deletion
return null;
});
},
/*
@method deleteLoadedFixture
@private
@param typeClass
@param snapshot
*/
deleteLoadedFixture: function (typeClass, snapshot) {
var existingFixture = this.findExistingFixture(typeClass, snapshot);
if (existingFixture) {
var index = ember$data$lib$adapters$fixture$adapter$$indexOf.call(typeClass.FIXTURES, existingFixture);
typeClass.FIXTURES.splice(index, 1);
return true;
}
},
/*
@method findExistingFixture
@private
@param typeClass
@param snapshot
*/
findExistingFixture: function (typeClass, snapshot) {
var fixtures = this.fixturesForType(typeClass);
var id = snapshot.id;
return this.findFixtureById(fixtures, id);
},
/*
@method findFixtureById
@private
@param fixtures
@param id
*/
findFixtureById: function (fixtures, id) {
return Ember.A(fixtures).find(function (r) {
if ("" + ember$data$lib$adapters$fixture$adapter$$get(r, "id") === "" + id) {
return true;
} else {
return false;
}
});
},
/*
@method simulateRemoteCall
@private
@param callback
@param context
*/
simulateRemoteCall: function (callback, context) {
var adapter = this;
return new Ember.RSVP.Promise(function (resolve) {
var value = Ember.copy(callback.call(context), true);
if (ember$data$lib$adapters$fixture$adapter$$get(adapter, "simulateRemoteResponse")) {
// Schedule with setTimeout
Ember.run.later(function () {
resolve(value);
}, ember$data$lib$adapters$fixture$adapter$$get(adapter, "latency"));
} else {
// Asynchronous, but at the of the runloop with zero latency
Ember.run.schedule("actions", null, function () {
resolve(value);
});
}
}, "DS: FixtureAdapter#simulateRemoteCall");
}
});
var ember$data$lib$adapters$errors$$EmberError = Ember.Error;
var ember$data$lib$adapters$errors$$create = Ember.create;
var ember$data$lib$adapters$errors$$forEach = Ember.ArrayPolyfills.forEach;
var ember$data$lib$adapters$errors$$SOURCE_POINTER_REGEXP = /data\/(attributes|relationships)\/(.*)/;
/**
@class AdapterError
@namespace DS
*/
function ember$data$lib$adapters$errors$$AdapterError(errors, message) {
message = message || "Adapter operation failed";
ember$data$lib$adapters$errors$$EmberError.call(this, message);
this.errors = errors || [{
title: "Adapter Error",
details: message
}];
}
ember$data$lib$adapters$errors$$AdapterError.prototype = ember$data$lib$adapters$errors$$create(ember$data$lib$adapters$errors$$EmberError.prototype);
/**
A `DS.InvalidError` is used by an adapter to signal the external API
was unable to process a request because the content was not
semantically correct or meaningful per the API. Usually this means a
record failed some form of server side validation. When a promise
from an adapter is rejected with a `DS.InvalidError` the record will
transition to the `invalid` state and the errors will be set to the
`errors` property on the record.
For Ember Data to correctly map errors to their corresponding
properties on the model, Ember Data expects each error to be
a valid json-api error object with a `source/pointer` that matches
the property name. For example if you had a Post model that
looked like this.
```app/models/post.js
import DS from 'ember-data';
export default DS.Model.extend({
title: DS.attr('string'),
content: DS.attr('string')
});
```
To show an error from the server related to the `title` and
`content` properties your adapter could return a promise that
rejects with a `DS.InvalidError` object that looks like this:
```app/adapters/post.js
import Ember from 'ember';
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
updateRecord: function() {
// Fictional adapter that always rejects
return Ember.RSVP.reject(new DS.InvalidError([
{
details: 'Must be unique',
source: { pointer: 'data/attributes/title' }
},
{
details: 'Must not be blank',
source: { pointer: 'data/attributes/content'}
}
]));
}
});
```
Your backend may use different property names for your records the
store will attempt extract and normalize the errors using the
serializer's `extractErrors` method before the errors get added to
the the model. As a result, it is safe for the `InvalidError` to
wrap the error payload unaltered.
@class InvalidError
@namespace DS
*/
function ember$data$lib$adapters$errors$$InvalidError(errors) {
if (!Ember.isArray(errors)) {
Ember.deprecate("`InvalidError` expects json-api formatted errors.");
errors = ember$data$lib$adapters$errors$$errorsHashToArray(errors);
}
ember$data$lib$adapters$errors$$AdapterError.call(this, errors, "The adapter rejected the commit because it was invalid");
}
ember$data$lib$adapters$errors$$InvalidError.prototype = ember$data$lib$adapters$errors$$create(ember$data$lib$adapters$errors$$AdapterError.prototype);
/**
@class TimeoutError
@namespace DS
*/
function ember$data$lib$adapters$errors$$TimeoutError() {
ember$data$lib$adapters$errors$$AdapterError.call(this, null, "The adapter operation timed out");
}
ember$data$lib$adapters$errors$$TimeoutError.prototype = ember$data$lib$adapters$errors$$create(ember$data$lib$adapters$errors$$AdapterError.prototype);
/**
@class AbortError
@namespace DS
*/
function ember$data$lib$adapters$errors$$AbortError() {
ember$data$lib$adapters$errors$$AdapterError.call(this, null, "The adapter operation was aborted");
}
ember$data$lib$adapters$errors$$AbortError.prototype = ember$data$lib$adapters$errors$$create(ember$data$lib$adapters$errors$$AdapterError.prototype);
/**
@private
*/
function ember$data$lib$adapters$errors$$errorsHashToArray(errors) {
var out = [];
if (Ember.isPresent(errors)) {
ember$data$lib$adapters$errors$$forEach.call(Ember.keys(errors), function (key) {
var messages = Ember.makeArray(errors[key]);
for (var i = 0; i < messages.length; i++) {
out.push({
title: "Invalid Attribute",
details: messages[i],
source: {
pointer: "data/attributes/" + key
}
});
}
});
}
return out;
}
function ember$data$lib$adapters$errors$$errorsArrayToHash(errors) {
var out = {};
if (Ember.isPresent(errors)) {
ember$data$lib$adapters$errors$$forEach.call(errors, function (error) {
if (error.source && error.source.pointer) {
var key = error.source.pointer.match(ember$data$lib$adapters$errors$$SOURCE_POINTER_REGEXP);
if (key) {
key = key[2];
out[key] = out[key] || [];
out[key].push(error.details || error.title);
}
}
});
}
return out;
}
var ember$data$lib$system$map$$Map = Ember.Map;
var ember$data$lib$system$map$$MapWithDefault = Ember.MapWithDefault;
var ember$data$lib$system$map$$default = ember$data$lib$system$map$$Map;
var ember$data$lib$adapters$build$url$mixin$$get = Ember.get;
/**
WARNING: This interface is likely to change in order to accomodate https://github.com/emberjs/rfcs/pull/4
## Using BuildURLMixin
To use url building, include the mixin when extending an adapter, and call `buildURL` where needed.
The default behaviour is designed for RESTAdapter.
### Example
```javascript
export default DS.Adapter.extend(BuildURLMixin, {
findRecord: function(store, type, id, snapshot) {
var url = this.buildURL(type.modelName, id, snapshot, 'findRecord');
return this.ajax(url, 'GET');
}
});
```
### Attributes
The `host` and `namespace` attributes will be used if defined, and are optional.
@class BuildURLMixin
@namespace DS
*/
var ember$data$lib$adapters$build$url$mixin$$BuildURLMixin = Ember.Mixin.create({
/**
Builds a URL for a given type and optional ID.
By default, it pluralizes the type's name (for example, 'post'
becomes 'posts' and 'person' becomes 'people'). To override the
pluralization see [pathForType](#method_pathForType).
If an ID is specified, it adds the ID to the path generated
for the type, separated by a `/`.
When called by RESTAdapter.findMany() the `id` and `snapshot` parameters
will be arrays of ids and snapshots.
@method buildURL
@param {String} modelName
@param {(String|Array|Object)} id single id or array of ids or query
@param {(DS.Snapshot|Array)} snapshot single snapshot or array of snapshots
@param {String} requestType
@param {Object} query object of query parameters to send for query requests.
@return {String} url
*/
buildURL: function (modelName, id, snapshot, requestType, query) {
switch (requestType) {
case 'find':
// The `find` case is deprecated
return this.urlForFind(id, modelName, snapshot);
case 'findRecord':
return this.urlForFindRecord(id, modelName, snapshot);
case 'findAll':
return this.urlForFindAll(modelName);
case 'findQuery':
// The `findQuery` case is deprecated
return this.urlForFindQuery(query, modelName);
case 'query':
return this.urlForQuery(query, modelName);
case 'findMany':
return this.urlForFindMany(id, modelName, snapshot);
case 'findHasMany':
return this.urlForFindHasMany(id, modelName);
case 'findBelongsTo':
return this.urlForFindBelongsTo(id, modelName);
case 'createRecord':
return this.urlForCreateRecord(modelName, snapshot);
case 'updateRecord':
return this.urlForUpdateRecord(id, modelName, snapshot);
case 'deleteRecord':
return this.urlForDeleteRecord(id, modelName, snapshot);
default:
return this._buildURL(modelName, id);
}
},
/**
@method _buildURL
@private
@param {String} modelName
@param {String} id
@return {String} url
*/
_buildURL: function (modelName, id) {
var url = [];
var host = ember$data$lib$adapters$build$url$mixin$$get(this, 'host');
var prefix = this.urlPrefix();
var path;
if (modelName) {
path = this.pathForType(modelName);
if (path) {
url.push(path);
}
}
if (id) {
url.push(encodeURIComponent(id));
}
if (prefix) {
url.unshift(prefix);
}
url = url.join('/');
if (!host && url && url.charAt(0) !== '/') {
url = '/' + url;
}
return url;
},
/**
* @method urlForFind
* @param {String} id
* @param {String} modelName
* @param {DS.Snapshot} snapshot
* @return {String} url
* @deprecated Use [urlForFindRecord](#method_urlForFindRecord) instead
*/
urlForFind: ember$data$lib$adapters$build$url$mixin$$urlForFind,
/**
* @method urlForFind
* @param {String} id
* @param {String} modelName
* @param {DS.Snapshot} snapshot
* @return {String} url
*/
urlForFindRecord: function (id, modelName, snapshot) {
if (this.urlForFind !== ember$data$lib$adapters$build$url$mixin$$urlForFind) {
Ember.deprecate('BuildURLMixin#urlForFind has been deprecated and renamed to `urlForFindRecord`.');
return this.urlForFind(id, modelName, snapshot);
}
return this._buildURL(modelName, id);
},
/**
* @method urlForFindAll
* @param {String} modelName
* @return {String} url
*/
urlForFindAll: function (modelName) {
return this._buildURL(modelName);
},
/**
* @method urlForFindQuery
* @param {Object} query
* @param {String} modelName
* @return {String} url
* @deprecated Use [urlForQuery](#method_urlForQuery) instead
*/
urlForFindQuery: ember$data$lib$adapters$build$url$mixin$$urlForFindQuery,
/**
* @method urlForQuery
* @param {Object} query
* @param {String} modelName
* @return {String} url
*/
urlForQuery: function (query, modelName) {
if (this.urlForFindQuery !== ember$data$lib$adapters$build$url$mixin$$urlForFindQuery) {
Ember.deprecate('BuildURLMixin#urlForFindQuery has been deprecated and renamed to `urlForQuery`.');
return this.urlForFindQuery(query, modelName);
}
return this._buildURL(modelName);
},
/**
* @method urlForFindMany
* @param {Array} ids
* @param {String} modelName
* @param {Array} snapshots
* @return {String} url
*/
urlForFindMany: function (ids, modelName, snapshots) {
return this._buildURL(modelName);
},
/**
* @method urlForFindHasMany
* @param {String} id
* @param {String} modelName
* @return {String} url
*/
urlForFindHasMany: function (id, modelName) {
return this._buildURL(modelName, id);
},
/**
* @method urlForFindBelongTo
* @param {String} id
* @param {String} modelName
* @return {String} url
*/
urlForFindBelongsTo: function (id, modelName) {
return this._buildURL(modelName, id);
},
/**
* @method urlForCreateRecord
* @param {String} modelName
* @param {DS.Snapshot} snapshot
* @return {String} url
*/
urlForCreateRecord: function (modelName, snapshot) {
return this._buildURL(modelName);
},
/**
* @method urlForUpdateRecord
* @param {String} id
* @param {String} modelName
* @param {DS.Snapshot} snapshot
* @return {String} url
*/
urlForUpdateRecord: function (id, modelName, snapshot) {
return this._buildURL(modelName, id);
},
/**
* @method urlForDeleteRecord
* @param {String} id
* @param {String} modelName
* @param {DS.Snapshot} snapshot
* @return {String} url
*/
urlForDeleteRecord: function (id, modelName, snapshot) {
return this._buildURL(modelName, id);
},
/**
@method urlPrefix
@private
@param {String} path
@param {String} parentURL
@return {String} urlPrefix
*/
urlPrefix: function (path, parentURL) {
var host = ember$data$lib$adapters$build$url$mixin$$get(this, 'host');
var namespace = ember$data$lib$adapters$build$url$mixin$$get(this, 'namespace');
var url = [];
if (path) {
// Protocol relative url
//jscs:disable disallowEmptyBlocks
if (/^\/\//.test(path)) {} else if (path.charAt(0) === '/') {
//jscs:enable disallowEmptyBlocks
if (host) {
path = path.slice(1);
url.push(host);
}
// Relative path
} else if (!/^http(s)?:\/\//.test(path)) {
url.push(parentURL);
}
} else {
if (host) {
url.push(host);
}
if (namespace) {
url.push(namespace);
}
}
if (path) {
url.push(path);
}
return url.join('/');
},
/**
Determines the pathname for a given type.
By default, it pluralizes the type's name (for example,
'post' becomes 'posts' and 'person' becomes 'people').
### Pathname customization
For example if you have an object LineItem with an
endpoint of "/line_items/".
```app/adapters/application.js
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
pathForType: function(modelName) {
var decamelized = Ember.String.decamelize(modelName);
return Ember.String.pluralize(decamelized);
}
});
```
@method pathForType
@param {String} modelName
@return {String} path
**/
pathForType: function (modelName) {
var camelized = Ember.String.camelize(modelName);
return Ember.String.pluralize(camelized);
}
});
function ember$data$lib$adapters$build$url$mixin$$urlForFind(id, modelName, snapshot) {
Ember.deprecate('BuildURLMixin#urlForFind has been deprecated and renamed to `urlForFindRecord`.');
return this._buildURL(modelName, id);
}
function ember$data$lib$adapters$build$url$mixin$$urlForFindQuery(query, modelName) {
Ember.deprecate('BuildURLMixin#urlForFindQuery has been deprecated and renamed to `urlForQuery`.');
return this._buildURL(modelName);
}
var ember$data$lib$adapters$build$url$mixin$$default = ember$data$lib$adapters$build$url$mixin$$BuildURLMixin;
var ember$data$lib$adapters$rest$adapter$$get = Ember.get;
var ember$data$lib$adapters$rest$adapter$$set = Ember.set;
var ember$data$lib$adapters$rest$adapter$$forEach = Ember.ArrayPolyfills.forEach;/**
The REST adapter allows your store to communicate with an HTTP server by
transmitting JSON via XHR. Most Ember.js apps that consume a JSON API
should use the REST adapter.
This adapter is designed around the idea that the JSON exchanged with
the server should be conventional.
## JSON Structure
The REST adapter expects the JSON returned from your server to follow
these conventions.
### Object Root
The JSON payload should be an object that contains the record inside a
root property. For example, in response to a `GET` request for
`/posts/1`, the JSON should look like this:
```js
{
"post": {
"id": 1,
"title": "I'm Running to Reform the W3C's Tag",
"author": "Yehuda Katz"
}
}
```
Similarly, in response to a `GET` request for `/posts`, the JSON should
look like this:
```js
{
"posts": [
{
"id": 1,
"title": "I'm Running to Reform the W3C's Tag",
"author": "Yehuda Katz"
},
{
"id": 2,
"title": "Rails is omakase",
"author": "D2H"
}
]
}
```
### Conventional Names
Attribute names in your JSON payload should be the camelCased versions of
the attributes in your Ember.js models.
For example, if you have a `Person` model:
```app/models/person.js
import DS from 'ember-data';
export default DS.Model.extend({
firstName: DS.attr('string'),
lastName: DS.attr('string'),
occupation: DS.attr('string')
});
```
The JSON returned should look like this:
```js
{
"person": {
"id": 5,
"firstName": "Barack",
"lastName": "Obama",
"occupation": "President"
}
}
```
## Customization
### Endpoint path customization
Endpoint paths can be prefixed with a `namespace` by setting the namespace
property on the adapter:
```app/adapters/application.js
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
namespace: 'api/1'
});
```
Requests for `App.Person` would now target `/api/1/people/1`.
### Host customization
An adapter can target other hosts by setting the `host` property.
```app/adapters/application.js
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
host: 'https://api.example.com'
});
```
### Headers customization
Some APIs require HTTP headers, e.g. to provide an API key. Arbitrary
headers can be set as key/value pairs on the `RESTAdapter`'s `headers`
object and Ember Data will send them along with each ajax request.
```app/adapters/application.js
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
headers: {
"API_KEY": "secret key",
"ANOTHER_HEADER": "Some header value"
}
});
```
`headers` can also be used as a computed property to support dynamic
headers. In the example below, the `session` object has been
injected into an adapter by Ember's container.
```app/adapters/application.js
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
headers: function() {
return {
"API_KEY": this.get("session.authToken"),
"ANOTHER_HEADER": "Some header value"
};
}.property("session.authToken")
});
```
In some cases, your dynamic headers may require data from some
object outside of Ember's observer system (for example
`document.cookie`). You can use the
[volatile](/api/classes/Ember.ComputedProperty.html#method_volatile)
function to set the property into a non-cached mode causing the headers to
be recomputed with every request.
```app/adapters/application.js
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
headers: function() {
return {
"API_KEY": Ember.get(document.cookie.match(/apiKey\=([^;]*)/), "1"),
"ANOTHER_HEADER": "Some header value"
};
}.property().volatile()
});
```
@class RESTAdapter
@constructor
@namespace DS
@extends DS.Adapter
@uses DS.BuildURLMixin
*/
var ember$data$lib$adapters$rest$adapter$$RestAdapter = ember$data$lib$system$adapter$$default.extend(ember$data$lib$adapters$build$url$mixin$$default, {
defaultSerializer: "-rest",
/**
By default, the RESTAdapter will send the query params sorted alphabetically to the
server.
For example:
```js
store.query('posts', { sort: 'price', category: 'pets' });
```
will generate a requests like this `/posts?category=pets&sort=price`, even if the
parameters were specified in a different order.
That way the generated URL will be deterministic and that simplifies caching mechanisms
in the backend.
Setting `sortQueryParams` to a falsey value will respect the original order.
In case you want to sort the query parameters with a different criteria, set
`sortQueryParams` to your custom sort function.
```app/adapters/application.js
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
sortQueryParams: function(params) {
var sortedKeys = Object.keys(params).sort().reverse();
var len = sortedKeys.length, newParams = {};
for (var i = 0; i < len; i++) {
newParams[sortedKeys[i]] = params[sortedKeys[i]];
}
return newParams;
}
});
```
@method sortQueryParams
@param {Object} obj
@return {Object}
*/
sortQueryParams: function (obj) {
var keys = Ember.keys(obj);
var len = keys.length;
if (len < 2) {
return obj;
}
var newQueryParams = {};
var sortedKeys = keys.sort();
for (var i = 0; i < len; i++) {
newQueryParams[sortedKeys[i]] = obj[sortedKeys[i]];
}
return newQueryParams;
},
/**
By default the RESTAdapter will send each find request coming from a `store.find`
or from accessing a relationship separately to the server. If your server supports passing
ids as a query string, you can set coalesceFindRequests to true to coalesce all find requests
within a single runloop.
For example, if you have an initial payload of:
```javascript
{
post: {
id: 1,
comments: [1, 2]
}
}
```
By default calling `post.get('comments')` will trigger the following requests(assuming the
comments haven't been loaded before):
```
GET /comments/1
GET /comments/2
```
If you set coalesceFindRequests to `true` it will instead trigger the following request:
```
GET /comments?ids[]=1&ids[]=2
```
Setting coalesceFindRequests to `true` also works for `store.find` requests and `belongsTo`
relationships accessed within the same runloop. If you set `coalesceFindRequests: true`
```javascript
store.findRecord('comment', 1);
store.findRecord('comment', 2);
```
will also send a request to: `GET /comments?ids[]=1&ids[]=2`
Note: Requests coalescing rely on URL building strategy. So if you override `buildURL` in your app
`groupRecordsForFindMany` more likely should be overridden as well in order for coalescing to work.
@property coalesceFindRequests
@type {boolean}
*/
coalesceFindRequests: false,
/**
Endpoint paths can be prefixed with a `namespace` by setting the namespace
property on the adapter:
```app/adapters/application.js
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
namespace: 'api/1'
});
```
Requests for `App.Post` would now target `/api/1/post/`.
@property namespace
@type {String}
*/
/**
An adapter can target other hosts by setting the `host` property.
```app/adapters/application.js
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
host: 'https://api.example.com'
});
```
Requests for `App.Post` would now target `https://api.example.com/post/`.
@property host
@type {String}
*/
/**
Some APIs require HTTP headers, e.g. to provide an API
key. Arbitrary headers can be set as key/value pairs on the
`RESTAdapter`'s `headers` object and Ember Data will send them
along with each ajax request. For dynamic headers see [headers
customization](/api/data/classes/DS.RESTAdapter.html#toc_headers-customization).
```app/adapters/application.js
import DS from 'ember-data';
export default DS.RESTAdapter.extend({
headers: {
"API_KEY": "secret key",
"ANOTHER_HEADER": "Some header value"
}
});
```
@property headers
@type {Object}
*/
/**
@method find
@param {DS.Store} store
@param {DS.Model} type
@param {String} id
@param {DS.Snapshot} snapshot
@return {Promise} promise
@deprecated Use [findRecord](#method_findRecord) instead
*/
find: function (store, type, id, snapshot) {
Ember.deprecate("RestAdapter#find has been deprecated and renamed to `findRecord`.");
return this.ajax(this.buildURL(type.modelName, id, snapshot, "find"), "GET");
},
/**
Called by the store in order to fetch the JSON for a given
type and ID.
The `findRecord` method makes an Ajax request to a URL computed by
`buildURL`, and returns a promise for the resulting payload.
This method performs an HTTP `GET` request with the id provided as part of the query string.
@method findRecord
@param {DS.Store} store
@param {DS.Model} type
@param {String} id
@param {DS.Snapshot} snapshot
@return {Promise} promise
*/
findRecord: function (store, type, id, snapshot) {
var find = ember$data$lib$adapters$rest$adapter$$RestAdapter.prototype.find;
if (find !== this.find) {
Ember.deprecate("RestAdapter#find has been deprecated and renamed to `findRecord`.");
return this.find(store, type, id, snapshot);
}
return this.ajax(this.buildURL(type.modelName, id, snapshot, "findRecord"), "GET");
},
/**
Called by the store in order to fetch a JSON array for all
of the records for a given type.
The `findAll` method makes an Ajax (HTTP GET) request to a URL computed by `buildURL`, and returns a
promise for the resulting payload.
@private
@method findAll
@param {DS.Store} store
@param {DS.Model} type
@param {String} sinceToken
@return {Promise} promise
*/
findAll: function (store, type, sinceToken) {
var query, url;
if (sinceToken) {
query = { since: sinceToken };
}
url = this.buildURL(type.modelName, null, null, "findAll");
return this.ajax(url, "GET", { data: query });
},
/**
Called by the store in order to fetch a JSON array for
the records that match a particular query.
The `findQuery` method makes an Ajax (HTTP GET) request to a URL computed by `buildURL`, and returns a
promise for the resulting payload.
The `query` argument is a simple JavaScript object that will be passed directly
to the server as parameters.
@private
@method findQuery
@param {DS.Store} store
@param {DS.Model} type
@param {Object} query
@return {Promise} promise
@deprecated Use [query](#method_query) instead
*/
findQuery: function (store, type, query) {
Ember.deprecate("RestAdapter#findQuery has been deprecated and renamed to `query`.");
var url = this.buildURL(type.modelName, null, null, "findQuery", query);
if (this.sortQueryParams) {
query = this.sortQueryParams(query);
}
return this.ajax(url, "GET", { data: query });
},
/**
Called by the store in order to fetch a JSON array for
the records that match a particular query.
The `findQuery` method makes an Ajax (HTTP GET) request to a URL computed by `buildURL`, and returns a
promise for the resulting payload.
The `query` argument is a simple JavaScript object that will be passed directly
to the server as parameters.
@private
@method query
@param {DS.Store} store
@param {DS.Model} type
@param {Object} query
@return {Promise} promise
*/
query: function (store, type, query) {
var findQuery = ember$data$lib$adapters$rest$adapter$$RestAdapter.prototype.findQuery;
if (findQuery !== this.findQuery) {
Ember.deprecate("RestAdapter#findQuery has been deprecated and renamed to `query`.");
return this.findQuery(store, type, query);
}
var url = this.buildURL(type.modelName, null, null, "query", query);
if (this.sortQueryParams) {
query = this.sortQueryParams(query);
}
return this.ajax(url, "GET", { data: query });
},
/**
Called by the store in order to fetch several records together if `coalesceFindRequests` is true
For example, if the original payload looks like:
```js
{
"id": 1,
"title": "Rails is omakase",
"comments": [ 1, 2, 3 ]
}
```
The IDs will be passed as a URL-encoded Array of IDs, in this form:
```
ids[]=1&ids[]=2&ids[]=3
```
Many servers, such as Rails and PHP, will automatically convert this URL-encoded array
into an Array for you on the server-side. If you want to encode the
IDs, differently, just override this (one-line) method.
The `findMany` method makes an Ajax (HTTP GET) request to a URL computed by `buildURL`, and returns a
promise for the resulting payload.
@method findMany
@param {DS.Store} store
@param {DS.Model} type
@param {Array} ids
@param {Array} snapshots
@return {Promise} promise
*/
findMany: function (store, type, ids, snapshots) {
var url = this.buildURL(type.modelName, ids, snapshots, "findMany");
return this.ajax(url, "GET", { data: { ids: ids } });
},
/**
Called by the store in order to fetch a JSON array for
the unloaded records in a has-many relationship that were originally
specified as a URL (inside of `links`).
For example, if your original payload looks like this:
```js
{
"post": {
"id": 1,
"title": "Rails is omakase",
"links": { "comments": "/posts/1/comments" }
}
}
```
This method will be called with the parent record and `/posts/1/comments`.
The `findHasMany` method will make an Ajax (HTTP GET) request to the originally specified URL.
@method findHasMany
@param {DS.Store} store
@param {DS.Snapshot} snapshot
@param {String} url
@return {Promise} promise
*/
findHasMany: function (store, snapshot, url, relationship) {
var id = snapshot.id;
var type = snapshot.modelName;
url = this.urlPrefix(url, this.buildURL(type, id, null, "findHasMany"));
return this.ajax(url, "GET");
},
/**
Called by the store in order to fetch a JSON array for
the unloaded records in a belongs-to relationship that were originally
specified as a URL (inside of `links`).
For example, if your original payload looks like this:
```js
{
"person": {
"id": 1,
"name": "Tom Dale",
"links": { "group": "/people/1/group" }
}
}
```
This method will be called with the parent record and `/people/1/group`.
The `findBelongsTo` method will make an Ajax (HTTP GET) request to the originally specified URL.
@method findBelongsTo
@param {DS.Store} store
@param {DS.Snapshot} snapshot
@param {String} url
@return {Promise} promise
*/
findBelongsTo: function (store, snapshot, url, relationship) {
var id = snapshot.id;
var type = snapshot.modelName;
url = this.urlPrefix(url, this.buildURL(type, id, null, "findBelongsTo"));
return this.ajax(url, "GET");
},
/**
Called by the store when a newly created record is
saved via the `save` method on a model record instance.
The `createRecord` method serializes the record and makes an Ajax (HTTP POST) request
to a URL computed by `buildURL`.
See `serialize` for information on how to customize the serialized form
of a record.
@method createRecord
@param {DS.Store} store
@param {DS.Model} type
@param {DS.Snapshot} snapshot
@return {Promise} promise
*/
createRecord: function (store, type, snapshot) {
var data = {};
var serializer = store.serializerFor(type.modelName);
var url = this.buildURL(type.modelName, null, snapshot, "createRecord");
serializer.serializeIntoHash(data, type, snapshot, { includeId: true });
return this.ajax(url, "POST", { data: data });
},
/**
Called by the store when an existing record is saved
via the `save` method on a model record instance.
The `updateRecord` method serializes the record and makes an Ajax (HTTP PUT) request
to a URL computed by `buildURL`.
See `serialize` for information on how to customize the serialized form
of a record.
@method updateRecord
@param {DS.Store} store
@param {DS.Model} type
@param {DS.Snapshot} snapshot
@return {Promise} promise
*/
updateRecord: function (store, type, snapshot) {
var data = {};
var serializer = store.serializerFor(type.modelName);
serializer.serializeIntoHash(data, type, snapshot);
var id = snapshot.id;
var url = this.buildURL(type.modelName, id, snapshot, "updateRecord");
return this.ajax(url, "PUT", { data: data });
},
/**
Called by the store when a record is deleted.
The `deleteRecord` method makes an Ajax (HTTP DELETE) request to a URL computed by `buildURL`.
@method deleteRecord
@param {DS.Store} store
@param {DS.Model} type
@param {DS.Snapshot} snapshot
@return {Promise} promise
*/
deleteRecord: function (store, type, snapshot) {
var id = snapshot.id;
return this.ajax(this.buildURL(type.modelName, id, snapshot, "deleteRecord"), "DELETE");
},
_stripIDFromURL: function (store, snapshot) {
var url = this.buildURL(snapshot.modelName, snapshot.id, snapshot);
var expandedURL = url.split("/");
//Case when the url is of the format ...something/:id
var lastSegment = expandedURL[expandedURL.length - 1];
var id = snapshot.id;
if (lastSegment === id) {
expandedURL[expandedURL.length - 1] = "";
} else if (ember$data$lib$adapters$rest$adapter$$endsWith(lastSegment, "?id=" + id)) {
//Case when the url is of the format ...something?id=:id
expandedURL[expandedURL.length - 1] = lastSegment.substring(0, lastSegment.length - id.length - 1);
}
return expandedURL.join("/");
},
// http://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers
maxURLLength: 2048,
/**
Organize records into groups, each of which is to be passed to separate
calls to `findMany`.
This implementation groups together records that have the same base URL but
differing ids. For example `/comments/1` and `/comments/2` will be grouped together
because we know findMany can coalesce them together as `/comments?ids[]=1&ids[]=2`
It also supports urls where ids are passed as a query param, such as `/comments?id=1`
but not those where there is more than 1 query param such as `/comments?id=2&name=David`
Currently only the query param of `id` is supported. If you need to support others, please
override this or the `_stripIDFromURL` method.
It does not group records that have differing base urls, such as for example: `/posts/1/comments/2`
and `/posts/2/comments/3`
@method groupRecordsForFindMany
@param {DS.Store} store
@param {Array} snapshots
@return {Array} an array of arrays of records, each of which is to be
loaded separately by `findMany`.
*/
groupRecordsForFindMany: function (store, snapshots) {
var groups = ember$data$lib$system$map$$MapWithDefault.create({ defaultValue: function () {
return [];
} });
var adapter = this;
var maxURLLength = this.maxURLLength;
ember$data$lib$adapters$rest$adapter$$forEach.call(snapshots, function (snapshot) {
var baseUrl = adapter._stripIDFromURL(store, snapshot);
groups.get(baseUrl).push(snapshot);
});
function splitGroupToFitInUrl(group, maxURLLength, paramNameLength) {
var baseUrl = adapter._stripIDFromURL(store, group[0]);
var idsSize = 0;
var splitGroups = [[]];
ember$data$lib$adapters$rest$adapter$$forEach.call(group, function (snapshot) {
var additionalLength = encodeURIComponent(snapshot.id).length + paramNameLength;
if (baseUrl.length + idsSize + additionalLength >= maxURLLength) {
idsSize = 0;
splitGroups.push([]);
}
idsSize += additionalLength;
var lastGroupIndex = splitGroups.length - 1;
splitGroups[lastGroupIndex].push(snapshot);
});
return splitGroups;
}
var groupsArray = [];
groups.forEach(function (group, key) {
var paramNameLength = "&ids%5B%5D=".length;
var splitGroups = splitGroupToFitInUrl(group, maxURLLength, paramNameLength);
ember$data$lib$adapters$rest$adapter$$forEach.call(splitGroups, function (splitGroup) {
groupsArray.push(splitGroup);
});
});
return groupsArray;
},
/**
Takes an ajax response, and returns an error payload.
@method ajaxError
@deprecated Use [handleResponse](#method_handleResponse) instead
@param {Object} jqXHR
@param {Object} responseText
@param {Object} errorThrown
@return {Object} jqXHR
*/
/**
Takes an ajax response, and returns the json payload.
@method ajaxSuccess
@deprecated Use [handleResponse](#method_handleResponse) instead
@param {Object} jqXHR
@param {Object} jsonPayload
@return {Object} jsonPayload
*/
/**
Takes an ajax response, and returns the json payload or an error.
By default this hook just returns the json payload passed to it.
You might want to override it in two cases:
1. Your API might return useful results in the response headers.
Response headers are passed in as the second argument.
2. Your API might return errors as successful responses with status code
200 and an Errors text or object. You can return a `DS.InvalidError` or a
`DS.AdapterError` (or a sub class) from this hook and it will automatically
reject the promise and put your record into the invalid or error state.
Returning a `DS.InvalidError` from this method will cause the
record to transition into the `invalid` state and make the
`errors` object available on the record. When returning an
`DS.InvalidError` the store will attempt to normalize the error data
returned from the server using the serializer's `extractErrors`
method.
@method handleResponse
@param {Number} status
@param {Object} headers
@param {Object} payload
@return {Object | DS.AdapterError} response
*/
handleResponse: function (status, headers, payload) {
if (this.isSuccess(status, headers, payload)) {
return payload;
} else if (this.isInvalid(status, headers, payload)) {
return new ember$data$lib$adapters$errors$$InvalidError(payload.errors);
}
var errors = this.normalizeErrorResponse(status, headers, payload);
return new ember$data$lib$adapters$errors$$AdapterError(errors);
},
/**
Default `handleResponse` implementation uses this hook to decide if the
response is a success.
@method isSuccess
@param {Number} status
@param {Object} headers
@param {Object} payload
@return {Boolean}
*/
isSuccess: function (status, headers, payload) {
return status >= 200 && status < 300 || status === 304;
},
/**
Default `handleResponse` implementation uses this hook to decide if the
response is a an invalid error.
@method isInvalid
@param {Number} status
@param {Object} headers
@param {Object} payload
@return {Boolean}
*/
isInvalid: function (status, headers, payload) {
return status === 422;
},
/**
Takes a URL, an HTTP method and a hash of data, and makes an
HTTP request.
When the server responds with a payload, Ember Data will call into `extractSingle`
or `extractArray` (depending on whether the original query was for one record or
many records).
By default, `ajax` method has the following behavior:
* It sets the response `dataType` to `"json"`
* If the HTTP method is not `"GET"`, it sets the `Content-Type` to be
`application/json; charset=utf-8`
* If the HTTP method is not `"GET"`, it stringifies the data passed in. The
data is the serialized record in the case of a save.
* Registers success and failure handlers.
@method ajax
@private
@param {String} url
@param {String} type The request type GET, POST, PUT, DELETE etc.
@param {Object} options
@return {Promise} promise
*/
ajax: function (url, type, options) {
var adapter = this;
return new Ember.RSVP.Promise(function (resolve, reject) {
var hash = adapter.ajaxOptions(url, type, options);
hash.success = function (payload, textStatus, jqXHR) {
var response = undefined;
if (adapter.ajaxSuccess) {
Ember.deprecate("`ajaxSuccess` has been deprecated. Use `isSuccess`, `isInvalid` or `handleResponse` instead.");
response = adapter.ajaxSuccess(jqXHR, payload);
}
if (!(response instanceof ember$data$lib$adapters$errors$$AdapterError)) {
response = adapter.handleResponse(jqXHR.status, ember$data$lib$adapters$rest$adapter$$parseResponseHeaders(jqXHR.getAllResponseHeaders()), response || payload);
}
if (response instanceof ember$data$lib$adapters$errors$$AdapterError) {
Ember.run(null, reject, response);
} else {
Ember.run(null, resolve, response);
}
};
hash.error = function (jqXHR, textStatus, errorThrown) {
var error = undefined;
if (adapter.ajaxError) {
Ember.deprecate("`ajaxError` has been deprecated. Use `isSuccess`, `isInvalid` or `handleResponse` instead.");
error = adapter.ajaxError(jqXHR, textStatus, errorThrown);
}
if (!(error instanceof Error)) {
if (errorThrown instanceof Error) {
error = errorThrown;
} else if (textStatus === "timeout") {
error = new ember$data$lib$adapters$errors$$TimeoutError();
} else if (textStatus === "abort") {
error = new ember$data$lib$adapters$errors$$AbortError();
} else {
error = adapter.handleResponse(jqXHR.status, ember$data$lib$adapters$rest$adapter$$parseResponseHeaders(jqXHR.getAllResponseHeaders()), adapter.parseErrorResponse(jqXHR.responseText) || errorThrown);
}
}
Ember.run(null, reject, error);
};
Ember.$.ajax(hash);
}, "DS: RESTAdapter#ajax " + type + " to " + url);
},
/**
@method ajaxOptions
@private
@param {String} url
@param {String} type The request type GET, POST, PUT, DELETE etc.
@param {Object} options
@return {Object}
*/
ajaxOptions: function (url, type, options) {
var hash = options || {};
hash.url = url;
hash.type = type;
hash.dataType = "json";
hash.context = this;
if (hash.data && type !== "GET") {
hash.contentType = "application/json; charset=utf-8";
hash.data = JSON.stringify(hash.data);
}
var headers = ember$data$lib$adapters$rest$adapter$$get(this, "headers");
if (headers !== undefined) {
hash.beforeSend = function (xhr) {
ember$data$lib$adapters$rest$adapter$$forEach.call(Ember.keys(headers), function (key) {
xhr.setRequestHeader(key, headers[key]);
});
};
}
return hash;
},
/**
@method parseErrorResponse
@private
@param {String} responseText
@return {Object}
*/
parseErrorResponse: function (responseText) {
var json = responseText;
try {
json = Ember.$.parseJSON(responseText);
} catch (e) {}
return json;
},
/**
@method normalizeErrorResponse
@private
@param {Number} status
@param {Object} headers
@param {Object} payload
@return {Object} errors payload
*/
normalizeErrorResponse: function (status, headers, payload) {
if (payload && typeof payload === "object" && payload.errors) {
return payload.errors;
} else {
return [{
status: "" + status,
title: "The backend responded with an error",
details: "" + payload
}];
}
}
});
function ember$data$lib$adapters$rest$adapter$$parseResponseHeaders(headerStr) {
var headers = Ember.create(null);
if (!headerStr) {
return headers;
}
var headerPairs = headerStr.split("\r\n");
for (var i = 0; i < headerPairs.length; i++) {
var headerPair = headerPairs[i];
// Can't use split() here because it does the wrong thing
// if the header value has the string ": " in it.
var index = headerPair.indexOf(": ");
if (index > 0) {
var key = headerPair.substring(0, index);
var val = headerPair.substring(index + 2);
headers[key] = val;
}
}
return headers;
}
//From http://stackoverflow.com/questions/280634/endswith-in-javascript
function ember$data$lib$adapters$rest$adapter$$endsWith(string, suffix) {
if (typeof String.prototype.endsWith !== "function") {
return string.indexOf(suffix, string.length - suffix.length) !== -1;
} else {
return string.endsWith(suffix);
}
}
if (Ember.platform.hasPropertyAccessors) {
Ember.defineProperty(ember$data$lib$adapters$rest$adapter$$RestAdapter.prototype, "maxUrlLength", {
enumerable: false,
get: function () {
Ember.deprecate("maxUrlLength has been deprecated (wrong casing). You should use maxURLLength instead.");
return this.maxURLLength;
},
set: function (value) {
Ember.deprecate("maxUrlLength has been deprecated (wrong casing). You should use maxURLLength instead.");
ember$data$lib$adapters$rest$adapter$$set(this, "maxURLLength", value);
}
});
}
var ember$data$lib$adapters$rest$adapter$$default = ember$data$lib$adapters$rest$adapter$$RestAdapter;
var ember$data$lib$adapters$json$api$adapter$$default = ember$data$lib$adapters$rest$adapter$$default.extend({
defaultSerializer: '-json-api',
/**
@method ajaxOptions
@private
@param {String} url
@param {String} type The request type GET, POST, PUT, DELETE etc.
@param {Object} options
@return {Object}
*/
ajaxOptions: function (url, type, options) {
var hash = this._super.apply(this, arguments);
if (hash.contentType) {
hash.contentType = 'application/vnd.api+json';
}
var beforeSend = hash.beforeSend;
hash.beforeSend = function (xhr) {
xhr.setRequestHeader('Accept', 'application/vnd.api+json');
if (beforeSend) {
beforeSend(xhr);
}
};
return hash;
},
/**
@method findMany
@param {DS.Store} store
@param {DS.Model} type
@param {Array} ids
@param {Array} snapshots
@return {Promise} promise
*/
findMany: function (store, type, ids, snapshots) {
var url = this.buildURL(type.modelName, ids, snapshots, 'findMany');
return this.ajax(url, 'GET', { data: { filter: { id: ids.join(',') } } });
},
/**
@method pathForType
@param {String} modelName
@return {String} path
**/
pathForType: function (modelName) {
var dasherized = Ember.String.dasherize(modelName);
return Ember.String.pluralize(dasherized);
},
// TODO: Remove this once we have a better way to override HTTP verbs.
/**
@method updateRecord
@param {DS.Store} store
@param {DS.Model} type
@param {DS.Snapshot} snapshot
@return {Promise} promise
*/
updateRecord: function (store, type, snapshot) {
var data = {};
var serializer = store.serializerFor(type.modelName);
serializer.serializeIntoHash(data, type, snapshot, { includeId: true });
var id = snapshot.id;
var url = this.buildURL(type.modelName, id, snapshot, 'updateRecord');
return this.ajax(url, 'PATCH', { data: data });
}
});
var ember$lib$main$$default = Ember;
var ember$inflector$lib$lib$system$inflector$$capitalize = ember$lib$main$$default.String.capitalize;
var ember$inflector$lib$lib$system$inflector$$BLANK_REGEX = /^\s*$/;
var ember$inflector$lib$lib$system$inflector$$LAST_WORD_DASHED_REGEX = /([\w/-]+[_/-])([a-z\d]+$)/;
var ember$inflector$lib$lib$system$inflector$$LAST_WORD_CAMELIZED_REGEX = /([\w/-]+)([A-Z][a-z\d]*$)/;
var ember$inflector$lib$lib$system$inflector$$CAMELIZED_REGEX = /[A-Z][a-z\d]*$/;
function ember$inflector$lib$lib$system$inflector$$loadUncountable(rules, uncountable) {
for (var i = 0, length = uncountable.length; i < length; i++) {
rules.uncountable[uncountable[i].toLowerCase()] = true;
}
}
function ember$inflector$lib$lib$system$inflector$$loadIrregular(rules, irregularPairs) {
var pair;
for (var i = 0, length = irregularPairs.length; i < length; i++) {
pair = irregularPairs[i];
//pluralizing
rules.irregular[pair[0].toLowerCase()] = pair[1];
rules.irregular[pair[1].toLowerCase()] = pair[1];
//singularizing
rules.irregularInverse[pair[1].toLowerCase()] = pair[0];
rules.irregularInverse[pair[0].toLowerCase()] = pair[0];
}
}
/**
Inflector.Ember provides a mechanism for supplying inflection rules for your
application. Ember includes a default set of inflection rules, and provides an
API for providing additional rules.
Examples:
Creating an inflector with no rules.
```js
var inflector = new Ember.Inflector();
```
Creating an inflector with the default ember ruleset.
```js
var inflector = new Ember.Inflector(Ember.Inflector.defaultRules);
inflector.pluralize('cow'); //=> 'kine'
inflector.singularize('kine'); //=> 'cow'
```
Creating an inflector and adding rules later.
```javascript
var inflector = Ember.Inflector.inflector;
inflector.pluralize('advice'); // => 'advices'
inflector.uncountable('advice');
inflector.pluralize('advice'); // => 'advice'
inflector.pluralize('formula'); // => 'formulas'
inflector.irregular('formula', 'formulae');
inflector.pluralize('formula'); // => 'formulae'
// you would not need to add these as they are the default rules
inflector.plural(/$/, 's');
inflector.singular(/s$/i, '');
```
Creating an inflector with a nondefault ruleset.
```javascript
var rules = {
plurals: [ /$/, 's' ],
singular: [ /\s$/, '' ],
irregularPairs: [
[ 'cow', 'kine' ]
],
uncountable: [ 'fish' ]
};
var inflector = new Ember.Inflector(rules);
```
@class Inflector
@namespace Ember
*/
function ember$inflector$lib$lib$system$inflector$$Inflector(ruleSet) {
ruleSet = ruleSet || {};
ruleSet.uncountable = ruleSet.uncountable || ember$inflector$lib$lib$system$inflector$$makeDictionary();
ruleSet.irregularPairs = ruleSet.irregularPairs || ember$inflector$lib$lib$system$inflector$$makeDictionary();
var rules = this.rules = {
plurals: ruleSet.plurals || [],
singular: ruleSet.singular || [],
irregular: ember$inflector$lib$lib$system$inflector$$makeDictionary(),
irregularInverse: ember$inflector$lib$lib$system$inflector$$makeDictionary(),
uncountable: ember$inflector$lib$lib$system$inflector$$makeDictionary()
};
ember$inflector$lib$lib$system$inflector$$loadUncountable(rules, ruleSet.uncountable);
ember$inflector$lib$lib$system$inflector$$loadIrregular(rules, ruleSet.irregularPairs);
this.enableCache();
}
if (!Object.create && !Object.create(null).hasOwnProperty) {
throw new Error('This browser does not support Object.create(null), please polyfil with es5-sham: http://git.io/yBU2rg');
}
function ember$inflector$lib$lib$system$inflector$$makeDictionary() {
var cache = Object.create(null);
cache['_dict'] = null;
delete cache['_dict'];
return cache;
}
ember$inflector$lib$lib$system$inflector$$Inflector.prototype = {
/**
@public
As inflections can be costly, and commonly the same subset of words are repeatedly
inflected an optional cache is provided.
@method enableCache
*/
enableCache: function () {
this.purgeCache();
this.singularize = function (word) {
this._cacheUsed = true;
return this._sCache[word] || (this._sCache[word] = this._singularize(word));
};
this.pluralize = function (word) {
this._cacheUsed = true;
return this._pCache[word] || (this._pCache[word] = this._pluralize(word));
};
},
/**
@public
@method purgedCache
*/
purgeCache: function () {
this._cacheUsed = false;
this._sCache = ember$inflector$lib$lib$system$inflector$$makeDictionary();
this._pCache = ember$inflector$lib$lib$system$inflector$$makeDictionary();
},
/**
@public
disable caching
@method disableCache;
*/
disableCache: function () {
this._sCache = null;
this._pCache = null;
this.singularize = function (word) {
return this._singularize(word);
};
this.pluralize = function (word) {
return this._pluralize(word);
};
},
/**
@method plural
@param {RegExp} regex
@param {String} string
*/
plural: function (regex, string) {
if (this._cacheUsed) {
this.purgeCache();
}
this.rules.plurals.push([regex, string.toLowerCase()]);
},
/**
@method singular
@param {RegExp} regex
@param {String} string
*/
singular: function (regex, string) {
if (this._cacheUsed) {
this.purgeCache();
}
this.rules.singular.push([regex, string.toLowerCase()]);
},
/**
@method uncountable
@param {String} regex
*/
uncountable: function (string) {
if (this._cacheUsed) {
this.purgeCache();
}
ember$inflector$lib$lib$system$inflector$$loadUncountable(this.rules, [string.toLowerCase()]);
},
/**
@method irregular
@param {String} singular
@param {String} plural
*/
irregular: function (singular, plural) {
if (this._cacheUsed) {
this.purgeCache();
}
ember$inflector$lib$lib$system$inflector$$loadIrregular(this.rules, [[singular, plural]]);
},
/**
@method pluralize
@param {String} word
*/
pluralize: function (word) {
return this._pluralize(word);
},
_pluralize: function (word) {
return this.inflect(word, this.rules.plurals, this.rules.irregular);
},
/**
@method singularize
@param {String} word
*/
singularize: function (word) {
return this._singularize(word);
},
_singularize: function (word) {
return this.inflect(word, this.rules.singular, this.rules.irregularInverse);
},
/**
@protected
@method inflect
@param {String} word
@param {Object} typeRules
@param {Object} irregular
*/
inflect: function (word, typeRules, irregular) {
var inflection, substitution, result, lowercase, wordSplit, firstPhrase, lastWord, isBlank, isCamelized, isUncountable, isIrregular, rule;
isBlank = !word || ember$inflector$lib$lib$system$inflector$$BLANK_REGEX.test(word);
isCamelized = ember$inflector$lib$lib$system$inflector$$CAMELIZED_REGEX.test(word);
firstPhrase = '';
if (isBlank) {
return word;
}
lowercase = word.toLowerCase();
wordSplit = ember$inflector$lib$lib$system$inflector$$LAST_WORD_DASHED_REGEX.exec(word) || ember$inflector$lib$lib$system$inflector$$LAST_WORD_CAMELIZED_REGEX.exec(word);
if (wordSplit) {
firstPhrase = wordSplit[1];
lastWord = wordSplit[2].toLowerCase();
}
isUncountable = this.rules.uncountable[lowercase] || this.rules.uncountable[lastWord];
if (isUncountable) {
return word;
}
isIrregular = irregular && (irregular[lowercase] || irregular[lastWord]);
if (isIrregular) {
if (irregular[lowercase]) {
return isIrregular;
} else {
isIrregular = isCamelized ? ember$inflector$lib$lib$system$inflector$$capitalize(isIrregular) : isIrregular;
return firstPhrase + isIrregular;
}
}
for (var i = typeRules.length, min = 0; i > min; i--) {
inflection = typeRules[i - 1];
rule = inflection[0];
if (rule.test(word)) {
break;
}
}
inflection = inflection || [];
rule = inflection[0];
substitution = inflection[1];
result = word.replace(rule, substitution);
return result;
}
};
var ember$inflector$lib$lib$system$inflector$$default = ember$inflector$lib$lib$system$inflector$$Inflector;
function ember$inflector$lib$lib$system$string$$pluralize(word) {
return ember$inflector$lib$lib$system$inflector$$default.inflector.pluralize(word);
}
function ember$inflector$lib$lib$system$string$$singularize(word) {
return ember$inflector$lib$lib$system$inflector$$default.inflector.singularize(word);
}
var ember$inflector$lib$lib$system$inflections$$default = {
plurals: [[/$/, 's'], [/s$/i, 's'], [/^(ax|test)is$/i, '$1es'], [/(octop|vir)us$/i, '$1i'], [/(octop|vir)i$/i, '$1i'], [/(alias|status)$/i, '$1es'], [/(bu)s$/i, '$1ses'], [/(buffal|tomat)o$/i, '$1oes'], [/([ti])um$/i, '$1a'], [/([ti])a$/i, '$1a'], [/sis$/i, 'ses'], [/(?:([^f])fe|([lr])f)$/i, '$1$2ves'], [/(hive)$/i, '$1s'], [/([^aeiouy]|qu)y$/i, '$1ies'], [/(x|ch|ss|sh)$/i, '$1es'], [/(matr|vert|ind)(?:ix|ex)$/i, '$1ices'], [/^(m|l)ouse$/i, '$1ice'], [/^(m|l)ice$/i, '$1ice'], [/^(ox)$/i, '$1en'], [/^(oxen)$/i, '$1'], [/(quiz)$/i, '$1zes']],
singular: [[/s$/i, ''], [/(ss)$/i, '$1'], [/(n)ews$/i, '$1ews'], [/([ti])a$/i, '$1um'], [/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)(sis|ses)$/i, '$1sis'], [/(^analy)(sis|ses)$/i, '$1sis'], [/([^f])ves$/i, '$1fe'], [/(hive)s$/i, '$1'], [/(tive)s$/i, '$1'], [/([lr])ves$/i, '$1f'], [/([^aeiouy]|qu)ies$/i, '$1y'], [/(s)eries$/i, '$1eries'], [/(m)ovies$/i, '$1ovie'], [/(x|ch|ss|sh)es$/i, '$1'], [/^(m|l)ice$/i, '$1ouse'], [/(bus)(es)?$/i, '$1'], [/(o)es$/i, '$1'], [/(shoe)s$/i, '$1'], [/(cris|test)(is|es)$/i, '$1is'], [/^(a)x[ie]s$/i, '$1xis'], [/(octop|vir)(us|i)$/i, '$1us'], [/(alias|status)(es)?$/i, '$1'], [/^(ox)en/i, '$1'], [/(vert|ind)ices$/i, '$1ex'], [/(matr)ices$/i, '$1ix'], [/(quiz)zes$/i, '$1'], [/(database)s$/i, '$1']],
irregularPairs: [['person', 'people'], ['man', 'men'], ['child', 'children'], ['sex', 'sexes'], ['move', 'moves'], ['cow', 'kine'], ['zombie', 'zombies']],
uncountable: ['equipment', 'information', 'rice', 'money', 'species', 'series', 'fish', 'sheep', 'jeans', 'police']
};
ember$inflector$lib$lib$system$inflector$$default.inflector = new ember$inflector$lib$lib$system$inflector$$default(ember$inflector$lib$lib$system$inflections$$default);
var ember$inflector$lib$lib$utils$register$helper$$default = ember$inflector$lib$lib$utils$register$helper$$registerHelper;
function ember$inflector$lib$lib$utils$register$helper$$registerHelperIteration1(name, helperFunction) {
//earlier versions of ember with htmlbars used this
ember$lib$main$$default.HTMLBars.helpers[name] = helperFunction;
}
function ember$inflector$lib$lib$utils$register$helper$$registerHelperIteration2(name, helperFunction) {
//registerHelper has been made private as _registerHelper
//this is kept here if anyone is using it
ember$lib$main$$default.HTMLBars.registerHelper(name, helperFunction);
}
function ember$inflector$lib$lib$utils$register$helper$$registerHelperIteration3(name, helperFunction) {
//latest versin of ember uses this
ember$lib$main$$default.HTMLBars._registerHelper(name, helperFunction);
}
function ember$inflector$lib$lib$utils$register$helper$$registerHelper(name, helperFunction) {
if (ember$lib$main$$default.HTMLBars) {
var fn = ember$lib$main$$default.HTMLBars.makeBoundHelper(helperFunction);
if (ember$lib$main$$default.HTMLBars._registerHelper) {
if (ember$lib$main$$default.HTMLBars.helpers) {
ember$inflector$lib$lib$utils$register$helper$$registerHelperIteration1(name, fn);
} else {
ember$inflector$lib$lib$utils$register$helper$$registerHelperIteration3(name, fn);
}
} else if (ember$lib$main$$default.HTMLBars.registerHelper) {
ember$inflector$lib$lib$utils$register$helper$$registerHelperIteration2(name, fn);
}
} else if (ember$lib$main$$default.Handlebars) {
ember$lib$main$$default.Handlebars.helper(name, helperFunction);
}
}
/**
*
* If you have Ember Inflector (such as if Ember Data is present),
* singularize a word. For example, turn "oxen" into "ox".
*
* Example:
*
* {{singularize myProperty}}
* {{singularize "oxen"}}
*
* @for Ember.HTMLBars.helpers
* @method singularize
* @param {String|Property} word word to singularize
*/
ember$inflector$lib$lib$utils$register$helper$$default('singularize', function (params) {
return ember$inflector$lib$lib$system$string$$singularize(params[0]);
});
/**
*
* If you have Ember Inflector (such as if Ember Data is present),
* pluralize a word. For example, turn "ox" into "oxen".
*
* Example:
*
* {{pluralize count myProperty}}
* {{pluralize 1 "oxen"}}
* {{pluralize myProperty}}
* {{pluralize "ox"}}
*
* @for Ember.HTMLBars.helpers
* @method pluralize
* @param {Number|Property} [count] count of objects
* @param {String|Property} word word to pluralize
*/
ember$inflector$lib$lib$utils$register$helper$$default('pluralize', function (params) {
var count, word;
if (params.length === 1) {
word = params[0];
return ember$inflector$lib$lib$system$string$$pluralize(word);
} else {
count = params[0];
word = params[1];
if (count !== 1) {
word = ember$inflector$lib$lib$system$string$$pluralize(word);
}
return count + ' ' + word;
}
});
if (ember$lib$main$$default.EXTEND_PROTOTYPES === true || ember$lib$main$$default.EXTEND_PROTOTYPES.String) {
/**
See {{#crossLink "Ember.String/pluralize"}}{{/crossLink}}
@method pluralize
@for String
*/
String.prototype.pluralize = function () {
return ember$inflector$lib$lib$system$string$$pluralize(this);
};
/**
See {{#crossLink "Ember.String/singularize"}}{{/crossLink}}
@method singularize
@for String
*/
String.prototype.singularize = function () {
return ember$inflector$lib$lib$system$string$$singularize(this);
};
}
ember$inflector$lib$lib$system$inflector$$default.defaultRules = ember$inflector$lib$lib$system$inflections$$default;
ember$lib$main$$default.Inflector = ember$inflector$lib$lib$system$inflector$$default;
ember$lib$main$$default.String.pluralize = ember$inflector$lib$lib$system$string$$pluralize;
ember$lib$main$$default.String.singularize = ember$inflector$lib$lib$system$string$$singularize;
var ember$inflector$lib$main$$default = ember$inflector$lib$lib$system$inflector$$default;
if (typeof define !== "undefined" && define.amd) {
define("ember-inflector", ["exports"], function (__exports__) {
__exports__["default"] = ember$inflector$lib$lib$system$inflector$$default;
return ember$inflector$lib$lib$system$inflector$$default;
});
} else if (typeof module !== "undefined" && module["exports"]) {
module["exports"] = ember$inflector$lib$lib$system$inflector$$default;
}
/**
@module ember-data
*/
var activemodel$adapter$lib$system$active$model$adapter$$decamelize = Ember.String.decamelize;
var activemodel$adapter$lib$system$active$model$adapter$$underscore = Ember.String.underscore;
/**
The ActiveModelAdapter is a subclass of the RESTAdapter designed to integrate
with a JSON API that uses an underscored naming convention instead of camelCasing.
It has been designed to work out of the box with the
[active\_model\_serializers](http://github.com/rails-api/active_model_serializers)
Ruby gem. This Adapter expects specific settings using ActiveModel::Serializers,
`embed :ids, embed_in_root: true` which sideloads the records.
This adapter extends the DS.RESTAdapter by making consistent use of the camelization,
decamelization and pluralization methods to normalize the serialized JSON into a
format that is compatible with a conventional Rails backend and Ember Data.
## JSON Structure
The ActiveModelAdapter expects the JSON returned from your server to follow
the REST adapter conventions substituting underscored keys for camelcased ones.
Unlike the DS.RESTAdapter, async relationship keys must be the singular form
of the relationship name, followed by "_id" for DS.belongsTo relationships,
or "_ids" for DS.hasMany relationships.
### Conventional Names
Attribute names in your JSON payload should be the underscored versions of
the attributes in your Ember.js models.
For example, if you have a `Person` model:
```js
App.FamousPerson = DS.Model.extend({
firstName: DS.attr('string'),
lastName: DS.attr('string'),
occupation: DS.attr('string')
});
```
The JSON returned should look like this:
```js
{
"famous_person": {
"id": 1,
"first_name": "Barack",
"last_name": "Obama",
"occupation": "President"
}
}
```
Let's imagine that `Occupation` is just another model:
```js
App.Person = DS.Model.extend({
firstName: DS.attr('string'),
lastName: DS.attr('string'),
occupation: DS.belongsTo('occupation')
});
App.Occupation = DS.Model.extend({
name: DS.attr('string'),
salary: DS.attr('number'),
people: DS.hasMany('person')
});
```
The JSON needed to avoid extra server calls, should look like this:
```js
{
"people": [{
"id": 1,
"first_name": "Barack",
"last_name": "Obama",
"occupation_id": 1
}],
"occupations": [{
"id": 1,
"name": "President",
"salary": 100000,
"person_ids": [1]
}]
}
```
@class ActiveModelAdapter
@constructor
@namespace DS
@extends DS.RESTAdapter
**/
var activemodel$adapter$lib$system$active$model$adapter$$ActiveModelAdapter = ember$data$lib$adapters$rest$adapter$$default.extend({
defaultSerializer: "-active-model",
/**
The ActiveModelAdapter overrides the `pathForType` method to build
underscored URLs by decamelizing and pluralizing the object type name.
```js
this.pathForType("famousPerson");
//=> "famous_people"
```
@method pathForType
@param {String} modelName
@return String
*/
pathForType: function (modelName) {
var decamelized = activemodel$adapter$lib$system$active$model$adapter$$decamelize(modelName);
var underscored = activemodel$adapter$lib$system$active$model$adapter$$underscore(decamelized);
return ember$inflector$lib$lib$system$string$$pluralize(underscored);
},
/**
The ActiveModelAdapter overrides the `handleResponse` method
to format errors passed to a DS.InvalidError for all
422 Unprocessable Entity responses.
A 422 HTTP response from the server generally implies that the request
was well formed but the API was unable to process it because the
content was not semantically correct or meaningful per the API.
For more information on 422 HTTP Error code see 11.2 WebDAV RFC 4918
https://tools.ietf.org/html/rfc4918#section-11.2
@method ajaxError
@param {Object} jqXHR
@return error
*/
handleResponse: function (status, headers, payload) {
if (this.isInvalid(status, headers, payload)) {
var errors = ember$data$lib$adapters$errors$$errorsHashToArray(payload.errors);
return new ember$data$lib$adapters$errors$$InvalidError(errors);
} else {
return this._super.apply(this, arguments);
}
}
});
var activemodel$adapter$lib$system$active$model$adapter$$default = activemodel$adapter$lib$system$active$model$adapter$$ActiveModelAdapter;
var ember$data$lib$system$serializer$$Serializer = Ember.Object.extend({
/*
This is only to be used temporarily during the transition from the old
serializer API to the new one.
This makes the store and the built-in serializers use the new Serializer API.
## Custom Serializers
If you have custom serializers you need to do the following:
1. Opt-in to the new Serializer API by setting `isNewSerializerAPI` to `true`
when extending one of the built-in serializers. This indicates that the
store should call `normalizeResponse` instead of `extract` and to expect
a JSON-API Document back.
2. If you have a custom `extract` hooks you need to refactor it to the new
`normalizeResponse` hooks and make sure it returns a JSON-API Document.
3. If you have a custom `normalize` method you need to make sure it also
returns a JSON-API Document with the record in question as the primary
data.
@property isNewSerializerAPI
*/
isNewSerializerAPI: false,
/**
The `store` property is the application's `store` that contains all records.
It's injected as a service.
It can be used to push records from a non flat data structure server
response.
@property store
@type {DS.Store}
@public
*/
/**
The `extract` method is used to deserialize the payload received from your
data source into the form that Ember Data expects.
@method extract
@param {DS.Store} store
@param {DS.Model} typeClass
@param {Object} payload
@param {(String|Number)} id
@param {String} requestType
@return {Object}
*/
extract: null,
/**
The `serialize` method is used when a record is saved in order to convert
the record into the form that your external data source expects.
`serialize` takes an optional `options` hash with a single option:
- `includeId`: If this is `true`, `serialize` should include the ID
in the serialized object it builds.
@method serialize
@param {DS.Model} record
@param {Object} [options]
@return {Object}
*/
serialize: null,
/**
The `normalize` method is used to convert a payload received from your
external data source into the normalized form `store.push()` expects. You
should override this method, munge the hash and return the normalized
payload.
@method normalize
@param {DS.Model} typeClass
@param {Object} hash
@return {Object}
*/
normalize: function (typeClass, hash) {
return hash;
}
});
var ember$data$lib$system$serializer$$default = ember$data$lib$system$serializer$$Serializer;
var ember$data$lib$system$coerce$id$$default = ember$data$lib$system$coerce$id$$coerceId;
// Used by the store to normalize IDs entering the store. Despite the fact
// that developers may provide IDs as numbers (e.g., `store.find(Person, 1)`),
// it is important that internally we use strings, since IDs may be serialized
// and lose type information. For example, Ember's router may put a record's
// ID into the URL, and if we later try to deserialize that URL and find the
// corresponding record, we will not know if it is a string or a number.
function ember$data$lib$system$coerce$id$$coerceId(id) {
return id == null || id === '' ? null : id + '';
}
var ember$data$lib$system$normalize$model$name$$default = ember$data$lib$system$normalize$model$name$$normalizeModelName;
/**
All modelNames are dasherized internally. Changing this function may
require changes to other normalization hooks (such as typeForRoot).
@method normalizeModelName
@public
@param {String} modelName
@return {String} if the adapter can generate one, an ID
@for DS
*/
function ember$data$lib$system$normalize$model$name$$normalizeModelName(modelName) {
return Ember.String.dasherize(modelName);
}
var ember$data$lib$serializers$json$serializer$$get = Ember.get;
var ember$data$lib$serializers$json$serializer$$isNone = Ember.isNone;
var ember$data$lib$serializers$json$serializer$$map = Ember.ArrayPolyfills.map;
var ember$data$lib$serializers$json$serializer$$merge = Ember.merge;
/*
Ember Data 2.0 Serializer:
In Ember Data a Serializer is used to serialize and deserialize
records when they are transferred in and out of an external source.
This process involves normalizing property names, transforming
attribute values and serializing relationships.
By default Ember Data recommends using the JSONApiSerializer.
`JSONSerializer` is useful for simpler or legacy backends that may
not support the http://jsonapi.org/ spec.
`JSONSerializer` normalizes a JSON payload that looks like:
```js
App.User = DS.Model.extend({
name: DS.attr(),
friends: DS.hasMany('user'),
house: DS.belongsTo('location'),
});
```
```js
{ id: 1,
name: 'Sebastian',
friends: [3, 4],
links: {
house: '/houses/lefkada'
}
}
```
to JSONApi format that the Ember Data store expects.
You can customize how JSONSerializer processes it's payload by passing options in
the attrs hash or by subclassing the JSONSerializer and overriding hooks:
-To customize how a single record is normalized, use the `normalize` hook
-To customize how JSONSerializer normalizes the whole server response, use the
normalizeResponse hook
-To customize how JSONSerializer normalizes a specific response from the server,
use one of the many specific normalizeResponse hooks
-To customize how JSONSerializer normalizes your attributes or relationships,
use the extractAttributes and extractRelationships hooks.
JSONSerializer normalization process follows these steps:
- `normalizeResponse` - entry method to the Serializer
- `normalizeCreateRecordResponse` - a normalizeResponse for a specific operation is called
- `normalizeSingleResponse`|`normalizeArrayResponse` - for methods like `createRecord` we expect
a single record back, while for methods like `findAll` we expect multiple methods back
- `normalize` - normalizeArray iterates and calls normalize for each of it's records while normalizeSingle
calls it once. This is the method you most likely want to subclass
- `extractId` | `extractAttributes` | `extractRelationships` - normalize delegates to these methods to
turn the record payload into the JSONApi format
@class JSONSerializer
@namespace DS
@extends DS.Serializer
*/
/**
In Ember Data a Serializer is used to serialize and deserialize
records when they are transferred in and out of an external source.
This process involves normalizing property names, transforming
attribute values and serializing relationships.
For maximum performance Ember Data recommends you use the
[RESTSerializer](DS.RESTSerializer.html) or one of its subclasses.
`JSONSerializer` is useful for simpler or legacy backends that may
not support the http://jsonapi.org/ spec.
@class JSONSerializer
@namespace DS
@extends DS.Serializer
*/
var ember$data$lib$serializers$json$serializer$$JSONSerializer = ember$data$lib$system$serializer$$default.extend({
/**
The primaryKey is used when serializing and deserializing
data. Ember Data always uses the `id` property to store the id of
the record. The external source may not always follow this
convention. In these cases it is useful to override the
primaryKey property to match the primaryKey of your external
store.
Example
```app/serializers/application.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
primaryKey: '_id'
});
```
@property primaryKey
@type {String}
@default 'id'
*/
primaryKey: "id",
/**
The `attrs` object can be used to declare a simple mapping between
property names on `DS.Model` records and payload keys in the
serialized JSON object representing the record. An object with the
property `key` can also be used to designate the attribute's key on
the response payload.
Example
```app/models/person.js
import DS from 'ember-data';
export default DS.Model.extend({
firstName: DS.attr('string'),
lastName: DS.attr('string'),
occupation: DS.attr('string'),
admin: DS.attr('boolean')
});
```
```app/serializers/person.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
attrs: {
admin: 'is_admin',
occupation: { key: 'career' }
}
});
```
You can also remove attributes by setting the `serialize` key to
false in your mapping object.
Example
```app/serializers/person.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
attrs: {
admin: {serialize: false},
occupation: { key: 'career' }
}
});
```
When serialized:
```javascript
{
"firstName": "Harry",
"lastName": "Houdini",
"career": "magician"
}
```
Note that the `admin` is now not included in the payload.
@property attrs
@type {Object}
*/
mergedProperties: ["attrs"],
/**
Given a subclass of `DS.Model` and a JSON object this method will
iterate through each attribute of the `DS.Model` and invoke the
`DS.Transform#deserialize` method on the matching property of the
JSON object. This method is typically called after the
serializer's `normalize` method.
@method applyTransforms
@private
@param {DS.Model} typeClass
@param {Object} data The data to transform
@return {Object} data The transformed data object
*/
applyTransforms: function (typeClass, data) {
typeClass.eachTransformedAttribute(function applyTransform(key, typeClass) {
if (!data.hasOwnProperty(key)) {
return;
}
var transform = this.transformFor(typeClass);
data[key] = transform.deserialize(data[key]);
}, this);
return data;
},
/*
The `normalizeResponse` method is used to normalize a payload from the
server to a JSON-API Document.
http://jsonapi.org/format/#document-structure
This method delegates to a more specific normalize method based on
the `requestType`.
To override this method with a custom one, make sure to call
`return this._super(store, primaryModelClass, payload, id, requestType)` with your
pre-processed data.
Here's an example of using `normalizeResponse` manually:
```javascript
socket.on('message', function(message) {
var data = message.data;
var modelClass = store.modelFor(data.modelName);
var serializer = store.serializerFor(data.modelName);
var json = serializer.normalizeSingleResponse(store, modelClass, data, data.id);
store.push(normalized);
});
```
@method normalizeResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@return {Object} JSON-API Document
*/
normalizeResponse: function (store, primaryModelClass, payload, id, requestType) {
switch (requestType) {
case "findRecord":
return this.normalizeFindRecordResponse.apply(this, arguments);
case "queryRecord":
return this.normalizeQueryRecordResponse.apply(this, arguments);
case "findAll":
return this.normalizeFindAllResponse.apply(this, arguments);
case "findBelongsTo":
return this.normalizeFindBelongsToResponse.apply(this, arguments);
case "findHasMany":
return this.normalizeFindHasManyResponse.apply(this, arguments);
case "findMany":
return this.normalizeFindManyResponse.apply(this, arguments);
case "query":
return this.normalizeQueryResponse.apply(this, arguments);
case "createRecord":
return this.normalizeCreateRecordResponse.apply(this, arguments);
case "deleteRecord":
return this.normalizeDeleteRecordResponse.apply(this, arguments);
case "updateRecord":
return this.normalizeUpdateRecordResponse.apply(this, arguments);
}
},
/*
@method normalizeFindRecordResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@return {Object} JSON-API Document
*/
normalizeFindRecordResponse: function (store, primaryModelClass, payload, id, requestType) {
return this.normalizeSingleResponse.apply(this, arguments);
},
/*
@method normalizeQueryRecordResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@return {Object} JSON-API Document
*/
normalizeQueryRecordResponse: function (store, primaryModelClass, payload, id, requestType) {
return this.normalizeSingleResponse.apply(this, arguments);
},
/*
@method normalizeFindAllResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@return {Object} JSON-API Document
*/
normalizeFindAllResponse: function (store, primaryModelClass, payload, id, requestType) {
return this.normalizeArrayResponse.apply(this, arguments);
},
/*
@method normalizeFindBelongsToResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@return {Object} JSON-API Document
*/
normalizeFindBelongsToResponse: function (store, primaryModelClass, payload, id, requestType) {
return this.normalizeSingleResponse.apply(this, arguments);
},
/*
@method normalizeFindHasManyResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@return {Object} JSON-API Document
*/
normalizeFindHasManyResponse: function (store, primaryModelClass, payload, id, requestType) {
return this.normalizeArrayResponse.apply(this, arguments);
},
/*
@method normalizeFindManyResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@return {Object} JSON-API Document
*/
normalizeFindManyResponse: function (store, primaryModelClass, payload, id, requestType) {
return this.normalizeArrayResponse.apply(this, arguments);
},
/*
@method normalizeQueryResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@return {Object} JSON-API Document
*/
normalizeQueryResponse: function (store, primaryModelClass, payload, id, requestType) {
return this.normalizeArrayResponse.apply(this, arguments);
},
/*
@method normalizeCreateRecordResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@return {Object} JSON-API Document
*/
normalizeCreateRecordResponse: function (store, primaryModelClass, payload, id, requestType) {
return this.normalizeSaveResponse.apply(this, arguments);
},
/*
@method normalizeDeleteRecordResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@return {Object} JSON-API Document
*/
normalizeDeleteRecordResponse: function (store, primaryModelClass, payload, id, requestType) {
return this.normalizeSaveResponse.apply(this, arguments);
},
/*
@method normalizeUpdateRecordResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@return {Object} JSON-API Document
*/
normalizeUpdateRecordResponse: function (store, primaryModelClass, payload, id, requestType) {
return this.normalizeSaveResponse.apply(this, arguments);
},
/*
@method normalizeSaveResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@return {Object} JSON-API Document
*/
normalizeSaveResponse: function (store, primaryModelClass, payload, id, requestType) {
return this.normalizeSingleResponse.apply(this, arguments);
},
/*
@method normalizeSingleResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@return {Object} JSON-API Document
*/
normalizeSingleResponse: function (store, primaryModelClass, payload, id, requestType) {
return this._normalizeResponse(store, primaryModelClass, payload, id, requestType, true);
},
/*
@method normalizeArrayResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@return {Object} JSON-API Document
*/
normalizeArrayResponse: function (store, primaryModelClass, payload, id, requestType) {
return this._normalizeResponse(store, primaryModelClass, payload, id, requestType, false);
},
/*
@method _normalizeResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@param {Boolean} isSingle
@return {Object} JSON-API Document
@private
*/
_normalizeResponse: function (store, primaryModelClass, payload, id, requestType, isSingle) {
var _this = this;
var documentHash = {
data: null,
included: []
};
var meta = this.extractMeta(store, primaryModelClass, payload);
if (meta) {
Ember.assert("The `meta` returned from `extractMeta` has to be an object, not \"" + Ember.typeOf(meta) + "\".", Ember.typeOf(meta) === "object");
documentHash.meta = meta;
}
if (isSingle) {
var _normalize = this.normalize(primaryModelClass, payload);
var data = _normalize.data;
documentHash.data = data;
} else {
documentHash.data = payload.map(function (item) {
var _normalize2 = _this.normalize(primaryModelClass, item);
var data = _normalize2.data;
return data;
});
}
return documentHash;
},
/**
Normalizes a part of the JSON payload returned by
the server. You should override this method, munge the hash
and call super if you have generic normalization to do.
It takes the type of the record that is being normalized
(as a DS.Model class), the property where the hash was
originally found, and the hash to normalize.
You can use this method, for example, to normalize underscored keys to camelized
or other general-purpose normalizations.
Example
```app/serializers/application.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
normalize: function(typeClass, hash) {
var fields = Ember.get(typeClass, 'fields');
fields.forEach(function(field) {
var payloadField = Ember.String.underscore(field);
if (field === payloadField) { return; }
hash[field] = hash[payloadField];
delete hash[payloadField];
});
return this._super.apply(this, arguments);
}
});
```
@method normalize
@param {DS.Model} typeClass
@param {Object} hash
@return {Object}
*/
normalize: function (typeClass, hash) {
if (this.get("isNewSerializerAPI")) {
return ember$data$lib$serializers$json$serializer$$_newNormalize.apply(this, arguments);
}
if (!hash) {
return hash;
}
this.normalizeId(hash);
this.normalizeAttributes(typeClass, hash);
this.normalizeRelationships(typeClass, hash);
this.normalizeUsingDeclaredMapping(typeClass, hash);
this.applyTransforms(typeClass, hash);
return hash;
},
/*
Returns the resource's ID.
@method extractId
@param {Object} resourceHash
@return {String}
*/
extractId: function (resourceHash) {
var primaryKey = ember$data$lib$serializers$json$serializer$$get(this, "primaryKey");
var id = resourceHash[primaryKey];
return ember$data$lib$system$coerce$id$$default(id);
},
/*
Returns the resource's attributes formatted as a JSON-API "attributes object".
http://jsonapi.org/format/#document-resource-object-attributes
@method extractId
@param {Object} resourceHash
@return {Object}
*/
extractAttributes: function (modelClass, resourceHash) {
var attributeKey;
var attributes = {};
modelClass.eachAttribute(function (key) {
attributeKey = this.keyForAttribute(key, "deserialize");
if (resourceHash.hasOwnProperty(attributeKey)) {
attributes[key] = resourceHash[attributeKey];
}
}, this);
return attributes;
},
/*
Returns a relationship formatted as a JSON-API "relationship object".
http://jsonapi.org/format/#document-resource-object-relationships
@method extractRelationship
@param {Object} relationshipModelName
@param {Object} relationshipHash
@return {Object}
*/
extractRelationship: function (relationshipModelName, relationshipHash) {
if (Ember.isNone(relationshipHash)) {
return null;
}
/*
When `relationshipHash` is an object it usually means that the relationship
is polymorphic. It could however also be embedded resources that the
EmbeddedRecordsMixin has be able to process.
*/
if (Ember.typeOf(relationshipHash) === "object") {
if (relationshipHash.id) {
relationshipHash.id = ember$data$lib$system$coerce$id$$default(relationshipHash.id);
}
if (relationshipHash.type) {
relationshipHash.type = this.modelNameFromPayloadKey(relationshipHash.type);
}
return relationshipHash;
}
return { id: ember$data$lib$system$coerce$id$$default(relationshipHash), type: relationshipModelName };
},
/*
Returns the resource's relationships formatted as a JSON-API "relationships object".
http://jsonapi.org/format/#document-resource-object-relationships
@method extractRelationships
@param {Object} modelClass
@param {Object} resourceHash
@return {Object}
*/
extractRelationships: function (modelClass, resourceHash) {
var relationships = {};
modelClass.eachRelationship(function (key, relationshipMeta) {
var relationship = null;
var relationshipKey = this.keyForRelationship(key, relationshipMeta.kind, "deserialize");
if (resourceHash.hasOwnProperty(relationshipKey)) {
var data = null;
var relationshipHash = resourceHash[relationshipKey];
if (relationshipMeta.kind === "belongsTo") {
data = this.extractRelationship(relationshipMeta.type, relationshipHash);
} else if (relationshipMeta.kind === "hasMany") {
data = Ember.A(relationshipHash).map(function (item) {
return this.extractRelationship(relationshipMeta.type, item);
}, this);
}
relationship = { data: data };
}
var linkKey = this.keyForLink(key, relationshipMeta.kind);
if (resourceHash.links && resourceHash.links.hasOwnProperty(linkKey)) {
var related = resourceHash.links[linkKey];
relationship = relationship || {};
relationship.links = { related: related };
}
if (relationship) {
relationships[key] = relationship;
}
}, this);
return relationships;
},
/**
@method modelNameFromPayloadKey
@param {String} key
@return {String} the model's modelName
*/
modelNameFromPayloadKey: function (key) {
return ember$data$lib$system$normalize$model$name$$default(key);
},
/**
You can use this method to normalize all payloads, regardless of whether they
represent single records or an array.
For example, you might want to remove some extraneous data from the payload:
```app/serializers/application.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
normalizePayload: function(payload) {
delete payload.version;
delete payload.status;
return payload;
}
});
```
@method normalizePayload
@param {Object} payload
@return {Object} the normalized payload
*/
normalizePayload: function (payload) {
return payload;
},
/**
@method normalizeAttributes
@private
*/
normalizeAttributes: function (typeClass, hash) {
var payloadKey;
if (this.keyForAttribute) {
typeClass.eachAttribute(function (key) {
payloadKey = this.keyForAttribute(key, "deserialize");
if (key === payloadKey) {
return;
}
if (!hash.hasOwnProperty(payloadKey)) {
return;
}
hash[key] = hash[payloadKey];
delete hash[payloadKey];
}, this);
}
},
/**
@method normalizeRelationships
@private
*/
normalizeRelationships: function (typeClass, hash) {
var payloadKey;
if (this.keyForRelationship) {
typeClass.eachRelationship(function (key, relationship) {
payloadKey = this.keyForRelationship(key, relationship.kind, "deserialize");
if (key === payloadKey) {
return;
}
if (!hash.hasOwnProperty(payloadKey)) {
return;
}
hash[key] = hash[payloadKey];
delete hash[payloadKey];
}, this);
}
},
/**
@method normalizeUsingDeclaredMapping
@private
*/
normalizeUsingDeclaredMapping: function (typeClass, hash) {
var attrs = ember$data$lib$serializers$json$serializer$$get(this, "attrs");
var payloadKey, key;
if (attrs) {
for (key in attrs) {
payloadKey = this._getMappedKey(key);
if (!hash.hasOwnProperty(payloadKey)) {
continue;
}
if (payloadKey !== key) {
hash[key] = hash[payloadKey];
delete hash[payloadKey];
}
}
}
},
/**
@method normalizeId
@private
*/
normalizeId: function (hash) {
var primaryKey = ember$data$lib$serializers$json$serializer$$get(this, "primaryKey");
if (primaryKey === "id") {
return;
}
hash.id = hash[primaryKey];
delete hash[primaryKey];
},
/**
@method normalizeErrors
@private
*/
normalizeErrors: function (typeClass, hash) {
this.normalizeId(hash);
this.normalizeAttributes(typeClass, hash);
this.normalizeRelationships(typeClass, hash);
this.normalizeUsingDeclaredMapping(typeClass, hash);
},
/**
Looks up the property key that was set by the custom `attr` mapping
passed to the serializer.
@method _getMappedKey
@private
@param {String} key
@return {String} key
*/
_getMappedKey: function (key) {
var attrs = ember$data$lib$serializers$json$serializer$$get(this, "attrs");
var mappedKey;
if (attrs && attrs[key]) {
mappedKey = attrs[key];
//We need to account for both the { title: 'post_title' } and
//{ title: { key: 'post_title' }} forms
if (mappedKey.key) {
mappedKey = mappedKey.key;
}
if (typeof mappedKey === "string") {
key = mappedKey;
}
}
return key;
},
/**
Check attrs.key.serialize property to inform if the `key`
can be serialized
@method _canSerialize
@private
@param {String} key
@return {boolean} true if the key can be serialized
*/
_canSerialize: function (key) {
var attrs = ember$data$lib$serializers$json$serializer$$get(this, "attrs");
return !attrs || !attrs[key] || attrs[key].serialize !== false;
},
/**
When attrs.key.serialize is set to true then
it takes priority over the other checks and the related
attribute/relationship will be serialized
@method _mustSerialize
@private
@param {String} key
@return {boolean} true if the key must be serialized
*/
_mustSerialize: function (key) {
var attrs = ember$data$lib$serializers$json$serializer$$get(this, "attrs");
return attrs && attrs[key] && attrs[key].serialize === true;
},
/**
Check if the given hasMany relationship should be serialized
@method _shouldSerializeHasMany
@private
@param {DS.Snapshot} snapshot
@param {String} key
@param {String} relationshipType
@return {boolean} true if the hasMany relationship should be serialized
*/
_shouldSerializeHasMany: function (snapshot, key, relationship) {
var relationshipType = snapshot.type.determineRelationshipType(relationship, this.store);
if (this._mustSerialize(key)) {
return true;
}
return this._canSerialize(key) && (relationshipType === "manyToNone" || relationshipType === "manyToMany");
},
// SERIALIZE
/**
Called when a record is saved in order to convert the
record into JSON.
By default, it creates a JSON object with a key for
each attribute and belongsTo relationship.
For example, consider this model:
```app/models/comment.js
import DS from 'ember-data';
export default DS.Model.extend({
title: DS.attr(),
body: DS.attr(),
author: DS.belongsTo('user')
});
```
The default serialization would create a JSON object like:
```javascript
{
"title": "Rails is unagi",
"body": "Rails? Omakase? O_O",
"author": 12
}
```
By default, attributes are passed through as-is, unless
you specified an attribute type (`DS.attr('date')`). If
you specify a transform, the JavaScript value will be
serialized when inserted into the JSON hash.
By default, belongs-to relationships are converted into
IDs when inserted into the JSON hash.
## IDs
`serialize` takes an options hash with a single option:
`includeId`. If this option is `true`, `serialize` will,
by default include the ID in the JSON object it builds.
The adapter passes in `includeId: true` when serializing
a record for `createRecord`, but not for `updateRecord`.
## Customization
Your server may expect a different JSON format than the
built-in serialization format.
In that case, you can implement `serialize` yourself and
return a JSON hash of your choosing.
```app/serializers/post.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
serialize: function(snapshot, options) {
var json = {
POST_TTL: snapshot.attr('title'),
POST_BDY: snapshot.attr('body'),
POST_CMS: snapshot.hasMany('comments', { ids: true })
}
if (options.includeId) {
json.POST_ID_ = snapshot.id;
}
return json;
}
});
```
## Customizing an App-Wide Serializer
If you want to define a serializer for your entire
application, you'll probably want to use `eachAttribute`
and `eachRelationship` on the record.
```app/serializers/application.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
serialize: function(snapshot, options) {
var json = {};
snapshot.eachAttribute(function(name) {
json[serverAttributeName(name)] = snapshot.attr(name);
})
snapshot.eachRelationship(function(name, relationship) {
if (relationship.kind === 'hasMany') {
json[serverHasManyName(name)] = snapshot.hasMany(name, { ids: true });
}
});
if (options.includeId) {
json.ID_ = snapshot.id;
}
return json;
}
});
function serverAttributeName(attribute) {
return attribute.underscore().toUpperCase();
}
function serverHasManyName(name) {
return serverAttributeName(name.singularize()) + "_IDS";
}
```
This serializer will generate JSON that looks like this:
```javascript
{
"TITLE": "Rails is omakase",
"BODY": "Yep. Omakase.",
"COMMENT_IDS": [ 1, 2, 3 ]
}
```
## Tweaking the Default JSON
If you just want to do some small tweaks on the default JSON,
you can call super first and make the tweaks on the returned
JSON.
```app/serializers/post.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
serialize: function(snapshot, options) {
var json = this._super.apply(this, arguments);
json.subject = json.title;
delete json.title;
return json;
}
});
```
@method serialize
@param {DS.Snapshot} snapshot
@param {Object} options
@return {Object} json
*/
serialize: function (snapshot, options) {
var json = {};
if (options && options.includeId) {
var id = snapshot.id;
if (id) {
json[ember$data$lib$serializers$json$serializer$$get(this, "primaryKey")] = id;
}
}
snapshot.eachAttribute(function (key, attribute) {
this.serializeAttribute(snapshot, json, key, attribute);
}, this);
snapshot.eachRelationship(function (key, relationship) {
if (relationship.kind === "belongsTo") {
this.serializeBelongsTo(snapshot, json, relationship);
} else if (relationship.kind === "hasMany") {
this.serializeHasMany(snapshot, json, relationship);
}
}, this);
return json;
},
/**
You can use this method to customize how a serialized record is added to the complete
JSON hash to be sent to the server. By default the JSON Serializer does not namespace
the payload and just sends the raw serialized JSON object.
If your server expects namespaced keys, you should consider using the RESTSerializer.
Otherwise you can override this method to customize how the record is added to the hash.
For example, your server may expect underscored root objects.
```app/serializers/application.js
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
serializeIntoHash: function(data, type, snapshot, options) {
var root = Ember.String.decamelize(type.modelName);
data[root] = this.serialize(snapshot, options);
}
});
```
@method serializeIntoHash
@param {Object} hash
@param {DS.Model} typeClass
@param {DS.Snapshot} snapshot
@param {Object} options
*/
serializeIntoHash: function (hash, typeClass, snapshot, options) {
ember$data$lib$serializers$json$serializer$$merge(hash, this.serialize(snapshot, options));
},
/**
`serializeAttribute` can be used to customize how `DS.attr`
properties are serialized
For example if you wanted to ensure all your attributes were always
serialized as properties on an `attributes` object you could
write:
```app/serializers/application.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
serializeAttribute: function(snapshot, json, key, attributes) {
json.attributes = json.attributes || {};
this._super(snapshot, json.attributes, key, attributes);
}
});
```
@method serializeAttribute
@param {DS.Snapshot} snapshot
@param {Object} json
@param {String} key
@param {Object} attribute
*/
serializeAttribute: function (snapshot, json, key, attribute) {
var type = attribute.type;
if (this._canSerialize(key)) {
var value = snapshot.attr(key);
if (type) {
var transform = this.transformFor(type);
value = transform.serialize(value);
}
// if provided, use the mapping provided by `attrs` in
// the serializer
var payloadKey = this._getMappedKey(key);
if (payloadKey === key && this.keyForAttribute) {
payloadKey = this.keyForAttribute(key, "serialize");
}
json[payloadKey] = value;
}
},
/**
`serializeBelongsTo` can be used to customize how `DS.belongsTo`
properties are serialized.
Example
```app/serializers/post.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
serializeBelongsTo: function(snapshot, json, relationship) {
var key = relationship.key;
var belongsTo = snapshot.belongsTo(key);
key = this.keyForRelationship ? this.keyForRelationship(key, "belongsTo", "serialize") : key;
json[key] = Ember.isNone(belongsTo) ? belongsTo : belongsTo.record.toJSON();
}
});
```
@method serializeBelongsTo
@param {DS.Snapshot} snapshot
@param {Object} json
@param {Object} relationship
*/
serializeBelongsTo: function (snapshot, json, relationship) {
var key = relationship.key;
if (this._canSerialize(key)) {
var belongsToId = snapshot.belongsTo(key, { id: true });
// if provided, use the mapping provided by `attrs` in
// the serializer
var payloadKey = this._getMappedKey(key);
if (payloadKey === key && this.keyForRelationship) {
payloadKey = this.keyForRelationship(key, "belongsTo", "serialize");
}
//Need to check whether the id is there for new&async records
if (ember$data$lib$serializers$json$serializer$$isNone(belongsToId)) {
json[payloadKey] = null;
} else {
json[payloadKey] = belongsToId;
}
if (relationship.options.polymorphic) {
this.serializePolymorphicType(snapshot, json, relationship);
}
}
},
/**
`serializeHasMany` can be used to customize how `DS.hasMany`
properties are serialized.
Example
```app/serializers/post.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
serializeHasMany: function(snapshot, json, relationship) {
var key = relationship.key;
if (key === 'comments') {
return;
} else {
this._super.apply(this, arguments);
}
}
});
```
@method serializeHasMany
@param {DS.Snapshot} snapshot
@param {Object} json
@param {Object} relationship
*/
serializeHasMany: function (snapshot, json, relationship) {
var key = relationship.key;
if (this._shouldSerializeHasMany(snapshot, key, relationship)) {
var payloadKey;
// if provided, use the mapping provided by `attrs` in
// the serializer
payloadKey = this._getMappedKey(key);
if (payloadKey === key && this.keyForRelationship) {
payloadKey = this.keyForRelationship(key, "hasMany", "serialize");
}
json[payloadKey] = snapshot.hasMany(key, { ids: true });
// TODO support for polymorphic manyToNone and manyToMany relationships
}
},
/**
You can use this method to customize how polymorphic objects are
serialized. Objects are considered to be polymorphic if
`{ polymorphic: true }` is pass as the second argument to the
`DS.belongsTo` function.
Example
```app/serializers/comment.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
serializePolymorphicType: function(snapshot, json, relationship) {
var key = relationship.key,
belongsTo = snapshot.belongsTo(key);
key = this.keyForAttribute ? this.keyForAttribute(key, "serialize") : key;
if (Ember.isNone(belongsTo)) {
json[key + "_type"] = null;
} else {
json[key + "_type"] = belongsTo.modelName;
}
}
});
```
@method serializePolymorphicType
@param {DS.Snapshot} snapshot
@param {Object} json
@param {Object} relationship
*/
serializePolymorphicType: Ember.K,
// EXTRACT
/**
The `extract` method is used to deserialize payload data from the
server. By default the `JSONSerializer` does not push the records
into the store. However records that subclass `JSONSerializer`
such as the `RESTSerializer` may push records into the store as
part of the extract call.
This method delegates to a more specific extract method based on
the `requestType`.
To override this method with a custom one, make sure to call
`return this._super(store, type, payload, id, requestType)` with your
pre-processed data.
Here's an example of using `extract` manually:
```javascript
socket.on('message', function(message) {
var data = message.data;
var typeClass = store.modelFor(message.modelName);
var serializer = store.serializerFor(typeClass.modelName);
var record = serializer.extract(store, typeClass, data, data.id, 'single');
store.push(message.modelName, record);
});
```
@method extract
@param {DS.Store} store
@param {DS.Model} typeClass
@param {Object} payload
@param {(String|Number)} id
@param {String} requestType
@return {Object} json The deserialized payload
*/
extract: function (store, typeClass, payload, id, requestType) {
this.extractMeta(store, typeClass.modelName, payload);
var specificExtract = "extract" + requestType.charAt(0).toUpperCase() + requestType.substr(1);
return this[specificExtract](store, typeClass, payload, id, requestType);
},
/**
`extractFindAll` is a hook into the extract method used when a
call is made to `DS.Store#findAll`. By default this method is an
alias for [extractArray](#method_extractArray).
@method extractFindAll
@param {DS.Store} store
@param {DS.Model} typeClass
@param {Object} payload
@param {(String|Number)} id
@param {String} requestType
@return {Array} array An array of deserialized objects
*/
extractFindAll: function (store, typeClass, payload, id, requestType) {
return this.extractArray(store, typeClass, payload, id, requestType);
},
/**
`extractFindQuery` is a hook into the extract method used when a
call is made to `DS.Store#findQuery`. By default this method is an
alias for [extractArray](#method_extractArray).
@method extractFindQuery
@param {DS.Store} store
@param {DS.Model} typeClass
@param {Object} payload
@param {(String|Number)} id
@param {String} requestType
@return {Array} array An array of deserialized objects
*/
extractFindQuery: function (store, typeClass, payload, id, requestType) {
return this.extractArray(store, typeClass, payload, id, requestType);
},
/**
TODO: remove this in a couple of days
`extractQueryRecord` is a hook into the extract method used when a
call is made to `DS.Store#queryRecord`. By default this method is an
alias for [extractSingle](#method_extractSingle).
@method extractQueryRecord
@param {DS.Store} store
@param {DS.Model} typeClass
@param {Object} payload
@param {(String|Number)} id
@param {String} requestType
@return {Object} object A hash of deserialized object
*/
extractQueryRecord: function (store, typeClass, payload, id, requestType) {
return this.extractSingle(store, typeClass, payload, id, requestType);
},
/**
`extractFindMany` is a hook into the extract method used when a
call is made to `DS.Store#findMany`. By default this method is
alias for [extractArray](#method_extractArray).
@method extractFindMany
@param {DS.Store} store
@param {DS.Model} typeClass
@param {Object} payload
@param {(String|Number)} id
@param {String} requestType
@return {Array} array An array of deserialized objects
*/
extractFindMany: function (store, typeClass, payload, id, requestType) {
return this.extractArray(store, typeClass, payload, id, requestType);
},
/**
`extractFindHasMany` is a hook into the extract method used when a
call is made to `DS.Store#findHasMany`. By default this method is
alias for [extractArray](#method_extractArray).
@method extractFindHasMany
@param {DS.Store} store
@param {DS.Model} typeClass
@param {Object} payload
@param {(String|Number)} id
@param {String} requestType
@return {Array} array An array of deserialized objects
*/
extractFindHasMany: function (store, typeClass, payload, id, requestType) {
return this.extractArray(store, typeClass, payload, id, requestType);
},
/**
`extractCreateRecord` is a hook into the extract method used when a
call is made to `DS.Model#save` and the record is new. By default
this method is alias for [extractSave](#method_extractSave).
@method extractCreateRecord
@param {DS.Store} store
@param {DS.Model} typeClass
@param {Object} payload
@param {(String|Number)} id
@param {String} requestType
@return {Object} json The deserialized payload
*/
extractCreateRecord: function (store, typeClass, payload, id, requestType) {
return this.extractSave(store, typeClass, payload, id, requestType);
},
/**
`extractUpdateRecord` is a hook into the extract method used when
a call is made to `DS.Model#save` and the record has been updated.
By default this method is alias for [extractSave](#method_extractSave).
@method extractUpdateRecord
@param {DS.Store} store
@param {DS.Model} typeClass
@param {Object} payload
@param {(String|Number)} id
@param {String} requestType
@return {Object} json The deserialized payload
*/
extractUpdateRecord: function (store, typeClass, payload, id, requestType) {
return this.extractSave(store, typeClass, payload, id, requestType);
},
/**
`extractDeleteRecord` is a hook into the extract method used when
a call is made to `DS.Model#save` and the record has been deleted.
By default this method is alias for [extractSave](#method_extractSave).
@method extractDeleteRecord
@param {DS.Store} store
@param {DS.Model} typeClass
@param {Object} payload
@param {(String|Number)} id
@param {String} requestType
@return {Object} json The deserialized payload
*/
extractDeleteRecord: function (store, typeClass, payload, id, requestType) {
return this.extractSave(store, typeClass, payload, id, requestType);
},
/**
`extractFind` is a hook into the extract method used when
a call is made to `DS.Store#find`. By default this method is
alias for [extractSingle](#method_extractSingle).
@method extractFind
@param {DS.Store} store
@param {DS.Model} typeClass
@param {Object} payload
@param {(String|Number)} id
@param {String} requestType
@return {Object} json The deserialized payload
*/
extractFind: function (store, typeClass, payload, id, requestType) {
return this.extractSingle(store, typeClass, payload, id, requestType);
},
/**
`extractFindBelongsTo` is a hook into the extract method used when
a call is made to `DS.Store#findBelongsTo`. By default this method is
alias for [extractSingle](#method_extractSingle).
@method extractFindBelongsTo
@param {DS.Store} store
@param {DS.Model} typeClass
@param {Object} payload
@param {(String|Number)} id
@param {String} requestType
@return {Object} json The deserialized payload
*/
extractFindBelongsTo: function (store, typeClass, payload, id, requestType) {
return this.extractSingle(store, typeClass, payload, id, requestType);
},
/**
`extractSave` is a hook into the extract method used when a call
is made to `DS.Model#save`. By default this method is alias
for [extractSingle](#method_extractSingle).
@method extractSave
@param {DS.Store} store
@param {DS.Model} typeClass
@param {Object} payload
@param {(String|Number)} id
@param {String} requestType
@return {Object} json The deserialized payload
*/
extractSave: function (store, typeClass, payload, id, requestType) {
return this.extractSingle(store, typeClass, payload, id, requestType);
},
/**
`extractSingle` is used to deserialize a single record returned
from the adapter.
Example
```app/serializers/post.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
extractSingle: function(store, typeClass, payload) {
payload.comments = payload._embedded.comment;
delete payload._embedded;
return this._super(store, typeClass, payload);
},
});
```
@method extractSingle
@param {DS.Store} store
@param {DS.Model} typeClass
@param {Object} payload
@param {(String|Number)} id
@param {String} requestType
@return {Object} json The deserialized payload
*/
extractSingle: function (store, typeClass, payload, id, requestType) {
var normalizedPayload = this.normalizePayload(payload);
return this.normalize(typeClass, normalizedPayload);
},
/**
`extractArray` is used to deserialize an array of records
returned from the adapter.
Example
```app/serializers/post.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
extractArray: function(store, typeClass, payload) {
return payload.map(function(json) {
return this.extractSingle(store, typeClass, json);
}, this);
}
});
```
@method extractArray
@param {DS.Store} store
@param {DS.Model} typeClass
@param {Object} arrayPayload
@param {(String|Number)} id
@param {String} requestType
@return {Array} array An array of deserialized objects
*/
extractArray: function (store, typeClass, arrayPayload, id, requestType) {
var normalizedPayload = this.normalizePayload(arrayPayload);
var serializer = this;
return ember$data$lib$serializers$json$serializer$$map.call(normalizedPayload, function (singlePayload) {
return serializer.normalize(typeClass, singlePayload);
});
},
/**
`extractMeta` is used to deserialize any meta information in the
adapter payload. By default Ember Data expects meta information to
be located on the `meta` property of the payload object.
Example
```app/serializers/post.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
extractMeta: function(store, typeClass, payload) {
if (payload && payload._pagination) {
store.setMetadataFor(typeClass, payload._pagination);
delete payload._pagination;
}
}
});
```
@method extractMeta
@param {DS.Store} store
@param {DS.Model} typeClass
@param {Object} payload
*/
extractMeta: function (store, typeClass, payload) {
if (this.get("isNewSerializerAPI")) {
return ember$data$lib$serializers$json$serializer$$_newExtractMeta.apply(this, arguments);
}
if (payload && payload.meta) {
store._setMetadataFor(typeClass, payload.meta);
delete payload.meta;
}
},
/**
`extractErrors` is used to extract model errors when a call is made
to `DS.Model#save` which fails with an `InvalidError`. By default
Ember Data expects error information to be located on the `errors`
property of the payload object.
Example
```app/serializers/post.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
extractErrors: function(store, typeClass, payload, id) {
if (payload && typeof payload === 'object' && payload._problems) {
payload = payload._problems;
this.normalizeErrors(typeClass, payload);
}
return payload;
}
});
```
@method extractErrors
@param {DS.Store} store
@param {DS.Model} typeClass
@param {Object} payload
@param {(String|Number)} id
@return {Object} json The deserialized errors
*/
extractErrors: function (store, typeClass, payload, id) {
if (payload && typeof payload === "object" && payload.errors) {
payload = ember$data$lib$adapters$errors$$errorsArrayToHash(payload.errors);
this.normalizeErrors(typeClass, payload);
}
return payload;
},
/**
`keyForAttribute` can be used to define rules for how to convert an
attribute name in your model to a key in your JSON.
Example
```app/serializers/application.js
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
keyForAttribute: function(attr, method) {
return Ember.String.underscore(attr).toUpperCase();
}
});
```
@method keyForAttribute
@param {String} key
@param {String} method
@return {String} normalized key
*/
keyForAttribute: function (key, method) {
return key;
},
/**
`keyForRelationship` can be used to define a custom key when
serializing and deserializing relationship properties. By default
`JSONSerializer` does not provide an implementation of this method.
Example
```app/serializers/post.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
keyForRelationship: function(key, relationship, method) {
return 'rel_' + Ember.String.underscore(key);
}
});
```
@method keyForRelationship
@param {String} key
@param {String} typeClass
@param {String} method
@return {String} normalized key
*/
keyForRelationship: function (key, typeClass, method) {
return key;
},
/**
`keyForLink` can be used to define a custom key when deserializing link
properties.
@method keyForLink
@param {String} key
@param {String} kind `belongsTo` or `hasMany`
@return {String} normalized key
*/
keyForLink: function (key, kind) {
return key;
},
// HELPERS
/**
@method transformFor
@private
@param {String} attributeType
@param {Boolean} skipAssertion
@return {DS.Transform} transform
*/
transformFor: function (attributeType, skipAssertion) {
var transform = this.container.lookup("transform:" + attributeType);
Ember.assert("Unable to find transform for '" + attributeType + "'", skipAssertion || !!transform);
return transform;
}
});
/*
@method _newNormalize
@param {DS.Model} modelClass
@param {Object} resourceHash
@return {Object}
@private
*/
function ember$data$lib$serializers$json$serializer$$_newNormalize(modelClass, resourceHash) {
var data = null;
if (resourceHash) {
this.normalizeUsingDeclaredMapping(modelClass, resourceHash);
data = {
id: this.extractId(resourceHash),
type: modelClass.modelName,
attributes: this.extractAttributes(modelClass, resourceHash),
relationships: this.extractRelationships(modelClass, resourceHash)
};
this.applyTransforms(modelClass, data.attributes);
}
return { data: data };
}
/*
@method _newExtractMeta
@param {DS.Store} store
@param {DS.Model} modelClass
@param {Object} payload
@return {Object}
@private
*/
function ember$data$lib$serializers$json$serializer$$_newExtractMeta(store, modelClass, payload) {
if (payload && payload.hasOwnProperty("meta")) {
var meta = payload.meta;
delete payload.meta;
return meta;
}
}
var ember$data$lib$serializers$json$serializer$$default = ember$data$lib$serializers$json$serializer$$JSONSerializer;
var ember$data$lib$system$promise$proxies$$Promise = Ember.RSVP.Promise;
var ember$data$lib$system$promise$proxies$$get = Ember.get;
/**
A `PromiseArray` is an object that acts like both an `Ember.Array`
and a promise. When the promise is resolved the resulting value
will be set to the `PromiseArray`'s `content` property. This makes
it easy to create data bindings with the `PromiseArray` that will be
updated when the promise resolves.
For more information see the [Ember.PromiseProxyMixin
documentation](/api/classes/Ember.PromiseProxyMixin.html).
Example
```javascript
var promiseArray = DS.PromiseArray.create({
promise: $.getJSON('/some/remote/data.json')
});
promiseArray.get('length'); // 0
promiseArray.then(function() {
promiseArray.get('length'); // 100
});
```
@class PromiseArray
@namespace DS
@extends Ember.ArrayProxy
@uses Ember.PromiseProxyMixin
*/
var ember$data$lib$system$promise$proxies$$PromiseArray = Ember.ArrayProxy.extend(Ember.PromiseProxyMixin);
/**
A `PromiseObject` is an object that acts like both an `Ember.Object`
and a promise. When the promise is resolved, then the resulting value
will be set to the `PromiseObject`'s `content` property. This makes
it easy to create data bindings with the `PromiseObject` that will
be updated when the promise resolves.
For more information see the [Ember.PromiseProxyMixin
documentation](/api/classes/Ember.PromiseProxyMixin.html).
Example
```javascript
var promiseObject = DS.PromiseObject.create({
promise: $.getJSON('/some/remote/data.json')
});
promiseObject.get('name'); // null
promiseObject.then(function() {
promiseObject.get('name'); // 'Tomster'
});
```
@class PromiseObject
@namespace DS
@extends Ember.ObjectProxy
@uses Ember.PromiseProxyMixin
*/
var ember$data$lib$system$promise$proxies$$PromiseObject = Ember.ObjectProxy.extend(Ember.PromiseProxyMixin);
var ember$data$lib$system$promise$proxies$$promiseObject = function (promise, label) {
return ember$data$lib$system$promise$proxies$$PromiseObject.create({
promise: ember$data$lib$system$promise$proxies$$Promise.resolve(promise, label)
});
};
var ember$data$lib$system$promise$proxies$$promiseArray = function (promise, label) {
return ember$data$lib$system$promise$proxies$$PromiseArray.create({
promise: ember$data$lib$system$promise$proxies$$Promise.resolve(promise, label)
});
};
/**
A PromiseManyArray is a PromiseArray that also proxies certain method calls
to the underlying manyArray.
Right now we proxy:
* `reload()`
* `createRecord()`
* `on()`
* `one()`
* `trigger()`
* `off()`
* `has()`
@class PromiseManyArray
@namespace DS
@extends Ember.ArrayProxy
*/
function ember$data$lib$system$promise$proxies$$proxyToContent(method) {
return function () {
var content = ember$data$lib$system$promise$proxies$$get(this, 'content');
return content[method].apply(content, arguments);
};
}
var ember$data$lib$system$promise$proxies$$PromiseManyArray = ember$data$lib$system$promise$proxies$$PromiseArray.extend({
reload: function () {
//I don't think this should ever happen right now, but worth guarding if we refactor the async relationships
Ember.assert('You are trying to reload an async manyArray before it has been created', ember$data$lib$system$promise$proxies$$get(this, 'content'));
return ember$data$lib$system$promise$proxies$$PromiseManyArray.create({
promise: ember$data$lib$system$promise$proxies$$get(this, 'content').reload()
});
},
createRecord: ember$data$lib$system$promise$proxies$$proxyToContent('createRecord'),
on: ember$data$lib$system$promise$proxies$$proxyToContent('on'),
one: ember$data$lib$system$promise$proxies$$proxyToContent('one'),
trigger: ember$data$lib$system$promise$proxies$$proxyToContent('trigger'),
off: ember$data$lib$system$promise$proxies$$proxyToContent('off'),
has: ember$data$lib$system$promise$proxies$$proxyToContent('has')
});
var ember$data$lib$system$promise$proxies$$promiseManyArray = function (promise, label) {
return ember$data$lib$system$promise$proxies$$PromiseManyArray.create({
promise: ember$data$lib$system$promise$proxies$$Promise.resolve(promise, label)
});
};
var ember$data$lib$system$model$errors$$get = Ember.get;
var ember$data$lib$system$model$errors$$isEmpty = Ember.isEmpty;
var ember$data$lib$system$model$errors$$map = Ember.ArrayPolyfills.map;
var ember$data$lib$system$model$errors$$default = Ember.Object.extend(Ember.Enumerable, Ember.Evented, {
/**
Register with target handler
@method registerHandlers
@param {Object} target
@param {Function} becameInvalid
@param {Function} becameValid
*/
registerHandlers: function (target, becameInvalid, becameValid) {
this.on('becameInvalid', target, becameInvalid);
this.on('becameValid', target, becameValid);
},
/**
@property errorsByAttributeName
@type {Ember.MapWithDefault}
@private
*/
errorsByAttributeName: Ember.computed(function () {
return ember$data$lib$system$map$$MapWithDefault.create({
defaultValue: function () {
return Ember.A();
}
});
}),
/**
Returns errors for a given attribute
```javascript
var user = store.createRecord('user', {
username: 'tomster',
email: 'invalidEmail'
});
user.save().catch(function(){
user.get('errors').errorsFor('email'); // returns:
// [{attribute: "email", message: "Doesn't look like a valid email."}]
});
```
@method errorsFor
@param {String} attribute
@return {Array}
*/
errorsFor: function (attribute) {
return ember$data$lib$system$model$errors$$get(this, 'errorsByAttributeName').get(attribute);
},
/**
An array containing all of the error messages for this
record. This is useful for displaying all errors to the user.
```handlebars
{{#each model.errors.messages as |message|}}
<div class="error">
{{message}}
</div>
{{/each}}
```
@property messages
@type {Array}
*/
messages: Ember.computed.mapBy('content', 'message'),
/**
@property content
@type {Array}
@private
*/
content: Ember.computed(function () {
return Ember.A();
}),
/**
@method unknownProperty
@private
*/
unknownProperty: function (attribute) {
var errors = this.errorsFor(attribute);
if (ember$data$lib$system$model$errors$$isEmpty(errors)) {
return null;
}
return errors;
},
/**
@method nextObject
@private
*/
nextObject: function (index, previousObject, context) {
return ember$data$lib$system$model$errors$$get(this, 'content').objectAt(index);
},
/**
Total number of errors.
@property length
@type {Number}
@readOnly
*/
length: Ember.computed.oneWay('content.length').readOnly(),
/**
@property isEmpty
@type {Boolean}
@readOnly
*/
isEmpty: Ember.computed.not('length').readOnly(),
/**
Adds error messages to a given attribute and sends
`becameInvalid` event to the record.
Example:
```javascript
if (!user.get('username') {
user.get('errors').add('username', 'This field is required');
}
```
@method add
@param {String} attribute
@param {(Array|String)} messages
*/
add: function (attribute, messages) {
var wasEmpty = ember$data$lib$system$model$errors$$get(this, 'isEmpty');
messages = this._findOrCreateMessages(attribute, messages);
ember$data$lib$system$model$errors$$get(this, 'content').addObjects(messages);
ember$data$lib$system$model$errors$$get(this, 'errorsByAttributeName').get(attribute).addObjects(messages);
this.notifyPropertyChange(attribute);
this.enumerableContentDidChange();
if (wasEmpty && !ember$data$lib$system$model$errors$$get(this, 'isEmpty')) {
this.trigger('becameInvalid');
}
},
/**
@method _findOrCreateMessages
@private
*/
_findOrCreateMessages: function (attribute, messages) {
var errors = this.errorsFor(attribute);
return ember$data$lib$system$model$errors$$map.call(Ember.makeArray(messages), function (message) {
return errors.findBy('message', message) || {
attribute: attribute,
message: message
};
});
},
/**
Removes all error messages from the given attribute and sends
`becameValid` event to the record if there no more errors left.
Example:
```app/models/user.js
import DS from 'ember-data';
export default DS.Model.extend({
email: DS.attr('string'),
twoFactorAuth: DS.attr('boolean'),
phone: DS.attr('string')
});
```
```app/routes/user/edit.js
import Ember from 'ember';
export default Ember.Route.extend({
actions: {
save: function(user) {
if (!user.get('twoFactorAuth')) {
user.get('errors').remove('phone');
}
user.save();
}
}
});
```
@method remove
@param {String} attribute
*/
remove: function (attribute) {
if (ember$data$lib$system$model$errors$$get(this, 'isEmpty')) {
return;
}
var content = ember$data$lib$system$model$errors$$get(this, 'content').rejectBy('attribute', attribute);
ember$data$lib$system$model$errors$$get(this, 'content').setObjects(content);
ember$data$lib$system$model$errors$$get(this, 'errorsByAttributeName')["delete"](attribute);
this.notifyPropertyChange(attribute);
this.enumerableContentDidChange();
if (ember$data$lib$system$model$errors$$get(this, 'isEmpty')) {
this.trigger('becameValid');
}
},
/**
Removes all error messages and sends `becameValid` event
to the record.
Example:
```app/routes/user/edit.js
import Ember from 'ember';
export default Ember.Route.extend({
actions: {
retrySave: function(user) {
user.get('errors').clear();
user.save();
}
}
});
```
@method clear
*/
clear: function () {
if (ember$data$lib$system$model$errors$$get(this, 'isEmpty')) {
return;
}
ember$data$lib$system$model$errors$$get(this, 'content').clear();
ember$data$lib$system$model$errors$$get(this, 'errorsByAttributeName').clear();
this.enumerableContentDidChange();
this.trigger('becameValid');
},
/**
Checks if there is error messages for the given attribute.
```app/routes/user/edit.js
import Ember from 'ember';
export default Ember.Route.extend({
actions: {
save: function(user) {
if (user.get('errors').has('email')) {
return alert('Please update your email before attempting to save.');
}
user.save();
}
}
});
```
@method has
@param {String} attribute
@return {Boolean} true if there some errors on given attribute
*/
has: function (attribute) {
return !ember$data$lib$system$model$errors$$isEmpty(this.errorsFor(attribute));
}
});
/**
@module ember-data
*/
var ember$data$lib$system$model$model$$get = Ember.get;
var ember$data$lib$system$model$model$$forEach = Ember.ArrayPolyfills.forEach;
var ember$data$lib$system$model$model$$indexOf = Ember.ArrayPolyfills.indexOf;
function ember$data$lib$system$model$model$$intersection(array1, array2) {
var result = [];
ember$data$lib$system$model$model$$forEach.call(array1, function (element) {
if (ember$data$lib$system$model$model$$indexOf.call(array2, element) >= 0) {
result.push(element);
}
});
return result;
}
var ember$data$lib$system$model$model$$RESERVED_MODEL_PROPS = ["currentState", "data", "store"];
var ember$data$lib$system$model$model$$retrieveFromCurrentState = Ember.computed("currentState", function (key) {
return ember$data$lib$system$model$model$$get(this._internalModel.currentState, key);
}).readOnly();
/**
The model class that all Ember Data records descend from.
This is the public API of Ember Data models. If you are using Ember Data
in your application, this is the class you should use.
If you are working on Ember Data internals, you most likely want to be dealing
with `InternalModel`
@class Model
@namespace DS
@extends Ember.Object
@uses Ember.Evented
*/
var ember$data$lib$system$model$model$$Model = Ember.Object.extend(Ember.Evented, {
_recordArrays: undefined,
_relationships: undefined,
_internalModel: null,
store: null,
/**
If this property is `true` the record is in the `empty`
state. Empty is the first state all records enter after they have
been created. Most records created by the store will quickly
transition to the `loading` state if data needs to be fetched from
the server or the `created` state if the record is created on the
client. A record can also enter the empty state if the adapter is
unable to locate the record.
@property isEmpty
@type {Boolean}
@readOnly
*/
isEmpty: ember$data$lib$system$model$model$$retrieveFromCurrentState,
/**
If this property is `true` the record is in the `loading` state. A
record enters this state when the store asks the adapter for its
data. It remains in this state until the adapter provides the
requested data.
@property isLoading
@type {Boolean}
@readOnly
*/
isLoading: ember$data$lib$system$model$model$$retrieveFromCurrentState,
/**
If this property is `true` the record is in the `loaded` state. A
record enters this state when its data is populated. Most of a
record's lifecycle is spent inside substates of the `loaded`
state.
Example
```javascript
var record = store.createRecord('model');
record.get('isLoaded'); // true
store.find('model', 1).then(function(model) {
model.get('isLoaded'); // true
});
```
@property isLoaded
@type {Boolean}
@readOnly
*/
isLoaded: ember$data$lib$system$model$model$$retrieveFromCurrentState,
/**
If this property is `true` the record is in the `dirty` state. The
record has local changes that have not yet been saved by the
adapter. This includes records that have been created (but not yet
saved) or deleted.
Example
```javascript
var record = store.createRecord('model');
record.get('isDirty'); // true
store.find('model', 1).then(function(model) {
model.get('isDirty'); // false
model.set('foo', 'some value');
model.get('isDirty'); // true
});
```
@property isDirty
@type {Boolean}
@readOnly
@deprecated
*/
isDirty: Ember.computed("currentState.isDirty", function () {
Ember.deprecate("DS.Model#isDirty has been deprecated please use hasDirtyAttributes instead");
return this.get("currentState.isDirty");
}),
/**
If this property is `true` the record is in the `dirty` state. The
record has local changes that have not yet been saved by the
adapter. This includes records that have been created (but not yet
saved) or deleted.
Example
```javascript
var record = store.createRecord('model');
record.get('hasDirtyAttributes'); // true
store.find('model', 1).then(function(model) {
model.get('hasDirtyAttributes'); // false
model.set('foo', 'some value');
model.get('hasDirtyAttributes'); // true
});
```
@property hasDirtyAttributes
@type {Boolean}
@readOnly
*/
hasDirtyAttributes: Ember.computed("currentState.isDirty", function () {
return this.get("currentState.isDirty");
}),
/**
If this property is `true` the record is in the `saving` state. A
record enters the saving state when `save` is called, but the
adapter has not yet acknowledged that the changes have been
persisted to the backend.
Example
```javascript
var record = store.createRecord('model');
record.get('isSaving'); // false
var promise = record.save();
record.get('isSaving'); // true
promise.then(function() {
record.get('isSaving'); // false
});
```
@property isSaving
@type {Boolean}
@readOnly
*/
isSaving: ember$data$lib$system$model$model$$retrieveFromCurrentState,
/**
If this property is `true` the record is in the `deleted` state
and has been marked for deletion. When `isDeleted` is true and
`isDirty` is true, the record is deleted locally but the deletion
was not yet persisted. When `isSaving` is true, the change is
in-flight. When both `isDirty` and `isSaving` are false, the
change has persisted.
Example
```javascript
var record = store.createRecord('model');
record.get('isDeleted'); // false
record.deleteRecord();
// Locally deleted
record.get('isDeleted'); // true
record.get('isDirty'); // true
record.get('isSaving'); // false
// Persisting the deletion
var promise = record.save();
record.get('isDeleted'); // true
record.get('isSaving'); // true
// Deletion Persisted
promise.then(function() {
record.get('isDeleted'); // true
record.get('isSaving'); // false
record.get('isDirty'); // false
});
```
@property isDeleted
@type {Boolean}
@readOnly
*/
isDeleted: ember$data$lib$system$model$model$$retrieveFromCurrentState,
/**
If this property is `true` the record is in the `new` state. A
record will be in the `new` state when it has been created on the
client and the adapter has not yet report that it was successfully
saved.
Example
```javascript
var record = store.createRecord('model');
record.get('isNew'); // true
record.save().then(function(model) {
model.get('isNew'); // false
});
```
@property isNew
@type {Boolean}
@readOnly
*/
isNew: ember$data$lib$system$model$model$$retrieveFromCurrentState,
/**
If this property is `true` the record is in the `valid` state.
A record will be in the `valid` state when the adapter did not report any
server-side validation failures.
@property isValid
@type {Boolean}
@readOnly
*/
isValid: ember$data$lib$system$model$model$$retrieveFromCurrentState,
/**
If the record is in the dirty state this property will report what
kind of change has caused it to move into the dirty
state. Possible values are:
- `created` The record has been created by the client and not yet saved to the adapter.
- `updated` The record has been updated by the client and not yet saved to the adapter.
- `deleted` The record has been deleted by the client and not yet saved to the adapter.
Example
```javascript
var record = store.createRecord('model');
record.get('dirtyType'); // 'created'
```
@property dirtyType
@type {String}
@readOnly
*/
dirtyType: ember$data$lib$system$model$model$$retrieveFromCurrentState,
/**
If `true` the adapter reported that it was unable to save local
changes to the backend for any reason other than a server-side
validation error.
Example
```javascript
record.get('isError'); // false
record.set('foo', 'valid value');
record.save().then(null, function() {
record.get('isError'); // true
});
```
@property isError
@type {Boolean}
@readOnly
*/
isError: false,
/**
If `true` the store is attempting to reload the record form the adapter.
Example
```javascript
record.get('isReloading'); // false
record.reload();
record.get('isReloading'); // true
```
@property isReloading
@type {Boolean}
@readOnly
*/
isReloading: false,
/**
All ember models have an id property. This is an identifier
managed by an external source. These are always coerced to be
strings before being used internally. Note when declaring the
attributes for a model it is an error to declare an id
attribute.
```javascript
var record = store.createRecord('model');
record.get('id'); // null
store.find('model', 1).then(function(model) {
model.get('id'); // '1'
});
```
@property id
@type {String}
*/
id: null,
/**
@property currentState
@private
@type {Object}
*/
/**
When the record is in the `invalid` state this object will contain
any errors returned by the adapter. When present the errors hash
contains keys corresponding to the invalid property names
and values which are arrays of Javascript objects with two keys:
- `message` A string containing the error message from the backend
- `attribute` The name of the property associated with this error message
```javascript
record.get('errors.length'); // 0
record.set('foo', 'invalid value');
record.save().catch(function() {
record.get('errors').get('foo');
// [{message: 'foo should be a number.', attribute: 'foo'}]
});
```
The `errors` property us useful for displaying error messages to
the user.
```handlebars
<label>Username: {{input value=username}} </label>
{{#each model.errors.username as |error|}}
<div class="error">
{{error.message}}
</div>
{{/each}}
<label>Email: {{input value=email}} </label>
{{#each model.errors.email as |error|}}
<div class="error">
{{error.message}}
</div>
{{/each}}
```
You can also access the special `messages` property on the error
object to get an array of all the error strings.
```handlebars
{{#each model.errors.messages as |message|}}
<div class="error">
{{message}}
</div>
{{/each}}
```
@property errors
@type {DS.Errors}
*/
errors: Ember.computed(function () {
var errors = ember$data$lib$system$model$errors$$default.create();
errors.registerHandlers(this._internalModel, function () {
this.send("becameInvalid");
}, function () {
this.send("becameValid");
});
return errors;
}).readOnly(),
/**
Create a JSON representation of the record, using the serialization
strategy of the store's adapter.
`serialize` takes an optional hash as a parameter, currently
supported options are:
- `includeId`: `true` if the record's ID should be included in the
JSON representation.
@method serialize
@param {Object} options
@return {Object} an object whose values are primitive JSON values only
*/
serialize: function (options) {
return this.store.serialize(this, options);
},
/**
Use [DS.JSONSerializer](DS.JSONSerializer.html) to
get the JSON representation of a record.
`toJSON` takes an optional hash as a parameter, currently
supported options are:
- `includeId`: `true` if the record's ID should be included in the
JSON representation.
@method toJSON
@param {Object} options
@return {Object} A JSON representation of the object.
*/
toJSON: function (options) {
// container is for lazy transform lookups
var serializer = this.store.serializerFor("-default");
var snapshot = this._internalModel.createSnapshot();
return serializer.serialize(snapshot, options);
},
/**
Fired when the record is ready to be interacted with,
that is either loaded from the server or created locally.
@event ready
*/
ready: Ember.K,
/**
Fired when the record is loaded from the server.
@event didLoad
*/
didLoad: Ember.K,
/**
Fired when the record is updated.
@event didUpdate
*/
didUpdate: Ember.K,
/**
Fired when a new record is commited to the server.
@event didCreate
*/
didCreate: Ember.K,
/**
Fired when the record is deleted.
@event didDelete
*/
didDelete: Ember.K,
/**
Fired when the record becomes invalid.
@event becameInvalid
*/
becameInvalid: Ember.K,
/**
Fired when the record enters the error state.
@event becameError
*/
becameError: Ember.K,
/**
Fired when the record is rolled back.
@event rolledBack
*/
rolledBack: Ember.K,
/**
@property data
@private
@type {Object}
*/
data: Ember.computed.readOnly("_internalModel._data"),
//TODO Do we want to deprecate these?
/**
@method send
@private
@param {String} name
@param {Object} context
*/
send: function (name, context) {
return this._internalModel.send(name, context);
},
/**
@method transitionTo
@private
@param {String} name
*/
transitionTo: function (name) {
return this._internalModel.transitionTo(name);
},
/**
Marks the record as deleted but does not save it. You must call
`save` afterwards if you want to persist it. You might use this
method if you want to allow the user to still `rollbackAttributes()`
after a delete it was made.
Example
```app/routes/model/delete.js
import Ember from 'ember';
export default Ember.Route.extend({
actions: {
softDelete: function() {
this.controller.get('model').deleteRecord();
},
confirm: function() {
this.controller.get('model').save();
},
undo: function() {
this.controller.get('model').rollbackAttributes();
}
}
});
```
@method deleteRecord
*/
deleteRecord: function () {
this._internalModel.deleteRecord();
},
/**
Same as `deleteRecord`, but saves the record immediately.
Example
```app/routes/model/delete.js
import Ember from 'ember';
export default Ember.Route.extend({
actions: {
delete: function() {
var controller = this.controller;
controller.get('model').destroyRecord().then(function() {
controller.transitionToRoute('model.index');
});
}
}
});
```
@method destroyRecord
@param {Object} options
@return {Promise} a promise that will be resolved when the adapter returns
successfully or rejected if the adapter returns with an error.
*/
destroyRecord: function (options) {
this.deleteRecord();
return this.save(options);
},
/**
@method unloadRecord
@private
*/
unloadRecord: function () {
if (this.isDestroyed) {
return;
}
this._internalModel.unloadRecord();
},
/**
@method _notifyProperties
@private
*/
_notifyProperties: function (keys) {
Ember.beginPropertyChanges();
var key;
for (var i = 0, length = keys.length; i < length; i++) {
key = keys[i];
this.notifyPropertyChange(key);
}
Ember.endPropertyChanges();
},
/**
Returns an object, whose keys are changed properties, and value is
an [oldProp, newProp] array.
Example
```app/models/mascot.js
import DS from 'ember-data';
export default DS.Model.extend({
name: attr('string')
});
```
```javascript
var mascot = store.createRecord('mascot');
mascot.changedAttributes(); // {}
mascot.set('name', 'Tomster');
mascot.changedAttributes(); // {name: [undefined, 'Tomster']}
```
@method changedAttributes
@return {Object} an object, whose keys are changed properties,
and value is an [oldProp, newProp] array.
*/
changedAttributes: function () {
var oldData = ember$data$lib$system$model$model$$get(this._internalModel, "_data");
var newData = ember$data$lib$system$model$model$$get(this._internalModel, "_attributes");
var diffData = Ember.create(null);
var newDataKeys = Ember.keys(newData);
for (var i = 0, _length = newDataKeys.length; i < _length; i++) {
var key = newDataKeys[i];
diffData[key] = [oldData[key], newData[key]];
}
return diffData;
},
//TODO discuss with tomhuda about events/hooks
//Bring back as hooks?
/**
@method adapterWillCommit
@private
adapterWillCommit: function() {
this.send('willCommit');
},
/**
@method adapterDidDirty
@private
adapterDidDirty: function() {
this.send('becomeDirty');
this.updateRecordArraysLater();
},
*/
/**
If the model `isDirty` this function will discard any unsaved
changes. If the model `isNew` it will be removed from the store.
Example
```javascript
record.get('name'); // 'Untitled Document'
record.set('name', 'Doc 1');
record.get('name'); // 'Doc 1'
record.rollback();
record.get('name'); // 'Untitled Document'
```
@method rollback
@deprecated Use `rollbackAttributes()` instead
*/
rollback: function () {
Ember.deprecate("Using model.rollback() has been deprecated. Use model.rollbackAttributes() to discard any unsaved changes to a model.");
this.rollbackAttributes();
},
/**
If the model `isDirty` this function will discard any unsaved
changes. If the model `isNew` it will be removed from the store.
Example
```javascript
record.get('name'); // 'Untitled Document'
record.set('name', 'Doc 1');
record.get('name'); // 'Doc 1'
record.rollbackAttributes();
record.get('name'); // 'Untitled Document'
```
@method rollbackAttributes
*/
rollbackAttributes: function () {
this._internalModel.rollbackAttributes();
},
/*
@method _createSnapshot
@private
*/
_createSnapshot: function () {
return this._internalModel.createSnapshot();
},
toStringExtension: function () {
return ember$data$lib$system$model$model$$get(this, "id");
},
/**
Save the record and persist any changes to the record to an
external source via the adapter.
Example
```javascript
record.set('name', 'Tomster');
record.save().then(function() {
// Success callback
}, function() {
// Error callback
});
```
@method save
@param {Object} options
@return {Promise} a promise that will be resolved when the adapter returns
successfully or rejected if the adapter returns with an error.
*/
save: function (options) {
var model = this;
return ember$data$lib$system$promise$proxies$$PromiseObject.create({
promise: this._internalModel.save(options).then(function () {
return model;
})
});
},
/**
Reload the record from the adapter.
This will only work if the record has already finished loading
and has not yet been modified (`isLoaded` but not `isDirty`,
or `isSaving`).
Example
```app/routes/model/view.js
import Ember from 'ember';
export default Ember.Route.extend({
actions: {
reload: function() {
this.controller.get('model').reload().then(function(model) {
// do something with the reloaded model
});
}
}
});
```
@method reload
@return {Promise} a promise that will be resolved with the record when the
adapter returns successfully or rejected if the adapter returns
with an error.
*/
reload: function () {
var model = this;
return ember$data$lib$system$promise$proxies$$PromiseObject.create({
promise: this._internalModel.reload().then(function () {
return model;
})
});
},
/**
Override the default event firing from Ember.Evented to
also call methods with the given name.
@method trigger
@private
@param {String} name
*/
trigger: function (name) {
var length = arguments.length;
var args = new Array(length - 1);
for (var i = 1; i < length; i++) {
args[i - 1] = arguments[i];
}
Ember.tryInvoke(this, name, args);
this._super.apply(this, arguments);
},
willDestroy: function () {
//TODO Move!
this._internalModel.clearRelationships();
this._internalModel.recordObjectWillDestroy();
this._super.apply(this, arguments);
//TODO should we set internalModel to null here?
},
// This is a temporary solution until we refactor DS.Model to not
// rely on the data property.
willMergeMixin: function (props) {
var constructor = this.constructor;
Ember.assert("`" + ember$data$lib$system$model$model$$intersection(Ember.keys(props), ember$data$lib$system$model$model$$RESERVED_MODEL_PROPS)[0] + "` is a reserved property name on DS.Model objects. Please choose a different property name for " + constructor.toString(), !ember$data$lib$system$model$model$$intersection(Ember.keys(props), ember$data$lib$system$model$model$$RESERVED_MODEL_PROPS)[0]);
},
attr: function () {
Ember.assert("The `attr` method is not available on DS.Model, a DS.Snapshot was probably expected. Are you passing a DS.Model instead of a DS.Snapshot to your serializer?", false);
},
belongsTo: function () {
Ember.assert("The `belongsTo` method is not available on DS.Model, a DS.Snapshot was probably expected. Are you passing a DS.Model instead of a DS.Snapshot to your serializer?", false);
},
hasMany: function () {
Ember.assert("The `hasMany` method is not available on DS.Model, a DS.Snapshot was probably expected. Are you passing a DS.Model instead of a DS.Snapshot to your serializer?", false);
}
});
ember$data$lib$system$model$model$$Model.reopenClass({
/**
Alias DS.Model's `create` method to `_create`. This allows us to create DS.Model
instances from within the store, but if end users accidentally call `create()`
(instead of `createRecord()`), we can raise an error.
@method _create
@private
@static
*/
_create: ember$data$lib$system$model$model$$Model.create,
/**
Override the class' `create()` method to raise an error. This
prevents end users from inadvertently calling `create()` instead
of `createRecord()`. The store is still able to create instances
by calling the `_create()` method. To create an instance of a
`DS.Model` use [store.createRecord](DS.Store.html#method_createRecord).
@method create
@private
@static
*/
create: function () {
throw new Ember.Error("You should not call `create` on a model. Instead, call `store.createRecord` with the attributes you would like to set.");
},
/**
Represents the model's class name as a string. This can be used to look up the model through
DS.Store's modelFor method.
`modelName` is generated for you by Ember Data. It will be a lowercased, dasherized string.
For example:
```javascript
store.modelFor('post').modelName; // 'post'
store.modelFor('blog-post').modelName; // 'blog-post'
```
The most common place you'll want to access `modelName` is in your serializer's `payloadKeyFromModelName` method. For example, to change payload
keys to underscore (instead of dasherized), you might use the following code:
```javascript
export default var PostSerializer = DS.RESTSerializer.extend({
payloadKeyFromModelName: function(modelName) {
return Ember.String.underscore(modelName);
}
});
```
@property
@type String
@readonly
*/
modelName: null
});
var ember$data$lib$system$model$model$$default = ember$data$lib$system$model$model$$Model;
var ember$data$lib$system$store$serializer$response$$forEach = Ember.ArrayPolyfills.forEach;
var ember$data$lib$system$store$serializer$response$$map = Ember.ArrayPolyfills.map;
var ember$data$lib$system$store$serializer$response$$get = Ember.get;
/**
This is a helper method that always returns a JSON-API Document.
If the current serializer has `isNewSerializerAPI` set to `true`
this helper calls `normalizeResponse` instead of `extract`.
All the built-in serializers get `isNewSerializerAPI` set to `true` automatically
if the feature flag is enabled.
@method normalizeResponseHelper
@param {DS.Serializer} serializer
@param {DS.Store} store
@param {subclass of DS.Model} modelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@return {Object} JSON-API Document
*/
function ember$data$lib$system$store$serializer$response$$normalizeResponseHelper(serializer, store, modelClass, payload, id, requestType) {
if (serializer.get('isNewSerializerAPI')) {
var normalizedResponse = serializer.normalizeResponse(store, modelClass, payload, id, requestType);
// TODO: Remove after metadata refactor
if (normalizedResponse.meta) {
store._setMetadataFor(modelClass.modelName, normalizedResponse.meta);
}
return normalizedResponse;
} else {
Ember.deprecate('Your custom serializer uses the old version of the Serializer API, with `extract` hooks. Please upgrade your serializers to the new Serializer API using `normalizeResponse` hooks instead.');
var serializerPayload = serializer.extract(store, modelClass, payload, id, requestType);
return ember$data$lib$system$store$serializer$response$$_normalizeSerializerPayload(modelClass, serializerPayload);
}
}
/**
Convert the payload from `serializer.extract` to a JSON-API Document.
@method _normalizeSerializerPayload
@private
@param {subclass of DS.Model} modelClass
@param {Object} payload
@return {Object} JSON-API Document
*/
function ember$data$lib$system$store$serializer$response$$_normalizeSerializerPayload(modelClass, payload) {
var data = null;
if (payload) {
if (Ember.typeOf(payload) === 'array') {
data = ember$data$lib$system$store$serializer$response$$map.call(payload, function (payload) {
return ember$data$lib$system$store$serializer$response$$_normalizeSerializerPayloadItem(modelClass, payload);
});
} else {
data = ember$data$lib$system$store$serializer$response$$_normalizeSerializerPayloadItem(modelClass, payload);
}
}
return { data: data };
}
/**
Convert the payload representing a single record from `serializer.extract` to
a JSON-API Resource Object.
@method _normalizeSerializerPayloadItem
@private
@param {subclass of DS.Model} modelClass
@param {Object} payload
@return {Object} JSON-API Resource Object
*/
function ember$data$lib$system$store$serializer$response$$_normalizeSerializerPayloadItem(modelClass, itemPayload) {
var item = {};
item.id = '' + itemPayload.id;
item.type = modelClass.modelName;
item.attributes = {};
item.relationships = {};
modelClass.eachAttribute(function (name) {
if (itemPayload.hasOwnProperty(name)) {
item.attributes[name] = itemPayload[name];
}
});
modelClass.eachRelationship(function (key, relationshipMeta) {
var relationship, value;
if (itemPayload.hasOwnProperty(key)) {
var relationshipData;
(function () {
relationship = {};
value = itemPayload[key];
var normalizeRelationshipData = function (value, relationshipMeta) {
if (Ember.isNone(value)) {
return null;
}
//Temporary support for https://github.com/emberjs/data/issues/3271
if (value instanceof ember$data$lib$system$model$model$$default) {
value = { id: value.id, type: value.constructor.modelName };
}
if (Ember.typeOf(value) === 'object') {
Ember.assert('Ember Data expected a number or string to represent the record(s) in the `' + key + '` relationship instead it found an object. If this is a polymorphic relationship please specify a `type` key. If this is an embedded relationship please include the `DS.EmbeddedRecordsMixin` and specify the `' + key + '` property in your serializer\'s attrs object.', value.type);
if (value.id) {
value.id = '' + value.id;
}
return value;
}
Ember.assert('A ' + relationshipMeta.parentType + ' record was pushed into the store with the value of ' + key + ' being ' + Ember.inspect(value) + ', but ' + key + ' is a belongsTo relationship so the value must not be an array. You should probably check your data payload or serializer.', !Ember.isArray(value));
return { id: '' + value, type: relationshipMeta.type };
};
if (relationshipMeta.kind === 'belongsTo') {
relationship.data = normalizeRelationshipData(value, relationshipMeta);
//handle the belongsTo polymorphic case, where { post:1, postType: 'video' }
if (relationshipMeta.options && relationshipMeta.options.polymorphic && itemPayload[key + 'Type']) {
relationship.data.type = itemPayload[key + 'Type'];
}
} else if (relationshipMeta.kind === 'hasMany') {
//|| [] because the hasMany could be === null
Ember.assert('A ' + relationshipMeta.parentType + ' record was pushed into the store with the value of ' + key + ' being \'' + Ember.inspect(value) + '\', but ' + key + ' is a hasMany relationship so the value must be an array. You should probably check your data payload or serializer.', Ember.isArray(value) || value === null);
relationshipData = Ember.A(value || []);
relationship.data = ember$data$lib$system$store$serializer$response$$map.call(relationshipData, function (item) {
return normalizeRelationshipData(item, relationshipMeta);
});
}
})();
}
if (itemPayload.links && itemPayload.links.hasOwnProperty(key)) {
relationship = relationship || {};
value = itemPayload.links[key];
relationship.links = {
related: value
};
}
if (relationship) {
relationship.meta = ember$data$lib$system$store$serializer$response$$get(itemPayload, 'meta.' + key);
item.relationships[key] = relationship;
}
});
return item;
}
/**
Push a JSON-API Document to the store.
This will push both primary data located in `data` and secondary data located
in `included` (if present).
@method pushPayload
@param {DS.Store} store
@param {Object} payload
@return {DS.Model|Array} one or multiple records from `data`
*/
function ember$data$lib$system$store$serializer$response$$pushPayload(store, payload) {
var result = ember$data$lib$system$store$serializer$response$$pushPayloadData(store, payload);
ember$data$lib$system$store$serializer$response$$pushPayloadIncluded(store, payload);
return result;
}
/**
Push the primary data of a JSON-API Document to the store.
This method only pushes the primary data located in `data`.
@method pushPayloadData
@param {DS.Store} store
@param {Object} payload
@return {DS.Model|Array} one or multiple records from `data`
*/
function ember$data$lib$system$store$serializer$response$$pushPayloadData(store, payload) {
var result;
if (payload && payload.data) {
if (Ember.isArray(payload.data)) {
result = ember$data$lib$system$store$serializer$response$$map.call(payload.data, function (item) {
return ember$data$lib$system$store$serializer$response$$_pushResourceObject(store, item);
});
} else {
result = ember$data$lib$system$store$serializer$response$$_pushResourceObject(store, payload.data);
}
}
return result;
}
/**
Push the secondary data of a JSON-API Document to the store.
This method only pushes the secondary data located in `included`.
@method pushPayloadIncluded
@param {DS.Store} store
@param {Object} payload
@return {Array} an array containing zero or more records from `included`
*/
function ember$data$lib$system$store$serializer$response$$pushPayloadIncluded(store, payload) {
var result;
if (payload && payload.included && Ember.isArray(payload.included)) {
result = ember$data$lib$system$store$serializer$response$$map.call(payload.included, function (item) {
return ember$data$lib$system$store$serializer$response$$_pushResourceObject(store, item);
});
}
return result;
}
/**
Push a single JSON-API Resource Object to the store.
@method _pushResourceObject
@private
@param {Object} resourceObject
@return {DS.Model} a record
*/
function ember$data$lib$system$store$serializer$response$$_pushResourceObject(store, resourceObject) {
return store.push({ data: resourceObject });
}
/**
This method converts a JSON-API Resource Object to a format that DS.Store
understands.
TODO: This method works as an interim until DS.Store understands JSON-API.
@method convertResourceObject
@param {Object} payload
@return {Object} an object formatted the way DS.Store understands
*/
function ember$data$lib$system$store$serializer$response$$convertResourceObject(payload) {
if (!payload) {
return payload;
}
var data = {
id: payload.id,
type: payload.type,
links: {}
};
if (payload.attributes) {
var attributeKeys = Ember.keys(payload.attributes);
ember$data$lib$system$store$serializer$response$$forEach.call(attributeKeys, function (key) {
var attribute = payload.attributes[key];
data[key] = attribute;
});
}
if (payload.relationships) {
var relationshipKeys = Ember.keys(payload.relationships);
ember$data$lib$system$store$serializer$response$$forEach.call(relationshipKeys, function (key) {
var relationship = payload.relationships[key];
if (relationship.hasOwnProperty('data')) {
data[key] = relationship.data;
} else if (relationship.links && relationship.links.related) {
data.links[key] = relationship.links.related;
}
});
}
return data;
}
var ember$data$lib$serializers$rest$serializer$$forEach = Ember.ArrayPolyfills.forEach;
var ember$data$lib$serializers$rest$serializer$$map = Ember.ArrayPolyfills.map;
var ember$data$lib$serializers$rest$serializer$$camelize = Ember.String.camelize;
var ember$data$lib$serializers$rest$serializer$$get = Ember.get;
/**
Normally, applications will use the `RESTSerializer` by implementing
the `normalize` method and individual normalizations under
`normalizeHash`.
This allows you to do whatever kind of munging you need, and is
especially useful if your server is inconsistent and you need to
do munging differently for many different kinds of responses.
See the `normalize` documentation for more information.
## Across the Board Normalization
There are also a number of hooks that you might find useful to define
across-the-board rules for your payload. These rules will be useful
if your server is consistent, or if you're building an adapter for
an infrastructure service, like Parse, and want to encode service
conventions.
For example, if all of your keys are underscored and all-caps, but
otherwise consistent with the names you use in your models, you
can implement across-the-board rules for how to convert an attribute
name in your model to a key in your JSON.
```app/serializers/application.js
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
keyForAttribute: function(attr, method) {
return Ember.String.underscore(attr).toUpperCase();
}
});
```
You can also implement `keyForRelationship`, which takes the name
of the relationship as the first parameter, the kind of
relationship (`hasMany` or `belongsTo`) as the second parameter, and
the method (`serialize` or `deserialize`) as the third parameter.
@class RESTSerializer
@namespace DS
@extends DS.JSONSerializer
*/
var ember$data$lib$serializers$rest$serializer$$RESTSerializer = ember$data$lib$serializers$json$serializer$$default.extend({
/**
If you want to do normalizations specific to some part of the payload, you
can specify those under `normalizeHash`.
For example, given the following json where the the `IDs` under
`"comments"` are provided as `_id` instead of `id`.
```javascript
{
"post": {
"id": 1,
"title": "Rails is omakase",
"comments": [ 1, 2 ]
},
"comments": [{
"_id": 1,
"body": "FIRST"
}, {
"_id": 2,
"body": "Rails is unagi"
}]
}
```
You use `normalizeHash` to normalize just the comments:
```app/serializers/post.js
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
normalizeHash: {
comments: function(hash) {
hash.id = hash._id;
delete hash._id;
return hash;
}
}
});
```
The key under `normalizeHash` is usually just the original key
that was in the original payload. However, key names will be
impacted by any modifications done in the `normalizePayload`
method. The `DS.RESTSerializer`'s default implementation makes no
changes to the payload keys.
@property normalizeHash
@type {Object}
@default undefined
*/
/**
Normalizes a part of the JSON payload returned by
the server. You should override this method, munge the hash
and call super if you have generic normalization to do.
It takes the type of the record that is being normalized
(as a DS.Model class), the property where the hash was
originally found, and the hash to normalize.
For example, if you have a payload that looks like this:
```js
{
"post": {
"id": 1,
"title": "Rails is omakase",
"comments": [ 1, 2 ]
},
"comments": [{
"id": 1,
"body": "FIRST"
}, {
"id": 2,
"body": "Rails is unagi"
}]
}
```
The `normalize` method will be called three times:
* With `App.Post`, `"posts"` and `{ id: 1, title: "Rails is omakase", ... }`
* With `App.Comment`, `"comments"` and `{ id: 1, body: "FIRST" }`
* With `App.Comment`, `"comments"` and `{ id: 2, body: "Rails is unagi" }`
You can use this method, for example, to normalize underscored keys to camelized
or other general-purpose normalizations.
If you want to do normalizations specific to some part of the payload, you
can specify those under `normalizeHash`.
For example, if the `IDs` under `"comments"` are provided as `_id` instead of
`id`, you can specify how to normalize just the comments:
```app/serializers/post.js
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
normalizeHash: {
comments: function(hash) {
hash.id = hash._id;
delete hash._id;
return hash;
}
}
});
```
The key under `normalizeHash` is just the original key that was in the original
payload.
@method normalize
@param {DS.Model} typeClass
@param {Object} hash
@param {String} prop
@return {Object}
*/
normalize: function (typeClass, hash, prop) {
if (this.get("isNewSerializerAPI")) {
ember$data$lib$serializers$rest$serializer$$_newNormalize.apply(this, arguments);
return this._super.apply(this, arguments);
}
this.normalizeId(hash);
this.normalizeAttributes(typeClass, hash);
this.normalizeRelationships(typeClass, hash);
this.normalizeUsingDeclaredMapping(typeClass, hash);
if (this.normalizeHash && this.normalizeHash[prop]) {
this.normalizeHash[prop](hash);
}
this.applyTransforms(typeClass, hash);
return hash;
},
/*
Normalizes an array of resource payloads and returns a JSON-API Document
with primary data and, if any, included data as `{ data, included }`.
@method normalizeArray
@param {DS.Store} store
@param {String} modelName
@param {Object} arrayHash
@param {String} prop
@return {Object}
*/
normalizeArray: function (store, modelName, arrayHash, prop) {
var documentHash = {
data: [],
included: []
};
var modelClass = store.modelFor(modelName);
var serializer = store.serializerFor(modelName);
Ember.assert("" + this.toString() + " has opted into the new serializer API and expects the " + serializer.toString() + " it collaborates with to also support the new serializer API by setting its `isNewSerializerAPI` property to true.", ember$data$lib$serializers$rest$serializer$$get(serializer, "isNewSerializerAPI"));
/*jshint loopfunc:true*/
ember$data$lib$serializers$rest$serializer$$forEach.call(arrayHash, function (hash) {
var _serializer$normalize = serializer.normalize(modelClass, hash, prop);
var data = _serializer$normalize.data;
var included = _serializer$normalize.included;
documentHash.data.push(data);
if (included) {
var _documentHash$included;
(_documentHash$included = documentHash.included).push.apply(_documentHash$included, included);
}
}, this);
return documentHash;
},
/*
@method _normalizeResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@param {Boolean} isSingle
@return {Object} JSON-API Document
@private
*/
_normalizeResponse: function (store, primaryModelClass, payload, id, requestType, isSingle) {
var documentHash = {
data: null,
included: []
};
var meta = this.extractMeta(store, primaryModelClass, payload);
if (meta) {
Ember.assert("The `meta` returned from `extractMeta` has to be an object, not \"" + Ember.typeOf(meta) + "\".", Ember.typeOf(meta) === "object");
documentHash.meta = meta;
}
var keys = Ember.keys(payload);
for (var i = 0, _length = keys.length; i < _length; i++) {
var prop = keys[i];
var modelName = prop;
var forcedSecondary = false;
/*
If you want to provide sideloaded records of the same type that the
primary data you can do that by prefixing the key with `_`.
Example
```
{
users: [
{ id: 1, title: 'Tom', manager: 3 },
{ id: 2, title: 'Yehuda', manager: 3 }
],
_users: [
{ id: 3, title: 'Tomster' }
]
}
```
This forces `_users` to be added to `included` instead of `data`.
*/
if (prop.charAt(0) === "_") {
forcedSecondary = true;
modelName = prop.substr(1);
}
var typeName = this.modelNameFromPayloadKey(modelName);
if (!store.modelFactoryFor(typeName)) {
Ember.warn(this.warnMessageNoModelForKey(modelName, typeName), false);
continue;
}
var isPrimary = !forcedSecondary && this.isPrimaryType(store, typeName, primaryModelClass);
var value = payload[prop];
if (value === null) {
continue;
}
/*
Support primary data as an object instead of an array.
Example
```
{
user: { id: 1, title: 'Tom', manager: 3 }
}
```
*/
if (isPrimary && Ember.typeOf(value) !== "array") {
var _normalize = this.normalize(primaryModelClass, value, prop);
var _data = _normalize.data;
var _included = _normalize.included;
documentHash.data = _data;
if (_included) {
var _documentHash$included2;
(_documentHash$included2 = documentHash.included).push.apply(_documentHash$included2, _included);
}
continue;
}
var _normalizeArray = this.normalizeArray(store, typeName, value, prop);
var data = _normalizeArray.data;
var included = _normalizeArray.included;
if (included) {
var _documentHash$included3;
(_documentHash$included3 = documentHash.included).push.apply(_documentHash$included3, included);
}
if (isSingle) {
/*jshint loopfunc:true*/
ember$data$lib$serializers$rest$serializer$$forEach.call(data, function (resource) {
/*
Figures out if this is the primary record or not.
It's either:
1. The record with the same ID as the original request
2. If it's a newly created record without an ID, the first record
in the array
*/
var isUpdatedRecord = isPrimary && ember$data$lib$system$coerce$id$$default(resource.id) === id;
var isFirstCreatedRecord = isPrimary && !id && !documentHash.data;
if (isFirstCreatedRecord || isUpdatedRecord) {
documentHash.data = resource;
} else {
documentHash.included.push(resource);
}
});
} else {
if (isPrimary) {
documentHash.data = data;
} else {
if (data) {
var _documentHash$included4;
(_documentHash$included4 = documentHash.included).push.apply(_documentHash$included4, data);
}
}
}
}
return documentHash;
},
/**
Called when the server has returned a payload representing
a single record, such as in response to a `find` or `save`.
It is your opportunity to clean up the server's response into the normalized
form expected by Ember Data.
If you want, you can just restructure the top-level of your payload, and
do more fine-grained normalization in the `normalize` method.
For example, if you have a payload like this in response to a request for
post 1:
```js
{
"id": 1,
"title": "Rails is omakase",
"_embedded": {
"comment": [{
"_id": 1,
"comment_title": "FIRST"
}, {
"_id": 2,
"comment_title": "Rails is unagi"
}]
}
}
```
You could implement a serializer that looks like this to get your payload
into shape:
```app/serializers/post.js
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
// First, restructure the top-level so it's organized by type
extractSingle: function(store, typeClass, payload, id) {
var comments = payload._embedded.comment;
delete payload._embedded;
payload = { comments: comments, post: payload };
return this._super(store, typeClass, payload, id);
},
normalizeHash: {
// Next, normalize individual comments, which (after `extract`)
// are now located under `comments`
comments: function(hash) {
hash.id = hash._id;
hash.title = hash.comment_title;
delete hash._id;
delete hash.comment_title;
return hash;
}
}
})
```
When you call super from your own implementation of `extractSingle`, the
built-in implementation will find the primary record in your normalized
payload and push the remaining records into the store.
The primary record is the single hash found under `post` or the first
element of the `posts` array.
The primary record has special meaning when the record is being created
for the first time or updated (`createRecord` or `updateRecord`). In
particular, it will update the properties of the record that was saved.
@method extractSingle
@param {DS.Store} store
@param {DS.Model} primaryTypeClass
@param {Object} rawPayload
@param {String} recordId
@return {Object} the primary response to the original request
*/
extractSingle: function (store, primaryTypeClass, rawPayload, recordId) {
var payload = this.normalizePayload(rawPayload);
var primaryRecord;
for (var prop in payload) {
var modelName = this.modelNameFromPayloadKey(prop);
if (!store.modelFactoryFor(modelName)) {
Ember.warn(this.warnMessageNoModelForKey(prop, modelName), false);
continue;
}
var isPrimary = this.isPrimaryType(store, modelName, primaryTypeClass);
var value = payload[prop];
if (value === null) {
continue;
}
// legacy support for singular resources
if (isPrimary && Ember.typeOf(value) !== "array") {
primaryRecord = this.normalize(primaryTypeClass, value, prop);
continue;
}
/*jshint loopfunc:true*/
ember$data$lib$serializers$rest$serializer$$forEach.call(value, function (hash) {
var typeName = this.modelNameFromPayloadKey(prop);
var type = store.modelFor(typeName);
var typeSerializer = store.serializerFor(type.modelName);
hash = typeSerializer.normalize(type, hash, prop);
var isFirstCreatedRecord = isPrimary && !recordId && !primaryRecord;
var isUpdatedRecord = isPrimary && ember$data$lib$system$coerce$id$$default(hash.id) === recordId;
// find the primary record.
//
// It's either:
// * the record with the same ID as the original request
// * in the case of a newly created record that didn't have an ID, the first
// record in the Array
if (isFirstCreatedRecord || isUpdatedRecord) {
primaryRecord = hash;
} else {
store.push(modelName, hash);
}
}, this);
}
return primaryRecord;
},
/**
Called when the server has returned a payload representing
multiple records, such as in response to a `findAll` or `findQuery`.
It is your opportunity to clean up the server's response into the normalized
form expected by Ember Data.
If you want, you can just restructure the top-level of your payload, and
do more fine-grained normalization in the `normalize` method.
For example, if you have a payload like this in response to a request for
all posts:
```js
{
"_embedded": {
"post": [{
"id": 1,
"title": "Rails is omakase"
}, {
"id": 2,
"title": "The Parley Letter"
}],
"comment": [{
"_id": 1,
"comment_title": "Rails is unagi",
"post_id": 1
}, {
"_id": 2,
"comment_title": "Don't tread on me",
"post_id": 2
}]
}
}
```
You could implement a serializer that looks like this to get your payload
into shape:
```app/serializers/post.js
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
// First, restructure the top-level so it's organized by type
// and the comments are listed under a post's `comments` key.
extractArray: function(store, type, payload) {
var posts = payload._embedded.post;
var comments = [];
var postCache = {};
posts.forEach(function(post) {
post.comments = [];
postCache[post.id] = post;
});
payload._embedded.comment.forEach(function(comment) {
comments.push(comment);
postCache[comment.post_id].comments.push(comment);
delete comment.post_id;
});
payload = { comments: comments, posts: posts };
return this._super(store, type, payload);
},
normalizeHash: {
// Next, normalize individual comments, which (after `extract`)
// are now located under `comments`
comments: function(hash) {
hash.id = hash._id;
hash.title = hash.comment_title;
delete hash._id;
delete hash.comment_title;
return hash;
}
}
})
```
When you call super from your own implementation of `extractArray`, the
built-in implementation will find the primary array in your normalized
payload and push the remaining records into the store.
The primary array is the array found under `posts`.
The primary record has special meaning when responding to `findQuery`
or `findHasMany`. In particular, the primary array will become the
list of records in the record array that kicked off the request.
If your primary array contains secondary (embedded) records of the same type,
you cannot place these into the primary array `posts`. Instead, place the
secondary items into an underscore prefixed property `_posts`, which will
push these items into the store and will not affect the resulting query.
@method extractArray
@param {DS.Store} store
@param {DS.Model} primaryTypeClass
@param {Object} rawPayload
@return {Array} The primary array that was returned in response
to the original query.
*/
extractArray: function (store, primaryTypeClass, rawPayload) {
var payload = this.normalizePayload(rawPayload);
var primaryArray;
for (var prop in payload) {
var modelName = prop;
var forcedSecondary = false;
if (prop.charAt(0) === "_") {
forcedSecondary = true;
modelName = prop.substr(1);
}
var typeName = this.modelNameFromPayloadKey(modelName);
if (!store.modelFactoryFor(typeName)) {
Ember.warn(this.warnMessageNoModelForKey(prop, typeName), false);
continue;
}
var type = store.modelFor(typeName);
var typeSerializer = store.serializerFor(type.modelName);
var isPrimary = !forcedSecondary && this.isPrimaryType(store, typeName, primaryTypeClass);
/*jshint loopfunc:true*/
var normalizedArray = ember$data$lib$serializers$rest$serializer$$map.call(payload[prop], function (hash) {
return typeSerializer.normalize(type, hash, prop);
}, this);
if (isPrimary) {
primaryArray = normalizedArray;
} else {
store.pushMany(typeName, normalizedArray);
}
}
return primaryArray;
},
isPrimaryType: function (store, typeName, primaryTypeClass) {
var typeClass = store.modelFor(typeName);
return typeClass.modelName === primaryTypeClass.modelName;
},
/**
This method allows you to push a payload containing top-level
collections of records organized per type.
```js
{
"posts": [{
"id": "1",
"title": "Rails is omakase",
"author", "1",
"comments": [ "1" ]
}],
"comments": [{
"id": "1",
"body": "FIRST"
}],
"users": [{
"id": "1",
"name": "@d2h"
}]
}
```
It will first normalize the payload, so you can use this to push
in data streaming in from your server structured the same way
that fetches and saves are structured.
@method pushPayload
@param {DS.Store} store
@param {Object} rawPayload
*/
pushPayload: function (store, rawPayload) {
if (this.get("isNewSerializerAPI")) {
ember$data$lib$serializers$rest$serializer$$_newPushPayload.apply(this, arguments);
return;
}
var payload = this.normalizePayload(rawPayload);
for (var prop in payload) {
var modelName = this.modelNameFromPayloadKey(prop);
if (!store.modelFactoryFor(modelName)) {
Ember.warn(this.warnMessageNoModelForKey(prop, modelName), false);
continue;
}
var typeClass = store.modelFor(modelName);
var typeSerializer = store.serializerFor(modelName);
/*jshint loopfunc:true*/
var normalizedArray = ember$data$lib$serializers$rest$serializer$$map.call(Ember.makeArray(payload[prop]), function (hash) {
return typeSerializer.normalize(typeClass, hash, prop);
}, this);
store.pushMany(modelName, normalizedArray);
}
},
/**
This method is used to convert each JSON root key in the payload
into a modelName that it can use to look up the appropriate model for
that part of the payload.
For example, your server may send a model name that does not correspond with
the name of the model in your app. Let's take a look at an example model,
and an example payload:
```app/models/post.js
import DS from 'ember-data';
export default DS.Model.extend({
});
```
```javascript
{
"blog/post": {
"id": "1
}
}
```
Ember Data is going to normalize the payload's root key for the modelName. As a result,
it will try to look up the "blog/post" model. Since we don't have a model called "blog/post"
(or a file called app/models/blog/post.js in ember-cli), Ember Data will throw an error
because it cannot find the "blog/post" model.
Since we want to remove this namespace, we can define a serializer for the application that will
remove "blog/" from the payload key whenver it's encountered by Ember Data:
```app/serializers/application.js
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
modelNameFromPayloadKey: function(payloadKey) {
if (payloadKey === 'blog/post') {
return this._super(payloadKey.replace('blog/', ''));
} else {
return this._super(payloadKey);
}
}
});
```
After refreshing, Ember Data will appropriately look up the "post" model.
By default the modelName for a model is its
name in dasherized form. This means that a payload key like "blogPost" would be
normalized to "blog-post" when Ember Data looks up the model. Usually, Ember Data
can use the correct inflection to do this for you. Most of the time, you won't
need to override `modelNameFromPayloadKey` for this purpose.
@method modelNameFromPayloadKey
@param {String} key
@return {String} the model's modelName
*/
modelNameFromPayloadKey: function (key) {
return ember$inflector$lib$lib$system$string$$singularize(ember$data$lib$system$normalize$model$name$$default(key));
},
// SERIALIZE
/**
Called when a record is saved in order to convert the
record into JSON.
By default, it creates a JSON object with a key for
each attribute and belongsTo relationship.
For example, consider this model:
```app/models/comment.js
import DS from 'ember-data';
export default DS.Model.extend({
title: DS.attr(),
body: DS.attr(),
author: DS.belongsTo('user')
});
```
The default serialization would create a JSON object like:
```js
{
"title": "Rails is unagi",
"body": "Rails? Omakase? O_O",
"author": 12
}
```
By default, attributes are passed through as-is, unless
you specified an attribute type (`DS.attr('date')`). If
you specify a transform, the JavaScript value will be
serialized when inserted into the JSON hash.
By default, belongs-to relationships are converted into
IDs when inserted into the JSON hash.
## IDs
`serialize` takes an options hash with a single option:
`includeId`. If this option is `true`, `serialize` will,
by default include the ID in the JSON object it builds.
The adapter passes in `includeId: true` when serializing
a record for `createRecord`, but not for `updateRecord`.
## Customization
Your server may expect a different JSON format than the
built-in serialization format.
In that case, you can implement `serialize` yourself and
return a JSON hash of your choosing.
```app/serializers/post.js
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
serialize: function(snapshot, options) {
var json = {
POST_TTL: snapshot.attr('title'),
POST_BDY: snapshot.attr('body'),
POST_CMS: snapshot.hasMany('comments', { ids: true })
}
if (options.includeId) {
json.POST_ID_ = snapshot.id;
}
return json;
}
});
```
## Customizing an App-Wide Serializer
If you want to define a serializer for your entire
application, you'll probably want to use `eachAttribute`
and `eachRelationship` on the record.
```app/serializers/application.js
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
serialize: function(snapshot, options) {
var json = {};
snapshot.eachAttribute(function(name) {
json[serverAttributeName(name)] = snapshot.attr(name);
})
snapshot.eachRelationship(function(name, relationship) {
if (relationship.kind === 'hasMany') {
json[serverHasManyName(name)] = snapshot.hasMany(name, { ids: true });
}
});
if (options.includeId) {
json.ID_ = snapshot.id;
}
return json;
}
});
function serverAttributeName(attribute) {
return attribute.underscore().toUpperCase();
}
function serverHasManyName(name) {
return serverAttributeName(name.singularize()) + "_IDS";
}
```
This serializer will generate JSON that looks like this:
```js
{
"TITLE": "Rails is omakase",
"BODY": "Yep. Omakase.",
"COMMENT_IDS": [ 1, 2, 3 ]
}
```
## Tweaking the Default JSON
If you just want to do some small tweaks on the default JSON,
you can call super first and make the tweaks on the returned
JSON.
```app/serializers/post.js
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
serialize: function(snapshot, options) {
var json = this._super(snapshot, options);
json.subject = json.title;
delete json.title;
return json;
}
});
```
@method serialize
@param {DS.Snapshot} snapshot
@param {Object} options
@return {Object} json
*/
serialize: function (snapshot, options) {
return this._super.apply(this, arguments);
},
/**
You can use this method to customize the root keys serialized into the JSON.
By default the REST Serializer sends the modelName of a model, which is a camelized
version of the name.
For example, your server may expect underscored root objects.
```app/serializers/application.js
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
serializeIntoHash: function(data, type, record, options) {
var root = Ember.String.decamelize(type.modelName);
data[root] = this.serialize(record, options);
}
});
```
@method serializeIntoHash
@param {Object} hash
@param {DS.Model} typeClass
@param {DS.Snapshot} snapshot
@param {Object} options
*/
serializeIntoHash: function (hash, typeClass, snapshot, options) {
var normalizedRootKey = this.payloadKeyFromModelName(typeClass.modelName);
hash[normalizedRootKey] = this.serialize(snapshot, options);
},
/**
You can use `payloadKeyFromModelName` to override the root key for an outgoing
request. By default, the RESTSerializer returns a camelized version of the
model's name.
For a model called TacoParty, its `modelName` would be the string `taco-party`. The RESTSerializer
will send it to the server with `tacoParty` as the root key in the JSON payload:
```js
{
"tacoParty": {
"id": "1",
"location": "Matthew Beale's House"
}
}
```
For example, your server may expect dasherized root objects:
```app/serializers/application.js
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
payloadKeyFromModelName: function(modelName) {
return Ember.String.dasherize(modelName);
}
});
```
Given a `TacoParty' model, calling `save` on a tacoModel would produce an outgoing
request like:
```js
{
"taco-party": {
"id": "1",
"location": "Matthew Beale's House"
}
}
```
@method payloadKeyFromModelName
@param {String} modelName
@return {String}
*/
payloadKeyFromModelName: function (modelName) {
return ember$data$lib$serializers$rest$serializer$$camelize(modelName);
},
/**
Deprecated. Use modelNameFromPayloadKey instead
@method typeForRoot
@param {String} modelName
@return {String}
@deprecated
*/
typeForRoot: function (modelName) {
Ember.deprecate("typeForRoot is deprecated. Use modelNameFromPayloadKey instead.");
return this.modelNameFromPayloadKey(modelName);
},
/**
You can use this method to customize how polymorphic objects are serialized.
By default the JSON Serializer creates the key by appending `Type` to
the attribute and value from the model's camelcased model name.
@method serializePolymorphicType
@param {DS.Snapshot} snapshot
@param {Object} json
@param {Object} relationship
*/
serializePolymorphicType: function (snapshot, json, relationship) {
var key = relationship.key;
var belongsTo = snapshot.belongsTo(key);
key = this.keyForAttribute ? this.keyForAttribute(key, "serialize") : key;
if (Ember.isNone(belongsTo)) {
json[key + "Type"] = null;
} else {
json[key + "Type"] = Ember.String.camelize(belongsTo.modelName);
}
}
});
Ember.runInDebug(function () {
ember$data$lib$serializers$rest$serializer$$RESTSerializer.reopen({
warnMessageNoModelForKey: function (prop, typeKey) {
return "Encountered \"" + prop + "\" in payload, but no model was found for model name \"" + typeKey + "\" (resolved model name using " + this.constructor.toString() + ".modelNameFromPayloadKey(\"" + prop + "\"))";
}
});
});
var ember$data$lib$serializers$rest$serializer$$default = ember$data$lib$serializers$rest$serializer$$RESTSerializer;
/*
@method _newNormalize
@param {DS.Model} modelClass
@param {Object} resourceHash
@param {String} prop
@return {Object}
@private
*/
function ember$data$lib$serializers$rest$serializer$$_newNormalize(modelClass, resourceHash, prop) {
if (this.normalizeHash && this.normalizeHash[prop]) {
this.normalizeHash[prop](resourceHash);
}
}
/*
@method _newPushPayload
@param {DS.Store} store
@param {Object} rawPayload
*/
function ember$data$lib$serializers$rest$serializer$$_newPushPayload(store, rawPayload) {
var documentHash = {
data: [],
included: []
};
var payload = this.normalizePayload(rawPayload);
for (var prop in payload) {
var modelName = this.modelNameFromPayloadKey(prop);
if (!store.modelFactoryFor(modelName)) {
Ember.warn(this.warnMessageNoModelForKey(prop, modelName), false);
continue;
}
var type = store.modelFor(modelName);
var typeSerializer = store.serializerFor(type.modelName);
/*jshint loopfunc:true*/
ember$data$lib$serializers$rest$serializer$$forEach.call(Ember.makeArray(payload[prop]), function (hash) {
var _typeSerializer$normalize = typeSerializer.normalize(type, hash, prop);
var data = _typeSerializer$normalize.data;
var included = _typeSerializer$normalize.included;
documentHash.data.push(data);
if (included) {
var _documentHash$included5;
(_documentHash$included5 = documentHash.included).push.apply(_documentHash$included5, included);
}
}, this);
}
ember$data$lib$system$store$serializer$response$$pushPayload(store, documentHash);
}
/**
@module ember-data
*/
var activemodel$adapter$lib$system$active$model$serializer$$forEach = Ember.ArrayPolyfills.forEach;
var activemodel$adapter$lib$system$active$model$serializer$$camelize = Ember.String.camelize;
var activemodel$adapter$lib$system$active$model$serializer$$classify = Ember.String.classify;
var activemodel$adapter$lib$system$active$model$serializer$$decamelize = Ember.String.decamelize;
var activemodel$adapter$lib$system$active$model$serializer$$underscore = Ember.String.underscore;
/**
The ActiveModelSerializer is a subclass of the RESTSerializer designed to integrate
with a JSON API that uses an underscored naming convention instead of camelCasing.
It has been designed to work out of the box with the
[active\_model\_serializers](http://github.com/rails-api/active_model_serializers)
Ruby gem. This Serializer expects specific settings using ActiveModel::Serializers,
`embed :ids, embed_in_root: true` which sideloads the records.
This serializer extends the DS.RESTSerializer by making consistent
use of the camelization, decamelization and pluralization methods to
normalize the serialized JSON into a format that is compatible with
a conventional Rails backend and Ember Data.
## JSON Structure
The ActiveModelSerializer expects the JSON returned from your server
to follow the REST adapter conventions substituting underscored keys
for camelcased ones.
### Conventional Names
Attribute names in your JSON payload should be the underscored versions of
the attributes in your Ember.js models.
For example, if you have a `Person` model:
```js
App.FamousPerson = DS.Model.extend({
firstName: DS.attr('string'),
lastName: DS.attr('string'),
occupation: DS.attr('string')
});
```
The JSON returned should look like this:
```js
{
"famous_person": {
"id": 1,
"first_name": "Barack",
"last_name": "Obama",
"occupation": "President"
}
}
```
Let's imagine that `Occupation` is just another model:
```js
App.Person = DS.Model.extend({
firstName: DS.attr('string'),
lastName: DS.attr('string'),
occupation: DS.belongsTo('occupation')
});
App.Occupation = DS.Model.extend({
name: DS.attr('string'),
salary: DS.attr('number'),
people: DS.hasMany('person')
});
```
The JSON needed to avoid extra server calls, should look like this:
```js
{
"people": [{
"id": 1,
"first_name": "Barack",
"last_name": "Obama",
"occupation_id": 1
}],
"occupations": [{
"id": 1,
"name": "President",
"salary": 100000,
"person_ids": [1]
}]
}
```
@class ActiveModelSerializer
@namespace DS
@extends DS.RESTSerializer
*/
var activemodel$adapter$lib$system$active$model$serializer$$ActiveModelSerializer = ember$data$lib$serializers$rest$serializer$$default.extend({
// SERIALIZE
/**
Converts camelCased attributes to underscored when serializing.
@method keyForAttribute
@param {String} attribute
@return String
*/
keyForAttribute: function (attr) {
return activemodel$adapter$lib$system$active$model$serializer$$decamelize(attr);
},
/**
Underscores relationship names and appends "_id" or "_ids" when serializing
relationship keys.
@method keyForRelationship
@param {String} relationshipModelName
@param {String} kind
@return String
*/
keyForRelationship: function (relationshipModelName, kind) {
var key = activemodel$adapter$lib$system$active$model$serializer$$decamelize(relationshipModelName);
if (kind === "belongsTo") {
return key + "_id";
} else if (kind === "hasMany") {
return ember$inflector$lib$lib$system$string$$singularize(key) + "_ids";
} else {
return key;
}
},
/**
`keyForLink` can be used to define a custom key when deserializing link
properties. The `ActiveModelSerializer` camelizes link keys by default.
@method keyForLink
@param {String} key
@param {String} kind `belongsTo` or `hasMany`
@return {String} normalized key
*/
keyForLink: function (key, relationshipKind) {
return activemodel$adapter$lib$system$active$model$serializer$$camelize(key);
},
/*
Does not serialize hasMany relationships by default.
*/
serializeHasMany: Ember.K,
/**
Underscores the JSON root keys when serializing.
@method payloadKeyFromModelName
@param {String} modelName
@return {String}
*/
payloadKeyFromModelName: function (modelName) {
return activemodel$adapter$lib$system$active$model$serializer$$underscore(activemodel$adapter$lib$system$active$model$serializer$$decamelize(modelName));
},
/**
Serializes a polymorphic type as a fully capitalized model name.
@method serializePolymorphicType
@param {DS.Snapshot} snapshot
@param {Object} json
@param {Object} relationship
*/
serializePolymorphicType: function (snapshot, json, relationship) {
var key = relationship.key;
var belongsTo = snapshot.belongsTo(key);
var jsonKey = activemodel$adapter$lib$system$active$model$serializer$$underscore(key + "_type");
if (Ember.isNone(belongsTo)) {
json[jsonKey] = null;
} else {
json[jsonKey] = activemodel$adapter$lib$system$active$model$serializer$$classify(belongsTo.modelName).replace(/(\/)([a-z])/g, function (match, separator, chr) {
return match.toUpperCase();
}).replace("/", "::");
}
},
// EXTRACT
/**
Add extra step to `DS.RESTSerializer.normalize` so links are normalized.
If your payload looks like:
```js
{
"post": {
"id": 1,
"title": "Rails is omakase",
"links": { "flagged_comments": "api/comments/flagged" }
}
}
```
The normalized version would look like this
```js
{
"post": {
"id": 1,
"title": "Rails is omakase",
"links": { "flaggedComments": "api/comments/flagged" }
}
}
```
@method normalize
@param {subclass of DS.Model} typeClass
@param {Object} hash
@param {String} prop
@return Object
*/
normalize: function (typeClass, hash, prop) {
this.normalizeLinks(hash);
return this._super(typeClass, hash, prop);
},
/**
Convert `snake_cased` links to `camelCase`
@method normalizeLinks
@param {Object} data
*/
normalizeLinks: function (data) {
if (data.links) {
var links = data.links;
for (var link in links) {
var camelizedLink = activemodel$adapter$lib$system$active$model$serializer$$camelize(link);
if (camelizedLink !== link) {
links[camelizedLink] = links[link];
delete links[link];
}
}
}
},
/**
Normalize the polymorphic type from the JSON.
Normalize:
```js
{
id: "1"
minion: { type: "evil_minion", id: "12"}
}
```
To:
```js
{
id: "1"
minion: { type: "evilMinion", id: "12"}
}
```
@param {Subclass of DS.Model} typeClass
@method normalizeRelationships
@private
*/
normalizeRelationships: function (typeClass, hash) {
if (this.keyForRelationship) {
typeClass.eachRelationship(function (key, relationship) {
var payloadKey, payload;
if (relationship.options.polymorphic) {
payloadKey = this.keyForAttribute(key, "deserialize");
payload = hash[payloadKey];
if (payload && payload.type) {
payload.type = this.modelNameFromPayloadKey(payload.type);
} else if (payload && relationship.kind === "hasMany") {
var self = this;
activemodel$adapter$lib$system$active$model$serializer$$forEach.call(payload, function (single) {
single.type = self.modelNameFromPayloadKey(single.type);
});
}
} else {
payloadKey = this.keyForRelationship(key, relationship.kind, "deserialize");
if (!hash.hasOwnProperty(payloadKey)) {
return;
}
payload = hash[payloadKey];
}
hash[key] = payload;
if (key !== payloadKey) {
delete hash[payloadKey];
}
}, this);
}
},
modelNameFromPayloadKey: function (key) {
var convertedFromRubyModule = activemodel$adapter$lib$system$active$model$serializer$$camelize(ember$inflector$lib$lib$system$string$$singularize(key)).replace(/(^|\:)([A-Z])/g, function (match, separator, chr) {
return match.toLowerCase();
}).replace("::", "/");
return ember$data$lib$system$normalize$model$name$$default(convertedFromRubyModule);
}
});
var activemodel$adapter$lib$system$active$model$serializer$$default = activemodel$adapter$lib$system$active$model$serializer$$ActiveModelSerializer;
function ember$data$lib$system$container$proxy$$ContainerProxy(container) {
this.container = container;
}
ember$data$lib$system$container$proxy$$ContainerProxy.prototype.aliasedFactory = function (path, preLookup) {
var _this = this;
return {
create: function () {
if (preLookup) {
preLookup();
}
return _this.container.lookup(path);
}
};
};
ember$data$lib$system$container$proxy$$ContainerProxy.prototype.registerAlias = function (source, dest, preLookup) {
var factory = this.aliasedFactory(dest, preLookup);
return this.container.register(source, factory);
};
ember$data$lib$system$container$proxy$$ContainerProxy.prototype.registerDeprecation = function (deprecated, valid) {
var preLookupCallback = function () {
Ember.deprecate("You tried to look up '" + deprecated + "', " + "but this has been deprecated in favor of '" + valid + "'.", false);
};
return this.registerAlias(deprecated, valid, preLookupCallback);
};
ember$data$lib$system$container$proxy$$ContainerProxy.prototype.registerDeprecations = function (proxyPairs) {
var i, proxyPair, deprecated, valid;
for (i = proxyPairs.length; i > 0; i--) {
proxyPair = proxyPairs[i - 1];
deprecated = proxyPair["deprecated"];
valid = proxyPair["valid"];
this.registerDeprecation(deprecated, valid);
}
};
var ember$data$lib$system$container$proxy$$default = ember$data$lib$system$container$proxy$$ContainerProxy;
var activemodel$adapter$lib$setup$container$$default = activemodel$adapter$lib$setup$container$$setupActiveModelAdapter;
function activemodel$adapter$lib$setup$container$$setupActiveModelAdapter(registry, application) {
var proxy = new ember$data$lib$system$container$proxy$$default(registry);
proxy.registerDeprecations([{ deprecated: "serializer:_ams", valid: "serializer:-active-model" }, { deprecated: "adapter:_ams", valid: "adapter:-active-model" }]);
registry.register("serializer:-active-model", activemodel$adapter$lib$system$active$model$serializer$$default.extend({ isNewSerializerAPI: true }));
registry.register("adapter:-active-model", activemodel$adapter$lib$system$active$model$adapter$$default);
}
var ember$data$lib$core$$DS = Ember.Namespace.create({
VERSION: '1.13.4'
});
if (Ember.libraries) {
Ember.libraries.registerCoreLibrary('Ember Data', ember$data$lib$core$$DS.VERSION);
}
//jshint ignore: line
var ember$data$lib$core$$EMBER_DATA_FEATURES = {};
Ember.merge(Ember.FEATURES, ember$data$lib$core$$EMBER_DATA_FEATURES);
var ember$data$lib$core$$default = ember$data$lib$core$$DS;
var ember$data$lib$system$store$common$$get = Ember.get;
function ember$data$lib$system$store$common$$_bind(fn) {
var args = Array.prototype.slice.call(arguments, 1);
return function () {
return fn.apply(undefined, args);
};
}
function ember$data$lib$system$store$common$$_guard(promise, test) {
var guarded = promise["finally"](function () {
if (!test()) {
guarded._subscribers.length = 0;
}
});
return guarded;
}
function ember$data$lib$system$store$common$$_objectIsAlive(object) {
return !(ember$data$lib$system$store$common$$get(object, "isDestroyed") || ember$data$lib$system$store$common$$get(object, "isDestroying"));
}
function ember$data$lib$system$store$serializers$$serializerForAdapter(store, adapter, type) {
var serializer = adapter.serializer;
if (serializer === undefined) {
serializer = store.serializerFor(type);
}
if (serializer === null || serializer === undefined) {
serializer = {
extract: function (store, type, payload) {
return payload;
}
};
}
return serializer;
}
var ember$data$lib$system$store$finders$$Promise = Ember.RSVP.Promise;
var ember$data$lib$system$store$finders$$map = Ember.ArrayPolyfills.map;
var ember$data$lib$system$store$finders$$get = Ember.get;
function ember$data$lib$system$store$finders$$_find(adapter, store, typeClass, id, internalModel, options) {
var snapshot = internalModel.createSnapshot(options);
var promise;
if (!adapter.findRecord) {
Ember.deprecate("Adapter#find has been deprecated and renamed to `findRecord`.");
promise = adapter.find(store, typeClass, id, snapshot);
} else {
promise = adapter.findRecord(store, typeClass, id, snapshot);
}
var serializer = ember$data$lib$system$store$serializers$$serializerForAdapter(store, adapter, internalModel.type.modelName);
var label = "DS: Handle Adapter#find of " + typeClass + " with id: " + id;
promise = ember$data$lib$system$store$finders$$Promise.cast(promise, label);
promise = ember$data$lib$system$store$common$$_guard(promise, ember$data$lib$system$store$common$$_bind(ember$data$lib$system$store$common$$_objectIsAlive, store));
return promise.then(function (adapterPayload) {
Ember.assert("You made a request for a " + typeClass.typeClassKey + " with id " + id + ", but the adapter's response did not have any data", adapterPayload);
return store._adapterRun(function () {
var requestType = ember$data$lib$system$store$finders$$get(serializer, "isNewSerializerAPI") ? "findRecord" : "find";
var payload = ember$data$lib$system$store$serializer$response$$normalizeResponseHelper(serializer, store, typeClass, adapterPayload, id, requestType);
//TODO Optimize
var record = ember$data$lib$system$store$serializer$response$$pushPayload(store, payload);
return record._internalModel;
});
}, function (error) {
internalModel.notFound();
if (internalModel.isEmpty()) {
internalModel.unloadRecord();
}
throw error;
}, "DS: Extract payload of '" + typeClass + "'");
}
function ember$data$lib$system$store$finders$$_findMany(adapter, store, typeClass, ids, internalModels) {
var snapshots = Ember.A(internalModels).invoke("createSnapshot");
var promise = adapter.findMany(store, typeClass, ids, snapshots);
var serializer = ember$data$lib$system$store$serializers$$serializerForAdapter(store, adapter, typeClass.modelName);
var label = "DS: Handle Adapter#findMany of " + typeClass;
if (promise === undefined) {
throw new Error("adapter.findMany returned undefined, this was very likely a mistake");
}
promise = ember$data$lib$system$store$finders$$Promise.cast(promise, label);
promise = ember$data$lib$system$store$common$$_guard(promise, ember$data$lib$system$store$common$$_bind(ember$data$lib$system$store$common$$_objectIsAlive, store));
return promise.then(function (adapterPayload) {
return store._adapterRun(function () {
var payload = ember$data$lib$system$store$serializer$response$$normalizeResponseHelper(serializer, store, typeClass, adapterPayload, null, "findMany");
//TODO Optimize, no need to materialize here
var records = ember$data$lib$system$store$serializer$response$$pushPayload(store, payload);
return ember$data$lib$system$store$finders$$map.call(records, function (record) {
return record._internalModel;
});
});
}, null, "DS: Extract payload of " + typeClass);
}
function ember$data$lib$system$store$finders$$_findHasMany(adapter, store, internalModel, link, relationship) {
var snapshot = internalModel.createSnapshot();
var typeClass = store.modelFor(relationship.type);
var promise = adapter.findHasMany(store, snapshot, link, relationship);
var serializer = ember$data$lib$system$store$serializers$$serializerForAdapter(store, adapter, relationship.type);
var label = "DS: Handle Adapter#findHasMany of " + internalModel + " : " + relationship.type;
promise = ember$data$lib$system$store$finders$$Promise.cast(promise, label);
promise = ember$data$lib$system$store$common$$_guard(promise, ember$data$lib$system$store$common$$_bind(ember$data$lib$system$store$common$$_objectIsAlive, store));
promise = ember$data$lib$system$store$common$$_guard(promise, ember$data$lib$system$store$common$$_bind(ember$data$lib$system$store$common$$_objectIsAlive, internalModel));
return promise.then(function (adapterPayload) {
return store._adapterRun(function () {
var payload = ember$data$lib$system$store$serializer$response$$normalizeResponseHelper(serializer, store, typeClass, adapterPayload, null, "findHasMany");
//TODO Use a non record creating push
var records = ember$data$lib$system$store$serializer$response$$pushPayload(store, payload);
var recordArray = ember$data$lib$system$store$finders$$map.call(records, function (record) {
return record._internalModel;
});
if (serializer.get("isNewSerializerAPI")) {
recordArray.meta = payload.meta;
}
return recordArray;
});
}, null, "DS: Extract payload of " + internalModel + " : hasMany " + relationship.type);
}
function ember$data$lib$system$store$finders$$_findBelongsTo(adapter, store, internalModel, link, relationship) {
var snapshot = internalModel.createSnapshot();
var typeClass = store.modelFor(relationship.type);
var promise = adapter.findBelongsTo(store, snapshot, link, relationship);
var serializer = ember$data$lib$system$store$serializers$$serializerForAdapter(store, adapter, relationship.type);
var label = "DS: Handle Adapter#findBelongsTo of " + internalModel + " : " + relationship.type;
promise = ember$data$lib$system$store$finders$$Promise.cast(promise, label);
promise = ember$data$lib$system$store$common$$_guard(promise, ember$data$lib$system$store$common$$_bind(ember$data$lib$system$store$common$$_objectIsAlive, store));
promise = ember$data$lib$system$store$common$$_guard(promise, ember$data$lib$system$store$common$$_bind(ember$data$lib$system$store$common$$_objectIsAlive, internalModel));
return promise.then(function (adapterPayload) {
return store._adapterRun(function () {
var payload = ember$data$lib$system$store$serializer$response$$normalizeResponseHelper(serializer, store, typeClass, adapterPayload, null, "findBelongsTo");
if (!payload.data) {
return null;
}
//TODO Optimize
var record = ember$data$lib$system$store$serializer$response$$pushPayload(store, payload);
return record._internalModel;
});
}, null, "DS: Extract payload of " + internalModel + " : " + relationship.type);
}
function ember$data$lib$system$store$finders$$_findAll(adapter, store, typeClass, sinceToken, options) {
var modelName = typeClass.modelName;
var recordArray = store.peekAll(modelName);
var snapshotArray = recordArray.createSnapshot(options);
var promise = adapter.findAll(store, typeClass, sinceToken, snapshotArray);
var serializer = ember$data$lib$system$store$serializers$$serializerForAdapter(store, adapter, modelName);
var label = "DS: Handle Adapter#findAll of " + typeClass;
promise = ember$data$lib$system$store$finders$$Promise.cast(promise, label);
promise = ember$data$lib$system$store$common$$_guard(promise, ember$data$lib$system$store$common$$_bind(ember$data$lib$system$store$common$$_objectIsAlive, store));
return promise.then(function (adapterPayload) {
store._adapterRun(function () {
var payload = ember$data$lib$system$store$serializer$response$$normalizeResponseHelper(serializer, store, typeClass, adapterPayload, null, "findAll");
//TODO Optimize
ember$data$lib$system$store$serializer$response$$pushPayload(store, payload);
});
store.didUpdateAll(typeClass);
return store.peekAll(modelName);
}, null, "DS: Extract payload of findAll " + typeClass);
}
function ember$data$lib$system$store$finders$$_query(adapter, store, typeClass, query, recordArray) {
var modelName = typeClass.modelName;
var promise;
if (!adapter.query) {
Ember.deprecate("Adapter#findQuery has been deprecated and renamed to `query`.");
promise = adapter.findQuery(store, typeClass, query, recordArray);
} else {
promise = adapter.query(store, typeClass, query, recordArray);
}
var serializer = ember$data$lib$system$store$serializers$$serializerForAdapter(store, adapter, modelName);
var label = "DS: Handle Adapter#findQuery of " + typeClass;
promise = ember$data$lib$system$store$finders$$Promise.cast(promise, label);
promise = ember$data$lib$system$store$common$$_guard(promise, ember$data$lib$system$store$common$$_bind(ember$data$lib$system$store$common$$_objectIsAlive, store));
return promise.then(function (adapterPayload) {
var records;
store._adapterRun(function () {
var requestType = ember$data$lib$system$store$finders$$get(serializer, "isNewSerializerAPI") ? "query" : "findQuery";
var payload = ember$data$lib$system$store$serializer$response$$normalizeResponseHelper(serializer, store, typeClass, adapterPayload, null, requestType);
//TODO Optimize
records = ember$data$lib$system$store$serializer$response$$pushPayload(store, payload);
});
recordArray.loadRecords(records);
return recordArray;
}, null, "DS: Extract payload of findQuery " + typeClass);
}
function ember$data$lib$system$store$finders$$_queryRecord(adapter, store, typeClass, query) {
var modelName = typeClass.modelName;
var promise = adapter.queryRecord(store, typeClass, query);
var serializer = ember$data$lib$system$store$serializers$$serializerForAdapter(store, adapter, modelName);
var label = "DS: Handle Adapter#queryRecord of " + typeClass;
promise = ember$data$lib$system$store$finders$$Promise.cast(promise, label);
promise = ember$data$lib$system$store$common$$_guard(promise, ember$data$lib$system$store$common$$_bind(ember$data$lib$system$store$common$$_objectIsAlive, store));
return promise.then(function (adapterPayload) {
var record;
store._adapterRun(function () {
var payload = ember$data$lib$system$store$serializer$response$$normalizeResponseHelper(serializer, store, typeClass, adapterPayload, null, "queryRecord");
//TODO Optimize
record = ember$data$lib$system$store$serializer$response$$pushPayload(store, payload);
});
return record;
}, null, "DS: Extract payload of queryRecord " + typeClass);
}
function ember$data$lib$system$snapshot$record$array$$SnapshotRecordArray(recordArray, meta, adapterOptions) {
this._snapshots = null;
this._recordArray = recordArray;
this.length = recordArray.get('length');
this.type = recordArray.get('type');
this.meta = meta;
this.adapterOptions = adapterOptions;
}
ember$data$lib$system$snapshot$record$array$$SnapshotRecordArray.prototype.snapshots = function () {
if (this._snapshots) {
return this._snapshots;
}
var recordArray = this._recordArray;
this._snapshots = recordArray.invoke('createSnapshot');
return this._snapshots;
};
var ember$data$lib$system$snapshot$record$array$$default = ember$data$lib$system$snapshot$record$array$$SnapshotRecordArray;
var ember$data$lib$system$record$arrays$record$array$$get = Ember.get;
var ember$data$lib$system$record$arrays$record$array$$set = Ember.set;
var ember$data$lib$system$record$arrays$record$array$$default = Ember.ArrayProxy.extend(Ember.Evented, {
/**
The model type contained by this record array.
@property type
@type DS.Model
*/
type: null,
/**
The array of client ids backing the record array. When a
record is requested from the record array, the record
for the client id at the same index is materialized, if
necessary, by the store.
@property content
@private
@type Ember.Array
*/
content: null,
/**
The flag to signal a `RecordArray` is finished loading data.
Example
```javascript
var people = store.peekAll('person');
people.get('isLoaded'); // true
```
@property isLoaded
@type Boolean
*/
isLoaded: false,
/**
The flag to signal a `RecordArray` is currently loading data.
Example
```javascript
var people = store.peekAll('person');
people.get('isUpdating'); // false
people.update();
people.get('isUpdating'); // true
```
@property isUpdating
@type Boolean
*/
isUpdating: false,
/**
The store that created this record array.
@property store
@private
@type DS.Store
*/
store: null,
/**
Retrieves an object from the content by index.
@method objectAtContent
@private
@param {Number} index
@return {DS.Model} record
*/
objectAtContent: function (index) {
var content = ember$data$lib$system$record$arrays$record$array$$get(this, "content");
var internalModel = content.objectAt(index);
return internalModel && internalModel.getRecord();
},
/**
Used to get the latest version of all of the records in this array
from the adapter.
Example
```javascript
var people = store.peekAll('person');
people.get('isUpdating'); // false
people.update();
people.get('isUpdating'); // true
```
@method update
*/
update: function () {
if (ember$data$lib$system$record$arrays$record$array$$get(this, "isUpdating")) {
return;
}
var store = ember$data$lib$system$record$arrays$record$array$$get(this, "store");
var modelName = ember$data$lib$system$record$arrays$record$array$$get(this, "type.modelName");
return store.findAll(modelName, { reload: true });
},
/**
Adds an internal model to the `RecordArray` without duplicates
@method addInternalModel
@private
@param {InternalModel} internalModel
@param {number} an optional index to insert at
*/
addInternalModel: function (internalModel, idx) {
var content = ember$data$lib$system$record$arrays$record$array$$get(this, "content");
if (idx === undefined) {
content.addObject(internalModel);
} else if (!content.contains(internalModel)) {
content.insertAt(idx, internalModel);
}
},
/**
Removes an internalModel to the `RecordArray`.
@method removeInternalModel
@private
@param {InternalModel} internalModel
*/
removeInternalModel: function (internalModel) {
ember$data$lib$system$record$arrays$record$array$$get(this, "content").removeObject(internalModel);
},
/**
Saves all of the records in the `RecordArray`.
Example
```javascript
var messages = store.peekAll('message');
messages.forEach(function(message) {
message.set('hasBeenSeen', true);
});
messages.save();
```
@method save
@return {DS.PromiseArray} promise
*/
save: function () {
var recordArray = this;
var promiseLabel = "DS: RecordArray#save " + ember$data$lib$system$record$arrays$record$array$$get(this, "type");
var promise = Ember.RSVP.all(this.invoke("save"), promiseLabel).then(function (array) {
return recordArray;
}, null, "DS: RecordArray#save return RecordArray");
return ember$data$lib$system$promise$proxies$$PromiseArray.create({ promise: promise });
},
_dissociateFromOwnRecords: function () {
var array = this;
this.get("content").forEach(function (record) {
var recordArrays = record._recordArrays;
if (recordArrays) {
recordArrays["delete"](array);
}
});
},
/**
@method _unregisterFromManager
@private
*/
_unregisterFromManager: function () {
var manager = ember$data$lib$system$record$arrays$record$array$$get(this, "manager");
manager.unregisterRecordArray(this);
},
willDestroy: function () {
this._unregisterFromManager();
this._dissociateFromOwnRecords();
ember$data$lib$system$record$arrays$record$array$$set(this, "content", undefined);
this._super.apply(this, arguments);
},
createSnapshot: function (options) {
var adapterOptions = options && options.adapterOptions;
var meta = this.get("meta");
return new ember$data$lib$system$snapshot$record$array$$default(this, meta, adapterOptions);
}
});
/**
@module ember-data
*/
var ember$data$lib$system$record$arrays$filtered$record$array$$get = Ember.get;
var ember$data$lib$system$record$arrays$filtered$record$array$$default = ember$data$lib$system$record$arrays$record$array$$default.extend({
/**
The filterFunction is a function used to test records from the store to
determine if they should be part of the record array.
Example
```javascript
var allPeople = store.peekAll('person');
allPeople.mapBy('name'); // ["Tom Dale", "Yehuda Katz", "Trek Glowacki"]
var people = store.filter('person', function(person) {
if (person.get('name').match(/Katz$/)) { return true; }
});
people.mapBy('name'); // ["Yehuda Katz"]
var notKatzFilter = function(person) {
return !person.get('name').match(/Katz$/);
};
people.set('filterFunction', notKatzFilter);
people.mapBy('name'); // ["Tom Dale", "Trek Glowacki"]
```
@method filterFunction
@param {DS.Model} record
@return {Boolean} `true` if the record should be in the array
*/
filterFunction: null,
isLoaded: true,
replace: function () {
var type = ember$data$lib$system$record$arrays$filtered$record$array$$get(this, "type").toString();
throw new Error("The result of a client-side filter (on " + type + ") is immutable.");
},
/**
@method updateFilter
@private
*/
_updateFilter: function () {
var manager = ember$data$lib$system$record$arrays$filtered$record$array$$get(this, "manager");
manager.updateFilter(this, ember$data$lib$system$record$arrays$filtered$record$array$$get(this, "type"), ember$data$lib$system$record$arrays$filtered$record$array$$get(this, "filterFunction"));
},
updateFilter: Ember.observer(function () {
Ember.run.once(this, this._updateFilter);
}, "filterFunction")
});
var ember$data$lib$system$clone$null$$default = ember$data$lib$system$clone$null$$cloneNull;
function ember$data$lib$system$clone$null$$cloneNull(source) {
var clone = Ember.create(null);
for (var key in source) {
clone[key] = source[key];
}
return clone;
}
/**
@module ember-data
*/
var ember$data$lib$system$record$arrays$adapter$populated$record$array$$get = Ember.get;
var ember$data$lib$system$record$arrays$adapter$populated$record$array$$default = ember$data$lib$system$record$arrays$record$array$$default.extend({
query: null,
replace: function () {
var type = ember$data$lib$system$record$arrays$adapter$populated$record$array$$get(this, "type").toString();
throw new Error("The result of a server query (on " + type + ") is immutable.");
},
/**
@method load
@private
@param {Array} data
*/
load: function (data) {
var store = ember$data$lib$system$record$arrays$adapter$populated$record$array$$get(this, "store");
var type = ember$data$lib$system$record$arrays$adapter$populated$record$array$$get(this, "type");
var modelName = type.modelName;
var records = store.pushMany(modelName, data);
this.loadRecords(records);
},
/**
@method loadRecords
@param {Array} records
@private
*/
loadRecords: function (records) {
var store = ember$data$lib$system$record$arrays$adapter$populated$record$array$$get(this, "store");
var type = ember$data$lib$system$record$arrays$adapter$populated$record$array$$get(this, "type");
var modelName = type.modelName;
var meta = store._metadataFor(modelName);
//TODO Optimize
var internalModels = Ember.A(records).mapBy("_internalModel");
this.setProperties({
content: Ember.A(internalModels),
isLoaded: true,
meta: ember$data$lib$system$clone$null$$default(meta)
});
internalModels.forEach(function (record) {
this.manager.recordArraysForRecord(record).add(this);
}, this);
// TODO: should triggering didLoad event be the last action of the runLoop?
Ember.run.once(this, "trigger", "didLoad");
}
});
var ember$data$lib$system$ordered$set$$EmberOrderedSet = Ember.OrderedSet;
var ember$data$lib$system$ordered$set$$guidFor = Ember.guidFor;
var ember$data$lib$system$ordered$set$$OrderedSet = function () {
this._super$constructor();
};
ember$data$lib$system$ordered$set$$OrderedSet.create = function () {
var Constructor = this;
return new Constructor();
};
ember$data$lib$system$ordered$set$$OrderedSet.prototype = Ember.create(ember$data$lib$system$ordered$set$$EmberOrderedSet.prototype);
ember$data$lib$system$ordered$set$$OrderedSet.prototype.constructor = ember$data$lib$system$ordered$set$$OrderedSet;
ember$data$lib$system$ordered$set$$OrderedSet.prototype._super$constructor = ember$data$lib$system$ordered$set$$EmberOrderedSet;
ember$data$lib$system$ordered$set$$OrderedSet.prototype.addWithIndex = function (obj, idx) {
var guid = ember$data$lib$system$ordered$set$$guidFor(obj);
var presenceSet = this.presenceSet;
var list = this.list;
if (presenceSet[guid] === true) {
return;
}
presenceSet[guid] = true;
if (idx === undefined || idx == null) {
list.push(obj);
} else {
list.splice(idx, 0, obj);
}
this.size += 1;
return this;
};
var ember$data$lib$system$ordered$set$$default = ember$data$lib$system$ordered$set$$OrderedSet;
var ember$data$lib$system$record$array$manager$$get = Ember.get;
var ember$data$lib$system$record$array$manager$$forEach = Ember.ArrayPolyfills.forEach;
var ember$data$lib$system$record$array$manager$$indexOf = Ember.ArrayPolyfills.indexOf;
var ember$data$lib$system$record$array$manager$$default = Ember.Object.extend({
init: function () {
var _this = this;
this.filteredRecordArrays = ember$data$lib$system$map$$MapWithDefault.create({
defaultValue: function () {
return [];
}
});
this.liveRecordArrays = ember$data$lib$system$map$$MapWithDefault.create({
defaultValue: function (typeClass) {
return _this.createRecordArray(typeClass);
}
});
this.changedRecords = [];
this._adapterPopulatedRecordArrays = [];
},
recordDidChange: function (record) {
if (this.changedRecords.push(record) !== 1) {
return;
}
Ember.run.schedule("actions", this, this.updateRecordArrays);
},
recordArraysForRecord: function (record) {
record._recordArrays = record._recordArrays || ember$data$lib$system$ordered$set$$default.create();
return record._recordArrays;
},
/**
This method is invoked whenever data is loaded into the store by the
adapter or updated by the adapter, or when a record has changed.
It updates all record arrays that a record belongs to.
To avoid thrashing, it only runs at most once per run loop.
@method updateRecordArrays
*/
updateRecordArrays: function () {
ember$data$lib$system$record$array$manager$$forEach.call(this.changedRecords, function (record) {
if (record.isDeleted()) {
this._recordWasDeleted(record);
} else {
this._recordWasChanged(record);
}
}, this);
this.changedRecords.length = 0;
},
_recordWasDeleted: function (record) {
var recordArrays = record._recordArrays;
if (!recordArrays) {
return;
}
recordArrays.forEach(function (array) {
array.removeInternalModel(record);
});
record._recordArrays = null;
},
_recordWasChanged: function (record) {
var typeClass = record.type;
var recordArrays = this.filteredRecordArrays.get(typeClass);
var filter;
ember$data$lib$system$record$array$manager$$forEach.call(recordArrays, function (array) {
filter = ember$data$lib$system$record$array$manager$$get(array, "filterFunction");
this.updateFilterRecordArray(array, filter, typeClass, record);
}, this);
},
//Need to update live arrays on loading
recordWasLoaded: function (record) {
var typeClass = record.type;
var recordArrays = this.filteredRecordArrays.get(typeClass);
var filter;
ember$data$lib$system$record$array$manager$$forEach.call(recordArrays, function (array) {
filter = ember$data$lib$system$record$array$manager$$get(array, "filterFunction");
this.updateFilterRecordArray(array, filter, typeClass, record);
}, this);
if (this.liveRecordArrays.has(typeClass)) {
var liveRecordArray = this.liveRecordArrays.get(typeClass);
this._addRecordToRecordArray(liveRecordArray, record);
}
},
/**
Update an individual filter.
@method updateFilterRecordArray
@param {DS.FilteredRecordArray} array
@param {Function} filter
@param {DS.Model} typeClass
@param {InternalModel} record
*/
updateFilterRecordArray: function (array, filter, typeClass, record) {
var shouldBeInArray = filter(record.getRecord());
var recordArrays = this.recordArraysForRecord(record);
if (shouldBeInArray) {
this._addRecordToRecordArray(array, record);
} else {
recordArrays["delete"](array);
array.removeInternalModel(record);
}
},
_addRecordToRecordArray: function (array, record) {
var recordArrays = this.recordArraysForRecord(record);
if (!recordArrays.has(array)) {
array.addInternalModel(record);
recordArrays.add(array);
}
},
populateLiveRecordArray: function (array, modelName) {
var typeMap = this.store.typeMapFor(modelName);
var records = typeMap.records;
var record;
for (var i = 0, l = records.length; i < l; i++) {
record = records[i];
if (!record.isDeleted() && !record.isEmpty()) {
this._addRecordToRecordArray(array, record);
}
}
},
/**
This method is invoked if the `filterFunction` property is
changed on a `DS.FilteredRecordArray`.
It essentially re-runs the filter from scratch. This same
method is invoked when the filter is created in th first place.
@method updateFilter
@param {Array} array
@param {String} modelName
@param {Function} filter
*/
updateFilter: function (array, modelName, filter) {
var typeMap = this.store.typeMapFor(modelName);
var records = typeMap.records;
var record;
for (var i = 0, l = records.length; i < l; i++) {
record = records[i];
if (!record.isDeleted() && !record.isEmpty()) {
this.updateFilterRecordArray(array, filter, modelName, record);
}
}
},
/**
Get the `DS.RecordArray` for a type, which contains all loaded records of
given type.
@method liveRecordArrayFor
@param {Class} typeClass
@return {DS.RecordArray}
*/
liveRecordArrayFor: function (typeClass) {
return this.liveRecordArrays.get(typeClass);
},
/**
Create a `DS.RecordArray` for a type.
@method createRecordArray
@param {Class} typeClass
@return {DS.RecordArray}
*/
createRecordArray: function (typeClass) {
var array = ember$data$lib$system$record$arrays$record$array$$default.create({
type: typeClass,
content: Ember.A(),
store: this.store,
isLoaded: true,
manager: this
});
return array;
},
/**
Create a `DS.FilteredRecordArray` for a type and register it for updates.
@method createFilteredRecordArray
@param {DS.Model} typeClass
@param {Function} filter
@param {Object} query (optional
@return {DS.FilteredRecordArray}
*/
createFilteredRecordArray: function (typeClass, filter, query) {
var array = ember$data$lib$system$record$arrays$filtered$record$array$$default.create({
query: query,
type: typeClass,
content: Ember.A(),
store: this.store,
manager: this,
filterFunction: filter
});
this.registerFilteredRecordArray(array, typeClass, filter);
return array;
},
/**
Create a `DS.AdapterPopulatedRecordArray` for a type with given query.
@method createAdapterPopulatedRecordArray
@param {DS.Model} typeClass
@param {Object} query
@return {DS.AdapterPopulatedRecordArray}
*/
createAdapterPopulatedRecordArray: function (typeClass, query) {
var array = ember$data$lib$system$record$arrays$adapter$populated$record$array$$default.create({
type: typeClass,
query: query,
content: Ember.A(),
store: this.store,
manager: this
});
this._adapterPopulatedRecordArrays.push(array);
return array;
},
/**
Register a RecordArray for a given type to be backed by
a filter function. This will cause the array to update
automatically when records of that type change attribute
values or states.
@method registerFilteredRecordArray
@param {DS.RecordArray} array
@param {DS.Model} typeClass
@param {Function} filter
*/
registerFilteredRecordArray: function (array, typeClass, filter) {
var recordArrays = this.filteredRecordArrays.get(typeClass);
recordArrays.push(array);
this.updateFilter(array, typeClass, filter);
},
/**
Unregister a RecordArray.
So manager will not update this array.
@method unregisterRecordArray
@param {DS.RecordArray} array
*/
unregisterRecordArray: function (array) {
var typeClass = array.type;
// unregister filtered record array
var recordArrays = this.filteredRecordArrays.get(typeClass);
var index = ember$data$lib$system$record$array$manager$$indexOf.call(recordArrays, array);
if (index !== -1) {
recordArrays.splice(index, 1);
// unregister live record array
} else if (this.liveRecordArrays.has(typeClass)) {
var liveRecordArrayForType = this.liveRecordArrayFor(typeClass);
if (array === liveRecordArrayForType) {
this.liveRecordArrays["delete"](typeClass);
}
}
},
willDestroy: function () {
this._super.apply(this, arguments);
this.filteredRecordArrays.forEach(function (value) {
ember$data$lib$system$record$array$manager$$forEach.call(ember$data$lib$system$record$array$manager$$flatten(value), ember$data$lib$system$record$array$manager$$destroy);
});
this.liveRecordArrays.forEach(ember$data$lib$system$record$array$manager$$destroy);
ember$data$lib$system$record$array$manager$$forEach.call(this._adapterPopulatedRecordArrays, ember$data$lib$system$record$array$manager$$destroy);
}
});
function ember$data$lib$system$record$array$manager$$destroy(entry) {
entry.destroy();
}
function ember$data$lib$system$record$array$manager$$flatten(list) {
var length = list.length;
var result = Ember.A();
for (var i = 0; i < length; i++) {
result = result.concat(list[i]);
}
return result;
}
/**
* The `ContainerInstanceCache` serves as a lazy cache for looking up
* instances of serializers and adapters. It has some additional logic for
* finding the 'fallback' adapter or serializer.
*
* The 'fallback' adapter or serializer is an adapter or serializer that is looked up
* when the preferred lookup fails. For example, say you try to look up `adapter:post`,
* but there is no entry (app/adapters/post.js in EmberCLI) for `adapter:post` in the registry.
*
* The `fallbacks` array passed will then be used; the first entry in the fallbacks array
* that exists in the container will then be cached for `adapter:post`. So, the next time you
* look up `adapter:post`, you'll get the `adapter:application` instance (or whatever the fallback
* was if `adapter:application` doesn't exist).
*
* @private
* @class ContainerInstanceCache
*
*/
function ember$data$lib$system$store$container$instance$cache$$ContainerInstanceCache(container) {
this._container = container;
this._cache = ember$lib$main$$default.create(null);
}
ember$data$lib$system$store$container$instance$cache$$ContainerInstanceCache.prototype = ember$lib$main$$default.create(null);
ember$lib$main$$default.merge(ember$data$lib$system$store$container$instance$cache$$ContainerInstanceCache.prototype, {
get: function (type, preferredKey, fallbacks) {
var cache = this._cache;
var preferredLookupKey = '' + type + ':' + preferredKey;
if (!(preferredLookupKey in cache)) {
var instance = this.instanceFor(preferredLookupKey) || this._findInstance(type, fallbacks);
if (instance) {
cache[preferredLookupKey] = instance;
}
}
return cache[preferredLookupKey];
},
_findInstance: function (type, fallbacks) {
for (var i = 0, _length = fallbacks.length; i < _length; i++) {
var fallback = fallbacks[i];
var lookupKey = '' + type + ':' + fallback;
var instance = this.instanceFor(lookupKey);
if (instance) {
return instance;
}
}
},
instanceFor: function (key) {
if (key === 'adapter:-rest') {
ember$lib$main$$default.deprecate('You are currently using the default DS.RESTAdapter adapter. For Ember 2.0 the default adapter will be DS.JSONAPIAdapter. If you would like to continue using DS.RESTAdapter please create an application adapter that extends DS.RESTAdapter.');
}
var cache = this._cache;
if (!cache[key]) {
var instance = this._container.lookup(key);
if (instance) {
cache[key] = instance;
}
}
return cache[key];
},
destroy: function () {
var cache = this._cache;
var cacheEntries = ember$lib$main$$default.keys(cache);
for (var i = 0, _length2 = cacheEntries.length; i < _length2; i++) {
var cacheKey = cacheEntries[i];
var cacheEntry = cache[cacheKey];
if (cacheEntry) {
cacheEntry.destroy();
}
}
this._container = null;
},
constructor: ember$data$lib$system$store$container$instance$cache$$ContainerInstanceCache,
toString: function () {
return 'ContainerInstanceCache';
}
});
var ember$data$lib$system$store$container$instance$cache$$default = ember$data$lib$system$store$container$instance$cache$$ContainerInstanceCache;
function ember$data$lib$system$merge$$merge(original, updates) {
if (!updates || typeof updates !== 'object') {
return original;
}
var props = Ember.keys(updates);
var prop;
var length = props.length;
for (var i = 0; i < length; i++) {
prop = props[i];
original[prop] = updates[prop];
}
return original;
}
var ember$data$lib$system$merge$$default = ember$data$lib$system$merge$$merge;
var ember$data$lib$system$model$states$$get = Ember.get;
/*
This file encapsulates the various states that a record can transition
through during its lifecycle.
*/
/**
### State
Each record has a `currentState` property that explicitly tracks what
state a record is in at any given time. For instance, if a record is
newly created and has not yet been sent to the adapter to be saved,
it would be in the `root.loaded.created.uncommitted` state. If a
record has had local modifications made to it that are in the
process of being saved, the record would be in the
`root.loaded.updated.inFlight` state. (This state paths will be
explained in more detail below.)
Events are sent by the record or its store to the record's
`currentState` property. How the state reacts to these events is
dependent on which state it is in. In some states, certain events
will be invalid and will cause an exception to be raised.
States are hierarchical and every state is a substate of the
`RootState`. For example, a record can be in the
`root.deleted.uncommitted` state, then transition into the
`root.deleted.inFlight` state. If a child state does not implement
an event handler, the state manager will attempt to invoke the event
on all parent states until the root state is reached. The state
hierarchy of a record is described in terms of a path string. You
can determine a record's current state by getting the state's
`stateName` property:
```javascript
record.get('currentState.stateName');
//=> "root.created.uncommitted"
```
The hierarchy of valid states that ship with ember data looks like
this:
```text
* root
* deleted
* saved
* uncommitted
* inFlight
* empty
* loaded
* created
* uncommitted
* inFlight
* saved
* updated
* uncommitted
* inFlight
* loading
```
The `DS.Model` states are themselves stateless. What that means is
that, the hierarchical states that each of *those* points to is a
shared data structure. For performance reasons, instead of each
record getting its own copy of the hierarchy of states, each record
points to this global, immutable shared instance. How does a state
know which record it should be acting on? We pass the record
instance into the state's event handlers as the first argument.
The record passed as the first parameter is where you should stash
state about the record if needed; you should never store data on the state
object itself.
### Events and Flags
A state may implement zero or more events and flags.
#### Events
Events are named functions that are invoked when sent to a record. The
record will first look for a method with the given name on the
current state. If no method is found, it will search the current
state's parent, and then its grandparent, and so on until reaching
the top of the hierarchy. If the root is reached without an event
handler being found, an exception will be raised. This can be very
helpful when debugging new features.
Here's an example implementation of a state with a `myEvent` event handler:
```javascript
aState: DS.State.create({
myEvent: function(manager, param) {
console.log("Received myEvent with", param);
}
})
```
To trigger this event:
```javascript
record.send('myEvent', 'foo');
//=> "Received myEvent with foo"
```
Note that an optional parameter can be sent to a record's `send()` method,
which will be passed as the second parameter to the event handler.
Events should transition to a different state if appropriate. This can be
done by calling the record's `transitionTo()` method with a path to the
desired state. The state manager will attempt to resolve the state path
relative to the current state. If no state is found at that path, it will
attempt to resolve it relative to the current state's parent, and then its
parent, and so on until the root is reached. For example, imagine a hierarchy
like this:
* created
* uncommitted <-- currentState
* inFlight
* updated
* inFlight
If we are currently in the `uncommitted` state, calling
`transitionTo('inFlight')` would transition to the `created.inFlight` state,
while calling `transitionTo('updated.inFlight')` would transition to
the `updated.inFlight` state.
Remember that *only events* should ever cause a state transition. You should
never call `transitionTo()` from outside a state's event handler. If you are
tempted to do so, create a new event and send that to the state manager.
#### Flags
Flags are Boolean values that can be used to introspect a record's current
state in a more user-friendly way than examining its state path. For example,
instead of doing this:
```javascript
var statePath = record.get('stateManager.currentPath');
if (statePath === 'created.inFlight') {
doSomething();
}
```
You can say:
```javascript
if (record.get('isNew') && record.get('isSaving')) {
doSomething();
}
```
If your state does not set a value for a given flag, the value will
be inherited from its parent (or the first place in the state hierarchy
where it is defined).
The current set of flags are defined below. If you want to add a new flag,
in addition to the area below, you will also need to declare it in the
`DS.Model` class.
* [isEmpty](DS.Model.html#property_isEmpty)
* [isLoading](DS.Model.html#property_isLoading)
* [isLoaded](DS.Model.html#property_isLoaded)
* [isDirty](DS.Model.html#property_isDirty)
* [isSaving](DS.Model.html#property_isSaving)
* [isDeleted](DS.Model.html#property_isDeleted)
* [isNew](DS.Model.html#property_isNew)
* [isValid](DS.Model.html#property_isValid)
@namespace DS
@class RootState
*/
function ember$data$lib$system$model$states$$didSetProperty(internalModel, context) {
if (context.value === context.originalValue) {
delete internalModel._attributes[context.name];
internalModel.send('propertyWasReset', context.name);
} else if (context.value !== context.oldValue) {
internalModel.send('becomeDirty');
}
internalModel.updateRecordArraysLater();
}
// Implementation notes:
//
// Each state has a boolean value for all of the following flags:
//
// * isLoaded: The record has a populated `data` property. When a
// record is loaded via `store.find`, `isLoaded` is false
// until the adapter sets it. When a record is created locally,
// its `isLoaded` property is always true.
// * isDirty: The record has local changes that have not yet been
// saved by the adapter. This includes records that have been
// created (but not yet saved) or deleted.
// * isSaving: The record has been committed, but
// the adapter has not yet acknowledged that the changes have
// been persisted to the backend.
// * isDeleted: The record was marked for deletion. When `isDeleted`
// is true and `isDirty` is true, the record is deleted locally
// but the deletion was not yet persisted. When `isSaving` is
// true, the change is in-flight. When both `isDirty` and
// `isSaving` are false, the change has persisted.
// * isError: The adapter reported that it was unable to save
// local changes to the backend. This may also result in the
// record having its `isValid` property become false if the
// adapter reported that server-side validations failed.
// * isNew: The record was created on the client and the adapter
// did not yet report that it was successfully saved.
// * isValid: The adapter did not report any server-side validation
// failures.
// The dirty state is a abstract state whose functionality is
// shared between the `created` and `updated` states.
//
// The deleted state shares the `isDirty` flag with the
// subclasses of `DirtyState`, but with a very different
// implementation.
//
// Dirty states have three child states:
//
// `uncommitted`: the store has not yet handed off the record
// to be saved.
// `inFlight`: the store has handed off the record to be saved,
// but the adapter has not yet acknowledged success.
// `invalid`: the record has invalid information and cannot be
// send to the adapter yet.
var ember$data$lib$system$model$states$$DirtyState = {
initialState: 'uncommitted',
// FLAGS
isDirty: true,
// SUBSTATES
// When a record first becomes dirty, it is `uncommitted`.
// This means that there are local pending changes, but they
// have not yet begun to be saved, and are not invalid.
uncommitted: {
// EVENTS
didSetProperty: ember$data$lib$system$model$states$$didSetProperty,
//TODO(Igor) reloading now triggers a
//loadingData event, though it seems fine?
loadingData: Ember.K,
propertyWasReset: function (internalModel, name) {
var length = Ember.keys(internalModel._attributes).length;
var stillDirty = length > 0;
if (!stillDirty) {
internalModel.send('rolledBack');
}
},
pushedData: Ember.K,
becomeDirty: Ember.K,
willCommit: function (internalModel) {
internalModel.transitionTo('inFlight');
},
reloadRecord: function (internalModel, resolve) {
resolve(internalModel.store.reloadRecord(internalModel));
},
rolledBack: function (internalModel) {
internalModel.transitionTo('loaded.saved');
},
becameInvalid: function (internalModel) {
internalModel.transitionTo('invalid');
},
rollback: function (internalModel) {
internalModel.rollbackAttributes();
internalModel.triggerLater('ready');
}
},
// Once a record has been handed off to the adapter to be
// saved, it is in the 'in flight' state. Changes to the
// record cannot be made during this window.
inFlight: {
// FLAGS
isSaving: true,
// EVENTS
didSetProperty: ember$data$lib$system$model$states$$didSetProperty,
becomeDirty: Ember.K,
pushedData: Ember.K,
unloadRecord: ember$data$lib$system$model$states$$assertAgainstUnloadRecord,
// TODO: More robust semantics around save-while-in-flight
willCommit: Ember.K,
didCommit: function (internalModel) {
var dirtyType = ember$data$lib$system$model$states$$get(this, 'dirtyType');
internalModel.transitionTo('saved');
internalModel.send('invokeLifecycleCallbacks', dirtyType);
},
becameInvalid: function (internalModel) {
internalModel.transitionTo('invalid');
internalModel.send('invokeLifecycleCallbacks');
},
becameError: function (internalModel) {
internalModel.transitionTo('uncommitted');
internalModel.triggerLater('becameError', internalModel);
}
},
// A record is in the `invalid` if the adapter has indicated
// the the record failed server-side invalidations.
invalid: {
// FLAGS
isValid: false,
// EVENTS
deleteRecord: function (internalModel) {
internalModel.transitionTo('deleted.uncommitted');
internalModel.disconnectRelationships();
},
didSetProperty: function (internalModel, context) {
internalModel.removeErrorMessageFromAttribute(context.name);
ember$data$lib$system$model$states$$didSetProperty(internalModel, context);
},
becomeDirty: Ember.K,
pushedData: Ember.K,
willCommit: function (internalModel) {
internalModel.clearErrorMessages();
internalModel.transitionTo('inFlight');
},
rolledBack: function (internalModel) {
internalModel.clearErrorMessages();
internalModel.triggerLater('ready');
},
becameValid: function (internalModel) {
internalModel.transitionTo('uncommitted');
},
invokeLifecycleCallbacks: function (internalModel) {
internalModel.triggerLater('becameInvalid', internalModel);
},
exit: function (internalModel) {
internalModel._inFlightAttributes = Ember.create(null);
}
}
};
// The created and updated states are created outside the state
// chart so we can reopen their substates and add mixins as
// necessary.
function ember$data$lib$system$model$states$$deepClone(object) {
var clone = {};
var value;
for (var prop in object) {
value = object[prop];
if (value && typeof value === 'object') {
clone[prop] = ember$data$lib$system$model$states$$deepClone(value);
} else {
clone[prop] = value;
}
}
return clone;
}
function ember$data$lib$system$model$states$$mixin(original, hash) {
for (var prop in hash) {
original[prop] = hash[prop];
}
return original;
}
function ember$data$lib$system$model$states$$dirtyState(options) {
var newState = ember$data$lib$system$model$states$$deepClone(ember$data$lib$system$model$states$$DirtyState);
return ember$data$lib$system$model$states$$mixin(newState, options);
}
var ember$data$lib$system$model$states$$createdState = ember$data$lib$system$model$states$$dirtyState({
dirtyType: 'created',
// FLAGS
isNew: true
});
ember$data$lib$system$model$states$$createdState.invalid.rolledBack = function (internalModel) {
internalModel.transitionTo('deleted.saved');
};
ember$data$lib$system$model$states$$createdState.uncommitted.rolledBack = function (internalModel) {
internalModel.transitionTo('deleted.saved');
};
var ember$data$lib$system$model$states$$updatedState = ember$data$lib$system$model$states$$dirtyState({
dirtyType: 'updated'
});
ember$data$lib$system$model$states$$createdState.uncommitted.deleteRecord = function (internalModel) {
internalModel.disconnectRelationships();
internalModel.transitionTo('deleted.saved');
internalModel.send('invokeLifecycleCallbacks');
};
ember$data$lib$system$model$states$$createdState.uncommitted.rollback = function (internalModel) {
ember$data$lib$system$model$states$$DirtyState.uncommitted.rollback.apply(this, arguments);
internalModel.transitionTo('deleted.saved');
};
ember$data$lib$system$model$states$$createdState.uncommitted.pushedData = function (internalModel) {
internalModel.transitionTo('loaded.updated.uncommitted');
internalModel.triggerLater('didLoad');
};
ember$data$lib$system$model$states$$createdState.uncommitted.propertyWasReset = Ember.K;
function ember$data$lib$system$model$states$$assertAgainstUnloadRecord(internalModel) {
Ember.assert('You can only unload a record which is not inFlight. `' + internalModel + '`', false);
}
ember$data$lib$system$model$states$$updatedState.inFlight.unloadRecord = ember$data$lib$system$model$states$$assertAgainstUnloadRecord;
ember$data$lib$system$model$states$$updatedState.uncommitted.deleteRecord = function (internalModel) {
internalModel.transitionTo('deleted.uncommitted');
internalModel.disconnectRelationships();
};
var ember$data$lib$system$model$states$$RootState = {
// FLAGS
isEmpty: false,
isLoading: false,
isLoaded: false,
isDirty: false,
isSaving: false,
isDeleted: false,
isNew: false,
isValid: true,
// DEFAULT EVENTS
// Trying to roll back if you're not in the dirty state
// doesn't change your state. For example, if you're in the
// in-flight state, rolling back the record doesn't move
// you out of the in-flight state.
rolledBack: Ember.K,
unloadRecord: function (internalModel) {
// clear relationships before moving to deleted state
// otherwise it fails
internalModel.clearRelationships();
internalModel.transitionTo('deleted.saved');
},
propertyWasReset: Ember.K,
// SUBSTATES
// A record begins its lifecycle in the `empty` state.
// If its data will come from the adapter, it will
// transition into the `loading` state. Otherwise, if
// the record is being created on the client, it will
// transition into the `created` state.
empty: {
isEmpty: true,
// EVENTS
loadingData: function (internalModel, promise) {
internalModel._loadingPromise = promise;
internalModel.transitionTo('loading');
},
loadedData: function (internalModel) {
internalModel.transitionTo('loaded.created.uncommitted');
internalModel.triggerLater('ready');
},
pushedData: function (internalModel) {
internalModel.transitionTo('loaded.saved');
internalModel.triggerLater('didLoad');
internalModel.triggerLater('ready');
}
},
// A record enters this state when the store asks
// the adapter for its data. It remains in this state
// until the adapter provides the requested data.
//
// Usually, this process is asynchronous, using an
// XHR to retrieve the data.
loading: {
// FLAGS
isLoading: true,
exit: function (internalModel) {
internalModel._loadingPromise = null;
},
// EVENTS
pushedData: function (internalModel) {
internalModel.transitionTo('loaded.saved');
internalModel.triggerLater('didLoad');
internalModel.triggerLater('ready');
//TODO this seems out of place here
internalModel.didCleanError();
},
becameError: function (internalModel) {
internalModel.triggerLater('becameError', internalModel);
},
notFound: function (internalModel) {
internalModel.transitionTo('empty');
}
},
// A record enters this state when its data is populated.
// Most of a record's lifecycle is spent inside substates
// of the `loaded` state.
loaded: {
initialState: 'saved',
// FLAGS
isLoaded: true,
//TODO(Igor) Reloading now triggers a loadingData event,
//but it should be ok?
loadingData: Ember.K,
// SUBSTATES
// If there are no local changes to a record, it remains
// in the `saved` state.
saved: {
setup: function (internalModel) {
var attrs = internalModel._attributes;
var isDirty = Ember.keys(attrs).length > 0;
if (isDirty) {
internalModel.adapterDidDirty();
}
},
// EVENTS
didSetProperty: ember$data$lib$system$model$states$$didSetProperty,
pushedData: Ember.K,
becomeDirty: function (internalModel) {
internalModel.transitionTo('updated.uncommitted');
},
willCommit: function (internalModel) {
internalModel.transitionTo('updated.inFlight');
},
reloadRecord: function (internalModel, resolve) {
resolve(internalModel.store.reloadRecord(internalModel));
},
deleteRecord: function (internalModel) {
internalModel.transitionTo('deleted.uncommitted');
internalModel.disconnectRelationships();
},
unloadRecord: function (internalModel) {
// clear relationships before moving to deleted state
// otherwise it fails
internalModel.clearRelationships();
internalModel.transitionTo('deleted.saved');
},
didCommit: function (internalModel) {
internalModel.send('invokeLifecycleCallbacks', ember$data$lib$system$model$states$$get(internalModel, 'lastDirtyType'));
},
// loaded.saved.notFound would be triggered by a failed
// `reload()` on an unchanged record
notFound: Ember.K
},
// A record is in this state after it has been locally
// created but before the adapter has indicated that
// it has been saved.
created: ember$data$lib$system$model$states$$createdState,
// A record is in this state if it has already been
// saved to the server, but there are new local changes
// that have not yet been saved.
updated: ember$data$lib$system$model$states$$updatedState
},
// A record is in this state if it was deleted from the store.
deleted: {
initialState: 'uncommitted',
dirtyType: 'deleted',
// FLAGS
isDeleted: true,
isLoaded: true,
isDirty: true,
// TRANSITIONS
setup: function (internalModel) {
internalModel.updateRecordArrays();
},
// SUBSTATES
// When a record is deleted, it enters the `start`
// state. It will exit this state when the record
// starts to commit.
uncommitted: {
// EVENTS
willCommit: function (internalModel) {
internalModel.transitionTo('inFlight');
},
rollback: function (internalModel) {
internalModel.rollbackAttributes();
internalModel.triggerLater('ready');
},
pushedData: Ember.K,
becomeDirty: Ember.K,
deleteRecord: Ember.K,
rolledBack: function (internalModel) {
internalModel.transitionTo('loaded.saved');
internalModel.triggerLater('ready');
}
},
// After a record starts committing, but
// before the adapter indicates that the deletion
// has saved to the server, a record is in the
// `inFlight` substate of `deleted`.
inFlight: {
// FLAGS
isSaving: true,
// EVENTS
unloadRecord: ember$data$lib$system$model$states$$assertAgainstUnloadRecord,
// TODO: More robust semantics around save-while-in-flight
willCommit: Ember.K,
didCommit: function (internalModel) {
internalModel.transitionTo('saved');
internalModel.send('invokeLifecycleCallbacks');
},
becameError: function (internalModel) {
internalModel.transitionTo('uncommitted');
internalModel.triggerLater('becameError', internalModel);
},
becameInvalid: function (internalModel) {
internalModel.transitionTo('invalid');
internalModel.triggerLater('becameInvalid', internalModel);
}
},
// Once the adapter indicates that the deletion has
// been saved, the record enters the `saved` substate
// of `deleted`.
saved: {
// FLAGS
isDirty: false,
setup: function (internalModel) {
var store = internalModel.store;
store._dematerializeRecord(internalModel);
},
invokeLifecycleCallbacks: function (internalModel) {
internalModel.triggerLater('didDelete', internalModel);
internalModel.triggerLater('didCommit', internalModel);
},
willCommit: Ember.K,
didCommit: Ember.K
},
invalid: {
isValid: false,
didSetProperty: function (internalModel, context) {
internalModel.removeErrorMessageFromAttribute(context.name);
ember$data$lib$system$model$states$$didSetProperty(internalModel, context);
},
deleteRecord: Ember.K,
becomeDirty: Ember.K,
willCommit: Ember.K,
rolledBack: function (internalModel) {
internalModel.clearErrorMessages();
internalModel.transitionTo('loaded.saved');
internalModel.triggerLater('ready');
},
becameValid: function (internalModel) {
internalModel.transitionTo('uncommitted');
}
}
},
invokeLifecycleCallbacks: function (internalModel, dirtyType) {
if (dirtyType === 'created') {
internalModel.triggerLater('didCreate', internalModel);
} else {
internalModel.triggerLater('didUpdate', internalModel);
}
internalModel.triggerLater('didCommit', internalModel);
}
};
function ember$data$lib$system$model$states$$wireState(object, parent, name) {
/*jshint proto:true*/
// TODO: Use Object.create and copy instead
object = ember$data$lib$system$model$states$$mixin(parent ? Ember.create(parent) : {}, object);
object.parentState = parent;
object.stateName = name;
for (var prop in object) {
if (!object.hasOwnProperty(prop) || prop === 'parentState' || prop === 'stateName') {
continue;
}
if (typeof object[prop] === 'object') {
object[prop] = ember$data$lib$system$model$states$$wireState(object[prop], object, name + '.' + prop);
}
}
return object;
}
ember$data$lib$system$model$states$$RootState = ember$data$lib$system$model$states$$wireState(ember$data$lib$system$model$states$$RootState, null, 'root');
var ember$data$lib$system$model$states$$default = ember$data$lib$system$model$states$$RootState;
var ember$data$lib$system$relationships$state$relationship$$forEach = Ember.ArrayPolyfills.forEach;
function ember$data$lib$system$relationships$state$relationship$$Relationship(store, record, inverseKey, relationshipMeta) {
this.members = new ember$data$lib$system$ordered$set$$default();
this.canonicalMembers = new ember$data$lib$system$ordered$set$$default();
this.store = store;
this.key = relationshipMeta.key;
this.inverseKey = inverseKey;
this.record = record;
this.isAsync = relationshipMeta.options.async;
this.relationshipMeta = relationshipMeta;
//This probably breaks for polymorphic relationship in complex scenarios, due to
//multiple possible modelNames
this.inverseKeyForImplicit = this.record.constructor.modelName + this.key;
this.linkPromise = null;
this.meta = null;
this.hasData = false;
}
ember$data$lib$system$relationships$state$relationship$$Relationship.prototype = {
constructor: ember$data$lib$system$relationships$state$relationship$$Relationship,
destroy: Ember.K,
updateMeta: function (meta) {
this.meta = meta;
},
clear: function () {
var members = this.members.list;
var member;
while (members.length > 0) {
member = members[0];
this.removeRecord(member);
}
},
disconnect: function () {
this.members.forEach(function (member) {
this.removeRecordFromInverse(member);
}, this);
},
reconnect: function () {
this.members.forEach(function (member) {
this.addRecordToInverse(member);
}, this);
},
removeRecords: function (records) {
var self = this;
ember$data$lib$system$relationships$state$relationship$$forEach.call(records, function (record) {
self.removeRecord(record);
});
},
addRecords: function (records, idx) {
var self = this;
ember$data$lib$system$relationships$state$relationship$$forEach.call(records, function (record) {
self.addRecord(record, idx);
if (idx !== undefined) {
idx++;
}
});
},
addCanonicalRecords: function (records, idx) {
for (var i = 0; i < records.length; i++) {
if (idx !== undefined) {
this.addCanonicalRecord(records[i], i + idx);
} else {
this.addCanonicalRecord(records[i]);
}
}
},
addCanonicalRecord: function (record, idx) {
if (!this.canonicalMembers.has(record)) {
this.canonicalMembers.add(record);
if (this.inverseKey) {
record._relationships.get(this.inverseKey).addCanonicalRecord(this.record);
} else {
if (!record._implicitRelationships[this.inverseKeyForImplicit]) {
record._implicitRelationships[this.inverseKeyForImplicit] = new ember$data$lib$system$relationships$state$relationship$$Relationship(this.store, record, this.key, { options: {} });
}
record._implicitRelationships[this.inverseKeyForImplicit].addCanonicalRecord(this.record);
}
}
this.flushCanonicalLater();
this.setHasData(true);
},
removeCanonicalRecords: function (records, idx) {
for (var i = 0; i < records.length; i++) {
if (idx !== undefined) {
this.removeCanonicalRecord(records[i], i + idx);
} else {
this.removeCanonicalRecord(records[i]);
}
}
},
removeCanonicalRecord: function (record, idx) {
if (this.canonicalMembers.has(record)) {
this.removeCanonicalRecordFromOwn(record);
if (this.inverseKey) {
this.removeCanonicalRecordFromInverse(record);
} else {
if (record._implicitRelationships[this.inverseKeyForImplicit]) {
record._implicitRelationships[this.inverseKeyForImplicit].removeCanonicalRecord(this.record);
}
}
}
this.flushCanonicalLater();
},
addRecord: function (record, idx) {
if (!this.members.has(record)) {
this.members.addWithIndex(record, idx);
this.notifyRecordRelationshipAdded(record, idx);
if (this.inverseKey) {
record._relationships.get(this.inverseKey).addRecord(this.record);
} else {
if (!record._implicitRelationships[this.inverseKeyForImplicit]) {
record._implicitRelationships[this.inverseKeyForImplicit] = new ember$data$lib$system$relationships$state$relationship$$Relationship(this.store, record, this.key, { options: {} });
}
record._implicitRelationships[this.inverseKeyForImplicit].addRecord(this.record);
}
this.record.updateRecordArraysLater();
}
this.setHasData(true);
},
removeRecord: function (record) {
if (this.members.has(record)) {
this.removeRecordFromOwn(record);
if (this.inverseKey) {
this.removeRecordFromInverse(record);
} else {
if (record._implicitRelationships[this.inverseKeyForImplicit]) {
record._implicitRelationships[this.inverseKeyForImplicit].removeRecord(this.record);
}
}
}
},
addRecordToInverse: function (record) {
if (this.inverseKey) {
record._relationships.get(this.inverseKey).addRecord(this.record);
}
},
removeRecordFromInverse: function (record) {
var inverseRelationship = record._relationships.get(this.inverseKey);
//Need to check for existence, as the record might unloading at the moment
if (inverseRelationship) {
inverseRelationship.removeRecordFromOwn(this.record);
}
},
removeRecordFromOwn: function (record) {
this.members["delete"](record);
this.notifyRecordRelationshipRemoved(record);
this.record.updateRecordArrays();
},
removeCanonicalRecordFromInverse: function (record) {
var inverseRelationship = record._relationships.get(this.inverseKey);
//Need to check for existence, as the record might unloading at the moment
if (inverseRelationship) {
inverseRelationship.removeCanonicalRecordFromOwn(this.record);
}
},
removeCanonicalRecordFromOwn: function (record) {
this.canonicalMembers["delete"](record);
this.flushCanonicalLater();
},
flushCanonical: function () {
this.willSync = false;
//a hack for not removing new records
//TODO remove once we have proper diffing
var newRecords = [];
for (var i = 0; i < this.members.list.length; i++) {
if (this.members.list[i].isNew()) {
newRecords.push(this.members.list[i]);
}
}
//TODO(Igor) make this less abysmally slow
this.members = this.canonicalMembers.copy();
for (i = 0; i < newRecords.length; i++) {
this.members.add(newRecords[i]);
}
},
flushCanonicalLater: function () {
if (this.willSync) {
return;
}
this.willSync = true;
var self = this;
this.store._backburner.join(function () {
self.store._backburner.schedule("syncRelationships", self, self.flushCanonical);
});
},
updateLink: function (link) {
Ember.warn("You have pushed a record of type '" + this.record.type.modelName + "' with '" + this.key + "' as a link, but the association is not an async relationship.", this.isAsync);
Ember.assert("You have pushed a record of type '" + this.record.type.modelName + "' with '" + this.key + "' as a link, but the value of that link is not a string.", typeof link === "string" || link === null);
if (link !== this.link) {
this.link = link;
this.linkPromise = null;
this.record.notifyPropertyChange(this.key);
}
},
findLink: function () {
if (this.linkPromise) {
return this.linkPromise;
} else {
var promise = this.fetchLink();
this.linkPromise = promise;
return promise.then(function (result) {
return result;
});
}
},
updateRecordsFromAdapter: function (records) {
//TODO(Igor) move this to a proper place
var self = this;
//TODO Once we have adapter support, we need to handle updated and canonical changes
self.computeChanges(records);
self.setHasData(true);
},
notifyRecordRelationshipAdded: Ember.K,
notifyRecordRelationshipRemoved: Ember.K,
setHasData: function (value) {
this.hasData = value;
}
};
var ember$data$lib$system$relationships$state$relationship$$default = ember$data$lib$system$relationships$state$relationship$$Relationship;
var ember$data$lib$system$many$array$$get = Ember.get;
var ember$data$lib$system$many$array$$set = Ember.set;
var ember$data$lib$system$many$array$$filter = Ember.ArrayPolyfills.filter;
var ember$data$lib$system$many$array$$default = Ember.Object.extend(Ember.MutableArray, Ember.Evented, {
init: function () {
this.currentState = Ember.A([]);
},
record: null,
canonicalState: null,
currentState: null,
length: 0,
objectAt: function (index) {
//Ember observers such as 'firstObject', 'lastObject' might do out of bounds accesses
if (!this.currentState[index]) {
return undefined;
}
return this.currentState[index].getRecord();
},
flushCanonical: function () {
//TODO make this smarter, currently its plenty stupid
var toSet = ember$data$lib$system$many$array$$filter.call(this.canonicalState, function (internalModel) {
return !internalModel.isDeleted();
});
//a hack for not removing new records
//TODO remove once we have proper diffing
var newRecords = this.currentState.filter(function (internalModel) {
return internalModel.isNew();
});
toSet = toSet.concat(newRecords);
var oldLength = this.length;
this.arrayContentWillChange(0, this.length, toSet.length);
this.set('length', toSet.length);
this.currentState = toSet;
this.arrayContentDidChange(0, oldLength, this.length);
//TODO Figure out to notify only on additions and maybe only if unloaded
this.relationship.notifyHasManyChanged();
this.record.updateRecordArrays();
},
/**
`true` if the relationship is polymorphic, `false` otherwise.
@property {Boolean} isPolymorphic
@private
*/
isPolymorphic: false,
/**
The loading state of this array
@property {Boolean} isLoaded
*/
isLoaded: false,
/**
The relationship which manages this array.
@property {ManyRelationship} relationship
@private
*/
relationship: null,
/**
Metadata associated with the request for async hasMany relationships.
Example
Given that the server returns the following JSON payload when fetching a
hasMany relationship:
```js
{
"comments": [{
"id": 1,
"comment": "This is the first comment",
}, {
// ...
}],
"meta": {
"page": 1,
"total": 5
}
}
```
You can then access the metadata via the `meta` property:
```js
post.get('comments').then(function(comments) {
var meta = comments.get('meta');
// meta.page => 1
// meta.total => 5
});
```
@property {Object} meta
@public
*/
meta: null,
internalReplace: function (idx, amt, objects) {
if (!objects) {
objects = [];
}
this.arrayContentWillChange(idx, amt, objects.length);
this.currentState.splice.apply(this.currentState, [idx, amt].concat(objects));
this.set('length', this.currentState.length);
this.arrayContentDidChange(idx, amt, objects.length);
if (objects) {
//TODO(Igor) probably needed only for unloaded records
this.relationship.notifyHasManyChanged();
}
this.record.updateRecordArrays();
},
//TODO(Igor) optimize
internalRemoveRecords: function (records) {
var index;
for (var i = 0; i < records.length; i++) {
index = this.currentState.indexOf(records[i]);
this.internalReplace(index, 1);
}
},
//TODO(Igor) optimize
internalAddRecords: function (records, idx) {
if (idx === undefined) {
idx = this.currentState.length;
}
this.internalReplace(idx, 0, records);
},
replace: function (idx, amt, objects) {
var records;
if (amt > 0) {
records = this.currentState.slice(idx, idx + amt);
this.get('relationship').removeRecords(records);
}
var map = objects.map || Ember.ArrayPolyfills.map;
if (objects) {
this.get('relationship').addRecords(map.call(objects, function (obj) {
return obj._internalModel;
}), idx);
}
},
/**
Used for async `hasMany` arrays
to keep track of when they will resolve.
@property {Ember.RSVP.Promise} promise
@private
*/
promise: null,
/**
@method loadingRecordsCount
@param {Number} count
@private
*/
loadingRecordsCount: function (count) {
this.loadingRecordsCount = count;
},
/**
@method loadedRecord
@private
*/
loadedRecord: function () {
this.loadingRecordsCount--;
if (this.loadingRecordsCount === 0) {
ember$data$lib$system$many$array$$set(this, 'isLoaded', true);
this.trigger('didLoad');
}
},
/**
@method reload
@public
*/
reload: function () {
return this.relationship.reload();
},
/**
Saves all of the records in the `ManyArray`.
Example
```javascript
store.find('inbox', 1).then(function(inbox) {
inbox.get('messages').then(function(messages) {
messages.forEach(function(message) {
message.set('isRead', true);
});
messages.save()
});
});
```
@method save
@return {DS.PromiseArray} promise
*/
save: function () {
var manyArray = this;
var promiseLabel = 'DS: ManyArray#save ' + ember$data$lib$system$many$array$$get(this, 'type');
var promise = Ember.RSVP.all(this.invoke('save'), promiseLabel).then(function (array) {
return manyArray;
}, null, 'DS: ManyArray#save return ManyArray');
return ember$data$lib$system$promise$proxies$$PromiseArray.create({ promise: promise });
},
/**
Create a child record within the owner
@method createRecord
@private
@param {Object} hash
@return {DS.Model} record
*/
createRecord: function (hash) {
var store = ember$data$lib$system$many$array$$get(this, 'store');
var type = ember$data$lib$system$many$array$$get(this, 'type');
var record;
Ember.assert('You cannot add \'' + type.modelName + '\' records to this polymorphic relationship.', !ember$data$lib$system$many$array$$get(this, 'isPolymorphic'));
record = store.createRecord(type.modelName, hash);
this.pushObject(record);
return record;
},
/**
@method addRecord
@param {DS.Model} record
@deprecated Use `addObject()` instead
*/
addRecord: function (record) {
Ember.deprecate('Using manyArray.addRecord() has been deprecated. You should use manyArray.addObject() instead.');
this.addObject(record);
},
/**
@method removeRecord
@param {DS.Model} record
@deprecated Use `removeObject()` instead
*/
removeRecord: function (record) {
Ember.deprecate('Using manyArray.removeRecord() has been deprecated. You should use manyArray.removeObject() instead.');
this.removeObject(record);
}
});
/**
Assert that `addedRecord` has a valid type so it can be added to the
relationship of the `record`.
The assert basically checks if the `addedRecord` can be added to the
relationship (specified via `relationshipMeta`) of the `record`.
This utility should only be used internally, as both record parameters must
be an InternalModel and the `relationshipMeta` needs to be the meta
information about the relationship, retrieved via
`record.relationshipFor(key)`.
@method assertPolymorphicType
@param {InternalModel} record
@param {RelationshipMeta} relationshipMeta retrieved via
`record.relationshipFor(key)`
@param {InternalModel} addedRecord record which
should be added/set for the relationship
*/
var ember$data$lib$utils$$assertPolymorphicType = function (record, relationshipMeta, addedRecord) {
var addedType = addedRecord.type.modelName;
var recordType = record.type.modelName;
var key = relationshipMeta.key;
var typeClass = record.store.modelFor(relationshipMeta.type);
var assertionMessage = 'You cannot add a record of type \'' + addedType + '\' to the \'' + recordType + '.' + key + '\' relationship (only \'' + typeClass.modelName + '\' allowed)';
ember$lib$main$$default.assert(assertionMessage, ember$data$lib$utils$$checkPolymorphic(typeClass, addedRecord));
};
function ember$data$lib$utils$$checkPolymorphic(typeClass, addedRecord) {
if (typeClass.__isMixin) {
//TODO Need to do this in order to support mixins, should convert to public api
//once it exists in Ember
return typeClass.__mixin.detect(addedRecord.type.PrototypeMixin);
}
if (ember$lib$main$$default.MODEL_FACTORY_INJECTIONS) {
typeClass = typeClass.superclass;
}
return typeClass.detect(addedRecord.type);
}
var ember$data$lib$system$relationships$state$has$many$$map = Ember.ArrayPolyfills.map;
var ember$data$lib$system$relationships$state$has$many$$ManyRelationship = function (store, record, inverseKey, relationshipMeta) {
this._super$constructor(store, record, inverseKey, relationshipMeta);
this.belongsToType = relationshipMeta.type;
this.canonicalState = [];
this.manyArray = ember$data$lib$system$many$array$$default.create({
canonicalState: this.canonicalState,
store: this.store,
relationship: this,
type: this.store.modelFor(this.belongsToType),
record: record
});
this.isPolymorphic = relationshipMeta.options.polymorphic;
this.manyArray.isPolymorphic = this.isPolymorphic;
};
ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype = Ember.create(ember$data$lib$system$relationships$state$relationship$$default.prototype);
ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype.constructor = ember$data$lib$system$relationships$state$has$many$$ManyRelationship;
ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype._super$constructor = ember$data$lib$system$relationships$state$relationship$$default;
ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype.destroy = function () {
this.manyArray.destroy();
};
ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype._super$updateMeta = ember$data$lib$system$relationships$state$relationship$$default.prototype.updateMeta;
ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype.updateMeta = function (meta) {
this._super$updateMeta(meta);
this.manyArray.set("meta", meta);
};
ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype._super$addCanonicalRecord = ember$data$lib$system$relationships$state$relationship$$default.prototype.addCanonicalRecord;
ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype.addCanonicalRecord = function (record, idx) {
if (this.canonicalMembers.has(record)) {
return;
}
if (idx !== undefined) {
this.canonicalState.splice(idx, 0, record);
} else {
this.canonicalState.push(record);
}
this._super$addCanonicalRecord(record, idx);
};
ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype._super$addRecord = ember$data$lib$system$relationships$state$relationship$$default.prototype.addRecord;
ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype.addRecord = function (record, idx) {
if (this.members.has(record)) {
return;
}
this._super$addRecord(record, idx);
this.manyArray.internalAddRecords([record], idx);
};
ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype._super$removeCanonicalRecordFromOwn = ember$data$lib$system$relationships$state$relationship$$default.prototype.removeCanonicalRecordFromOwn;
ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype.removeCanonicalRecordFromOwn = function (record, idx) {
var i = idx;
if (!this.canonicalMembers.has(record)) {
return;
}
if (i === undefined) {
i = this.canonicalState.indexOf(record);
}
if (i > -1) {
this.canonicalState.splice(i, 1);
}
this._super$removeCanonicalRecordFromOwn(record, idx);
};
ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype._super$flushCanonical = ember$data$lib$system$relationships$state$relationship$$default.prototype.flushCanonical;
ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype.flushCanonical = function () {
this.manyArray.flushCanonical();
this._super$flushCanonical();
};
ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype._super$removeRecordFromOwn = ember$data$lib$system$relationships$state$relationship$$default.prototype.removeRecordFromOwn;
ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype.removeRecordFromOwn = function (record, idx) {
if (!this.members.has(record)) {
return;
}
this._super$removeRecordFromOwn(record, idx);
if (idx !== undefined) {
//TODO(Igor) not used currently, fix
this.manyArray.currentState.removeAt(idx);
} else {
this.manyArray.internalRemoveRecords([record]);
}
};
ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype.notifyRecordRelationshipAdded = function (record, idx) {
ember$data$lib$utils$$assertPolymorphicType(this.record, this.relationshipMeta, record);
this.record.notifyHasManyAdded(this.key, record, idx);
};
ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype.reload = function () {
var self = this;
if (this.link) {
return this.fetchLink();
} else {
return this.store.scheduleFetchMany(this.manyArray.toArray()).then(function () {
//Goes away after the manyArray refactor
self.manyArray.set("isLoaded", true);
return self.manyArray;
});
}
};
ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype.computeChanges = function (records) {
var members = this.canonicalMembers;
var recordsToRemove = [];
var length;
var record;
var i;
records = ember$data$lib$system$relationships$state$has$many$$setForArray(records);
members.forEach(function (member) {
if (records.has(member)) {
return;
}
recordsToRemove.push(member);
});
this.removeCanonicalRecords(recordsToRemove);
// Using records.toArray() since currently using
// removeRecord can modify length, messing stuff up
// forEach since it directly looks at "length" each
// iteration
records = records.toArray();
length = records.length;
for (i = 0; i < length; i++) {
record = records[i];
this.removeCanonicalRecord(record);
this.addCanonicalRecord(record, i);
}
};
ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype.fetchLink = function () {
var _this = this;
return this.store.findHasMany(this.record, this.link, this.relationshipMeta).then(function (records) {
if (records.hasOwnProperty("meta")) {
_this.updateMeta(records.meta);
}
_this.store._backburner.join(function () {
_this.updateRecordsFromAdapter(records);
});
return _this.manyArray;
});
};
ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype.findRecords = function () {
var manyArray = this.manyArray;
//TODO CLEANUP
return this.store.findMany(ember$data$lib$system$relationships$state$has$many$$map.call(manyArray.toArray(), function (rec) {
return rec._internalModel;
})).then(function () {
//Goes away after the manyArray refactor
manyArray.set("isLoaded", true);
return manyArray;
});
};
ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype.notifyHasManyChanged = function () {
this.record.notifyHasManyAdded(this.key);
};
ember$data$lib$system$relationships$state$has$many$$ManyRelationship.prototype.getRecords = function () {
//TODO(Igor) sync server here, once our syncing is not stupid
if (this.isAsync) {
var self = this;
var promise;
if (this.link) {
promise = this.findLink().then(function () {
return self.findRecords();
});
} else {
promise = this.findRecords();
}
return ember$data$lib$system$promise$proxies$$PromiseManyArray.create({
content: this.manyArray,
promise: promise
});
} else {
Ember.assert("You looked up the '" + this.key + "' relationship on a '" + this.record.type.modelName + "' with id " + this.record.id + " but some of the associated records were not loaded. Either make sure they are all loaded together with the parent record, or specify that the relationship is async (`DS.hasMany({ async: true })`)", this.manyArray.isEvery("isEmpty", false));
//TODO(Igor) WTF DO I DO HERE?
if (!this.manyArray.get("isDestroyed")) {
this.manyArray.set("isLoaded", true);
}
return this.manyArray;
}
};
function ember$data$lib$system$relationships$state$has$many$$setForArray(array) {
var set = new ember$data$lib$system$ordered$set$$default();
if (array) {
for (var i = 0, l = array.length; i < l; i++) {
set.add(array[i]);
}
}
return set;
}
var ember$data$lib$system$relationships$state$has$many$$default = ember$data$lib$system$relationships$state$has$many$$ManyRelationship;
var ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship = function (store, record, inverseKey, relationshipMeta) {
this._super$constructor(store, record, inverseKey, relationshipMeta);
this.record = record;
this.key = relationshipMeta.key;
this.inverseRecord = null;
this.canonicalState = null;
};
ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype = Ember.create(ember$data$lib$system$relationships$state$relationship$$default.prototype);
ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype.constructor = ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship;
ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype._super$constructor = ember$data$lib$system$relationships$state$relationship$$default;
ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype.setRecord = function (newRecord) {
if (newRecord) {
this.addRecord(newRecord);
} else if (this.inverseRecord) {
this.removeRecord(this.inverseRecord);
}
this.setHasData(true);
};
ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype.setCanonicalRecord = function (newRecord) {
if (newRecord) {
this.addCanonicalRecord(newRecord);
} else if (this.inverseRecord) {
this.removeCanonicalRecord(this.inverseRecord);
}
this.setHasData(true);
};
ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype._super$addCanonicalRecord = ember$data$lib$system$relationships$state$relationship$$default.prototype.addCanonicalRecord;
ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype.addCanonicalRecord = function (newRecord) {
if (this.canonicalMembers.has(newRecord)) {
return;
}
if (this.canonicalState) {
this.removeCanonicalRecord(this.canonicalState);
}
this.canonicalState = newRecord;
this._super$addCanonicalRecord(newRecord);
};
ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype._super$flushCanonical = ember$data$lib$system$relationships$state$relationship$$default.prototype.flushCanonical;
ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype.flushCanonical = function () {
//temporary fix to not remove newly created records if server returned null.
//TODO remove once we have proper diffing
if (this.inverseRecord && this.inverseRecord.isNew() && !this.canonicalState) {
return;
}
this.inverseRecord = this.canonicalState;
this.record.notifyBelongsToChanged(this.key);
this._super$flushCanonical();
};
ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype._super$addRecord = ember$data$lib$system$relationships$state$relationship$$default.prototype.addRecord;
ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype.addRecord = function (newRecord) {
if (this.members.has(newRecord)) {
return;
}
ember$data$lib$utils$$assertPolymorphicType(this.record, this.relationshipMeta, newRecord);
if (this.inverseRecord) {
this.removeRecord(this.inverseRecord);
}
this.inverseRecord = newRecord;
this._super$addRecord(newRecord);
this.record.notifyBelongsToChanged(this.key);
};
ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype.setRecordPromise = function (newPromise) {
var content = newPromise.get && newPromise.get("content");
Ember.assert("You passed in a promise that did not originate from an EmberData relationship. You can only pass promises that come from a belongsTo or hasMany relationship to the get call.", content !== undefined);
this.setRecord(content ? content._internalModel : content);
};
ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype._super$removeRecordFromOwn = ember$data$lib$system$relationships$state$relationship$$default.prototype.removeRecordFromOwn;
ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype.removeRecordFromOwn = function (record) {
if (!this.members.has(record)) {
return;
}
this.inverseRecord = null;
this._super$removeRecordFromOwn(record);
this.record.notifyBelongsToChanged(this.key);
};
ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype._super$removeCanonicalRecordFromOwn = ember$data$lib$system$relationships$state$relationship$$default.prototype.removeCanonicalRecordFromOwn;
ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype.removeCanonicalRecordFromOwn = function (record) {
if (!this.canonicalMembers.has(record)) {
return;
}
this.canonicalState = null;
this._super$removeCanonicalRecordFromOwn(record);
};
ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype.findRecord = function () {
if (this.inverseRecord) {
return this.store._findByInternalModel(this.inverseRecord);
} else {
return Ember.RSVP.Promise.resolve(null);
}
};
ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype.fetchLink = function () {
var self = this;
return this.store.findBelongsTo(this.record, this.link, this.relationshipMeta).then(function (record) {
if (record) {
self.addRecord(record);
}
return record;
});
};
ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship.prototype.getRecord = function () {
//TODO(Igor) flushCanonical here once our syncing is not stupid
if (this.isAsync) {
var promise;
if (this.link) {
var self = this;
promise = this.findLink().then(function () {
return self.findRecord();
});
} else {
promise = this.findRecord();
}
return ember$data$lib$system$promise$proxies$$PromiseObject.create({
promise: promise,
content: this.inverseRecord ? this.inverseRecord.getRecord() : null
});
} else {
if (this.inverseRecord === null) {
return null;
}
var toReturn = this.inverseRecord.getRecord();
Ember.assert("You looked up the '" + this.key + "' relationship on a '" + this.record.type.modelName + "' with id " + this.record.id + " but some of the associated records were not loaded. Either make sure they are all loaded together with the parent record, or specify that the relationship is async (`DS.belongsTo({ async: true })`)", toReturn === null || !toReturn.get("isEmpty"));
return toReturn;
}
};
var ember$data$lib$system$relationships$state$belongs$to$$default = ember$data$lib$system$relationships$state$belongs$to$$BelongsToRelationship;
var ember$data$lib$system$relationships$state$create$$get = Ember.get;
var ember$data$lib$system$relationships$state$create$$createRelationshipFor = function (record, relationshipMeta, store) {
var inverseKey;
var inverse = record.type.inverseFor(relationshipMeta.key, store);
if (inverse) {
inverseKey = inverse.name;
}
if (relationshipMeta.kind === "hasMany") {
return new ember$data$lib$system$relationships$state$has$many$$default(store, record, inverseKey, relationshipMeta);
} else {
return new ember$data$lib$system$relationships$state$belongs$to$$default(store, record, inverseKey, relationshipMeta);
}
};
var ember$data$lib$system$relationships$state$create$$Relationships = function (record) {
this.record = record;
this.initializedRelationships = Ember.create(null);
};
ember$data$lib$system$relationships$state$create$$Relationships.prototype.has = function (key) {
return !!this.initializedRelationships[key];
};
ember$data$lib$system$relationships$state$create$$Relationships.prototype.get = function (key) {
var relationships = this.initializedRelationships;
var relationshipsByName = ember$data$lib$system$relationships$state$create$$get(this.record.type, "relationshipsByName");
if (!relationships[key] && relationshipsByName.get(key)) {
relationships[key] = ember$data$lib$system$relationships$state$create$$createRelationshipFor(this.record, relationshipsByName.get(key), this.record.store);
}
return relationships[key];
};
var ember$data$lib$system$relationships$state$create$$default = ember$data$lib$system$relationships$state$create$$Relationships;
var ember$data$lib$system$snapshot$$get = Ember.get;
/**
@class Snapshot
@namespace DS
@private
@constructor
@param {DS.Model} internalModel The model to create a snapshot from
*/
function ember$data$lib$system$snapshot$$Snapshot(internalModel) {
this._attributes = Ember.create(null);
this._belongsToRelationships = Ember.create(null);
this._belongsToIds = Ember.create(null);
this._hasManyRelationships = Ember.create(null);
this._hasManyIds = Ember.create(null);
var record = internalModel.getRecord();
this.record = record;
record.eachAttribute(function (keyName) {
this._attributes[keyName] = ember$data$lib$system$snapshot$$get(record, keyName);
}, this);
this.id = internalModel.id;
this._internalModel = internalModel;
this.type = internalModel.type;
this.modelName = internalModel.type.modelName;
this._changedAttributes = record.changedAttributes();
// The following code is here to keep backwards compatibility when accessing
// `constructor` directly.
//
// With snapshots you should use `type` instead of `constructor`.
//
// Remove for Ember Data 1.0.
if (Ember.platform.hasPropertyAccessors) {
var callDeprecate = true;
Ember.defineProperty(this, 'constructor', {
get: function () {
// Ugly hack since accessing error.stack (done in `Ember.deprecate()`)
// causes the internals of Chrome to access the constructor, which then
// causes an infinite loop if accessed and calls `Ember.deprecate()`
// again.
if (callDeprecate) {
callDeprecate = false;
Ember.deprecate('Usage of `snapshot.constructor` is deprecated, use `snapshot.type` instead.');
callDeprecate = true;
}
return this.type;
}
});
} else {
this.constructor = this.type;
}
}
ember$data$lib$system$snapshot$$Snapshot.prototype = {
constructor: ember$data$lib$system$snapshot$$Snapshot,
/**
The id of the snapshot's underlying record
Example
```javascript
// store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });
postSnapshot.id; // => '1'
```
@property id
@type {String}
*/
id: null,
/**
The underlying record for this snapshot. Can be used to access methods and
properties defined on the record.
Example
```javascript
var json = snapshot.record.toJSON();
```
@property record
@type {DS.Model}
*/
record: null,
/**
The type of the underlying record for this snapshot, as a DS.Model.
@property type
@type {DS.Model}
*/
type: null,
/**
The name of the type of the underlying record for this snapshot, as a string.
@property modelName
@type {String}
*/
modelName: null,
/**
Returns the value of an attribute.
Example
```javascript
// store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });
postSnapshot.attr('author'); // => 'Tomster'
postSnapshot.attr('title'); // => 'Ember.js rocks'
```
Note: Values are loaded eagerly and cached when the snapshot is created.
@method attr
@param {String} keyName
@return {Object} The attribute value or undefined
*/
attr: function (keyName) {
if (keyName in this._attributes) {
return this._attributes[keyName];
}
throw new Ember.Error('Model \'' + Ember.inspect(this.record) + '\' has no attribute named \'' + keyName + '\' defined.');
},
/**
Returns all attributes and their corresponding values.
Example
```javascript
// store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });
postSnapshot.attributes(); // => { author: 'Tomster', title: 'Ember.js rocks' }
```
@method attributes
@return {Object} All attributes of the current snapshot
*/
attributes: function () {
return Ember.copy(this._attributes);
},
/**
Returns all changed attributes and their old and new values.
Example
```javascript
// store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });
postModel.set('title', 'Ember.js rocks!');
postSnapshot.changedAttributes(); // => { title: ['Ember.js rocks', 'Ember.js rocks!'] }
```
@method changedAttributes
@return {Object} All changed attributes of the current snapshot
*/
changedAttributes: function () {
var changedAttributes = Ember.create(null);
var changedAttributeKeys = Ember.keys(this._changedAttributes);
for (var i = 0, _length = changedAttributeKeys.length; i < _length; i++) {
var key = changedAttributeKeys[i];
changedAttributes[key] = Ember.copy(this._changedAttributes[key]);
}
return changedAttributes;
},
/**
Returns the current value of a belongsTo relationship.
`belongsTo` takes an optional hash of options as a second parameter,
currently supported options are:
- `id`: set to `true` if you only want the ID of the related record to be
returned.
Example
```javascript
// store.push('post', { id: 1, title: 'Hello World' });
// store.createRecord('comment', { body: 'Lorem ipsum', post: post });
commentSnapshot.belongsTo('post'); // => DS.Snapshot
commentSnapshot.belongsTo('post', { id: true }); // => '1'
// store.push('comment', { id: 1, body: 'Lorem ipsum' });
commentSnapshot.belongsTo('post'); // => undefined
```
Calling `belongsTo` will return a new Snapshot as long as there's any known
data for the relationship available, such as an ID. If the relationship is
known but unset, `belongsTo` will return `null`. If the contents of the
relationship is unknown `belongsTo` will return `undefined`.
Note: Relationships are loaded lazily and cached upon first access.
@method belongsTo
@param {String} keyName
@param {Object} [options]
@return {(DS.Snapshot|String|null|undefined)} A snapshot or ID of a known
relationship or null if the relationship is known but unset. undefined
will be returned if the contents of the relationship is unknown.
*/
belongsTo: function (keyName, options) {
var id = options && options.id;
var relationship, inverseRecord, hasData;
var result;
if (id && keyName in this._belongsToIds) {
return this._belongsToIds[keyName];
}
if (!id && keyName in this._belongsToRelationships) {
return this._belongsToRelationships[keyName];
}
relationship = this._internalModel._relationships.get(keyName);
if (!(relationship && relationship.relationshipMeta.kind === 'belongsTo')) {
throw new Ember.Error('Model \'' + Ember.inspect(this.record) + '\' has no belongsTo relationship named \'' + keyName + '\' defined.');
}
hasData = ember$data$lib$system$snapshot$$get(relationship, 'hasData');
inverseRecord = ember$data$lib$system$snapshot$$get(relationship, 'inverseRecord');
if (hasData) {
if (inverseRecord && !inverseRecord.isDeleted()) {
if (id) {
result = ember$data$lib$system$snapshot$$get(inverseRecord, 'id');
} else {
result = inverseRecord.createSnapshot();
}
} else {
result = null;
}
}
if (id) {
this._belongsToIds[keyName] = result;
} else {
this._belongsToRelationships[keyName] = result;
}
return result;
},
/**
Returns the current value of a hasMany relationship.
`hasMany` takes an optional hash of options as a second parameter,
currently supported options are:
- `ids`: set to `true` if you only want the IDs of the related records to be
returned.
Example
```javascript
// store.push('post', { id: 1, title: 'Hello World', comments: [2, 3] });
postSnapshot.hasMany('comments'); // => [DS.Snapshot, DS.Snapshot]
postSnapshot.hasMany('comments', { ids: true }); // => ['2', '3']
// store.push('post', { id: 1, title: 'Hello World' });
postSnapshot.hasMany('comments'); // => undefined
```
Note: Relationships are loaded lazily and cached upon first access.
@method hasMany
@param {String} keyName
@param {Object} [options]
@return {(Array|undefined)} An array of snapshots or IDs of a known
relationship or an empty array if the relationship is known but unset.
undefined will be returned if the contents of the relationship is unknown.
*/
hasMany: function (keyName, options) {
var ids = options && options.ids;
var relationship, members, hasData;
var results;
if (ids && keyName in this._hasManyIds) {
return this._hasManyIds[keyName];
}
if (!ids && keyName in this._hasManyRelationships) {
return this._hasManyRelationships[keyName];
}
relationship = this._internalModel._relationships.get(keyName);
if (!(relationship && relationship.relationshipMeta.kind === 'hasMany')) {
throw new Ember.Error('Model \'' + Ember.inspect(this.record) + '\' has no hasMany relationship named \'' + keyName + '\' defined.');
}
hasData = ember$data$lib$system$snapshot$$get(relationship, 'hasData');
members = ember$data$lib$system$snapshot$$get(relationship, 'members');
if (hasData) {
results = [];
members.forEach(function (member) {
if (!member.isDeleted()) {
if (ids) {
results.push(member.id);
} else {
results.push(member.createSnapshot());
}
}
});
}
if (ids) {
this._hasManyIds[keyName] = results;
} else {
this._hasManyRelationships[keyName] = results;
}
return results;
},
/**
Iterates through all the attributes of the model, calling the passed
function on each attribute.
Example
```javascript
snapshot.eachAttribute(function(name, meta) {
// ...
});
```
@method eachAttribute
@param {Function} callback the callback to execute
@param {Object} [binding] the value to which the callback's `this` should be bound
*/
eachAttribute: function (callback, binding) {
this.record.eachAttribute(callback, binding);
},
/**
Iterates through all the relationships of the model, calling the passed
function on each relationship.
Example
```javascript
snapshot.eachRelationship(function(name, relationship) {
// ...
});
```
@method eachRelationship
@param {Function} callback the callback to execute
@param {Object} [binding] the value to which the callback's `this` should be bound
*/
eachRelationship: function (callback, binding) {
this.record.eachRelationship(callback, binding);
},
/**
@method get
@param {String} keyName
@return {Object} The property value
@deprecated Use [attr](#method_attr), [belongsTo](#method_belongsTo) or [hasMany](#method_hasMany) instead
*/
get: function (keyName) {
Ember.deprecate('Using DS.Snapshot.get() is deprecated. Use .attr(), .belongsTo() or .hasMany() instead.');
if (keyName === 'id') {
return this.id;
}
if (keyName in this._attributes) {
return this.attr(keyName);
}
var relationship = this._internalModel._relationships.get(keyName);
if (relationship && relationship.relationshipMeta.kind === 'belongsTo') {
return this.belongsTo(keyName);
}
if (relationship && relationship.relationshipMeta.kind === 'hasMany') {
return this.hasMany(keyName);
}
return ember$data$lib$system$snapshot$$get(this.record, keyName);
},
/**
@method serialize
@param {Object} options
@return {Object} an object whose values are primitive JSON values only
*/
serialize: function (options) {
return this.record.store.serializerFor(this.modelName).serialize(this, options);
},
/**
@method unknownProperty
@param {String} keyName
@return {Object} The property value
@deprecated Use [attr](#method_attr), [belongsTo](#method_belongsTo) or [hasMany](#method_hasMany) instead
*/
unknownProperty: function (keyName) {
return this.get(keyName);
},
/**
@method _createSnapshot
@private
*/
_createSnapshot: function () {
Ember.deprecate('You called _createSnapshot on what\'s already a DS.Snapshot. You shouldn\'t manually create snapshots in your adapter since the store passes snapshots to adapters by default.');
return this;
}
};
Ember.defineProperty(ember$data$lib$system$snapshot$$Snapshot.prototype, 'typeKey', {
enumerable: false,
get: function () {
Ember.deprecate('Snapshot.typeKey is deprecated. Use snapshot.modelName instead.');
return this.modelName;
},
set: function () {
Ember.assert('Setting snapshot.typeKey is not supported. In addition, Snapshot.typeKey has been deprecated for Snapshot.modelName.');
}
});
var ember$data$lib$system$snapshot$$default = ember$data$lib$system$snapshot$$Snapshot;
var ember$data$lib$system$model$internal$model$$Promise = Ember.RSVP.Promise;
var ember$data$lib$system$model$internal$model$$get = Ember.get;
var ember$data$lib$system$model$internal$model$$set = Ember.set;
var ember$data$lib$system$model$internal$model$$forEach = Ember.ArrayPolyfills.forEach;
var ember$data$lib$system$model$internal$model$$map = Ember.ArrayPolyfills.map;
var ember$data$lib$system$model$internal$model$$_extractPivotNameCache = Ember.create(null);
var ember$data$lib$system$model$internal$model$$_splitOnDotCache = Ember.create(null);
function ember$data$lib$system$model$internal$model$$splitOnDot(name) {
return ember$data$lib$system$model$internal$model$$_splitOnDotCache[name] || (ember$data$lib$system$model$internal$model$$_splitOnDotCache[name] = name.split("."));
}
function ember$data$lib$system$model$internal$model$$extractPivotName(name) {
return ember$data$lib$system$model$internal$model$$_extractPivotNameCache[name] || (ember$data$lib$system$model$internal$model$$_extractPivotNameCache[name] = ember$data$lib$system$model$internal$model$$splitOnDot(name)[0]);
}
function ember$data$lib$system$model$internal$model$$retrieveFromCurrentState(key) {
return function () {
return ember$data$lib$system$model$internal$model$$get(this.currentState, key);
};
}
/**
`InternalModel` is the Model class that we use internally inside Ember Data to represent models.
Internal ED methods should only deal with `InternalModel` objects. It is a fast, plain Javascript class.
We expose `DS.Model` to application code, by materializing a `DS.Model` from `InternalModel` lazily, as
a performance optimization.
`InternalModel` should never be exposed to application code. At the boundaries of the system, in places
like `find`, `push`, etc. we convert between Models and InternalModels.
We need to make sure that the properties from `InternalModel` are correctly exposed/proxied on `Model`
if they are needed.
@class InternalModel
*/
var ember$data$lib$system$model$internal$model$$InternalModel = function InternalModel(type, id, store, container, data) {
this.type = type;
this.id = id;
this.store = store;
this.container = container;
this._data = data || Ember.create(null);
this.modelName = type.modelName;
this.dataHasInitialized = false;
//Look into making this lazy
this._deferredTriggers = [];
this._attributes = Ember.create(null);
this._inFlightAttributes = Ember.create(null);
this._relationships = new ember$data$lib$system$relationships$state$create$$default(this);
this.currentState = ember$data$lib$system$model$states$$default.empty;
this.isReloading = false;
this.isError = false;
this.error = null;
/*
implicit relationships are relationship which have not been declared but the inverse side exists on
another record somewhere
For example if there was
```app/models/comment.js
import DS from 'ember-data';
export default DS.Model.extend({
name: DS.attr()
})
```
but there is also
```app/models/post.js
import DS from 'ember-data';
export default DS.Model.extend({
name: DS.attr(),
comments: DS.hasMany('comment')
})
```
would have a implicit post relationship in order to be do things like remove ourselves from the post
when we are deleted
*/
this._implicitRelationships = Ember.create(null);
};
ember$data$lib$system$model$internal$model$$InternalModel.prototype = {
isEmpty: ember$data$lib$system$model$internal$model$$retrieveFromCurrentState("isEmpty"),
isLoading: ember$data$lib$system$model$internal$model$$retrieveFromCurrentState("isLoading"),
isLoaded: ember$data$lib$system$model$internal$model$$retrieveFromCurrentState("isLoaded"),
hasDirtyAttributes: ember$data$lib$system$model$internal$model$$retrieveFromCurrentState("hasDirtyAttributes"),
isSaving: ember$data$lib$system$model$internal$model$$retrieveFromCurrentState("isSaving"),
isDeleted: ember$data$lib$system$model$internal$model$$retrieveFromCurrentState("isDeleted"),
isNew: ember$data$lib$system$model$internal$model$$retrieveFromCurrentState("isNew"),
isValid: ember$data$lib$system$model$internal$model$$retrieveFromCurrentState("isValid"),
dirtyType: ember$data$lib$system$model$internal$model$$retrieveFromCurrentState("dirtyType"),
constructor: ember$data$lib$system$model$internal$model$$InternalModel,
materializeRecord: function () {
Ember.assert("Materialized " + this.modelName + " record with id:" + this.id + "more than once", this.record === null || this.record === undefined);
// lookupFactory should really return an object that creates
// instances with the injections applied
this.record = this.type._create({
id: this.id,
store: this.store,
container: this.container,
_internalModel: this,
currentState: ember$data$lib$system$model$internal$model$$get(this, "currentState"),
isError: this.isError,
error: this.error
});
this._triggerDeferredTriggers();
},
recordObjectWillDestroy: function () {
this.record = null;
},
deleteRecord: function () {
this.send("deleteRecord");
},
save: function (options) {
var promiseLabel = "DS: Model#save " + this;
var resolver = Ember.RSVP.defer(promiseLabel);
this.store.scheduleSave(this, resolver, options);
return resolver.promise;
},
startedReloading: function () {
this.isReloading = true;
if (this.record) {
ember$data$lib$system$model$internal$model$$set(this.record, "isReloading", true);
}
},
finishedReloading: function () {
this.isReloading = false;
if (this.record) {
ember$data$lib$system$model$internal$model$$set(this.record, "isReloading", false);
}
},
reload: function () {
this.startedReloading();
var record = this;
var promiseLabel = "DS: Model#reload of " + this;
return new ember$data$lib$system$model$internal$model$$Promise(function (resolve) {
record.send("reloadRecord", resolve);
}, promiseLabel).then(function () {
record.didCleanError();
return record;
}, function (error) {
record.didError(error);
throw error;
}, "DS: Model#reload complete, update flags")["finally"](function () {
record.finishedReloading();
record.updateRecordArrays();
});
},
getRecord: function () {
if (!this.record) {
this.materializeRecord();
}
return this.record;
},
unloadRecord: function () {
this.send("unloadRecord");
},
eachRelationship: function (callback, binding) {
return this.type.eachRelationship(callback, binding);
},
eachAttribute: function (callback, binding) {
return this.type.eachAttribute(callback, binding);
},
inverseFor: function (key) {
return this.type.inverseFor(key);
},
setupData: function (data) {
var changedKeys = this._changedKeys(data.attributes);
ember$data$lib$system$merge$$default(this._data, data.attributes);
this.pushedData();
if (this.record) {
this.record._notifyProperties(changedKeys);
}
this.didInitalizeData();
},
becameReady: function () {
Ember.run.schedule("actions", this.store.recordArrayManager, this.store.recordArrayManager.recordWasLoaded, this);
},
didInitalizeData: function () {
if (!this.dataHasInitialized) {
this.becameReady();
this.dataHasInitialized = true;
}
},
destroy: function () {
if (this.record) {
return this.record.destroy();
}
},
/**
@method createSnapshot
@private
*/
createSnapshot: function (options) {
var adapterOptions = options && options.adapterOptions;
var snapshot = new ember$data$lib$system$snapshot$$default(this);
snapshot.adapterOptions = adapterOptions;
return snapshot;
},
/**
@method loadingData
@private
@param {Promise} promise
*/
loadingData: function (promise) {
this.send("loadingData", promise);
},
/**
@method loadedData
@private
*/
loadedData: function () {
this.send("loadedData");
this.didInitalizeData();
},
/**
@method notFound
@private
*/
notFound: function () {
this.send("notFound");
},
/**
@method pushedData
@private
*/
pushedData: function () {
this.send("pushedData");
},
flushChangedAttributes: function () {
this._inFlightAttributes = this._attributes;
this._attributes = Ember.create(null);
},
/**
@method adapterWillCommit
@private
*/
adapterWillCommit: function () {
this.send("willCommit");
},
/**
@method adapterDidDirty
@private
*/
adapterDidDirty: function () {
this.send("becomeDirty");
this.updateRecordArraysLater();
},
/**
@method send
@private
@param {String} name
@param {Object} context
*/
send: function (name, context) {
var currentState = ember$data$lib$system$model$internal$model$$get(this, "currentState");
if (!currentState[name]) {
this._unhandledEvent(currentState, name, context);
}
return currentState[name](this, context);
},
notifyHasManyAdded: function (key, record, idx) {
if (this.record) {
this.record.notifyHasManyAdded(key, record, idx);
}
},
notifyHasManyRemoved: function (key, record, idx) {
if (this.record) {
this.record.notifyHasManyRemoved(key, record, idx);
}
},
notifyBelongsToChanged: function (key, record) {
if (this.record) {
this.record.notifyBelongsToChanged(key, record);
}
},
notifyPropertyChange: function (key) {
if (this.record) {
this.record.notifyPropertyChange(key);
}
},
rollbackAttributes: function () {
var dirtyKeys = Ember.keys(this._attributes);
this._attributes = Ember.create(null);
if (ember$data$lib$system$model$internal$model$$get(this, "isError")) {
this._inFlightAttributes = Ember.create(null);
this.didCleanError();
}
//Eventually rollback will always work for relationships
//For now we support it only out of deleted state, because we
//have an explicit way of knowing when the server acked the relationship change
if (this.isDeleted()) {
//TODO: Should probably move this to the state machine somehow
this.becameReady();
this.reconnectRelationships();
}
if (this.isNew()) {
this.clearRelationships();
}
if (this.isValid()) {
this._inFlightAttributes = Ember.create(null);
}
this.send("rolledBack");
this.record._notifyProperties(dirtyKeys);
},
/**
@method transitionTo
@private
@param {String} name
*/
transitionTo: function (name) {
// POSSIBLE TODO: Remove this code and replace with
// always having direct reference to state objects
var pivotName = ember$data$lib$system$model$internal$model$$extractPivotName(name);
var currentState = ember$data$lib$system$model$internal$model$$get(this, "currentState");
var state = currentState;
do {
if (state.exit) {
state.exit(this);
}
state = state.parentState;
} while (!state.hasOwnProperty(pivotName));
var path = ember$data$lib$system$model$internal$model$$splitOnDot(name);
var setups = [];
var enters = [];
var i, l;
for (i = 0, l = path.length; i < l; i++) {
state = state[path[i]];
if (state.enter) {
enters.push(state);
}
if (state.setup) {
setups.push(state);
}
}
for (i = 0, l = enters.length; i < l; i++) {
enters[i].enter(this);
}
ember$data$lib$system$model$internal$model$$set(this, "currentState", state);
//TODO Consider whether this is the best approach for keeping these two in sync
if (this.record) {
ember$data$lib$system$model$internal$model$$set(this.record, "currentState", state);
}
for (i = 0, l = setups.length; i < l; i++) {
setups[i].setup(this);
}
this.updateRecordArraysLater();
},
_unhandledEvent: function (state, name, context) {
var errorMessage = "Attempted to handle event `" + name + "` ";
errorMessage += "on " + String(this) + " while in state ";
errorMessage += state.stateName + ". ";
if (context !== undefined) {
errorMessage += "Called with " + Ember.inspect(context) + ".";
}
throw new Ember.Error(errorMessage);
},
triggerLater: function () {
var length = arguments.length;
var args = new Array(length);
for (var i = 0; i < length; i++) {
args[i] = arguments[i];
}
if (this._deferredTriggers.push(args) !== 1) {
return;
}
Ember.run.scheduleOnce("actions", this, "_triggerDeferredTriggers");
},
_triggerDeferredTriggers: function () {
//TODO: Before 1.0 we want to remove all the events that happen on the pre materialized record,
//but for now, we queue up all the events triggered before the record was materialized, and flush
//them once we have the record
if (!this.record) {
return;
}
for (var i = 0, l = this._deferredTriggers.length; i < l; i++) {
this.record.trigger.apply(this.record, this._deferredTriggers[i]);
}
this._deferredTriggers.length = 0;
},
/**
@method clearRelationships
@private
*/
clearRelationships: function () {
this.eachRelationship(function (name, relationship) {
if (this._relationships.has(name)) {
var rel = this._relationships.get(name);
//TODO(Igor) figure out whether we want to clear or disconnect
rel.clear();
rel.destroy();
}
}, this);
var model = this;
ember$data$lib$system$model$internal$model$$forEach.call(Ember.keys(this._implicitRelationships), function (key) {
model._implicitRelationships[key].clear();
model._implicitRelationships[key].destroy();
});
},
disconnectRelationships: function () {
this.eachRelationship(function (name, relationship) {
this._relationships.get(name).disconnect();
}, this);
var model = this;
ember$data$lib$system$model$internal$model$$forEach.call(Ember.keys(this._implicitRelationships), function (key) {
model._implicitRelationships[key].disconnect();
});
},
reconnectRelationships: function () {
this.eachRelationship(function (name, relationship) {
this._relationships.get(name).reconnect();
}, this);
var model = this;
ember$data$lib$system$model$internal$model$$forEach.call(Ember.keys(this._implicitRelationships), function (key) {
model._implicitRelationships[key].reconnect();
});
},
/**
When a find request is triggered on the store, the user can optionally pass in
attributes and relationships to be preloaded. These are meant to behave as if they
came back from the server, except the user obtained them out of band and is informing
the store of their existence. The most common use case is for supporting client side
nested URLs, such as `/posts/1/comments/2` so the user can do
`store.find('comment', 2, {post:1})` without having to fetch the post.
Preloaded data can be attributes and relationships passed in either as IDs or as actual
models.
@method _preloadData
@private
@param {Object} preload
*/
_preloadData: function (preload) {
var record = this;
//TODO(Igor) consider the polymorphic case
ember$data$lib$system$model$internal$model$$forEach.call(Ember.keys(preload), function (key) {
var preloadValue = ember$data$lib$system$model$internal$model$$get(preload, key);
var relationshipMeta = record.type.metaForProperty(key);
if (relationshipMeta.isRelationship) {
record._preloadRelationship(key, preloadValue);
} else {
record._data[key] = preloadValue;
}
});
},
_preloadRelationship: function (key, preloadValue) {
var relationshipMeta = this.type.metaForProperty(key);
var type = relationshipMeta.type;
if (relationshipMeta.kind === "hasMany") {
this._preloadHasMany(key, preloadValue, type);
} else {
this._preloadBelongsTo(key, preloadValue, type);
}
},
_preloadHasMany: function (key, preloadValue, type) {
Ember.assert("You need to pass in an array to set a hasMany property on a record", Ember.isArray(preloadValue));
var internalModel = this;
var recordsToSet = ember$data$lib$system$model$internal$model$$map.call(preloadValue, function (recordToPush) {
return internalModel._convertStringOrNumberIntoInternalModel(recordToPush, type);
});
//We use the pathway of setting the hasMany as if it came from the adapter
//because the user told us that they know this relationships exists already
this._relationships.get(key).updateRecordsFromAdapter(recordsToSet);
},
_preloadBelongsTo: function (key, preloadValue, type) {
var recordToSet = this._convertStringOrNumberIntoInternalModel(preloadValue, type);
//We use the pathway of setting the hasMany as if it came from the adapter
//because the user told us that they know this relationships exists already
this._relationships.get(key).setRecord(recordToSet);
},
_convertStringOrNumberIntoInternalModel: function (value, type) {
if (typeof value === "string" || typeof value === "number") {
return this.store._internalModelForId(type, value);
}
if (value._internalModel) {
return value._internalModel;
}
return value;
},
/**
@method updateRecordArrays
@private
*/
updateRecordArrays: function () {
this._updatingRecordArraysLater = false;
this.store.dataWasUpdated(this.type, this);
},
setId: function (id) {
this.id = id;
//TODO figure out whether maybe we should proxy
ember$data$lib$system$model$internal$model$$set(this.record, "id", id);
},
didError: function (error) {
this.error = error;
this.isError = true;
if (this.record) {
this.record.setProperties({
isError: true,
error: error
});
}
},
didCleanError: function () {
this.isError = false;
if (this.record) {
this.record.setProperties({
isError: false,
error: null
});
}
},
/**
If the adapter did not return a hash in response to a commit,
merge the changed attributes and relationships into the existing
saved data.
@method adapterDidCommit
*/
adapterDidCommit: function (data) {
if (data) {
data = data.attributes;
}
this.didCleanError();
var changedKeys = this._changedKeys(data);
ember$data$lib$system$merge$$default(this._data, this._inFlightAttributes);
if (data) {
ember$data$lib$system$merge$$default(this._data, data);
}
this._inFlightAttributes = Ember.create(null);
this.send("didCommit");
this.updateRecordArraysLater();
if (!data) {
return;
}
this.record._notifyProperties(changedKeys);
},
/**
@method updateRecordArraysLater
@private
*/
updateRecordArraysLater: function () {
// quick hack (something like this could be pushed into run.once
if (this._updatingRecordArraysLater) {
return;
}
this._updatingRecordArraysLater = true;
Ember.run.schedule("actions", this, this.updateRecordArrays);
},
addErrorMessageToAttribute: function (attribute, message) {
var record = this.getRecord();
ember$data$lib$system$model$internal$model$$get(record, "errors").add(attribute, message);
},
removeErrorMessageFromAttribute: function (attribute) {
var record = this.getRecord();
ember$data$lib$system$model$internal$model$$get(record, "errors").remove(attribute);
},
clearErrorMessages: function () {
var record = this.getRecord();
ember$data$lib$system$model$internal$model$$get(record, "errors").clear();
},
// FOR USE DURING COMMIT PROCESS
/**
@method adapterDidInvalidate
@private
*/
adapterDidInvalidate: function (errors) {
var attribute;
for (attribute in errors) {
if (errors.hasOwnProperty(attribute)) {
this.addErrorMessageToAttribute(attribute, errors[attribute]);
}
}
this._saveWasRejected();
},
/**
@method adapterDidError
@private
*/
adapterDidError: function (error) {
this.send("becameError");
this.didError(error);
this._saveWasRejected();
},
_saveWasRejected: function () {
var keys = Ember.keys(this._inFlightAttributes);
for (var i = 0; i < keys.length; i++) {
if (this._attributes[keys[i]] === undefined) {
this._attributes[keys[i]] = this._inFlightAttributes[keys[i]];
}
}
this._inFlightAttributes = Ember.create(null);
},
/**
@method _changedKeys
Ember Data has 3 buckets for storing the value of an attribute on an internalModel.
`_data` holds all of the attributes that have been acknowledged by
a backend via the adapter. When rollbackAttributes is called on a model all
attributes will revert to the record's state in `_data`.
`_attributes` holds any change the user has made to an attribute
that has not been acknowledged by the adapter. Any values in
`_attributes` are have priority over values in `_data`.
`_inFlightAttributes`. When a record is being synced with the
backend the values in `_attributes` are copied to
`_inFlightAttributes`. This way if the backend acknowledges the
save but does not return the new state Ember Data can copy the
values from `_inFlightAttributes` to `_data`. Without having to
worry about changes made to `_attributes` while the save was
happenign.
Changed keys builds a list of all of the values that may have been
changed by the backend after a successful save.
It does this by iterating over each key, value pair in the payload
returned from the server after a save. If the `key` is found in
`_attributes` then the user has a local changed to the attribute
that has not been synced with the server and the key is not
included in the list of changed keys.
If the value, for a key differs from the value in what Ember Data
believes to be the truth about the backend state (A merger of the
`_data` and `_inFlightAttributes` objects where
`_inFlightAttributes` has priority) then that means the backend
has updated the value and the key is added to the list of changed
keys.
@private
*/
_changedKeys: function (updates) {
var changedKeys = [];
if (updates) {
var original, i, value, key;
var keys = Ember.keys(updates);
var length = keys.length;
original = ember$data$lib$system$merge$$default(Ember.create(null), this._data);
original = ember$data$lib$system$merge$$default(original, this._inFlightAttributes);
for (i = 0; i < length; i++) {
key = keys[i];
value = updates[key];
// A value in _attributes means the user has a local change to
// this attributes. We never override this value when merging
// updates from the backend so we should not sent a change
// notification if the server value differs from the original.
if (this._attributes[key] !== undefined) {
continue;
}
if (!Ember.isEqual(original[key], value)) {
changedKeys.push(key);
}
}
}
return changedKeys;
},
toString: function () {
if (this.record) {
return this.record.toString();
} else {
return "<" + this.modelName + ":" + this.id + ">";
}
}
};
var ember$data$lib$system$model$internal$model$$default = ember$data$lib$system$model$internal$model$$InternalModel;
var ember$data$lib$system$store$$Backburner = Ember._Backburner || Ember.Backburner || Ember.__loader.require("backburner")["default"] || Ember.__loader.require("backburner")["Backburner"];
//Shim Backburner.join
if (!ember$data$lib$system$store$$Backburner.prototype.join) {
var ember$data$lib$system$store$$isString = function (suspect) {
return typeof suspect === "string";
};
ember$data$lib$system$store$$Backburner.prototype.join = function () {
var method, target;
if (this.currentInstance) {
var length = arguments.length;
if (length === 1) {
method = arguments[0];
target = null;
} else {
target = arguments[0];
method = arguments[1];
}
if (ember$data$lib$system$store$$isString(method)) {
method = target[method];
}
if (length === 1) {
return method();
} else if (length === 2) {
return method.call(target);
} else {
var args = new Array(length - 2);
for (var i = 0, l = length - 2; i < l; i++) {
args[i] = arguments[i + 2];
}
return method.apply(target, args);
}
} else {
return this.run.apply(this, arguments);
}
};
}
//Get the materialized model from the internalModel/promise that returns
//an internal model and return it in a promiseObject. Useful for returning
//from find methods
function ember$data$lib$system$store$$promiseRecord(internalModel, label) {
var toReturn = internalModel.then(function (model) {
return model.getRecord();
});
return ember$data$lib$system$promise$proxies$$promiseObject(toReturn, label);
}
var ember$data$lib$system$store$$get = Ember.get;
var ember$data$lib$system$store$$set = Ember.set;
var ember$data$lib$system$store$$once = Ember.run.once;
var ember$data$lib$system$store$$isNone = Ember.isNone;
var ember$data$lib$system$store$$forEach = Ember.ArrayPolyfills.forEach;
var ember$data$lib$system$store$$indexOf = Ember.ArrayPolyfills.indexOf;
var ember$data$lib$system$store$$map = Ember.ArrayPolyfills.map;
var ember$data$lib$system$store$$Promise = Ember.RSVP.Promise;
var ember$data$lib$system$store$$copy = Ember.copy;
var ember$data$lib$system$store$$Store;
var ember$data$lib$system$store$$Service = Ember.Service;
if (!ember$data$lib$system$store$$Service) {
ember$data$lib$system$store$$Service = Ember.Object;
}
// Implementors Note:
//
// The variables in this file are consistently named according to the following
// scheme:
//
// * +id+ means an identifier managed by an external source, provided inside
// the data provided by that source. These are always coerced to be strings
// before being used internally.
// * +clientId+ means a transient numerical identifier generated at runtime by
// the data store. It is important primarily because newly created objects may
// not yet have an externally generated id.
// * +internalModel+ means a record internalModel object, which holds metadata about a
// record, even if it has not yet been fully materialized.
// * +type+ means a DS.Model.
/**
The store contains all of the data for records loaded from the server.
It is also responsible for creating instances of `DS.Model` that wrap
the individual data for a record, so that they can be bound to in your
Handlebars templates.
Define your application's store like this:
```app/stores/application.js
import DS from 'ember-data';
export default DS.Store.extend({
});
```
Most Ember.js applications will only have a single `DS.Store` that is
automatically created by their `Ember.Application`.
You can retrieve models from the store in several ways. To retrieve a record
for a specific id, use `DS.Store`'s `find()` method:
```javascript
store.find('person', 123).then(function (person) {
});
```
By default, the store will talk to your backend using a standard
REST mechanism. You can customize how the store talks to your
backend by specifying a custom adapter:
```app/adapters/application.js
import DS from 'ember-data';
export default DS.Adapter.extend({
});
```
You can learn more about writing a custom adapter by reading the `DS.Adapter`
documentation.
### Store createRecord() vs. push() vs. pushPayload()
The store provides multiple ways to create new record objects. They have
some subtle differences in their use which are detailed below:
[createRecord](#method_createRecord) is used for creating new
records on the client side. This will return a new record in the
`created.uncommitted` state. In order to persist this record to the
backend you will need to call `record.save()`.
[push](#method_push) is used to notify Ember Data's store of new or
updated records that exist in the backend. This will return a record
in the `loaded.saved` state. The primary use-case for `store#push` is
to notify Ember Data about record updates (full or partial) that happen
outside of the normal adapter methods (for example
[SSE](http://dev.w3.org/html5/eventsource/) or [Web
Sockets](http://www.w3.org/TR/2009/WD-websockets-20091222/)).
[pushPayload](#method_pushPayload) is a convenience wrapper for
`store#push` that will deserialize payloads if the
Serializer implements a `pushPayload` method.
Note: When creating a new record using any of the above methods
Ember Data will update `DS.RecordArray`s such as those returned by
`store#peekAll()`, `store#findAll()` or `store#filter()`. This means any
data bindings or computed properties that depend on the RecordArray
will automatically be synced to include the new or updated record
values.
@class Store
@namespace DS
@extends Ember.Service
*/
ember$data$lib$system$store$$Store = ember$data$lib$system$store$$Service.extend({
/**
@method init
@private
*/
init: function () {
this._backburner = new ember$data$lib$system$store$$Backburner(["normalizeRelationships", "syncRelationships", "finished"]);
// internal bookkeeping; not observable
this.typeMaps = {};
this.recordArrayManager = ember$data$lib$system$record$array$manager$$default.create({
store: this
});
this._pendingSave = [];
this._instanceCache = new ember$data$lib$system$store$container$instance$cache$$default(this.container);
//Used to keep track of all the find requests that need to be coalesced
this._pendingFetch = ember$data$lib$system$map$$Map.create();
},
/**
The adapter to use to communicate to a backend server or other persistence layer.
This can be specified as an instance, class, or string.
If you want to specify `app/adapters/custom.js` as a string, do:
```js
adapter: 'custom'
```
@property adapter
@default DS.RESTAdapter
@type {(DS.Adapter|String)}
*/
adapter: "-rest",
/**
Returns a JSON representation of the record using a custom
type-specific serializer, if one exists.
The available options are:
* `includeId`: `true` if the record's ID should be included in
the JSON representation
@method serialize
@private
@param {DS.Model} record the record to serialize
@param {Object} options an options hash
*/
serialize: function (record, options) {
var snapshot = record._internalModel.createSnapshot();
return snapshot.serialize(options);
},
/**
This property returns the adapter, after resolving a possible
string key.
If the supplied `adapter` was a class, or a String property
path resolved to a class, this property will instantiate the
class.
This property is cacheable, so the same instance of a specified
adapter class should be used for the lifetime of the store.
@property defaultAdapter
@private
@return DS.Adapter
*/
defaultAdapter: Ember.computed("adapter", function () {
var adapter = ember$data$lib$system$store$$get(this, "adapter");
Ember.assert("You tried to set `adapter` property to an instance of `DS.Adapter`, where it should be a name", typeof adapter === "string");
adapter = this.retrieveManagedInstance("adapter", adapter);
return adapter;
}),
// .....................
// . CREATE NEW RECORD .
// .....................
/**
Create a new record in the current store. The properties passed
to this method are set on the newly created record.
To create a new instance of `App.Post`:
```js
store.createRecord('post', {
title: "Rails is omakase"
});
```
@method createRecord
@param {String} modelName
@param {Object} inputProperties a hash of properties to set on the
newly created record.
@return {DS.Model} record
*/
createRecord: function (modelName, inputProperties) {
Ember.assert("Passing classes to store methods has been removed. Please pass a dasherized string instead of " + Ember.inspect(modelName), typeof modelName === "string");
var typeClass = this.modelFor(modelName);
var properties = ember$data$lib$system$store$$copy(inputProperties) || Ember.create(null);
// If the passed properties do not include a primary key,
// give the adapter an opportunity to generate one. Typically,
// client-side ID generators will use something like uuid.js
// to avoid conflicts.
if (ember$data$lib$system$store$$isNone(properties.id)) {
properties.id = this._generateId(modelName, properties);
}
// Coerce ID to a string
properties.id = ember$data$lib$system$coerce$id$$default(properties.id);
var internalModel = this.buildInternalModel(typeClass, properties.id);
var record = internalModel.getRecord();
// Move the record out of its initial `empty` state into
// the `loaded` state.
internalModel.loadedData();
// Set the properties specified on the record.
record.setProperties(properties);
internalModel.eachRelationship(function (key, descriptor) {
internalModel._relationships.get(key).setHasData(true);
});
return record;
},
/**
If possible, this method asks the adapter to generate an ID for
a newly created record.
@method _generateId
@private
@param {String} modelName
@param {Object} properties from the new record
@return {String} if the adapter can generate one, an ID
*/
_generateId: function (modelName, properties) {
var adapter = this.adapterFor(modelName);
if (adapter && adapter.generateIdForRecord) {
return adapter.generateIdForRecord(this, modelName, properties);
}
return null;
},
// .................
// . DELETE RECORD .
// .................
/**
For symmetry, a record can be deleted via the store.
Example
```javascript
var post = store.createRecord('post', {
title: "Rails is omakase"
});
store.deleteRecord(post);
```
@method deleteRecord
@param {DS.Model} record
*/
deleteRecord: function (record) {
record.deleteRecord();
},
/**
For symmetry, a record can be unloaded via the store. Only
non-dirty records can be unloaded.
Example
```javascript
store.find('post', 1).then(function(post) {
store.unloadRecord(post);
});
```
@method unloadRecord
@param {DS.Model} record
*/
unloadRecord: function (record) {
record.unloadRecord();
},
// ................
// . FIND RECORDS .
// ................
/**
This is the main entry point into finding records. The first parameter to
this method is the model's name as a string.
---
To find a record by ID, pass the `id` as the second parameter:
```javascript
store.find('person', 1);
```
The `find` method will always return a **promise** that will be resolved
with the record. If the record was already in the store, the promise will
be resolved immediately. Otherwise, the store will ask the adapter's `find`
method to find the necessary data.
The `find` method will always resolve its promise with the same object for
a given type and `id`.
---
You can optionally `preload` specific attributes and relationships that you know of
by passing them as the third argument to find.
For example, if your Ember route looks like `/posts/1/comments/2` and your API route
for the comment also looks like `/posts/1/comments/2` if you want to fetch the comment
without fetching the post you can pass in the post to the `find` call:
```javascript
store.find('comment', 2, { preload: { post: 1 } });
```
If you have access to the post model you can also pass the model itself:
```javascript
store.find('post', 1).then(function (myPostModel) {
store.find('comment', 2, {post: myPostModel});
});
```
This way, your adapter's `find` or `buildURL` method will be able to look up the
relationship on the record and construct the nested URL without having to first
fetch the post.
---
To find all records for a type, call `findAll`:
```javascript
store.findAll('person');
```
This will ask the adapter's `findAll` method to find the records for the
given type, and return a promise that will be resolved once the server
returns the values. The promise will resolve into all records of this type
present in the store, even if the server only returns a subset of them.
@method find
@param {String} modelName
@param {(Object|String|Integer|null)} id
@param {Object} options
@return {Promise} promise
*/
find: function (modelName, id, preload) {
Ember.assert("You need to pass a type to the store's find method", arguments.length >= 1);
Ember.assert("You may not pass `" + id + "` as id to the store's find method", arguments.length === 1 || !Ember.isNone(id));
Ember.assert("Passing classes to store methods has been removed. Please pass a dasherized string instead of " + Ember.inspect(modelName), typeof modelName === "string");
if (arguments.length === 1) {
Ember.deprecate("Using store.find(type) has been deprecated. Use store.findAll(type) to retrieve all records for a given type.");
return this.findAll(modelName);
}
// We are passed a query instead of an id.
if (Ember.typeOf(id) === "object") {
Ember.deprecate("Calling store.find() with a query object is deprecated. Use store.query() instead.");
return this.query(modelName, id);
}
var options = ember$data$lib$system$store$$deprecatePreload(preload, this.modelFor(modelName), "find");
return this.findRecord(modelName, ember$data$lib$system$coerce$id$$default(id), options);
},
/**
This method returns a fresh record for a given type and id combination.
@method fetchById
@deprecated Use [findRecord](#method_findRecord) instead
@param {String} modelName
@param {(String|Integer)} id
@param {Object} options
@return {Promise} promise
*/
fetchById: function (modelName, id, preload) {
Ember.assert("Passing classes to store methods has been removed. Please pass a dasherized string instead of " + Ember.inspect(modelName), typeof modelName === "string");
var options = ember$data$lib$system$store$$deprecatePreload(preload, this.modelFor(modelName), "fetchById");
Ember.deprecate("Using store.fetchById(type, id) has been deprecated. Use store.findRecord(type, id, { reload: true }) to reload a record for a given type.");
if (this.hasRecordForId(modelName, id)) {
return this.peekRecord(modelName, id).reload();
} else {
return this.findRecord(modelName, id, options);
}
},
/**
This method returns a fresh collection from the server, regardless of if there is already records
in the store or not.
@method fetchAll
@deprecated Use [findAll](#method_findAll) instead
@param {String} modelName
@return {Promise} promise
*/
fetchAll: function (modelName) {
Ember.deprecate("Using store.fetchAll(type) has been deprecated. Use store.findAll(type, { reload: true }) to retrieve all records for a given type.");
return this.findAll(modelName, { reload: true });
},
/**
@method fetch
@param {String} modelName
@param {(String|Integer)} id
@param {Object} preload - optional set of attributes and relationships passed in either as IDs or as actual models
@return {Promise} promise
@deprecated Use [findRecord](#method_findRecord) instead
*/
fetch: function (modelName, id, preload) {
Ember.assert("Passing classes to store methods has been removed. Please pass a dasherized string instead of " + Ember.inspect(modelName), typeof modelName === "string");
Ember.deprecate("Using store.fetch() has been deprecated. Use store.findRecord for fetching individual records or store.findAll for collections");
return this.findRecord(modelName, id, { reload: true, preload: preload });
},
/**
This method returns a record for a given type and id combination.
@method findById
@private
@param {String} modelName
@param {(String|Integer)} id
@param {Object} options
@return {Promise} promise
*/
findById: function (modelName, id, preload) {
Ember.deprecate("Using store.findById() has been deprecated. Use store.findRecord() to return a record for a given type and id combination.");
var options = ember$data$lib$system$store$$deprecatePreload(preload, this.modelFor(modelName), "findById");
return this.findRecord(modelName, id, options);
},
/**
This method returns a record for a given type and id combination.
The `findRecord` method will always return a **promise** that will be
resolved with the record. If the record was already in the store,
the promise will be resolved immediately. Otherwise, the store
will ask the adapter's `find` method to find the necessary data.
The `findRecord` method will always resolve its promise with the same
object for a given type and `id`.
Example
```app/routes/post.js
import Ember from 'ember';
export default Ember.Route.extend({
model: function(params) {
return this.store.findRecord('post', params.post_id);
}
});
```
If you would like to force the record to reload, instead of
loading it from the cache when present you can set `reload: true`
in the options object for `findRecord`.
```app/routes/post/edit.js
import Ember from 'ember';
export default Ember.Route.extend({
model: function(params) {
return this.store.findRecord('post', params.post_id, { reload: true });
}
});
```
@method findRecord
@param {String} modelName
@param {(String|Integer)} id
@param {Object} options
@return {Promise} promise
*/
findRecord: function (modelName, id, options) {
Ember.assert("Passing classes to store methods has been removed. Please pass a dasherized string instead of " + Ember.inspect(modelName), typeof modelName === "string");
var internalModel = this._internalModelForId(modelName, id);
options = options || {};
return this._findByInternalModel(internalModel, options);
},
_findByInternalModel: function (internalModel, options) {
options = options || {};
if (options.preload) {
internalModel._preloadData(options.preload);
}
var fetchedInternalModel = this._fetchOrResolveInternalModel(internalModel, options);
return ember$data$lib$system$store$$promiseRecord(fetchedInternalModel, "DS: Store#findRecord " + internalModel.typeKey + " with id: " + ember$data$lib$system$store$$get(internalModel, "id"));
},
_fetchOrResolveInternalModel: function (internalModel, options) {
var typeClass = internalModel.type;
var adapter = this.adapterFor(typeClass.modelName);
// Always fetch the model if it is not loaded
if (internalModel.isEmpty()) {
return this.scheduleFetch(internalModel, options);
}
//TODO double check about reloading
if (internalModel.isLoading()) {
return internalModel._loadingPromise;
}
// Refetch if the reload option is passed
if (options.reload) {
return this.scheduleFetch(internalModel, options);
}
// Refetch the record if the adapter thinks the record is stale
var snapshot = internalModel.createSnapshot();
snapshot.adapterOptions = options && options.adapterOptions;
if (adapter.shouldReloadRecord(this, snapshot)) {
return this.scheduleFetch(internalModel, options);
}
// Trigger the background refetch if all the previous checks fail
if (adapter.shouldBackgroundReloadRecord(this, snapshot)) {
this.scheduleFetch(internalModel, options);
}
// Return the cached record
return ember$data$lib$system$store$$Promise.resolve(internalModel);
},
/**
This method makes a series of requests to the adapter's `find` method
and returns a promise that resolves once they are all loaded.
@private
@method findByIds
@param {String} modelName
@param {Array} ids
@return {Promise} promise
*/
findByIds: function (modelName, ids) {
Ember.assert("Passing classes to store methods has been removed. Please pass a dasherized string instead of " + Ember.inspect(modelName), typeof modelName === "string");
var store = this;
return ember$data$lib$system$promise$proxies$$promiseArray(Ember.RSVP.all(ember$data$lib$system$store$$map.call(ids, function (id) {
return store.findRecord(modelName, id);
})).then(Ember.A, null, "DS: Store#findByIds of " + modelName + " complete"));
},
/**
This method is called by `findRecord` if it discovers that a particular
type/id pair hasn't been loaded yet to kick off a request to the
adapter.
@method fetchRecord
@private
@param {InternalModel} internalModel model
@return {Promise} promise
*/
// TODO rename this to have an underscore
fetchRecord: function (internalModel, options) {
var typeClass = internalModel.type;
var id = internalModel.id;
var adapter = this.adapterFor(typeClass.modelName);
Ember.assert("You tried to find a record but you have no adapter (for " + typeClass + ")", adapter);
Ember.assert("You tried to find a record but your adapter (for " + typeClass + ") does not implement 'findRecord'", typeof adapter.findRecord === "function" || typeof adapter.find === "function");
var promise = ember$data$lib$system$store$finders$$_find(adapter, this, typeClass, id, internalModel, options);
return promise;
},
scheduleFetchMany: function (records) {
var internalModels = ember$data$lib$system$store$$map.call(records, function (record) {
return record._internalModel;
});
return ember$data$lib$system$store$$Promise.all(ember$data$lib$system$store$$map.call(internalModels, this.scheduleFetch, this));
},
scheduleFetch: function (internalModel, options) {
var typeClass = internalModel.type;
if (internalModel._loadingPromise) {
return internalModel._loadingPromise;
}
var resolver = Ember.RSVP.defer("Fetching " + typeClass + "with id: " + internalModel.id);
var pendingFetchItem = {
record: internalModel,
resolver: resolver,
options: options
};
var promise = resolver.promise;
internalModel.loadingData(promise);
if (!this._pendingFetch.get(typeClass)) {
this._pendingFetch.set(typeClass, [pendingFetchItem]);
} else {
this._pendingFetch.get(typeClass).push(pendingFetchItem);
}
Ember.run.scheduleOnce("afterRender", this, this.flushAllPendingFetches);
return promise;
},
flushAllPendingFetches: function () {
if (this.isDestroyed || this.isDestroying) {
return;
}
this._pendingFetch.forEach(this._flushPendingFetchForType, this);
this._pendingFetch = ember$data$lib$system$map$$Map.create();
},
_flushPendingFetchForType: function (pendingFetchItems, typeClass) {
var store = this;
var adapter = store.adapterFor(typeClass.modelName);
var shouldCoalesce = !!adapter.findMany && adapter.coalesceFindRequests;
var records = Ember.A(pendingFetchItems).mapBy("record");
function _fetchRecord(recordResolverPair) {
recordResolverPair.resolver.resolve(store.fetchRecord(recordResolverPair.record, recordResolverPair.options)); // TODO adapter options
}
function resolveFoundRecords(records) {
ember$data$lib$system$store$$forEach.call(records, function (record) {
var pair = Ember.A(pendingFetchItems).findBy("record", record);
if (pair) {
var resolver = pair.resolver;
resolver.resolve(record);
}
});
return records;
}
function makeMissingRecordsRejector(requestedRecords) {
return function rejectMissingRecords(resolvedRecords) {
resolvedRecords = Ember.A(resolvedRecords);
var missingRecords = requestedRecords.reject(function (record) {
return resolvedRecords.contains(record);
});
if (missingRecords.length) {
Ember.warn("Ember Data expected to find records with the following ids in the adapter response but they were missing: " + Ember.inspect(Ember.A(missingRecords).mapBy("id")), false);
}
rejectRecords(missingRecords);
};
}
function makeRecordsRejector(records) {
return function (error) {
rejectRecords(records, error);
};
}
function rejectRecords(records, error) {
ember$data$lib$system$store$$forEach.call(records, function (record) {
var pair = Ember.A(pendingFetchItems).findBy("record", record);
if (pair) {
var resolver = pair.resolver;
resolver.reject(error);
}
});
}
if (pendingFetchItems.length === 1) {
_fetchRecord(pendingFetchItems[0]);
} else if (shouldCoalesce) {
// TODO: Improve records => snapshots => records => snapshots
//
// We want to provide records to all store methods and snapshots to all
// adapter methods. To make sure we're doing that we're providing an array
// of snapshots to adapter.groupRecordsForFindMany(), which in turn will
// return grouped snapshots instead of grouped records.
//
// But since the _findMany() finder is a store method we need to get the
// records from the grouped snapshots even though the _findMany() finder
// will once again convert the records to snapshots for adapter.findMany()
var snapshots = Ember.A(records).invoke("createSnapshot");
var groups = adapter.groupRecordsForFindMany(this, snapshots);
ember$data$lib$system$store$$forEach.call(groups, function (groupOfSnapshots) {
var groupOfRecords = Ember.A(groupOfSnapshots).mapBy("_internalModel");
var requestedRecords = Ember.A(groupOfRecords);
var ids = requestedRecords.mapBy("id");
if (ids.length > 1) {
ember$data$lib$system$store$finders$$_findMany(adapter, store, typeClass, ids, requestedRecords).then(resolveFoundRecords).then(makeMissingRecordsRejector(requestedRecords)).then(null, makeRecordsRejector(requestedRecords));
} else if (ids.length === 1) {
var pair = Ember.A(pendingFetchItems).findBy("record", groupOfRecords[0]);
_fetchRecord(pair);
} else {
Ember.assert("You cannot return an empty array from adapter's method groupRecordsForFindMany", false);
}
});
} else {
ember$data$lib$system$store$$forEach.call(pendingFetchItems, _fetchRecord);
}
},
/**
Get a record by a given type and ID without triggering a fetch.
This method will synchronously return the record if it is available in the store,
otherwise it will return `null`. A record is available if it has been fetched earlier, or
pushed manually into the store.
_Note: This is an synchronous method and does not return a promise._
```js
var post = store.getById('post', 1);
post.get('id'); // 1
```
@method getById
@param {String} modelName
@param {String|Integer} id
@return {DS.Model|null} record
*/
getById: function (modelName, id) {
Ember.deprecate("Using store.getById() has been deprecated. Use store.peekRecord to get a record by a given type and ID without triggering a fetch.");
return this.peekRecord(modelName, id);
},
/**
Get a record by a given type and ID without triggering a fetch.
This method will synchronously return the record if it is available in the store,
otherwise it will return `null`. A record is available if it has been fetched earlier, or
pushed manually into the store.
_Note: This is an synchronous method and does not return a promise._
```js
var post = store.peekRecord('post', 1);
post.get('id'); // 1
```
@method peekRecord
@param {String} modelName
@param {String|Integer} id
@return {DS.Model|null} record
*/
peekRecord: function (modelName, id) {
Ember.assert("Passing classes to store methods has been removed. Please pass a dasherized string instead of " + Ember.inspect(modelName), typeof modelName === "string");
if (this.hasRecordForId(modelName, id)) {
return this._internalModelForId(modelName, id).getRecord();
} else {
return null;
}
},
/**
This method is called by the record's `reload` method.
This method calls the adapter's `find` method, which returns a promise. When
**that** promise resolves, `reloadRecord` will resolve the promise returned
by the record's `reload`.
@method reloadRecord
@private
@param {DS.Model} internalModel
@return {Promise} promise
*/
reloadRecord: function (internalModel) {
var modelName = internalModel.type.modelName;
var adapter = this.adapterFor(modelName);
var id = internalModel.id;
Ember.assert("You cannot reload a record without an ID", id);
Ember.assert("You tried to reload a record but you have no adapter (for " + modelName + ")", adapter);
Ember.assert("You tried to reload a record but your adapter does not implement `findRecord`", typeof adapter.findRecord === "function" || typeof adapter.find === "function");
return this.scheduleFetch(internalModel);
},
/**
Returns true if a record for a given type and ID is already loaded.
@method hasRecordForId
@param {(String|DS.Model)} modelName
@param {(String|Integer)} inputId
@return {Boolean}
*/
hasRecordForId: function (modelName, inputId) {
Ember.assert("Passing classes to store methods has been removed. Please pass a dasherized string instead of " + Ember.inspect(modelName), typeof modelName === "string");
var typeClass = this.modelFor(modelName);
var id = ember$data$lib$system$coerce$id$$default(inputId);
var internalModel = this.typeMapFor(typeClass).idToRecord[id];
return !!internalModel && internalModel.isLoaded();
},
/**
Returns id record for a given type and ID. If one isn't already loaded,
it builds a new record and leaves it in the `empty` state.
@method recordForId
@private
@param {String} modelName
@param {(String|Integer)} id
@return {DS.Model} record
*/
recordForId: function (modelName, id) {
Ember.assert("Passing classes to store methods has been removed. Please pass a dasherized string instead of " + Ember.inspect(modelName), typeof modelName === "string");
return this._internalModelForId(modelName, id).getRecord();
},
_internalModelForId: function (typeName, inputId) {
var typeClass = this.modelFor(typeName);
var id = ember$data$lib$system$coerce$id$$default(inputId);
var idToRecord = this.typeMapFor(typeClass).idToRecord;
var record = idToRecord[id];
if (!record || !idToRecord[id]) {
record = this.buildInternalModel(typeClass, id);
}
return record;
},
/**
@method findMany
@private
@param {Array} internalModels
@return {Promise} promise
*/
findMany: function (internalModels) {
var store = this;
return ember$data$lib$system$store$$Promise.all(ember$data$lib$system$store$$map.call(internalModels, function (internalModel) {
return store._findByInternalModel(internalModel);
}));
},
/**
If a relationship was originally populated by the adapter as a link
(as opposed to a list of IDs), this method is called when the
relationship is fetched.
The link (which is usually a URL) is passed through unchanged, so the
adapter can make whatever request it wants.
The usual use-case is for the server to register a URL as a link, and
then use that URL in the future to make a request for the relationship.
@method findHasMany
@private
@param {DS.Model} owner
@param {any} link
@param {(Relationship)} relationship
@return {Promise} promise
*/
findHasMany: function (owner, link, relationship) {
var adapter = this.adapterFor(owner.type.modelName);
Ember.assert("You tried to load a hasMany relationship but you have no adapter (for " + owner.type + ")", adapter);
Ember.assert("You tried to load a hasMany relationship from a specified `link` in the original payload but your adapter does not implement `findHasMany`", typeof adapter.findHasMany === "function");
return ember$data$lib$system$store$finders$$_findHasMany(adapter, this, owner, link, relationship);
},
/**
@method findBelongsTo
@private
@param {DS.Model} owner
@param {any} link
@param {Relationship} relationship
@return {Promise} promise
*/
findBelongsTo: function (owner, link, relationship) {
var adapter = this.adapterFor(owner.type.modelName);
Ember.assert("You tried to load a belongsTo relationship but you have no adapter (for " + owner.type + ")", adapter);
Ember.assert("You tried to load a belongsTo relationship from a specified `link` in the original payload but your adapter does not implement `findBelongsTo`", typeof adapter.findBelongsTo === "function");
return ember$data$lib$system$store$finders$$_findBelongsTo(adapter, this, owner, link, relationship);
},
/**
This method delegates a query to the adapter. This is the one place where
adapter-level semantics are exposed to the application.
Exposing queries this way seems preferable to creating an abstract query
language for all server-side queries, and then require all adapters to
implement them.
The call made to the server, using a Rails backend, will look something like this:
```
Started GET "/api/v1/person?page=1"
Processing by Api::V1::PersonsController#index as HTML
Parameters: {"page"=>"1"}
```
If you do something like this:
```javascript
store.query('person', {ids: [1, 2, 3]});
```
The call to the server, using a Rails backend, will look something like this:
```
Started GET "/api/v1/person?ids%5B%5D=1&ids%5B%5D=2&ids%5B%5D=3"
Processing by Api::V1::PersonsController#index as HTML
Parameters: {"ids"=>["1", "2", "3"]}
```
This method returns a promise, which is resolved with a `RecordArray`
once the server returns.
@method query
@param {String} modelName
@param {any} query an opaque query to be used by the adapter
@return {Promise} promise
*/
query: function (modelName, query) {
Ember.assert("Passing classes to store methods has been removed. Please pass a dasherized string instead of " + Ember.inspect(modelName), typeof modelName === "string");
var typeClass = this.modelFor(modelName);
var array = this.recordArrayManager.createAdapterPopulatedRecordArray(typeClass, query);
var adapter = this.adapterFor(modelName);
Ember.assert("You tried to load a query but you have no adapter (for " + typeClass + ")", adapter);
Ember.assert("You tried to load a query but your adapter does not implement `query`", typeof adapter.query === "function" || typeof adapter.findQuery === "function");
return ember$data$lib$system$promise$proxies$$promiseArray(ember$data$lib$system$store$finders$$_query(adapter, this, typeClass, query, array));
},
/**
This method delegates a query to the adapter. This is the one place where
adapter-level semantics are exposed to the application.
Exposing queries this way seems preferable to creating an abstract query
language for all server-side queries, and then require all adapters to
implement them.
This method returns a promise, which is resolved with a `RecordObject`
once the server returns.
@method queryRecord
@param {String or subclass of DS.Model} type
@param {any} query an opaque query to be used by the adapter
@return {Promise} promise
*/
queryRecord: function (modelName, query) {
Ember.assert("You need to pass a type to the store's queryRecord method", modelName);
Ember.assert("You need to pass a query hash to the store's queryRecord method", query);
Ember.assert("Passing classes to store methods has been removed. Please pass a dasherized string instead of " + Ember.inspect(modelName), typeof modelName === "string");
var typeClass = this.modelFor(modelName);
var adapter = this.adapterFor(modelName);
Ember.assert("You tried to make a query but you have no adapter (for " + typeClass + ")", adapter);
Ember.assert("You tried to make a query but your adapter does not implement `queryRecord`", typeof adapter.queryRecord === "function");
return ember$data$lib$system$promise$proxies$$promiseObject(ember$data$lib$system$store$finders$$_queryRecord(adapter, this, typeClass, query));
},
/**
This method delegates a query to the adapter. This is the one place where
adapter-level semantics are exposed to the application.
Exposing queries this way seems preferable to creating an abstract query
language for all server-side queries, and then require all adapters to
implement them.
This method returns a promise, which is resolved with a `RecordArray`
once the server returns.
@method query
@param {String} modelName
@param {any} query an opaque query to be used by the adapter
@return {Promise} promise
@deprecated Use `store.query instead`
*/
findQuery: function (modelName, query) {
Ember.deprecate("store#findQuery is deprecated. You should use store#query instead.");
return this.query(modelName, query);
},
/**
`findAll` ask the adapter's `findAll` method to find the records
for the given type, and return a promise that will be resolved
once the server returns the values. The promise will resolve into
all records of this type present in the store, even if the server
only returns a subset of them.
```app/routes/authors.js
import Ember from 'ember';
export default Ember.Route.extend({
model: function(params) {
return this.store.findAll('author');
}
});
```
@method findAll
@param {String} modelName
@param {Object} options
@return {DS.AdapterPopulatedRecordArray}
*/
findAll: function (modelName, options) {
Ember.assert("Passing classes to store methods has been removed. Please pass a dasherized string instead of " + Ember.inspect(modelName), typeof modelName === "string");
var typeClass = this.modelFor(modelName);
return this._fetchAll(typeClass, this.peekAll(modelName), options);
},
/**
@method _fetchAll
@private
@param {DS.Model} typeClass
@param {DS.RecordArray} array
@return {Promise} promise
*/
_fetchAll: function (typeClass, array, options) {
options = options || {};
var adapter = this.adapterFor(typeClass.modelName);
var sinceToken = this.typeMapFor(typeClass).metadata.since;
ember$data$lib$system$store$$set(array, "isUpdating", true);
Ember.assert("You tried to load all records but you have no adapter (for " + typeClass + ")", adapter);
Ember.assert("You tried to load all records but your adapter does not implement `findAll`", typeof adapter.findAll === "function");
if (options.reload) {
return ember$data$lib$system$promise$proxies$$promiseArray(ember$data$lib$system$store$finders$$_findAll(adapter, this, typeClass, sinceToken, options));
}
var snapshotArray = array.createSnapshot(options);
if (adapter.shouldReloadAll(this, snapshotArray)) {
return ember$data$lib$system$promise$proxies$$promiseArray(ember$data$lib$system$store$finders$$_findAll(adapter, this, typeClass, sinceToken, options));
}
if (adapter.shouldBackgroundReloadAll(this, snapshotArray)) {
ember$data$lib$system$promise$proxies$$promiseArray(ember$data$lib$system$store$finders$$_findAll(adapter, this, typeClass, sinceToken, options));
}
return ember$data$lib$system$promise$proxies$$promiseArray(ember$data$lib$system$store$$Promise.resolve(array));
},
/**
@method didUpdateAll
@param {DS.Model} typeClass
@private
*/
didUpdateAll: function (typeClass) {
var liveRecordArray = this.recordArrayManager.liveRecordArrayFor(typeClass);
ember$data$lib$system$store$$set(liveRecordArray, "isUpdating", false);
},
/**
This method returns a filtered array that contains all of the
known records for a given type in the store.
Note that because it's just a filter, the result will contain any
locally created records of the type, however, it will not make a
request to the backend to retrieve additional records. If you
would like to request all the records from the backend please use
[store.find](#method_find).
Also note that multiple calls to `all` for a given type will always
return the same `RecordArray`.
Example
```javascript
var localPosts = store.all('post');
```
@method all
@param {String} modelName
@return {DS.RecordArray}
*/
all: function (modelName) {
Ember.deprecate("Using store.all() has been deprecated. Use store.peekAll() to get all records by a given type without triggering a fetch.");
return this.peekAll(modelName);
},
/**
This method returns a filtered array that contains all of the
known records for a given type in the store.
Note that because it's just a filter, the result will contain any
locally created records of the type, however, it will not make a
request to the backend to retrieve additional records. If you
would like to request all the records from the backend please use
[store.find](#method_find).
Also note that multiple calls to `peekAll` for a given type will always
return the same `RecordArray`.
Example
```javascript
var localPosts = store.peekAll('post');
```
@method peekAll
@param {String} modelName
@return {DS.RecordArray}
*/
peekAll: function (modelName) {
Ember.assert("Passing classes to store methods has been removed. Please pass a dasherized string instead of " + Ember.inspect(modelName), typeof modelName === "string");
var typeClass = this.modelFor(modelName);
var liveRecordArray = this.recordArrayManager.liveRecordArrayFor(typeClass);
this.recordArrayManager.populateLiveRecordArray(liveRecordArray, typeClass);
return liveRecordArray;
},
/**
This method unloads all records in the store.
Optionally you can pass a type which unload all records for a given type.
```javascript
store.unloadAll();
store.unloadAll('post');
```
@method unloadAll
@param {String=} modelName
*/
unloadAll: function (modelName) {
Ember.assert("Passing classes to store methods has been removed. Please pass a dasherized string instead of " + Ember.inspect(modelName), !modelName || typeof modelName === "string");
if (arguments.length === 0) {
var typeMaps = this.typeMaps;
var keys = Ember.keys(typeMaps);
var types = ember$data$lib$system$store$$map.call(keys, byType);
ember$data$lib$system$store$$forEach.call(types, this.unloadAll, this);
} else {
var typeClass = this.modelFor(modelName);
var typeMap = this.typeMapFor(typeClass);
var records = typeMap.records.slice();
var record;
for (var i = 0; i < records.length; i++) {
record = records[i];
record.unloadRecord();
record.destroy(); // maybe within unloadRecord
}
typeMap.metadata = Ember.create(null);
}
function byType(entry) {
return typeMaps[entry]["type"].modelName;
}
},
/**
Takes a type and filter function, and returns a live RecordArray that
remains up to date as new records are loaded into the store or created
locally.
The filter function takes a materialized record, and returns true
if the record should be included in the filter and false if it should
not.
Example
```javascript
store.filter('post', function(post) {
return post.get('unread');
});
```
The filter function is called once on all records for the type when
it is created, and then once on each newly loaded or created record.
If any of a record's properties change, or if it changes state, the
filter function will be invoked again to determine whether it should
still be in the array.
Optionally you can pass a query, which is the equivalent of calling
[find](#method_find) with that same query, to fetch additional records
from the server. The results returned by the server could then appear
in the filter if they match the filter function.
The query itself is not used to filter records, it's only sent to your
server for you to be able to do server-side filtering. The filter
function will be applied on the returned results regardless.
Example
```javascript
store.filter('post', { unread: true }, function(post) {
return post.get('unread');
}).then(function(unreadPosts) {
unreadPosts.get('length'); // 5
var unreadPost = unreadPosts.objectAt(0);
unreadPost.set('unread', false);
unreadPosts.get('length'); // 4
});
```
@method filter
@param {String} modelName
@param {Object} query optional query
@param {Function} filter
@return {DS.PromiseArray}
*/
filter: function (modelName, query, filter) {
Ember.assert("Passing classes to store methods has been removed. Please pass a dasherized string instead of " + Ember.inspect(modelName), typeof modelName === "string");
if (!Ember.ENV.ENABLE_DS_FILTER) {
Ember.deprecate("The filter API will be moved into a plugin soon. To enable store.filter using an environment flag, or to use an alternative, you can visit the ember-data-filter addon page", false, {
url: "https://github.com/ember-data/ember-data-filter"
});
}
var promise;
var length = arguments.length;
var array;
var hasQuery = length === 3;
// allow an optional server query
if (hasQuery) {
promise = this.query(modelName, query);
} else if (arguments.length === 2) {
filter = query;
}
modelName = this.modelFor(modelName);
if (hasQuery) {
array = this.recordArrayManager.createFilteredRecordArray(modelName, filter, query);
} else {
array = this.recordArrayManager.createFilteredRecordArray(modelName, filter);
}
promise = promise || ember$data$lib$system$store$$Promise.cast(array);
return ember$data$lib$system$promise$proxies$$promiseArray(promise.then(function () {
return array;
}, null, "DS: Store#filter of " + modelName));
},
/**
This method returns if a certain record is already loaded
in the store. Use this function to know beforehand if a find()
will result in a request or that it will be a cache hit.
Example
```javascript
store.recordIsLoaded('post', 1); // false
store.find('post', 1).then(function() {
store.recordIsLoaded('post', 1); // true
});
```
@method recordIsLoaded
@param {String} modelName
@param {string} id
@return {boolean}
*/
recordIsLoaded: function (modelName, id) {
Ember.assert("Passing classes to store methods has been removed. Please pass a dasherized string instead of " + Ember.inspect(modelName), typeof modelName === "string");
return this.hasRecordForId(modelName, id);
},
/**
This method returns the metadata for a specific type.
@method metadataFor
@param {String} modelName
@return {object}
@deprecated
*/
metadataFor: function (modelName) {
Ember.deprecate("`store.metadataFor()` has been deprecated. You can use `.get('meta')` on relationships and arrays returned from `store.query()`.");
return this._metadataFor(modelName);
},
/**
@method _metadataFor
@param {String} modelName
@return {object}
@private
*/
_metadataFor: function (modelName) {
Ember.assert("Passing classes to store methods has been removed. Please pass a dasherized string instead of " + Ember.inspect(modelName), typeof modelName === "string");
var typeClass = this.modelFor(modelName);
return this.typeMapFor(typeClass).metadata;
},
/**
This method sets the metadata for a specific type.
@method setMetadataFor
@param {String} modelName
@param {Object} metadata metadata to set
@return {object}
@deprecated
*/
setMetadataFor: function (modelName, metadata) {
Ember.deprecate("`store.setMetadataFor()` has been deprecated. Please return meta from your serializer's `extractMeta` hook.");
this._setMetadataFor(modelName, metadata);
},
/**
@method _setMetadataFor
@param {String} modelName
@param {Object} metadata metadata to set
@private
*/
_setMetadataFor: function (modelName, metadata) {
Ember.assert("Passing classes to store methods has been removed. Please pass a dasherized string instead of " + Ember.inspect(modelName), typeof modelName === "string");
var typeClass = this.modelFor(modelName);
Ember.merge(this.typeMapFor(typeClass).metadata, metadata);
},
// ............
// . UPDATING .
// ............
/**
If the adapter updates attributes the record will notify
the store to update its membership in any filters.
To avoid thrashing, this method is invoked only once per
run loop per record.
@method dataWasUpdated
@private
@param {Class} type
@param {InternalModel} internalModel
*/
dataWasUpdated: function (type, internalModel) {
this.recordArrayManager.recordDidChange(internalModel);
},
// ..............
// . PERSISTING .
// ..............
/**
This method is called by `record.save`, and gets passed a
resolver for the promise that `record.save` returns.
It schedules saving to happen at the end of the run loop.
@method scheduleSave
@private
@param {InternalModel} internalModel
@param {Resolver} resolver
@param {Object} options
*/
scheduleSave: function (internalModel, resolver, options) {
var snapshot = internalModel.createSnapshot(options);
internalModel.flushChangedAttributes();
internalModel.adapterWillCommit();
this._pendingSave.push({
snapshot: snapshot,
resolver: resolver
});
ember$data$lib$system$store$$once(this, "flushPendingSave");
},
/**
This method is called at the end of the run loop, and
flushes any records passed into `scheduleSave`
@method flushPendingSave
@private
*/
flushPendingSave: function () {
var pending = this._pendingSave.slice();
this._pendingSave = [];
ember$data$lib$system$store$$forEach.call(pending, function (pendingItem) {
var snapshot = pendingItem.snapshot;
var resolver = pendingItem.resolver;
var record = snapshot._internalModel;
var adapter = this.adapterFor(record.type.modelName);
var operation;
if (ember$data$lib$system$store$$get(record, "currentState.stateName") === "root.deleted.saved") {
return resolver.resolve();
} else if (record.isNew()) {
operation = "createRecord";
} else if (record.isDeleted()) {
operation = "deleteRecord";
} else {
operation = "updateRecord";
}
resolver.resolve(ember$data$lib$system$store$$_commit(adapter, this, operation, snapshot));
}, this);
},
/**
This method is called once the promise returned by an
adapter's `createRecord`, `updateRecord` or `deleteRecord`
is resolved.
If the data provides a server-generated ID, it will
update the record and the store's indexes.
@method didSaveRecord
@private
@param {InternalModel} internalModel the in-flight internal model
@param {Object} data optional data (see above)
*/
didSaveRecord: function (internalModel, dataArg) {
var data;
if (dataArg) {
data = dataArg.data;
}
if (data) {
// normalize relationship IDs into records
this._backburner.schedule("normalizeRelationships", this, "_setupRelationships", internalModel, internalModel.type, data);
this.updateId(internalModel, data);
}
//We first make sure the primary data has been updated
//TODO try to move notification to the user to the end of the runloop
internalModel.adapterDidCommit(data);
},
/**
This method is called once the promise returned by an
adapter's `createRecord`, `updateRecord` or `deleteRecord`
is rejected with a `DS.InvalidError`.
@method recordWasInvalid
@private
@param {InternalModel} internalModel
@param {Object} errors
*/
recordWasInvalid: function (internalModel, errors) {
internalModel.adapterDidInvalidate(errors);
},
/**
This method is called once the promise returned by an
adapter's `createRecord`, `updateRecord` or `deleteRecord`
is rejected (with anything other than a `DS.InvalidError`).
@method recordWasError
@private
@param {InternalModel} internalModel
@param {Error} error
*/
recordWasError: function (internalModel, error) {
internalModel.adapterDidError(error);
},
/**
When an adapter's `createRecord`, `updateRecord` or `deleteRecord`
resolves with data, this method extracts the ID from the supplied
data.
@method updateId
@private
@param {InternalModel} internalModel
@param {Object} data
*/
updateId: function (internalModel, data) {
var oldId = internalModel.id;
var id = ember$data$lib$system$coerce$id$$default(data.id);
Ember.assert("An adapter cannot assign a new id to a record that already has an id. " + internalModel + " had id: " + oldId + " and you tried to update it with " + id + ". This likely happened because your server returned data in response to a find or update that had a different id than the one you sent.", oldId === null || id === oldId);
this.typeMapFor(internalModel.type).idToRecord[id] = internalModel;
internalModel.setId(id);
},
/**
Returns a map of IDs to client IDs for a given type.
@method typeMapFor
@private
@param {DS.Model} typeClass
@return {Object} typeMap
*/
typeMapFor: function (typeClass) {
var typeMaps = ember$data$lib$system$store$$get(this, "typeMaps");
var guid = Ember.guidFor(typeClass);
var typeMap = typeMaps[guid];
if (typeMap) {
return typeMap;
}
typeMap = {
idToRecord: Ember.create(null),
records: [],
metadata: Ember.create(null),
type: typeClass
};
typeMaps[guid] = typeMap;
return typeMap;
},
// ................
// . LOADING DATA .
// ................
/**
This internal method is used by `push`.
@method _load
@private
@param {(String|DS.Model)} type
@param {Object} data
*/
_load: function (data) {
var id = ember$data$lib$system$coerce$id$$default(data.id);
var internalModel = this._internalModelForId(data.type, id);
internalModel.setupData(data);
this.recordArrayManager.recordDidChange(internalModel);
return internalModel;
},
/*
In case someone defined a relationship to a mixin, for example:
```
var Comment = DS.Model.extend({
owner: belongsTo('commentable'. { polymorphic: true})
});
var Commentable = Ember.Mixin.create({
comments: hasMany('comment')
});
```
we want to look up a Commentable class which has all the necessary
relationship metadata. Thus, we look up the mixin and create a mock
DS.Model, so we can access the relationship CPs of the mixin (`comments`)
in this case
*/
_modelForMixin: function (modelName) {
var normalizedModelName = ember$data$lib$system$normalize$model$name$$default(modelName);
var registry = this.container._registry ? this.container._registry : this.container;
var mixin = registry.resolve("mixin:" + normalizedModelName);
if (mixin) {
//Cache the class as a model
registry.register("model:" + normalizedModelName, DS.Model.extend(mixin));
}
var factory = this.modelFactoryFor(normalizedModelName);
if (factory) {
factory.__isMixin = true;
factory.__mixin = mixin;
}
return factory;
},
/**
Returns a model class for a particular key. Used by
methods that take a type key (like `find`, `createRecord`,
etc.)
@method modelFor
@param {String} modelName
@return {DS.Model}
*/
modelFor: function (modelName) {
Ember.assert("Passing classes to store methods has been removed. Please pass a dasherized string instead of " + Ember.inspect(modelName), typeof modelName === "string");
var factory = this.modelFactoryFor(modelName);
if (!factory) {
//Support looking up mixins as base types for polymorphic relationships
factory = this._modelForMixin(modelName);
}
if (!factory) {
throw new Ember.Error("No model was found for '" + modelName + "'");
}
factory.modelName = factory.modelName || ember$data$lib$system$normalize$model$name$$default(modelName);
// deprecate typeKey
if (!("typeKey" in factory)) {
Ember.defineProperty(factory, "typeKey", {
enumerable: true,
configurable: false,
get: function () {
Ember.deprecate("Usage of `typeKey` has been deprecated and will be removed in Ember Data 1.0. It has been replaced by `modelName` on the model class.");
var typeKey = this.modelName;
if (typeKey) {
typeKey = Ember.String.camelize(this.modelName);
}
return typeKey;
},
set: function () {
Ember.assert("Setting typeKey is not supported. In addition, typeKey has also been deprecated in favor of modelName. Setting modelName is also not supported.");
}
});
}
return factory;
},
modelFactoryFor: function (modelName) {
Ember.assert("Passing classes to store methods has been removed. Please pass a dasherized string instead of " + Ember.inspect(modelName), typeof modelName === "string");
var normalizedKey = ember$data$lib$system$normalize$model$name$$default(modelName);
return this.container.lookupFactory("model:" + normalizedKey);
},
/**
Push some data for a given type into the store.
This method expects normalized data:
* The ID is a key named `id` (an ID is mandatory)
* The names of attributes are the ones you used in
your model's `DS.attr`s.
* Your relationships must be:
* represented as IDs or Arrays of IDs
* represented as model instances
* represented as URLs, under the `links` key
For this model:
```app/models/person.js
import DS from 'ember-data';
export default DS.Model.extend({
firstName: DS.attr(),
lastName: DS.attr(),
children: DS.hasMany('person')
});
```
To represent the children as IDs:
```js
{
id: 1,
firstName: "Tom",
lastName: "Dale",
children: [1, 2, 3]
}
```
To represent the children relationship as a URL:
```js
{
id: 1,
firstName: "Tom",
lastName: "Dale",
links: {
children: "/people/1/children"
}
}
```
If you're streaming data or implementing an adapter, make sure
that you have converted the incoming data into this form. The
store's [normalize](#method_normalize) method is a convenience
helper for converting a json payload into the form Ember Data
expects.
```js
store.push('person', store.normalize('person', data));
```
This method can be used both to push in brand new
records, as well as to update existing records.
@method push
@param {String} modelName
@param {Object} data
@return {DS.Model|Array} the record(s) that was created or
updated.
*/
push: function (modelNameArg, dataArg) {
var _this = this;
var data, modelName;
if (Ember.typeOf(modelNameArg) === "object" && Ember.typeOf(dataArg) === "undefined") {
data = modelNameArg;
} else {
Ember.deprecate("store.push(type, data) has been deprecated. Please provide a JSON-API document object as the first and only argument to store.push.");
Ember.assert("Expected an object as `data` in a call to `push` for " + modelNameArg + " , but was " + Ember.typeOf(dataArg), Ember.typeOf(dataArg) === "object");
Ember.assert("You must include an `id` for " + modelNameArg + " in an object passed to `push`", dataArg.id != null && dataArg.id !== "");
data = ember$data$lib$system$store$serializer$response$$_normalizeSerializerPayload(this.modelFor(modelNameArg), dataArg);
modelName = modelNameArg;
Ember.assert("Passing classes to store methods has been removed. Please pass a dasherized string instead of " + Ember.inspect(modelName), typeof modelName === "string" || typeof data === "undefined");
}
if (data.included) {
ember$data$lib$system$store$$forEach.call(data.included, function (recordData) {
return _this._pushInternalModel(recordData);
});
}
if (Ember.typeOf(data.data) === "array") {
var internalModels = ember$data$lib$system$store$$map.call(data.data, function (recordData) {
return _this._pushInternalModel(recordData);
});
return ember$data$lib$system$store$$map.call(internalModels, function (internalModel) {
return internalModel.getRecord();
});
}
var internalModel = this._pushInternalModel(data.data || data);
return internalModel.getRecord();
},
_pushInternalModel: function (data) {
var modelName = data.type;
Ember.assert("Expected an object as `data` in a call to `push` for " + modelName + " , but was " + Ember.typeOf(data), Ember.typeOf(data) === "object");
Ember.assert("You must include an `id` for " + modelName + " in an object passed to `push`", data.id != null && data.id !== "");
var type = this.modelFor(modelName);
var filter = Ember.ArrayPolyfills.filter;
// If Ember.ENV.DS_WARN_ON_UNKNOWN_KEYS is set to true and the payload
// contains unknown keys, log a warning.
if (Ember.ENV.DS_WARN_ON_UNKNOWN_KEYS) {
Ember.warn("The payload for '" + type.modelName + "' contains these unknown keys: " + Ember.inspect(filter.call(Ember.keys(data), function (key) {
return !(key === "id" || key === "links" || ember$data$lib$system$store$$get(type, "fields").has(key) || key.match(/Type$/));
})) + ". Make sure they've been defined in your model.", filter.call(Ember.keys(data), function (key) {
return !(key === "id" || key === "links" || ember$data$lib$system$store$$get(type, "fields").has(key) || key.match(/Type$/));
}).length === 0);
}
// Actually load the record into the store.
var internalModel = this._load(data);
var store = this;
this._backburner.join(function () {
store._backburner.schedule("normalizeRelationships", store, "_setupRelationships", internalModel, type, data);
});
return internalModel;
},
_setupRelationships: function (record, type, data) {
// If the payload contains relationships that are specified as
// IDs, normalizeRelationships will convert them into DS.Model instances
// (possibly unloaded) before we push the payload into the
// store.
data = ember$data$lib$system$store$$normalizeRelationships(this, type, data);
// Now that the pushed record as well as any related records
// are in the store, create the data structures used to track
// relationships.
ember$data$lib$system$store$$setupRelationships(this, record, data);
},
/**
Push some raw data into the store.
This method can be used both to push in brand new
records, as well as to update existing records. You
can push in more than one type of object at once.
All objects should be in the format expected by the
serializer.
```app/serializers/application.js
import DS from 'ember-data';
export default DS.ActiveModelSerializer;
```
```js
var pushData = {
posts: [
{ id: 1, post_title: "Great post", comment_ids: [2] }
],
comments: [
{ id: 2, comment_body: "Insightful comment" }
]
}
store.pushPayload(pushData);
```
By default, the data will be deserialized using a default
serializer (the application serializer if it exists).
Alternatively, `pushPayload` will accept a model type which
will determine which serializer will process the payload.
However, the serializer itself (processing this data via
`normalizePayload`) will not know which model it is
deserializing.
```app/serializers/application.js
import DS from 'ember-data';
export default DS.ActiveModelSerializer;
```
```app/serializers/post.js
import DS from 'ember-data';
export default DS.JSONSerializer;
```
```js
store.pushPayload('comment', pushData); // Will use the application serializer
store.pushPayload('post', pushData); // Will use the post serializer
```
@method pushPayload
@param {String} modelName Optionally, a model type used to determine which serializer will be used
@param {Object} inputPayload
*/
pushPayload: function (modelName, inputPayload) {
var serializer;
var payload;
if (!inputPayload) {
payload = modelName;
serializer = ember$data$lib$system$store$$defaultSerializer(this.container);
Ember.assert("You cannot use `store#pushPayload` without a modelName unless your default serializer defines `pushPayload`", typeof serializer.pushPayload === "function");
} else {
payload = inputPayload;
Ember.assert("Passing classes to store methods has been removed. Please pass a dasherized string instead of " + Ember.inspect(modelName), typeof modelName === "string");
serializer = this.serializerFor(modelName);
}
var store = this;
this._adapterRun(function () {
serializer.pushPayload(store, payload);
});
},
/**
`normalize` converts a json payload into the normalized form that
[push](#method_push) expects.
Example
```js
socket.on('message', function(message) {
var modelName = message.model;
var data = message.data;
store.push(modelName, store.normalize(modelName, data));
});
```
@method normalize
@param {String} modelName The name of the model type for this payload
@param {Object} payload
@return {Object} The normalized payload
*/
normalize: function (modelName, payload) {
Ember.assert("Passing classes to store methods has been removed. Please pass a dasherized string instead of " + Ember.inspect(modelName), typeof modelName === "string");
var serializer = this.serializerFor(modelName);
var model = this.modelFor(modelName);
return serializer.normalize(model, payload);
},
/**
@method update
@param {String} modelName
@param {Object} data
@return {DS.Model} the record that was updated.
@deprecated Use [push](#method_push) instead
*/
update: function (modelName, data) {
Ember.assert("Passing classes to store methods has been removed. Please pass a dasherized string instead of " + Ember.inspect(modelName), typeof modelName === "string");
Ember.deprecate("Using store.update() has been deprecated since store.push() now handles partial updates. You should use store.push() instead.");
return this.push(modelName, data);
},
/**
If you have an Array of normalized data to push,
you can call `pushMany` with the Array, and it will
call `push` repeatedly for you.
@method pushMany
@param {String} modelName
@param {Array} datas
@return {Array}
*/
pushMany: function (modelName, datas) {
Ember.assert("Passing classes to store methods has been removed. Please pass a dasherized string instead of " + Ember.inspect(modelName), typeof modelName === "string");
Ember.deprecate("Using store.pushMany() has been deprecated since store.push() now handles multiple items. You should use store.push() instead.");
var length = datas.length;
var result = new Array(length);
for (var i = 0; i < length; i++) {
result[i] = this.push(modelName, datas[i]);
}
return result;
},
/**
@method metaForType
@param {String} modelName
@param {Object} metadata
@deprecated Use [setMetadataFor](#method_setMetadataFor) instead
*/
metaForType: function (modelName, metadata) {
Ember.assert("Passing classes to store methods has been removed. Please pass a dasherized string instead of " + Ember.inspect(modelName), typeof modelName === "string");
Ember.deprecate("Using store.metaForType() has been deprecated. Use store.setMetadataFor() to set metadata for a specific type.");
this.setMetadataFor(modelName, metadata);
},
/**
Build a brand new record for a given type, ID, and
initial data.
@method buildRecord
@private
@param {DS.Model} type
@param {String} id
@param {Object} data
@return {InternalModel} internal model
*/
buildInternalModel: function (type, id, data) {
var typeMap = this.typeMapFor(type);
var idToRecord = typeMap.idToRecord;
Ember.assert("The id " + id + " has already been used with another record of type " + type.toString() + ".", !id || !idToRecord[id]);
Ember.assert("`" + Ember.inspect(type) + "` does not appear to be an ember-data model", typeof type._create === "function");
// lookupFactory should really return an object that creates
// instances with the injections applied
var internalModel = new ember$data$lib$system$model$internal$model$$default(type, id, this, this.container, data);
// if we're creating an item, this process will be done
// later, once the object has been persisted.
if (id) {
idToRecord[id] = internalModel;
}
typeMap.records.push(internalModel);
return internalModel;
},
//Called by the state machine to notify the store that the record is ready to be interacted with
recordWasLoaded: function (record) {
this.recordArrayManager.recordWasLoaded(record);
},
// ...............
// . DESTRUCTION .
// ...............
/**
@method dematerializeRecord
@private
@param {DS.Model} record
@deprecated Use [unloadRecord](#method_unloadRecord) instead
*/
dematerializeRecord: function (record) {
Ember.deprecate("Using store.dematerializeRecord() has been deprecated since it was intended for private use only. You should use store.unloadRecord() instead.");
this._dematerializeRecord(record);
},
/**
When a record is destroyed, this un-indexes it and
removes it from any record arrays so it can be GCed.
@method _dematerializeRecord
@private
@param {InternalModel} internalModel
*/
_dematerializeRecord: function (internalModel) {
var type = internalModel.type;
var typeMap = this.typeMapFor(type);
var id = internalModel.id;
internalModel.updateRecordArrays();
if (id) {
delete typeMap.idToRecord[id];
}
var loc = ember$data$lib$system$store$$indexOf.call(typeMap.records, internalModel);
typeMap.records.splice(loc, 1);
},
// ......................
// . PER-TYPE ADAPTERS
// ......................
/**
Returns an instance of the adapter for a given type. For
example, `adapterFor('person')` will return an instance of
`App.PersonAdapter`.
If no `App.PersonAdapter` is found, this method will look
for an `App.ApplicationAdapter` (the default adapter for
your entire application).
If no `App.ApplicationAdapter` is found, it will return
the value of the `defaultAdapter`.
@method adapterFor
@private
@param {String} modelName
@return DS.Adapter
*/
adapterFor: function (modelOrClass) {
var modelName;
Ember.deprecate("Passing classes to store methods has been removed. Please pass a dasherized string instead of " + Ember.inspect(modelName), typeof modelOrClass === "string");
if (typeof modelOrClass !== "string") {
modelName = modelOrClass.modelName;
} else {
modelName = modelOrClass;
}
return this.lookupAdapter(modelName);
},
_adapterRun: function (fn) {
return this._backburner.run(fn);
},
// ..............................
// . RECORD CHANGE NOTIFICATION .
// ..............................
/**
Returns an instance of the serializer for a given type. For
example, `serializerFor('person')` will return an instance of
`App.PersonSerializer`.
If no `App.PersonSerializer` is found, this method will look
for an `App.ApplicationSerializer` (the default serializer for
your entire application).
if no `App.ApplicationSerializer` is found, it will attempt
to get the `defaultSerializer` from the `PersonAdapter`
(`adapterFor('person')`).
If a serializer cannot be found on the adapter, it will fall back
to an instance of `DS.JSONSerializer`.
@method serializerFor
@private
@param {String} modelName the record to serialize
@return {DS.Serializer}
*/
serializerFor: function (modelOrClass) {
var modelName;
Ember.deprecate("Passing classes to store methods has been removed. Please pass a dasherized string instead of " + Ember.inspect(modelOrClass), typeof modelOrClass === "string");
if (typeof modelOrClass !== "string") {
modelName = modelOrClass.modelName;
} else {
modelName = modelOrClass;
}
var fallbacks = ["application", this.adapterFor(modelName).get("defaultSerializer"), "-default"];
var serializer = this.lookupSerializer(modelName, fallbacks);
return serializer;
},
/**
Retrieve a particular instance from the
container cache. If not found, creates it and
placing it in the cache.
Enabled a store to manage local instances of
adapters and serializers.
@method retrieveManagedInstance
@private
@param {String} modelName the object modelName
@param {String} name the object name
@param {Array} fallbacks the fallback objects to lookup if the lookup for modelName or 'application' fails
@return {Ember.Object}
*/
retrieveManagedInstance: function (type, modelName, fallbacks) {
var normalizedModelName = ember$data$lib$system$normalize$model$name$$default(modelName);
var instance = this._instanceCache.get(type, normalizedModelName, fallbacks);
ember$data$lib$system$store$$set(instance, "store", this);
return instance;
},
lookupAdapter: function (name) {
return this.retrieveManagedInstance("adapter", name, this.get("_adapterFallbacks"));
},
_adapterFallbacks: Ember.computed("adapter", function () {
var adapter = this.get("adapter");
return ["application", adapter, "-rest"];
}),
lookupSerializer: function (name, fallbacks) {
return this.retrieveManagedInstance("serializer", name, fallbacks);
},
willDestroy: function () {
this.recordArrayManager.destroy();
this.unloadAll();
for (var cacheKey in this._containerCache) {
this._containerCache[cacheKey].destroy();
delete this._containerCache[cacheKey];
}
delete this._containerCache;
}
});
function ember$data$lib$system$store$$normalizeRelationships(store, type, data, record) {
data.relationships = data.relationships || {};
type.eachRelationship(function (key, relationship) {
var kind = relationship.kind;
var value;
if (data.relationships[key] && data.relationships[key].data) {
value = data.relationships[key].data;
if (kind === "belongsTo") {
data.relationships[key].data = ember$data$lib$system$store$$deserializeRecordId(store, key, relationship, value);
} else if (kind === "hasMany") {
data.relationships[key].data = ember$data$lib$system$store$$deserializeRecordIds(store, key, relationship, value);
}
}
});
return data;
}
function ember$data$lib$system$store$$deserializeRecordId(store, key, relationship, id) {
if (ember$data$lib$system$store$$isNone(id)) {
return;
}
Ember.assert("A " + relationship.parentType + " record was pushed into the store with the value of " + key + " being " + Ember.inspect(id) + ", but " + key + " is a belongsTo relationship so the value must not be an array. You should probably check your data payload or serializer.", !Ember.isArray(id));
//TODO:Better asserts
return store._internalModelForId(id.type, id.id);
}
function ember$data$lib$system$store$$deserializeRecordIds(store, key, relationship, ids) {
if (ember$data$lib$system$store$$isNone(ids)) {
return;
}
Ember.assert("A " + relationship.parentType + " record was pushed into the store with the value of " + key + " being '" + Ember.inspect(ids) + "', but " + key + " is a hasMany relationship so the value must be an array. You should probably check your data payload or serializer.", Ember.isArray(ids));
return ember$data$lib$system$store$$map.call(ids, function (id) {
return ember$data$lib$system$store$$deserializeRecordId(store, key, relationship, id);
});
}
// Delegation to the adapter and promise management
function ember$data$lib$system$store$$defaultSerializer(container) {
return container.lookup("serializer:application") || container.lookup("serializer:-default");
}
function ember$data$lib$system$store$$_commit(adapter, store, operation, snapshot) {
var internalModel = snapshot._internalModel;
var modelName = snapshot.modelName;
var typeClass = store.modelFor(modelName);
var promise = adapter[operation](store, typeClass, snapshot);
var serializer = ember$data$lib$system$store$serializers$$serializerForAdapter(store, adapter, modelName);
var label = "DS: Extract and notify about " + operation + " completion of " + internalModel;
Ember.assert("Your adapter's '" + operation + "' method must return a value, but it returned `undefined", promise !== undefined);
promise = ember$data$lib$system$store$$Promise.cast(promise, label);
promise = ember$data$lib$system$store$common$$_guard(promise, ember$data$lib$system$store$common$$_bind(ember$data$lib$system$store$common$$_objectIsAlive, store));
promise = ember$data$lib$system$store$common$$_guard(promise, ember$data$lib$system$store$common$$_bind(ember$data$lib$system$store$common$$_objectIsAlive, internalModel));
return promise.then(function (adapterPayload) {
store._adapterRun(function () {
var payload, data;
if (adapterPayload) {
payload = ember$data$lib$system$store$serializer$response$$normalizeResponseHelper(serializer, store, typeClass, adapterPayload, snapshot.id, operation);
if (payload.included) {
store.push({ data: payload.included });
}
data = ember$data$lib$system$store$serializer$response$$convertResourceObject(payload.data);
}
store.didSaveRecord(internalModel, ember$data$lib$system$store$serializer$response$$_normalizeSerializerPayload(internalModel.type, data));
});
return internalModel;
}, function (error) {
if (error instanceof ember$data$lib$adapters$errors$$InvalidError) {
var errors = serializer.extractErrors(store, typeClass, error, snapshot.id);
store.recordWasInvalid(internalModel, errors);
} else {
store.recordWasError(internalModel, error);
}
throw error;
}, label);
}
function ember$data$lib$system$store$$setupRelationships(store, record, data) {
var typeClass = record.type;
if (!data.relationships) {
return;
}
typeClass.eachRelationship(function (key, descriptor) {
var kind = descriptor.kind;
if (!data.relationships[key]) {
return;
}
var relationship;
if (data.relationships[key].links && data.relationships[key].links.related) {
relationship = record._relationships.get(key);
relationship.updateLink(data.relationships[key].links.related);
}
if (data.relationships[key].meta) {
relationship = record._relationships.get(key);
relationship.updateMeta(data.relationships[key].meta);
}
var value = data.relationships[key].data;
if (value !== undefined) {
if (kind === "belongsTo") {
relationship = record._relationships.get(key);
relationship.setCanonicalRecord(value);
} else if (kind === "hasMany") {
relationship = record._relationships.get(key);
relationship.updateRecordsFromAdapter(value);
}
}
});
}
function ember$data$lib$system$store$$deprecatePreload(preloadOrOptions, type, methodName) {
if (preloadOrOptions) {
var modelProperties = [];
var fields = Ember.get(type, "fields");
fields.forEach(function (fieldType, key) {
modelProperties.push(key);
});
var preloadDetected = false;
for (var i = 0, _length = modelProperties.length; i < _length; i++) {
var key = modelProperties[i];
if (typeof preloadOrOptions[key] !== "undefined") {
preloadDetected = true;
break;
}
}
if (preloadDetected) {
Ember.deprecate("Passing a preload argument to `store." + methodName + "` is deprecated. Please move it to the preload key on the " + methodName + " `options` argument.");
var preload = preloadOrOptions;
return {
preload: preload
};
}
}
return preloadOrOptions;
}
var ember$data$lib$system$store$$default = ember$data$lib$system$store$$Store;
var ember$data$lib$serializers$json$api$serializer$$dasherize = Ember.String.dasherize;
var ember$data$lib$serializers$json$api$serializer$$map = Ember.ArrayPolyfills.map;
var ember$data$lib$serializers$json$api$serializer$$default = ember$data$lib$serializers$json$serializer$$default.extend({
/*
This is only to be used temporarily during the transition from the old
serializer API to the new one.
`JSONAPISerializer` only supports the new Serializer API.
@property isNewSerializerAPI
*/
isNewSerializerAPI: true,
/*
@method _normalizeDocumentHelper
@param {Object} documentHash
@return {Object}
@private
*/
_normalizeDocumentHelper: function (documentHash) {
if (Ember.typeOf(documentHash.data) === 'object') {
documentHash.data = this._normalizeResourceHelper(documentHash.data);
} else {
documentHash.data = ember$data$lib$serializers$json$api$serializer$$map.call(documentHash.data, this._normalizeResourceHelper, this);
}
if (Ember.typeOf(documentHash.included) === 'array') {
documentHash.included = ember$data$lib$serializers$json$api$serializer$$map.call(documentHash.included, this._normalizeResourceHelper, this);
}
return documentHash;
},
/*
@method _normalizeRelationshipDataHelper
@param {Object} relationshipDataHash
@return {Object}
@private
*/
_normalizeRelationshipDataHelper: function (relationshipDataHash) {
var type = this.modelNameFromPayloadKey(relationshipDataHash.type);
relationshipDataHash.type = type;
return relationshipDataHash;
},
/*
@method _normalizeResourceHelper
@param {Object} resourceHash
@return {Object}
@private
*/
_normalizeResourceHelper: function (resourceHash) {
var modelName = this.modelNameFromPayloadKey(resourceHash.type);
var modelClass = this.store.modelFor(modelName);
var serializer = this.store.serializerFor(modelName);
var _serializer$normalize = serializer.normalize(modelClass, resourceHash);
var data = _serializer$normalize.data;
return data;
},
/**
@method pushPayload
@param {DS.Store} store
@param {Object} payload
*/
pushPayload: function (store, payload) {
var normalizedPayload = this._normalizeDocumentHelper(payload);
store.push(normalizedPayload);
},
/**
@method _normalizeResponse
@param {DS.Store} store
@param {DS.Model} primaryModelClass
@param {Object} payload
@param {String|Number} id
@param {String} requestType
@param {Boolean} isSingle
@return {Object} JSON-API Document
@private
*/
_normalizeResponse: function (store, primaryModelClass, payload, id, requestType, isSingle) {
var normalizedPayload = this._normalizeDocumentHelper(payload);
return normalizedPayload;
},
/*
@method extractAttributes
@param {DS.Model} modelClass
@param {Object} resourceHash
@return {Object}
*/
extractAttributes: function (modelClass, resourceHash) {
var _this = this;
var attributes = {};
if (resourceHash.attributes) {
modelClass.eachAttribute(function (key) {
var attributeKey = _this.keyForAttribute(key, 'deserialize');
if (resourceHash.attributes.hasOwnProperty(attributeKey)) {
attributes[key] = resourceHash.attributes[attributeKey];
}
});
}
return attributes;
},
/*
@method extractRelationship
@param {Object} relationshipHash
@return {Object}
*/
extractRelationship: function (relationshipHash) {
if (Ember.typeOf(relationshipHash.data) === 'object') {
relationshipHash.data = this._normalizeRelationshipDataHelper(relationshipHash.data);
}
if (Ember.typeOf(relationshipHash.data) === 'array') {
relationshipHash.data = ember$data$lib$serializers$json$api$serializer$$map.call(relationshipHash.data, this._normalizeRelationshipDataHelper, this);
}
return relationshipHash;
},
/*
@method extractRelationships
@param {Object} modelClass
@param {Object} resourceHash
@return {Object}
*/
extractRelationships: function (modelClass, resourceHash) {
var _this2 = this;
var relationships = {};
if (resourceHash.relationships) {
modelClass.eachRelationship(function (key, relationshipMeta) {
var relationshipKey = _this2.keyForRelationship(key, relationshipMeta.kind, 'deserialize');
if (resourceHash.relationships.hasOwnProperty(relationshipKey)) {
var relationshipHash = resourceHash.relationships[relationshipKey];
relationships[key] = _this2.extractRelationship(relationshipHash);
}
});
}
return relationships;
},
/*
@method extractType
@param {DS.Model} modelClass
@param {Object} resourceHash
@return {String}
@private
*/
_extractType: function (modelClass, resourceHash) {
return this.modelNameFromPayloadKey(resourceHash.type);
},
/**
@method modelNameFromPayloadKey
@param {String} key
@return {String} the model's modelName
*/
modelNameFromPayloadKey: function (key) {
return ember$inflector$lib$lib$system$string$$singularize(ember$data$lib$system$normalize$model$name$$default(key));
},
/**
@method payloadKeyFromModelName
@param {String} modelName
@return {String}
*/
payloadKeyFromModelName: function (modelName) {
return ember$inflector$lib$lib$system$string$$pluralize(modelName);
},
/*
@method normalize
@param {DS.Model} modelClass
@param {Object} resourceHash
@return {String}
*/
normalize: function (modelClass, resourceHash) {
this.normalizeUsingDeclaredMapping(modelClass, resourceHash);
var data = {
id: this.extractId(resourceHash),
type: this._extractType(modelClass, resourceHash),
attributes: this.extractAttributes(modelClass, resourceHash),
relationships: this.extractRelationships(modelClass, resourceHash)
};
this.applyTransforms(modelClass, data.attributes);
return { data: data };
},
/**
@method keyForAttribute
@param {String} key
@param {String} method
@return {String} normalized key
*/
keyForAttribute: function (key, method) {
return ember$data$lib$serializers$json$api$serializer$$dasherize(key);
},
/**
@method keyForRelationship
@param {String} key
@param {String} typeClass
@param {String} method
@return {String} normalized key
*/
keyForRelationship: function (key, typeClass, method) {
return ember$data$lib$serializers$json$api$serializer$$dasherize(key);
},
/**
@method serialize
@param {DS.Snapshot} snapshot
@param {Object} options
@return {Object} json
*/
serialize: function (snapshot, options) {
var data = this._super.apply(this, arguments);
data.type = this.payloadKeyFromModelName(snapshot.modelName);
return { data: data };
},
/**
@method serializeAttribute
@param {DS.Snapshot} snapshot
@param {Object} json
@param {String} key
@param {Object} attribute
*/
serializeAttribute: function (snapshot, json, key, attribute) {
var type = attribute.type;
if (this._canSerialize(key)) {
json.attributes = json.attributes || {};
var value = snapshot.attr(key);
if (type) {
var transform = this.transformFor(type);
value = transform.serialize(value);
}
var payloadKey = this._getMappedKey(key);
if (payloadKey === key) {
payloadKey = this.keyForAttribute(key, 'serialize');
}
json.attributes[payloadKey] = value;
}
},
/**
@method serializeBelongsTo
@param {DS.Snapshot} snapshot
@param {Object} json
@param {Object} relationship
*/
serializeBelongsTo: function (snapshot, json, relationship) {
var key = relationship.key;
if (this._canSerialize(key)) {
var belongsTo = snapshot.belongsTo(key);
if (belongsTo !== undefined) {
json.relationships = json.relationships || {};
var payloadKey = this._getMappedKey(key);
if (payloadKey === key) {
payloadKey = this.keyForRelationship(key, 'belongsTo', 'serialize');
}
var data = null;
if (belongsTo) {
data = {
type: this.payloadKeyFromModelName(belongsTo.modelName),
id: belongsTo.id
};
}
json.relationships[payloadKey] = { data: data };
}
}
},
/**
@method serializeHasMany
@param {DS.Snapshot} snapshot
@param {Object} json
@param {Object} relationship
*/
serializeHasMany: function (snapshot, json, relationship) {
var _this3 = this;
var key = relationship.key;
if (this._shouldSerializeHasMany(snapshot, key, relationship)) {
var hasMany = snapshot.hasMany(key);
if (hasMany !== undefined) {
json.relationships = json.relationships || {};
var payloadKey = this._getMappedKey(key);
if (payloadKey === key && this.keyForRelationship) {
payloadKey = this.keyForRelationship(key, 'hasMany', 'serialize');
}
var data = ember$data$lib$serializers$json$api$serializer$$map.call(hasMany, function (item) {
return {
type: _this3.payloadKeyFromModelName(item.modelName),
id: item.id
};
});
json.relationships[payloadKey] = { data: data };
}
}
}
});
var ember$data$lib$initializers$store$$default = ember$data$lib$initializers$store$$initializeStore;
/**
Configures a registry for use with an Ember-Data
store. Accepts an optional namespace argument.
@method initializeStore
@param {Ember.Registry} registry
@param {Object} [application] an application namespace
*/
function ember$data$lib$initializers$store$$initializeStore(registry, application) {
Ember.deprecate("Specifying a custom Store for Ember Data on your global namespace as `App.Store` " + "has been deprecated. Please use `App.ApplicationStore` instead.", !(application && application.Store));
registry.optionsForType("serializer", { singleton: false });
registry.optionsForType("adapter", { singleton: false });
// allow older names to be looked up
var proxy = new ember$data$lib$system$container$proxy$$default(registry);
proxy.registerDeprecations([{ deprecated: "serializer:_default", valid: "serializer:-default" }, { deprecated: "serializer:_rest", valid: "serializer:-rest" }, { deprecated: "adapter:_rest", valid: "adapter:-rest" }]);
// new go forward paths
registry.register("serializer:-default", ember$data$lib$serializers$json$serializer$$default.extend({ isNewSerializerAPI: true }));
registry.register("serializer:-rest", ember$data$lib$serializers$rest$serializer$$default.extend({ isNewSerializerAPI: true }));
registry.register("adapter:-rest", ember$data$lib$adapters$rest$adapter$$default);
registry.register("adapter:-json-api", ember$data$lib$adapters$json$api$adapter$$default);
registry.register("serializer:-json-api", ember$data$lib$serializers$json$api$serializer$$default);
var store;
if (registry.has("store:main")) {
Ember.deprecate("Registering a custom store as `store:main` or defining a store in app/store.js has been deprecated. Please move you store to `service:store` or define your custom store in `app/services/store.js`");
store = registry.lookup("store:main");
} else {
var storeMainProxy = new ember$data$lib$system$container$proxy$$default(registry);
storeMainProxy.registerDeprecations([{ deprecated: "store:main", valid: "service:store" }]);
}
if (registry.has("store:application")) {
Ember.deprecate("Registering a custom store as `store:application` or defining a store in app/stores/application.js has been deprecated. Please move you store to `service:store` or define your custom store in `app/services/store.js`");
store = registry.lookup("store:application");
} else {
var storeApplicationProxy = new ember$data$lib$system$container$proxy$$default(registry);
storeApplicationProxy.registerDeprecations([{ deprecated: "store:application", valid: "service:store" }]);
}
if (store) {
registry.register("service:store", store, { instantiate: false });
} else {
registry.register("service:store", application && application.Store || ember$data$lib$system$store$$default);
}
}
var ember$data$lib$transforms$base$$default = Ember.Object.extend({
/**
When given a deserialized value from a record attribute this
method must return the serialized value.
Example
```javascript
serialize: function(deserialized) {
return Ember.isEmpty(deserialized) ? null : Number(deserialized);
}
```
@method serialize
@param deserialized The deserialized value
@return The serialized value
*/
serialize: null,
/**
When given a serialize value from a JSON object this method must
return the deserialized value for the record attribute.
Example
```javascript
deserialize: function(serialized) {
return empty(serialized) ? null : Number(serialized);
}
```
@method deserialize
@param serialized The serialized value
@return The deserialized value
*/
deserialize: null
});
var ember$data$lib$transforms$number$$empty = Ember.isEmpty;
function ember$data$lib$transforms$number$$isNumber(value) {
return value === value && value !== Infinity && value !== -Infinity;
}
var ember$data$lib$transforms$number$$default = ember$data$lib$transforms$base$$default.extend({
deserialize: function (serialized) {
var transformed;
if (ember$data$lib$transforms$number$$empty(serialized)) {
return null;
} else {
transformed = Number(serialized);
return ember$data$lib$transforms$number$$isNumber(transformed) ? transformed : null;
}
},
serialize: function (deserialized) {
var transformed;
if (ember$data$lib$transforms$number$$empty(deserialized)) {
return null;
} else {
transformed = Number(deserialized);
return ember$data$lib$transforms$number$$isNumber(transformed) ? transformed : null;
}
}
});
// Date.prototype.toISOString shim
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString
var ember$data$lib$transforms$date$$toISOString = Date.prototype.toISOString || function () {
function pad(number) {
if (number < 10) {
return '0' + number;
}
return number;
}
return this.getUTCFullYear() + '-' + pad(this.getUTCMonth() + 1) + '-' + pad(this.getUTCDate()) + 'T' + pad(this.getUTCHours()) + ':' + pad(this.getUTCMinutes()) + ':' + pad(this.getUTCSeconds()) + '.' + (this.getUTCMilliseconds() / 1000).toFixed(3).slice(2, 5) + 'Z';
};
if (Ember.SHIM_ES5) {
if (!Date.prototype.toISOString) {
Date.prototype.toISOString = ember$data$lib$transforms$date$$toISOString;
}
}
var ember$data$lib$transforms$date$$default = ember$data$lib$transforms$base$$default.extend({
deserialize: function (serialized) {
var type = typeof serialized;
if (type === 'string') {
return new Date(Ember.Date.parse(serialized));
} else if (type === 'number') {
return new Date(serialized);
} else if (serialized === null || serialized === undefined) {
// if the value is null return null
// if the value is not present in the data return undefined
return serialized;
} else {
return null;
}
},
serialize: function (date) {
if (date instanceof Date) {
return ember$data$lib$transforms$date$$toISOString.call(date);
} else {
return null;
}
}
});
var ember$data$lib$transforms$string$$none = Ember.isNone;
var ember$data$lib$transforms$string$$default = ember$data$lib$transforms$base$$default.extend({
deserialize: function (serialized) {
return ember$data$lib$transforms$string$$none(serialized) ? null : String(serialized);
},
serialize: function (deserialized) {
return ember$data$lib$transforms$string$$none(deserialized) ? null : String(deserialized);
}
});
var ember$data$lib$transforms$boolean$$default = ember$data$lib$transforms$base$$default.extend({
deserialize: function (serialized) {
var type = typeof serialized;
if (type === "boolean") {
return serialized;
} else if (type === "string") {
return serialized.match(/^true$|^t$|^1$/i) !== null;
} else if (type === "number") {
return serialized === 1;
} else {
return false;
}
},
serialize: function (deserialized) {
return Boolean(deserialized);
}
});
var ember$data$lib$initializers$transforms$$default = ember$data$lib$initializers$transforms$$initializeTransforms;
/**
Configures a registry for use with Ember-Data
transforms.
@method initializeTransforms
@param {Ember.Registry} registry
*/
function ember$data$lib$initializers$transforms$$initializeTransforms(registry) {
registry.register('transform:boolean', ember$data$lib$transforms$boolean$$default);
registry.register('transform:date', ember$data$lib$transforms$date$$default);
registry.register('transform:number', ember$data$lib$transforms$number$$default);
registry.register('transform:string', ember$data$lib$transforms$string$$default);
}
var ember$data$lib$initializers$store$injections$$default = ember$data$lib$initializers$store$injections$$initializeStoreInjections;
/**
Configures a registry with injections on Ember applications
for the Ember-Data store. Accepts an optional namespace argument.
@method initializeStoreInjections
@param {Ember.Registry} registry
*/
function ember$data$lib$initializers$store$injections$$initializeStoreInjections(registry) {
registry.injection('controller', 'store', 'service:store');
registry.injection('route', 'store', 'service:store');
registry.injection('data-adapter', 'store', 'service:store');
}
var ember$new$computed$lib$utils$can$use$new$syntax$$supportsSetterGetter;
try {
ember$lib$main$$default.computed({
set: function () {},
get: function () {}
});
ember$new$computed$lib$utils$can$use$new$syntax$$supportsSetterGetter = true;
} catch (e) {
ember$new$computed$lib$utils$can$use$new$syntax$$supportsSetterGetter = false;
}
var ember$new$computed$lib$utils$can$use$new$syntax$$default = ember$new$computed$lib$utils$can$use$new$syntax$$supportsSetterGetter;
var ember$new$computed$lib$main$$default = ember$new$computed$lib$main$$newComputed;
var ember$new$computed$lib$main$$computed = ember$lib$main$$default.computed;
function ember$new$computed$lib$main$$newComputed() {
var polyfillArguments = [];
var config = arguments[arguments.length - 1];
if (typeof config === 'function' || ember$new$computed$lib$utils$can$use$new$syntax$$default) {
return ember$new$computed$lib$main$$computed.apply(undefined, arguments);
}
for (var i = 0, l = arguments.length - 1; i < l; i++) {
polyfillArguments.push(arguments[i]);
}
var func;
if (config.set) {
func = function (key, value) {
if (arguments.length > 1) {
return config.set.call(this, key, value);
} else {
return config.get.call(this, key);
}
};
} else {
func = function (key) {
return config.get.call(this, key);
};
}
polyfillArguments.push(func);
return ember$new$computed$lib$main$$computed.apply(undefined, polyfillArguments);
}
var ember$new$computed$lib$main$$computedKeys = ember$lib$main$$default.keys(ember$new$computed$lib$main$$computed);
for (var ember$new$computed$lib$main$$i = 0, ember$new$computed$lib$main$$l = ember$new$computed$lib$main$$computedKeys.length; ember$new$computed$lib$main$$i < ember$new$computed$lib$main$$l; ember$new$computed$lib$main$$i++) {
ember$new$computed$lib$main$$newComputed[ember$new$computed$lib$main$$computedKeys[ember$new$computed$lib$main$$i]] = ember$new$computed$lib$main$$computed[ember$new$computed$lib$main$$computedKeys[ember$new$computed$lib$main$$i]];
}
var ember$data$lib$system$model$attributes$$default = ember$data$lib$system$model$attributes$$attr;
/**
@module ember-data
*/
var ember$data$lib$system$model$attributes$$get = Ember.get;
/**
@class Model
@namespace DS
*/
ember$data$lib$system$model$model$$default.reopenClass({
/**
A map whose keys are the attributes of the model (properties
described by DS.attr) and whose values are the meta object for the
property.
Example
```app/models/person.js
import DS from 'ember-data';
export default DS.Model.extend({
firstName: attr('string'),
lastName: attr('string'),
birthday: attr('date')
});
```
```javascript
import Ember from 'ember';
import Person from 'app/models/person';
var attributes = Ember.get(Person, 'attributes')
attributes.forEach(function(name, meta) {
console.log(name, meta);
});
// prints:
// firstName {type: "string", isAttribute: true, options: Object, parentType: function, name: "firstName"}
// lastName {type: "string", isAttribute: true, options: Object, parentType: function, name: "lastName"}
// birthday {type: "date", isAttribute: true, options: Object, parentType: function, name: "birthday"}
```
@property attributes
@static
@type {Ember.Map}
@readOnly
*/
attributes: Ember.computed(function () {
var map = ember$data$lib$system$map$$Map.create();
this.eachComputedProperty(function (name, meta) {
if (meta.isAttribute) {
Ember.assert("You may not set `id` as an attribute on your model. Please remove any lines that look like: `id: DS.attr('<type>')` from " + this.toString(), name !== "id");
meta.name = name;
map.set(name, meta);
}
});
return map;
}).readOnly(),
/**
A map whose keys are the attributes of the model (properties
described by DS.attr) and whose values are type of transformation
applied to each attribute. This map does not include any
attributes that do not have an transformation type.
Example
```app/models/person.js
import DS from 'ember-data';
export default DS.Model.extend({
firstName: attr(),
lastName: attr('string'),
birthday: attr('date')
});
```
```javascript
import Ember from 'ember';
import Person from 'app/models/person';
var transformedAttributes = Ember.get(Person, 'transformedAttributes')
transformedAttributes.forEach(function(field, type) {
console.log(field, type);
});
// prints:
// lastName string
// birthday date
```
@property transformedAttributes
@static
@type {Ember.Map}
@readOnly
*/
transformedAttributes: Ember.computed(function () {
var map = ember$data$lib$system$map$$Map.create();
this.eachAttribute(function (key, meta) {
if (meta.type) {
map.set(key, meta.type);
}
});
return map;
}).readOnly(),
/**
Iterates through the attributes of the model, calling the passed function on each
attribute.
The callback method you provide should have the following signature (all
parameters are optional):
```javascript
function(name, meta);
```
- `name` the name of the current property in the iteration
- `meta` the meta object for the attribute property in the iteration
Note that in addition to a callback, you can also pass an optional target
object that will be set as `this` on the context.
Example
```javascript
import DS from 'ember-data';
var Person = DS.Model.extend({
firstName: attr('string'),
lastName: attr('string'),
birthday: attr('date')
});
Person.eachAttribute(function(name, meta) {
console.log(name, meta);
});
// prints:
// firstName {type: "string", isAttribute: true, options: Object, parentType: function, name: "firstName"}
// lastName {type: "string", isAttribute: true, options: Object, parentType: function, name: "lastName"}
// birthday {type: "date", isAttribute: true, options: Object, parentType: function, name: "birthday"}
```
@method eachAttribute
@param {Function} callback The callback to execute
@param {Object} [binding] the value to which the callback's `this` should be bound
@static
*/
eachAttribute: function (callback, binding) {
ember$data$lib$system$model$attributes$$get(this, "attributes").forEach(function (meta, name) {
callback.call(binding, name, meta);
}, binding);
},
/**
Iterates through the transformedAttributes of the model, calling
the passed function on each attribute. Note the callback will not be
called for any attributes that do not have an transformation type.
The callback method you provide should have the following signature (all
parameters are optional):
```javascript
function(name, type);
```
- `name` the name of the current property in the iteration
- `type` a string containing the name of the type of transformed
applied to the attribute
Note that in addition to a callback, you can also pass an optional target
object that will be set as `this` on the context.
Example
```javascript
import DS from 'ember-data';
var Person = DS.Model.extend({
firstName: attr(),
lastName: attr('string'),
birthday: attr('date')
});
Person.eachTransformedAttribute(function(name, type) {
console.log(name, type);
});
// prints:
// lastName string
// birthday date
```
@method eachTransformedAttribute
@param {Function} callback The callback to execute
@param {Object} [binding] the value to which the callback's `this` should be bound
@static
*/
eachTransformedAttribute: function (callback, binding) {
ember$data$lib$system$model$attributes$$get(this, "transformedAttributes").forEach(function (type, name) {
callback.call(binding, name, type);
});
}
});
ember$data$lib$system$model$model$$default.reopen({
eachAttribute: function (callback, binding) {
this.constructor.eachAttribute(callback, binding);
}
});
function ember$data$lib$system$model$attributes$$getDefaultValue(record, options, key) {
if (typeof options.defaultValue === "function") {
return options.defaultValue.apply(null, arguments);
} else {
return options.defaultValue;
}
}
function ember$data$lib$system$model$attributes$$hasValue(record, key) {
return key in record._attributes || key in record._inFlightAttributes || key in record._data;
}
function ember$data$lib$system$model$attributes$$getValue(record, key) {
if (key in record._attributes) {
return record._attributes[key];
} else if (key in record._inFlightAttributes) {
return record._inFlightAttributes[key];
} else {
return record._data[key];
}
}
/**
`DS.attr` defines an attribute on a [DS.Model](/api/data/classes/DS.Model.html).
By default, attributes are passed through as-is, however you can specify an
optional type to have the value automatically transformed.
Ember Data ships with four basic transform types: `string`, `number`,
`boolean` and `date`. You can define your own transforms by subclassing
[DS.Transform](/api/data/classes/DS.Transform.html).
Note that you cannot use `attr` to define an attribute of `id`.
`DS.attr` takes an optional hash as a second parameter, currently
supported options are:
- `defaultValue`: Pass a string or a function to be called to set the attribute
to a default value if none is supplied.
Example
```app/models/user.js
import DS from 'ember-data';
export default DS.Model.extend({
username: DS.attr('string'),
email: DS.attr('string'),
verified: DS.attr('boolean', { defaultValue: false })
});
```
Default value can also be a function. This is useful it you want to return
a new object for each attribute.
```app/models/user.js
import DS from 'ember-data';
export default DS.Model.extend({
username: attr('string'),
email: attr('string'),
settings: attr({defaultValue: function() {
return {};
}})
});
```
@namespace
@method attr
@for DS
@param {String} type the attribute type
@param {Object} options a hash of options
@return {Attribute}
*/
function ember$data$lib$system$model$attributes$$attr(type, options) {
if (typeof type === "object") {
options = type;
type = undefined;
} else {
options = options || {};
}
var meta = {
type: type,
isAttribute: true,
options: options
};
return ember$new$computed$lib$main$$default({
get: function (key) {
var internalModel = this._internalModel;
if (ember$data$lib$system$model$attributes$$hasValue(internalModel, key)) {
return ember$data$lib$system$model$attributes$$getValue(internalModel, key);
} else {
return ember$data$lib$system$model$attributes$$getDefaultValue(this, options, key);
}
},
set: function (key, value) {
Ember.assert("You may not set `id` as an attribute on your model. Please remove any lines that look like: `id: DS.attr('<type>')` from " + this.constructor.toString(), key !== "id");
var internalModel = this._internalModel;
var oldValue = ember$data$lib$system$model$attributes$$getValue(internalModel, key);
if (value !== oldValue) {
// Add the new value to the changed attributes hash; it will get deleted by
// the 'didSetProperty' handler if it is no different from the original value
internalModel._attributes[key] = value;
this._internalModel.send("didSetProperty", {
name: key,
oldValue: oldValue,
originalValue: internalModel._data[key],
value: value
});
}
return value;
}
}).meta(meta);
}
var ember$data$lib$system$model$$default = ember$data$lib$system$model$model$$default;
var ember$data$lib$system$debug$debug$adapter$$get = Ember.get;
var ember$data$lib$system$debug$debug$adapter$$capitalize = Ember.String.capitalize;
var ember$data$lib$system$debug$debug$adapter$$underscore = Ember.String.underscore;
var ember$data$lib$system$debug$debug$adapter$$_Ember = Ember;
var ember$data$lib$system$debug$debug$adapter$$assert = ember$data$lib$system$debug$debug$adapter$$_Ember.assert;
var ember$data$lib$system$debug$debug$adapter$$default = Ember.DataAdapter.extend({
getFilters: function () {
return [{ name: 'isNew', desc: 'New' }, { name: 'isModified', desc: 'Modified' }, { name: 'isClean', desc: 'Clean' }];
},
detect: function (typeClass) {
return typeClass !== ember$data$lib$system$model$$default && ember$data$lib$system$model$$default.detect(typeClass);
},
columnsForType: function (typeClass) {
var columns = [{
name: 'id',
desc: 'Id'
}];
var count = 0;
var self = this;
ember$data$lib$system$debug$debug$adapter$$get(typeClass, 'attributes').forEach(function (meta, name) {
if (count++ > self.attributeLimit) {
return false;
}
var desc = ember$data$lib$system$debug$debug$adapter$$capitalize(ember$data$lib$system$debug$debug$adapter$$underscore(name).replace('_', ' '));
columns.push({ name: name, desc: desc });
});
return columns;
},
getRecords: function (modelClass, modelName) {
if (arguments.length < 2) {
// Legacy Ember.js < 1.13 support
var containerKey = modelClass._debugContainerKey;
if (containerKey) {
var match = containerKey.match(/model:(.*)/);
if (match) {
modelName = match[1];
}
}
}
ember$data$lib$system$debug$debug$adapter$$assert('Cannot find model name. Please upgrade to Ember.js >= 1.13 for Ember Inspector support', !!modelName);
return this.get('store').peekAll(modelName);
},
getRecordColumnValues: function (record) {
var self = this;
var count = 0;
var columnValues = { id: ember$data$lib$system$debug$debug$adapter$$get(record, 'id') };
record.eachAttribute(function (key) {
if (count++ > self.attributeLimit) {
return false;
}
var value = ember$data$lib$system$debug$debug$adapter$$get(record, key);
columnValues[key] = value;
});
return columnValues;
},
getRecordKeywords: function (record) {
var keywords = [];
var keys = Ember.A(['id']);
record.eachAttribute(function (key) {
keys.push(key);
});
keys.forEach(function (key) {
keywords.push(ember$data$lib$system$debug$debug$adapter$$get(record, key));
});
return keywords;
},
getRecordFilterValues: function (record) {
return {
isNew: record.get('isNew'),
isModified: record.get('hasDirtyAttributes') && !record.get('isNew'),
isClean: !record.get('hasDirtyAttributes')
};
},
getRecordColor: function (record) {
var color = 'black';
if (record.get('isNew')) {
color = 'green';
} else if (record.get('hasDirtyAttributes')) {
color = 'blue';
}
return color;
},
observeRecord: function (record, recordUpdated) {
var releaseMethods = Ember.A();
var self = this;
var keysToObserve = Ember.A(['id', 'isNew', 'hasDirtyAttributes']);
record.eachAttribute(function (key) {
keysToObserve.push(key);
});
keysToObserve.forEach(function (key) {
var handler = function () {
recordUpdated(self.wrapRecord(record));
};
Ember.addObserver(record, key, handler);
releaseMethods.push(function () {
Ember.removeObserver(record, key, handler);
});
});
var release = function () {
releaseMethods.forEach(function (fn) {
fn();
});
};
return release;
}
});
var ember$data$lib$initializers$data$adapter$$default = ember$data$lib$initializers$data$adapter$$initializeDebugAdapter;
/**
Configures a registry with injections on Ember applications
for the Ember-Data store. Accepts an optional namespace argument.
@method initializeStoreInjections
@param {Ember.Registry} registry
*/
function ember$data$lib$initializers$data$adapter$$initializeDebugAdapter(registry) {
registry.register("data-adapter:main", ember$data$lib$system$debug$debug$adapter$$default);
}
var ember$data$lib$instance$initializers$initialize$store$service$$default = ember$data$lib$instance$initializers$initialize$store$service$$initializeStoreService;
/**
Configures a registry for use with an Ember-Data
store.
@method initializeStore
@param {Ember.ApplicationInstance} applicationOrRegistry
*/
function ember$data$lib$instance$initializers$initialize$store$service$$initializeStoreService(applicationOrRegistry) {
var registry, container;
if (applicationOrRegistry.registry && applicationOrRegistry.container) {
// initializeStoreService was registered with an
// instanceInitializer. The first argument is the application
// instance.
registry = applicationOrRegistry.registry;
container = applicationOrRegistry.container;
} else {
// initializeStoreService was called by an initializer instead of
// an instanceInitializer. The first argument is a registy. This
// case allows ED to support Ember pre 1.12
registry = applicationOrRegistry;
if (registry.container) {
// Support Ember 1.10 - 1.11
container = registry.container();
} else {
// Support Ember 1.9
container = registry;
}
}
// Eagerly generate the store so defaultStore is populated.
container.lookup('service:store');
}
var ember$data$lib$setup$container$$default = ember$data$lib$setup$container$$setupContainer;
function ember$data$lib$setup$container$$setupContainer(registry, application) {
// application is not a required argument. This ensures
// testing setups can setup a container without booting an
// entire ember application.
ember$data$lib$setup$container$$initializeInjects(registry, application);
ember$data$lib$instance$initializers$initialize$store$service$$default(registry);
}
function ember$data$lib$setup$container$$initializeInjects(registry, application) {
ember$data$lib$initializers$data$adapter$$default(registry, application);
ember$data$lib$initializers$transforms$$default(registry, application);
ember$data$lib$initializers$store$injections$$default(registry, application);
activemodel$adapter$lib$setup$container$$default(registry, application);
ember$data$lib$initializers$store$$default(registry, application);
}
var ember$data$lib$ember$initializer$$K = Ember.K;
/**
@module ember-data
*/
/*
This code initializes Ember-Data onto an Ember application.
If an Ember.js developer defines a subclass of DS.Store on their application,
as `App.StoreService` (or via a module system that resolves to `service:store`)
this code will automatically instantiate it and make it available on the
router.
Additionally, after an application's controllers have been injected, they will
each have the store made available to them.
For example, imagine an Ember.js application with the following classes:
App.StoreService = DS.Store.extend({
adapter: 'custom'
});
App.PostsController = Ember.ArrayController.extend({
// ...
});
When the application is initialized, `App.ApplicationStore` will automatically be
instantiated, and the instance of `App.PostsController` will have its `store`
property set to that instance.
Note that this code will only be run if the `ember-application` package is
loaded. If Ember Data is being used in an environment other than a
typical application (e.g., node.js where only `ember-runtime` is available),
this code will be ignored.
*/
Ember.onLoad('Ember.Application', function (Application) {
Application.initializer({
name: 'ember-data',
initialize: ember$data$lib$setup$container$$initializeInjects
});
if (Application.instanceInitializer) {
Application.instanceInitializer({
name: 'ember-data',
initialize: ember$data$lib$instance$initializers$initialize$store$service$$default
});
} else {
Application.initializer({
name: 'ember-data-store-service',
after: 'ember-data',
initialize: ember$data$lib$instance$initializers$initialize$store$service$$default
});
}
// Deprecated initializers to satisfy old code that depended on them
Application.initializer({
name: 'store',
after: 'ember-data',
initialize: ember$data$lib$ember$initializer$$K
});
Application.initializer({
name: 'activeModelAdapter',
before: 'store',
initialize: ember$data$lib$ember$initializer$$K
});
Application.initializer({
name: 'transforms',
before: 'store',
initialize: ember$data$lib$ember$initializer$$K
});
Application.initializer({
name: 'data-adapter',
before: 'store',
initialize: ember$data$lib$ember$initializer$$K
});
Application.initializer({
name: 'injectStore',
before: 'store',
initialize: ember$data$lib$ember$initializer$$K
});
});
Ember.Date = Ember.Date || {};
var origParse = Date.parse;
var numericKeys = [1, 4, 5, 6, 7, 10, 11];
/**
@method parse
@param {Date} date
@return {Number} timestamp
*/
Ember.Date.parse = function (date) {
var timestamp, struct;
var minutesOffset = 0;
// ES5 §15.9.4.2 states that the string should attempt to be parsed as a Date Time String Format string
// before falling back to any implementation-specific date parsing, so that’s what we do, even if native
// implementations could be faster
// 1 YYYY 2 MM 3 DD 4 HH 5 mm 6 ss 7 msec 8 Z 9 ± 10 tzHH 11 tzmm
if (struct = /^(\d{4}|[+\-]\d{6})(?:-(\d{2})(?:-(\d{2}))?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/.exec(date)) {
// avoid NaN timestamps caused by “undefined” values being passed to Date.UTC
for (var i = 0, k; k = numericKeys[i]; ++i) {
struct[k] = +struct[k] || 0;
}
// allow undefined days and months
struct[2] = (+struct[2] || 1) - 1;
struct[3] = +struct[3] || 1;
if (struct[8] !== 'Z' && struct[9] !== undefined) {
minutesOffset = struct[10] * 60 + struct[11];
if (struct[9] === '+') {
minutesOffset = 0 - minutesOffset;
}
}
timestamp = Date.UTC(struct[1], struct[2], struct[3], struct[4], struct[5] + minutesOffset, struct[6], struct[7]);
} else {
timestamp = origParse ? origParse(date) : NaN;
}
return timestamp;
};
if (Ember.EXTEND_PROTOTYPES === true || Ember.EXTEND_PROTOTYPES.Date) {
Date.parse = Ember.Date.parse;
}
ember$data$lib$system$model$$default.reopen({
/**
Provides info about the model for debugging purposes
by grouping the properties into more semantic groups.
Meant to be used by debugging tools such as the Chrome Ember Extension.
- Groups all attributes in "Attributes" group.
- Groups all belongsTo relationships in "Belongs To" group.
- Groups all hasMany relationships in "Has Many" group.
- Groups all flags in "Flags" group.
- Flags relationship CPs as expensive properties.
@method _debugInfo
@for DS.Model
@private
*/
_debugInfo: function () {
var attributes = ['id'];
var relationships = { belongsTo: [], hasMany: [] };
var expensiveProperties = [];
this.eachAttribute(function (name, meta) {
attributes.push(name);
}, this);
this.eachRelationship(function (name, relationship) {
relationships[relationship.kind].push(name);
expensiveProperties.push(name);
});
var groups = [{
name: 'Attributes',
properties: attributes,
expand: true
}, {
name: 'Belongs To',
properties: relationships.belongsTo,
expand: true
}, {
name: 'Has Many',
properties: relationships.hasMany,
expand: true
}, {
name: 'Flags',
properties: ['isLoaded', 'hasDirtyAttributes', 'isSaving', 'isDeleted', 'isError', 'isNew', 'isValid']
}];
return {
propertyInfo: {
// include all other mixins / properties (not just the grouped ones)
includeOtherProperties: true,
groups: groups,
// don't pre-calculate unless cached
expensiveProperties: expensiveProperties
}
};
}
});
var ember$data$lib$system$debug$debug$info$$default = ember$data$lib$system$model$$default;
var ember$data$lib$system$debug$$default = ember$data$lib$system$debug$debug$adapter$$default;
var ember$data$lib$serializers$embedded$records$mixin$$get = Ember.get;
var ember$data$lib$serializers$embedded$records$mixin$$set = Ember.set;
var ember$data$lib$serializers$embedded$records$mixin$$forEach = Ember.ArrayPolyfills.forEach;
var ember$data$lib$serializers$embedded$records$mixin$$camelize = Ember.String.camelize;
/**
## Using Embedded Records
`DS.EmbeddedRecordsMixin` supports serializing embedded records.
To set up embedded records, include the mixin when extending a serializer
then define and configure embedded (model) relationships.
Below is an example of a per-type serializer ('post' type).
```app/serializers/post.js
import DS from 'ember-data';
export default DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {
attrs: {
author: { embedded: 'always' },
comments: { serialize: 'ids' }
}
});
```
Note that this use of `{ embedded: 'always' }` is unrelated to
the `{ embedded: 'always' }` that is defined as an option on `DS.attr` as part of
defining a model while working with the ActiveModelSerializer. Nevertheless,
using `{ embedded: 'always' }` as an option to DS.attr is not a valid way to setup
embedded records.
The `attrs` option for a resource `{ embedded: 'always' }` is shorthand for:
```js
{
serialize: 'records',
deserialize: 'records'
}
```
### Configuring Attrs
A resource's `attrs` option may be set to use `ids`, `records` or false for the
`serialize` and `deserialize` settings.
The `attrs` property can be set on the ApplicationSerializer or a per-type
serializer.
In the case where embedded JSON is expected while extracting a payload (reading)
the setting is `deserialize: 'records'`, there is no need to use `ids` when
extracting as that is the default behavior without this mixin if you are using
the vanilla EmbeddedRecordsMixin. Likewise, to embed JSON in the payload while
serializing `serialize: 'records'` is the setting to use. There is an option of
not embedding JSON in the serialized payload by using `serialize: 'ids'`. If you
do not want the relationship sent at all, you can use `serialize: false`.
### EmbeddedRecordsMixin defaults
If you do not overwrite `attrs` for a specific relationship, the `EmbeddedRecordsMixin`
will behave in the following way:
BelongsTo: `{ serialize: 'id', deserialize: 'id' }`
HasMany: `{ serialize: false, deserialize: 'ids' }`
### Model Relationships
Embedded records must have a model defined to be extracted and serialized. Note that
when defining any relationships on your model such as `belongsTo` and `hasMany`, you
should not both specify `async:true` and also indicate through the serializer's
`attrs` attribute that the related model should be embedded for deserialization.
If a model is declared embedded for deserialization (`embedded: 'always'`,
`deserialize: 'record'` or `deserialize: 'records'`), then do not use `async:true`.
To successfully extract and serialize embedded records the model relationships
must be setup correcty See the
[defining relationships](/guides/models/defining-models/#toc_defining-relationships)
section of the **Defining Models** guide page.
Records without an `id` property are not considered embedded records, model
instances must have an `id` property to be used with Ember Data.
### Example JSON payloads, Models and Serializers
**When customizing a serializer it is important to grok what the customizations
are. Please read the docs for the methods this mixin provides, in case you need
to modify it to fit your specific needs.**
For example review the docs for each method of this mixin:
* [normalize](/api/data/classes/DS.EmbeddedRecordsMixin.html#method_normalize)
* [serializeBelongsTo](/api/data/classes/DS.EmbeddedRecordsMixin.html#method_serializeBelongsTo)
* [serializeHasMany](/api/data/classes/DS.EmbeddedRecordsMixin.html#method_serializeHasMany)
@class EmbeddedRecordsMixin
@namespace DS
*/
var ember$data$lib$serializers$embedded$records$mixin$$EmbeddedRecordsMixin = Ember.Mixin.create({
/**
Normalize the record and recursively normalize/extract all the embedded records
while pushing them into the store as they are encountered
A payload with an attr configured for embedded records needs to be extracted:
```js
{
"post": {
"id": "1"
"title": "Rails is omakase",
"comments": [{
"id": "1",
"body": "Rails is unagi"
}, {
"id": "2",
"body": "Omakase O_o"
}]
}
}
```
@method normalize
@param {DS.Model} typeClass
@param {Object} hash to be normalized
@param {String} prop the hash has been referenced by
@return {Object} the normalized hash
**/
normalize: function (typeClass, hash, prop) {
var normalizedHash = this._super(typeClass, hash, prop);
return this._extractEmbeddedRecords(this, this.store, typeClass, normalizedHash);
},
keyForRelationship: function (key, typeClass, method) {
if (method === 'serialize' && this.hasSerializeRecordsOption(key) || method === 'deserialize' && this.hasDeserializeRecordsOption(key)) {
return this.keyForAttribute(key, method);
} else {
return this._super(key, typeClass, method) || key;
}
},
/**
Serialize `belongsTo` relationship when it is configured as an embedded object.
This example of an author model belongs to a post model:
```js
Post = DS.Model.extend({
title: DS.attr('string'),
body: DS.attr('string'),
author: DS.belongsTo('author')
});
Author = DS.Model.extend({
name: DS.attr('string'),
post: DS.belongsTo('post')
});
```
Use a custom (type) serializer for the post model to configure embedded author
```app/serializers/post.js
import DS from 'ember-data;
export default DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {
attrs: {
author: { embedded: 'always' }
}
})
```
A payload with an attribute configured for embedded records can serialize
the records together under the root attribute's payload:
```js
{
"post": {
"id": "1"
"title": "Rails is omakase",
"author": {
"id": "2"
"name": "dhh"
}
}
}
```
@method serializeBelongsTo
@param {DS.Snapshot} snapshot
@param {Object} json
@param {Object} relationship
*/
serializeBelongsTo: function (snapshot, json, relationship) {
var attr = relationship.key;
if (this.noSerializeOptionSpecified(attr)) {
this._super(snapshot, json, relationship);
return;
}
var includeIds = this.hasSerializeIdsOption(attr);
var includeRecords = this.hasSerializeRecordsOption(attr);
var embeddedSnapshot = snapshot.belongsTo(attr);
var key;
if (includeIds) {
key = this.keyForRelationship(attr, relationship.kind, 'serialize');
if (!embeddedSnapshot) {
json[key] = null;
} else {
json[key] = embeddedSnapshot.id;
}
} else if (includeRecords) {
key = this.keyForAttribute(attr, 'serialize');
if (!embeddedSnapshot) {
json[key] = null;
} else {
json[key] = embeddedSnapshot.record.serialize({ includeId: true });
this.removeEmbeddedForeignKey(snapshot, embeddedSnapshot, relationship, json[key]);
}
}
},
/**
Serialize `hasMany` relationship when it is configured as embedded objects.
This example of a post model has many comments:
```js
Post = DS.Model.extend({
title: DS.attr('string'),
body: DS.attr('string'),
comments: DS.hasMany('comment')
});
Comment = DS.Model.extend({
body: DS.attr('string'),
post: DS.belongsTo('post')
});
```
Use a custom (type) serializer for the post model to configure embedded comments
```app/serializers/post.js
import DS from 'ember-data;
export default DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {
attrs: {
comments: {embedded: 'always'}
}
})
```
A payload with an attribute configured for embedded records can serialize
the records together under the root attribute's payload:
```js
{
"post": {
"id": "1"
"title": "Rails is omakase",
"body": "I want this for my ORM, I want that for my template language..."
"comments": [{
"id": "1",
"body": "Rails is unagi"
}, {
"id": "2",
"body": "Omakase O_o"
}]
}
}
```
The attrs options object can use more specific instruction for extracting and
serializing. When serializing, an option to embed `ids` or `records` can be set.
When extracting the only option is `records`.
So `{ embedded: 'always' }` is shorthand for:
`{ serialize: 'records', deserialize: 'records' }`
To embed the `ids` for a related object (using a hasMany relationship):
```app/serializers/post.js
import DS from 'ember-data;
export default DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {
attrs: {
comments: { serialize: 'ids', deserialize: 'records' }
}
})
```
```js
{
"post": {
"id": "1"
"title": "Rails is omakase",
"body": "I want this for my ORM, I want that for my template language..."
"comments": ["1", "2"]
}
}
```
@method serializeHasMany
@param {DS.Snapshot} snapshot
@param {Object} json
@param {Object} relationship
*/
serializeHasMany: function (snapshot, json, relationship) {
var attr = relationship.key;
if (this.noSerializeOptionSpecified(attr)) {
this._super(snapshot, json, relationship);
return;
}
var includeIds = this.hasSerializeIdsOption(attr);
var includeRecords = this.hasSerializeRecordsOption(attr);
var key, hasMany;
if (includeIds) {
key = this.keyForRelationship(attr, relationship.kind, 'serialize');
json[key] = snapshot.hasMany(attr, { ids: true });
} else if (includeRecords) {
key = this.keyForAttribute(attr, 'serialize');
hasMany = snapshot.hasMany(attr);
Ember.warn('The embedded relationship \'' + key + '\' is undefined for \'' + snapshot.modelName + '\' with id \'' + snapshot.id + '\'. Please include it in your original payload.', Ember.typeOf(hasMany) !== 'undefined');
json[key] = Ember.A(hasMany).map(function (embeddedSnapshot) {
var embeddedJson = embeddedSnapshot.record.serialize({ includeId: true });
this.removeEmbeddedForeignKey(snapshot, embeddedSnapshot, relationship, embeddedJson);
return embeddedJson;
}, this);
}
},
/**
When serializing an embedded record, modify the property (in the json payload)
that refers to the parent record (foreign key for relationship).
Serializing a `belongsTo` relationship removes the property that refers to the
parent record
Serializing a `hasMany` relationship does not remove the property that refers to
the parent record.
@method removeEmbeddedForeignKey
@param {DS.Snapshot} snapshot
@param {DS.Snapshot} embeddedSnapshot
@param {Object} relationship
@param {Object} json
*/
removeEmbeddedForeignKey: function (snapshot, embeddedSnapshot, relationship, json) {
if (relationship.kind === 'hasMany') {
return;
} else if (relationship.kind === 'belongsTo') {
var parentRecord = snapshot.type.inverseFor(relationship.key, this.store);
if (parentRecord) {
var name = parentRecord.name;
var embeddedSerializer = this.store.serializerFor(embeddedSnapshot.modelName);
var parentKey = embeddedSerializer.keyForRelationship(name, parentRecord.kind, 'deserialize');
if (parentKey) {
delete json[parentKey];
}
}
}
},
// checks config for attrs option to embedded (always) - serialize and deserialize
hasEmbeddedAlwaysOption: function (attr) {
var option = this.attrsOption(attr);
return option && option.embedded === 'always';
},
// checks config for attrs option to serialize ids
hasSerializeRecordsOption: function (attr) {
var alwaysEmbed = this.hasEmbeddedAlwaysOption(attr);
var option = this.attrsOption(attr);
return alwaysEmbed || option && option.serialize === 'records';
},
// checks config for attrs option to serialize records
hasSerializeIdsOption: function (attr) {
var option = this.attrsOption(attr);
return option && (option.serialize === 'ids' || option.serialize === 'id');
},
// checks config for attrs option to serialize records
noSerializeOptionSpecified: function (attr) {
var option = this.attrsOption(attr);
return !(option && (option.serialize || option.embedded));
},
// checks config for attrs option to deserialize records
// a defined option object for a resource is treated the same as
// `deserialize: 'records'`
hasDeserializeRecordsOption: function (attr) {
var alwaysEmbed = this.hasEmbeddedAlwaysOption(attr);
var option = this.attrsOption(attr);
return alwaysEmbed || option && option.deserialize === 'records';
},
attrsOption: function (attr) {
var attrs = this.get('attrs');
return attrs && (attrs[ember$data$lib$serializers$embedded$records$mixin$$camelize(attr)] || attrs[attr]);
},
/**
@method _extractEmbeddedRecords
@private
*/
_extractEmbeddedRecords: function (serializer, store, typeClass, partial) {
if (this.get('isNewSerializerAPI')) {
return ember$data$lib$serializers$embedded$records$mixin$$_newExtractEmbeddedRecords.apply(this, arguments);
}
typeClass.eachRelationship(function (key, relationship) {
if (serializer.hasDeserializeRecordsOption(key)) {
var embeddedTypeClass = store.modelFor(relationship.type);
if (relationship.kind === 'hasMany') {
if (relationship.options.polymorphic) {
this._extractEmbeddedHasManyPolymorphic(store, key, partial);
} else {
this._extractEmbeddedHasMany(store, key, embeddedTypeClass, partial);
}
}
if (relationship.kind === 'belongsTo') {
if (relationship.options.polymorphic) {
this._extractEmbeddedBelongsToPolymorphic(store, key, partial);
} else {
this._extractEmbeddedBelongsTo(store, key, embeddedTypeClass, partial);
}
}
}
}, this);
return partial;
},
/**
@method _extractEmbeddedHasMany
@private
*/
_extractEmbeddedHasMany: function (store, key, embeddedTypeClass, hash) {
if (this.get('isNewSerializerAPI')) {
return ember$data$lib$serializers$embedded$records$mixin$$_newExtractEmbeddedHasMany.apply(this, arguments);
}
if (!hash[key]) {
return hash;
}
var ids = [];
var embeddedSerializer = store.serializerFor(embeddedTypeClass.modelName);
ember$data$lib$serializers$embedded$records$mixin$$forEach.call(hash[key], function (data) {
var embeddedRecord = embeddedSerializer.normalize(embeddedTypeClass, data, null);
store.push(embeddedTypeClass.modelName, embeddedRecord);
ids.push(embeddedRecord.id);
});
hash[key] = ids;
return hash;
},
/**
@method _extractEmbeddedHasManyPolymorphic
@private
*/
_extractEmbeddedHasManyPolymorphic: function (store, key, hash) {
if (!hash[key]) {
return hash;
}
var ids = [];
ember$data$lib$serializers$embedded$records$mixin$$forEach.call(hash[key], function (data) {
var modelName = data.type;
var embeddedSerializer = store.serializerFor(modelName);
var embeddedTypeClass = store.modelFor(modelName);
// var primaryKey = embeddedSerializer.get('primaryKey');
var embeddedRecord = embeddedSerializer.normalize(embeddedTypeClass, data, null);
store.push(embeddedTypeClass.modelName, embeddedRecord);
ids.push({ id: embeddedRecord.id, type: modelName });
});
hash[key] = ids;
return hash;
},
/**
@method _extractEmbeddedBelongsTo
@private
*/
_extractEmbeddedBelongsTo: function (store, key, embeddedTypeClass, hash) {
if (this.get('isNewSerializerAPI')) {
return ember$data$lib$serializers$embedded$records$mixin$$_newExtractEmbeddedBelongsTo.apply(this, arguments);
}
if (!hash[key]) {
return hash;
}
var embeddedSerializer = store.serializerFor(embeddedTypeClass.modelName);
var embeddedRecord = embeddedSerializer.normalize(embeddedTypeClass, hash[key], null);
store.push(embeddedTypeClass.modelName, embeddedRecord);
hash[key] = embeddedRecord.id;
return hash;
},
/**
@method _extractEmbeddedBelongsToPolymorphic
@private
*/
_extractEmbeddedBelongsToPolymorphic: function (store, key, hash) {
if (!hash[key]) {
return hash;
}
var data = hash[key];
var modelName = data.type;
var embeddedSerializer = store.serializerFor(modelName);
var embeddedTypeClass = store.modelFor(modelName);
// var primaryKey = embeddedSerializer.get('primaryKey');
var embeddedRecord = embeddedSerializer.normalize(embeddedTypeClass, data, null);
store.push(embeddedTypeClass.modelName, embeddedRecord);
hash[key] = embeddedRecord.id;
hash[key + 'Type'] = modelName;
return hash;
},
/**
@method _normalizeEmbeddedRelationship
@private
*/
_normalizeEmbeddedRelationship: function (store, relationshipMeta, relationshipHash) {
var modelName = relationshipMeta.type;
if (relationshipMeta.options.polymorphic) {
modelName = relationshipHash.type;
}
var modelClass = store.modelFor(modelName);
var serializer = store.serializerFor(modelName);
return serializer.normalize(modelClass, relationshipHash, null);
}
});
var ember$data$lib$serializers$embedded$records$mixin$$default = ember$data$lib$serializers$embedded$records$mixin$$EmbeddedRecordsMixin;
/*
@method _newExtractEmbeddedRecords
@private
*/
function ember$data$lib$serializers$embedded$records$mixin$$_newExtractEmbeddedRecords(serializer, store, typeClass, partial) {
var _this = this;
typeClass.eachRelationship(function (key, relationship) {
if (serializer.hasDeserializeRecordsOption(key)) {
if (relationship.kind === 'hasMany') {
_this._extractEmbeddedHasMany(store, key, partial, relationship);
}
if (relationship.kind === 'belongsTo') {
_this._extractEmbeddedBelongsTo(store, key, partial, relationship);
}
}
}, this);
return partial;
}
/*
@method _newExtractEmbeddedHasMany
@private
*/
function ember$data$lib$serializers$embedded$records$mixin$$_newExtractEmbeddedHasMany(store, key, hash, relationshipMeta) {
var _this2 = this;
var relationshipHash = ember$data$lib$serializers$embedded$records$mixin$$get(hash, 'data.relationships.' + key + '.data');
if (!relationshipHash) {
return;
}
var hasMany = relationshipHash.map(function (item) {
var _normalizeEmbeddedRelationship = _this2._normalizeEmbeddedRelationship(store, relationshipMeta, item);
var data = _normalizeEmbeddedRelationship.data;
var included = _normalizeEmbeddedRelationship.included;
hash.included = hash.included || [];
hash.included.push(data);
if (included) {
var _hash$included;
(_hash$included = hash.included).push.apply(_hash$included, included);
}
return { id: data.id, type: data.type };
});
var relationship = { data: hasMany };
ember$data$lib$serializers$embedded$records$mixin$$set(hash, 'data.relationships.' + key, relationship);
}
/*
@method _newExtractEmbeddedBelongsTo
@private
*/
function ember$data$lib$serializers$embedded$records$mixin$$_newExtractEmbeddedBelongsTo(store, key, hash, relationshipMeta) {
var relationshipHash = ember$data$lib$serializers$embedded$records$mixin$$get(hash, 'data.relationships.' + key + '.data');
if (!relationshipHash) {
return;
}
var _normalizeEmbeddedRelationship2 = this._normalizeEmbeddedRelationship(store, relationshipMeta, relationshipHash);
var data = _normalizeEmbeddedRelationship2.data;
var included = _normalizeEmbeddedRelationship2.included;
hash.included = hash.included || [];
hash.included.push(data);
if (included) {
var _hash$included2;
(_hash$included2 = hash.included).push.apply(_hash$included2, included);
}
var belongsTo = { id: data.id, type: data.type };
var relationship = { data: belongsTo };
ember$data$lib$serializers$embedded$records$mixin$$set(hash, 'data.relationships.' + key, relationship);
}
/**
`DS.belongsTo` is used to define One-To-One and One-To-Many
relationships on a [DS.Model](/api/data/classes/DS.Model.html).
`DS.belongsTo` takes an optional hash as a second parameter, currently
supported options are:
- `async`: A boolean value used to explicitly declare this to be an async relationship.
- `inverse`: A string used to identify the inverse property on a
related model in a One-To-Many relationship. See [Explicit Inverses](#toc_explicit-inverses)
#### One-To-One
To declare a one-to-one relationship between two models, use
`DS.belongsTo`:
```app/models/user.js
import DS from 'ember-data';
export default DS.Model.extend({
profile: DS.belongsTo('profile')
});
```
```app/models/profile.js
import DS from 'ember-data';
export default DS.Model.extend({
user: DS.belongsTo('user')
});
```
#### One-To-Many
To declare a one-to-many relationship between two models, use
`DS.belongsTo` in combination with `DS.hasMany`, like this:
```app/models/post.js
import DS from 'ember-data';
export default DS.Model.extend({
comments: DS.hasMany('comment')
});
```
```app/models/comment.js
import DS from 'ember-data';
export default DS.Model.extend({
post: DS.belongsTo('post')
});
```
You can avoid passing a string as the first parameter. In that case Ember Data
will infer the type from the key name.
```app/models/comment.js
import DS from 'ember-data';
export default DS.Model.extend({
post: DS.belongsTo()
});
```
will lookup for a Post type.
@namespace
@method belongsTo
@for DS
@param {String} modelName (optional) type of the relationship
@param {Object} options (optional) a hash of options
@return {Ember.computed} relationship
*/
function ember$data$lib$system$relationships$belongs$to$$belongsTo(modelName, options) {
var opts, userEnteredModelName;
if (typeof modelName === "object") {
opts = modelName;
userEnteredModelName = undefined;
} else {
opts = options;
userEnteredModelName = modelName;
}
if (typeof userEnteredModelName === "string") {
userEnteredModelName = ember$data$lib$system$normalize$model$name$$default(userEnteredModelName);
}
Ember.assert("The first argument to DS.belongsTo must be a string representing a model type key, not an instance of " + Ember.inspect(userEnteredModelName) + ". E.g., to define a relation to the Person model, use DS.belongsTo('person')", typeof userEnteredModelName === "string" || typeof userEnteredModelName === "undefined");
opts = opts || {};
var shouldWarnAsync = false;
if (typeof opts.async === "undefined") {
shouldWarnAsync = true;
}
var meta = {
type: userEnteredModelName,
isRelationship: true,
options: opts,
kind: "belongsTo",
key: null,
shouldWarnAsync: shouldWarnAsync
};
return ember$new$computed$lib$main$$default({
get: function (key) {
Ember.warn("You provided a serialize option on the \"" + key + "\" property in the \"" + this._internalModel.modelName + "\" class, this belongs in the serializer. See DS.Serializer and it's implementations http://emberjs.com/api/data/classes/DS.Serializer.html", !opts.hasOwnProperty("serialize"));
Ember.warn("You provided an embedded option on the \"" + key + "\" property in the \"" + this._internalModel.modelName + "\" class, this belongs in the serializer. See DS.EmbeddedRecordsMixin http://emberjs.com/api/data/classes/DS.EmbeddedRecordsMixin.html", !opts.hasOwnProperty("embedded"));
if (meta.shouldWarnAsync) {
Ember.deprecate("In Ember Data 2.0, relationships will be asynchronous by default. You must set `" + key + ": DS.belongsTo('" + modelName + "', { async: false })` if you wish for a relationship remain synchronous.");
meta.shouldWarnAsycn = false;
}
return this._internalModel._relationships.get(key).getRecord();
},
set: function (key, value) {
if (value === undefined) {
value = null;
}
if (value && value.then) {
this._internalModel._relationships.get(key).setRecordPromise(value);
} else if (value) {
this._internalModel._relationships.get(key).setRecord(value._internalModel);
} else {
this._internalModel._relationships.get(key).setRecord(value);
}
return this._internalModel._relationships.get(key).getRecord();
}
}).meta(meta);
}
/*
These observers observe all `belongsTo` relationships on the record. See
`relationships/ext` to see how these observers get their dependencies.
*/
ember$data$lib$system$model$$default.reopen({
notifyBelongsToChanged: function (key) {
this.notifyPropertyChange(key);
}
});
var ember$data$lib$system$relationships$belongs$to$$default = ember$data$lib$system$relationships$belongs$to$$belongsTo;
/**
`DS.hasMany` is used to define One-To-Many and Many-To-Many
relationships on a [DS.Model](/api/data/classes/DS.Model.html).
`DS.hasMany` takes an optional hash as a second parameter, currently
supported options are:
- `async`: A boolean value used to explicitly declare this to be an async relationship.
- `inverse`: A string used to identify the inverse property on a related model.
#### One-To-Many
To declare a one-to-many relationship between two models, use
`DS.belongsTo` in combination with `DS.hasMany`, like this:
```app/models/post.js
import DS from 'ember-data';
export default DS.Model.extend({
comments: DS.hasMany('comment')
});
```
```app/models/comment.js
import DS from 'ember-data';
export default DS.Model.extend({
post: DS.belongsTo('post')
});
```
#### Many-To-Many
To declare a many-to-many relationship between two models, use
`DS.hasMany`:
```app/models/post.js
import DS from 'ember-data';
export default DS.Model.extend({
tags: DS.hasMany('tag')
});
```
```app/models/tag.js
import DS from 'ember-data';
export default DS.Model.extend({
posts: DS.hasMany('post')
});
```
You can avoid passing a string as the first parameter. In that case Ember Data
will infer the type from the singularized key name.
```app/models/post.js
import DS from 'ember-data';
export default DS.Model.extend({
tags: DS.hasMany()
});
```
will lookup for a Tag type.
#### Explicit Inverses
Ember Data will do its best to discover which relationships map to
one another. In the one-to-many code above, for example, Ember Data
can figure out that changing the `comments` relationship should update
the `post` relationship on the inverse because post is the only
relationship to that model.
However, sometimes you may have multiple `belongsTo`/`hasManys` for the
same type. You can specify which property on the related model is
the inverse using `DS.hasMany`'s `inverse` option:
```app/models/comment.js
import DS from 'ember-data';
export default DS.Model.extend({
onePost: DS.belongsTo('post'),
twoPost: DS.belongsTo('post'),
redPost: DS.belongsTo('post'),
bluePost: DS.belongsTo('post')
});
```
```app/models/post.js
import DS from 'ember-data';
export default DS.Model.extend({
comments: DS.hasMany('comment', {
inverse: 'redPost'
})
});
```
You can also specify an inverse on a `belongsTo`, which works how
you'd expect.
@namespace
@method hasMany
@for DS
@param {String} type (optional) type of the relationship
@param {Object} options (optional) a hash of options
@return {Ember.computed} relationship
*/
function ember$data$lib$system$relationships$has$many$$hasMany(type, options) {
if (typeof type === "object") {
options = type;
type = undefined;
}
Ember.assert("The first argument to DS.hasMany must be a string representing a model type key, not an instance of " + Ember.inspect(type) + ". E.g., to define a relation to the Comment model, use DS.hasMany('comment')", typeof type === "string" || typeof type === "undefined");
options = options || {};
var shouldWarnAsync = false;
if (typeof options.async === "undefined") {
shouldWarnAsync = true;
}
if (typeof type === "string") {
type = ember$data$lib$system$normalize$model$name$$default(type);
}
// Metadata about relationships is stored on the meta of
// the relationship. This is used for introspection and
// serialization. Note that `key` is populated lazily
// the first time the CP is called.
var meta = {
type: type,
isRelationship: true,
options: options,
kind: "hasMany",
key: null,
shouldWarnAsync: shouldWarnAsync
};
return ember$new$computed$lib$main$$default({
get: function (key) {
if (meta.shouldWarnAsync) {
Ember.deprecate("In Ember Data 2.0, relationships will be asynchronous by default. You must set `" + key + ": DS.hasMany('" + type + "', { async: false })` if you wish for a relationship remain synchronous.");
meta.shouldWarnAsync = false;
}
var relationship = this._internalModel._relationships.get(key);
return relationship.getRecords();
},
set: function (key, records) {
var relationship = this._internalModel._relationships.get(key);
relationship.clear();
Ember.assert("You must pass an array of records to set a hasMany relationship", Ember.isArray(records));
relationship.addRecords(Ember.A(records).mapBy("_internalModel"));
return relationship.getRecords();
}
}).meta(meta);
}
ember$data$lib$system$model$$default.reopen({
notifyHasManyAdded: function (key) {
//We need to notifyPropertyChange in the adding case because we need to make sure
//we fetch the newly added record in case it is unloaded
//TODO(Igor): Consider whether we could do this only if the record state is unloaded
//Goes away once hasMany is double promisified
this.notifyPropertyChange(key);
}
});
var ember$data$lib$system$relationships$has$many$$default = ember$data$lib$system$relationships$has$many$$hasMany;
function ember$data$lib$system$relationship$meta$$typeForRelationshipMeta(meta) {
var modelName;
modelName = meta.type || meta.key;
if (meta.kind === 'hasMany') {
modelName = ember$inflector$lib$lib$system$string$$singularize(ember$data$lib$system$normalize$model$name$$default(modelName));
}
return modelName;
}
function ember$data$lib$system$relationship$meta$$relationshipFromMeta(meta) {
return {
key: meta.key,
kind: meta.kind,
type: ember$data$lib$system$relationship$meta$$typeForRelationshipMeta(meta),
options: meta.options,
parentType: meta.parentType,
isRelationship: true
};
}
var ember$data$lib$system$relationships$ext$$get = Ember.get;
var ember$data$lib$system$relationships$ext$$filter = Ember.ArrayPolyfills.filter;
var ember$data$lib$system$relationships$ext$$relationshipsDescriptor = Ember.computed(function () {
if (Ember.testing === true && ember$data$lib$system$relationships$ext$$relationshipsDescriptor._cacheable === true) {
ember$data$lib$system$relationships$ext$$relationshipsDescriptor._cacheable = false;
}
var map = new ember$data$lib$system$map$$MapWithDefault({
defaultValue: function () {
return [];
}
});
// Loop through each computed property on the class
this.eachComputedProperty(function (name, meta) {
// If the computed property is a relationship, add
// it to the map.
if (meta.isRelationship) {
meta.key = name;
var relationshipsForType = map.get(ember$data$lib$system$relationship$meta$$typeForRelationshipMeta(meta));
relationshipsForType.push({
name: name,
kind: meta.kind
});
}
});
return map;
}).readOnly();
var ember$data$lib$system$relationships$ext$$relatedTypesDescriptor = Ember.computed(function () {
if (Ember.testing === true && ember$data$lib$system$relationships$ext$$relatedTypesDescriptor._cacheable === true) {
ember$data$lib$system$relationships$ext$$relatedTypesDescriptor._cacheable = false;
}
var modelName;
var types = Ember.A();
// Loop through each computed property on the class,
// and create an array of the unique types involved
// in relationships
this.eachComputedProperty(function (name, meta) {
if (meta.isRelationship) {
meta.key = name;
modelName = ember$data$lib$system$relationship$meta$$typeForRelationshipMeta(meta);
Ember.assert("You specified a hasMany (" + meta.type + ") on " + meta.parentType + " but " + meta.type + " was not found.", modelName);
if (!types.contains(modelName)) {
Ember.assert("Trying to sideload " + name + " on " + this.toString() + " but the type doesn't exist.", !!modelName);
types.push(modelName);
}
}
});
return types;
}).readOnly();
var ember$data$lib$system$relationships$ext$$relationshipsByNameDescriptor = Ember.computed(function () {
if (Ember.testing === true && ember$data$lib$system$relationships$ext$$relationshipsByNameDescriptor._cacheable === true) {
ember$data$lib$system$relationships$ext$$relationshipsByNameDescriptor._cacheable = false;
}
var map = ember$data$lib$system$map$$Map.create();
this.eachComputedProperty(function (name, meta) {
if (meta.isRelationship) {
meta.key = name;
var relationship = ember$data$lib$system$relationship$meta$$relationshipFromMeta(meta);
relationship.type = ember$data$lib$system$relationship$meta$$typeForRelationshipMeta(meta);
map.set(name, relationship);
}
});
return map;
}).readOnly();
/**
@module ember-data
*/
/*
This file defines several extensions to the base `DS.Model` class that
add support for one-to-many relationships.
*/
/**
@class Model
@namespace DS
*/
ember$data$lib$system$model$$default.reopen({
/**
This Ember.js hook allows an object to be notified when a property
is defined.
In this case, we use it to be notified when an Ember Data user defines a
belongs-to relationship. In that case, we need to set up observers for
each one, allowing us to track relationship changes and automatically
reflect changes in the inverse has-many array.
This hook passes the class being set up, as well as the key and value
being defined. So, for example, when the user does this:
```javascript
DS.Model.extend({
parent: DS.belongsTo('user')
});
```
This hook would be called with "parent" as the key and the computed
property returned by `DS.belongsTo` as the value.
@method didDefineProperty
@param {Object} proto
@param {String} key
@param {Ember.ComputedProperty} value
*/
didDefineProperty: function (proto, key, value) {
// Check if the value being set is a computed property.
if (value instanceof Ember.ComputedProperty) {
// If it is, get the metadata for the relationship. This is
// populated by the `DS.belongsTo` helper when it is creating
// the computed property.
var meta = value.meta();
meta.parentType = proto.constructor;
}
}
});
/*
These DS.Model extensions add class methods that provide relationship
introspection abilities about relationships.
A note about the computed properties contained here:
**These properties are effectively sealed once called for the first time.**
To avoid repeatedly doing expensive iteration over a model's fields, these
values are computed once and then cached for the remainder of the runtime of
your application.
If your application needs to modify a class after its initial definition
(for example, using `reopen()` to add additional attributes), make sure you
do it before using your model with the store, which uses these properties
extensively.
*/
ember$data$lib$system$model$$default.reopenClass({
/**
For a given relationship name, returns the model type of the relationship.
For example, if you define a model like this:
```app/models/post.js
import DS from 'ember-data';
export default DS.Model.extend({
comments: DS.hasMany('comment')
});
```
Calling `App.Post.typeForRelationship('comments')` will return `App.Comment`.
@method typeForRelationship
@static
@param {String} name the name of the relationship
@param {store} store an instance of DS.Store
@return {DS.Model} the type of the relationship, or undefined
*/
typeForRelationship: function (name, store) {
var relationship = ember$data$lib$system$relationships$ext$$get(this, "relationshipsByName").get(name);
return relationship && store.modelFor(relationship.type);
},
inverseMap: Ember.computed(function () {
return Ember.create(null);
}),
/**
Find the relationship which is the inverse of the one asked for.
For example, if you define models like this:
```app/models/post.js
import DS from 'ember-data';
export default DS.Model.extend({
comments: DS.hasMany('message')
});
```
```app/models/message.js
import DS from 'ember-data';
export default DS.Model.extend({
owner: DS.belongsTo('post')
});
```
App.Post.inverseFor('comments') -> { type: App.Message, name: 'owner', kind: 'belongsTo' }
App.Message.inverseFor('owner') -> { type: App.Post, name: 'comments', kind: 'hasMany' }
@method inverseFor
@static
@param {String} name the name of the relationship
@return {Object} the inverse relationship, or null
*/
inverseFor: function (name, store) {
var inverseMap = ember$data$lib$system$relationships$ext$$get(this, "inverseMap");
if (inverseMap[name]) {
return inverseMap[name];
} else {
var inverse = this._findInverseFor(name, store);
inverseMap[name] = inverse;
return inverse;
}
},
//Calculate the inverse, ignoring the cache
_findInverseFor: function (name, store) {
var inverseType = this.typeForRelationship(name, store);
if (!inverseType) {
return null;
}
var propertyMeta = this.metaForProperty(name);
//If inverse is manually specified to be null, like `comments: DS.hasMany('message', { inverse: null })`
var options = propertyMeta.options;
if (options.inverse === null) {
return null;
}
var inverseName, inverseKind, inverse;
Ember.warn("Detected a reflexive relationship by the name of '" + name + "' without an inverse option. Look at http://emberjs.com/guides/models/defining-models/#toc_reflexive-relation for how to explicitly specify inverses.", options.inverse || propertyMeta.type !== propertyMeta.parentType.modelName);
//If inverse is specified manually, return the inverse
if (options.inverse) {
inverseName = options.inverse;
inverse = Ember.get(inverseType, "relationshipsByName").get(inverseName);
Ember.assert("We found no inverse relationships by the name of '" + inverseName + "' on the '" + inverseType.modelName + "' model. This is most likely due to a missing attribute on your model definition.", !Ember.isNone(inverse));
inverseKind = inverse.kind;
} else {
//No inverse was specified manually, we need to use a heuristic to guess one
var possibleRelationships = findPossibleInverses(this, inverseType);
if (possibleRelationships.length === 0) {
return null;
}
var filteredRelationships = ember$data$lib$system$relationships$ext$$filter.call(possibleRelationships, function (possibleRelationship) {
var optionsForRelationship = inverseType.metaForProperty(possibleRelationship.name).options;
return name === optionsForRelationship.inverse;
});
Ember.assert("You defined the '" + name + "' relationship on " + this + ", but you defined the inverse relationships of type " + inverseType.toString() + " multiple times. Look at http://emberjs.com/guides/models/defining-models/#toc_explicit-inverses for how to explicitly specify inverses", filteredRelationships.length < 2);
if (filteredRelationships.length === 1) {
possibleRelationships = filteredRelationships;
}
Ember.assert("You defined the '" + name + "' relationship on " + this + ", but multiple possible inverse relationships of type " + this + " were found on " + inverseType + ". Look at http://emberjs.com/guides/models/defining-models/#toc_explicit-inverses for how to explicitly specify inverses", possibleRelationships.length === 1);
inverseName = possibleRelationships[0].name;
inverseKind = possibleRelationships[0].kind;
}
function findPossibleInverses(type, inverseType, relationshipsSoFar) {
var possibleRelationships = relationshipsSoFar || [];
var relationshipMap = ember$data$lib$system$relationships$ext$$get(inverseType, "relationships");
if (!relationshipMap) {
return possibleRelationships;
}
var relationships = relationshipMap.get(type.modelName);
relationships = ember$data$lib$system$relationships$ext$$filter.call(relationships, function (relationship) {
var optionsForRelationship = inverseType.metaForProperty(relationship.name).options;
if (!optionsForRelationship.inverse) {
return true;
}
return name === optionsForRelationship.inverse;
});
if (relationships) {
possibleRelationships.push.apply(possibleRelationships, relationships);
}
//Recurse to support polymorphism
if (type.superclass) {
findPossibleInverses(type.superclass, inverseType, possibleRelationships);
}
return possibleRelationships;
}
return {
type: inverseType,
name: inverseName,
kind: inverseKind
};
},
/**
The model's relationships as a map, keyed on the type of the
relationship. The value of each entry is an array containing a descriptor
for each relationship with that type, describing the name of the relationship
as well as the type.
For example, given the following model definition:
```app/models/blog.js
import DS from 'ember-data';
export default DS.Model.extend({
users: DS.hasMany('user'),
owner: DS.belongsTo('user'),
posts: DS.hasMany('post')
});
```
This computed property would return a map describing these
relationships, like this:
```javascript
import Ember from 'ember';
import Blog from 'app/models/blog';
var relationships = Ember.get(Blog, 'relationships');
relationships.get(App.User);
//=> [ { name: 'users', kind: 'hasMany' },
// { name: 'owner', kind: 'belongsTo' } ]
relationships.get(App.Post);
//=> [ { name: 'posts', kind: 'hasMany' } ]
```
@property relationships
@static
@type Ember.Map
@readOnly
*/
relationships: ember$data$lib$system$relationships$ext$$relationshipsDescriptor,
/**
A hash containing lists of the model's relationships, grouped
by the relationship kind. For example, given a model with this
definition:
```app/models/blog.js
import DS from 'ember-data';
export default DS.Model.extend({
users: DS.hasMany('user'),
owner: DS.belongsTo('user'),
posts: DS.hasMany('post')
});
```
This property would contain the following:
```javascript
import Ember from 'ember';
import Blog from 'app/models/blog';
var relationshipNames = Ember.get(Blog, 'relationshipNames');
relationshipNames.hasMany;
//=> ['users', 'posts']
relationshipNames.belongsTo;
//=> ['owner']
```
@property relationshipNames
@static
@type Object
@readOnly
*/
relationshipNames: Ember.computed(function () {
var names = {
hasMany: [],
belongsTo: []
};
this.eachComputedProperty(function (name, meta) {
if (meta.isRelationship) {
names[meta.kind].push(name);
}
});
return names;
}),
/**
An array of types directly related to a model. Each type will be
included once, regardless of the number of relationships it has with
the model.
For example, given a model with this definition:
```app/models/blog.js
import DS from 'ember-data';
export default DS.Model.extend({
users: DS.hasMany('user'),
owner: DS.belongsTo('user'),
posts: DS.hasMany('post')
});
```
This property would contain the following:
```javascript
import Ember from 'ember';
import Blog from 'app/models/blog';
var relatedTypes = Ember.get(Blog, 'relatedTypes');
//=> [ App.User, App.Post ]
```
@property relatedTypes
@static
@type Ember.Array
@readOnly
*/
relatedTypes: ember$data$lib$system$relationships$ext$$relatedTypesDescriptor,
/**
A map whose keys are the relationships of a model and whose values are
relationship descriptors.
For example, given a model with this
definition:
```app/models/blog.js
import DS from 'ember-data';
export default DS.Model.extend({
users: DS.hasMany('user'),
owner: DS.belongsTo('user'),
posts: DS.hasMany('post')
});
```
This property would contain the following:
```javascript
import Ember from 'ember';
import Blog from 'app/models/blog';
var relationshipsByName = Ember.get(Blog, 'relationshipsByName');
relationshipsByName.get('users');
//=> { key: 'users', kind: 'hasMany', type: App.User }
relationshipsByName.get('owner');
//=> { key: 'owner', kind: 'belongsTo', type: App.User }
```
@property relationshipsByName
@static
@type Ember.Map
@readOnly
*/
relationshipsByName: ember$data$lib$system$relationships$ext$$relationshipsByNameDescriptor,
/**
A map whose keys are the fields of the model and whose values are strings
describing the kind of the field. A model's fields are the union of all of its
attributes and relationships.
For example:
```app/models/blog.js
import DS from 'ember-data';
export default DS.Model.extend({
users: DS.hasMany('user'),
owner: DS.belongsTo('user'),
posts: DS.hasMany('post'),
title: DS.attr('string')
});
```
```js
import Ember from 'ember';
import Blog from 'app/models/blog';
var fields = Ember.get(Blog, 'fields');
fields.forEach(function(kind, field) {
console.log(field, kind);
});
// prints:
// users, hasMany
// owner, belongsTo
// posts, hasMany
// title, attribute
```
@property fields
@static
@type Ember.Map
@readOnly
*/
fields: Ember.computed(function () {
var map = ember$data$lib$system$map$$Map.create();
this.eachComputedProperty(function (name, meta) {
if (meta.isRelationship) {
map.set(name, meta.kind);
} else if (meta.isAttribute) {
map.set(name, "attribute");
}
});
return map;
}).readOnly(),
/**
Given a callback, iterates over each of the relationships in the model,
invoking the callback with the name of each relationship and its relationship
descriptor.
@method eachRelationship
@static
@param {Function} callback the callback to invoke
@param {any} binding the value to which the callback's `this` should be bound
*/
eachRelationship: function (callback, binding) {
ember$data$lib$system$relationships$ext$$get(this, "relationshipsByName").forEach(function (relationship, name) {
callback.call(binding, name, relationship);
});
},
/**
Given a callback, iterates over each of the types related to a model,
invoking the callback with the related type's class. Each type will be
returned just once, regardless of how many different relationships it has
with a model.
@method eachRelatedType
@static
@param {Function} callback the callback to invoke
@param {any} binding the value to which the callback's `this` should be bound
*/
eachRelatedType: function (callback, binding) {
ember$data$lib$system$relationships$ext$$get(this, "relatedTypes").forEach(function (type) {
callback.call(binding, type);
});
},
determineRelationshipType: function (knownSide, store) {
var knownKey = knownSide.key;
var knownKind = knownSide.kind;
var inverse = this.inverseFor(knownKey, store);
var key, otherKind;
if (!inverse) {
return knownKind === "belongsTo" ? "oneToNone" : "manyToNone";
}
key = inverse.name;
otherKind = inverse.kind;
if (otherKind === "belongsTo") {
return knownKind === "belongsTo" ? "oneToOne" : "manyToOne";
} else {
return knownKind === "belongsTo" ? "oneToMany" : "manyToMany";
}
}
});
ember$data$lib$system$model$$default.reopen({
/**
Given a callback, iterates over each of the relationships in the model,
invoking the callback with the name of each relationship and its relationship
descriptor.
The callback method you provide should have the following signature (all
parameters are optional):
```javascript
function(name, descriptor);
```
- `name` the name of the current property in the iteration
- `descriptor` the meta object that describes this relationship
The relationship descriptor argument is an object with the following properties.
- **key** <span class="type">String</span> the name of this relationship on the Model
- **kind** <span class="type">String</span> "hasMany" or "belongsTo"
- **options** <span class="type">Object</span> the original options hash passed when the relationship was declared
- **parentType** <span class="type">DS.Model</span> the type of the Model that owns this relationship
- **type** <span class="type">DS.Model</span> the type of the related Model
Note that in addition to a callback, you can also pass an optional target
object that will be set as `this` on the context.
Example
```app/serializers/application.js
import DS from 'ember-data';
export default DS.JSONSerializer.extend({
serialize: function(record, options) {
var json = {};
record.eachRelationship(function(name, descriptor) {
if (descriptor.kind === 'hasMany') {
var serializedHasManyName = name.toUpperCase() + '_IDS';
json[name.toUpperCase()] = record.get(name).mapBy('id');
}
});
return json;
}
});
```
@method eachRelationship
@param {Function} callback the callback to invoke
@param {any} binding the value to which the callback's `this` should be bound
*/
eachRelationship: function (callback, binding) {
this.constructor.eachRelationship(callback, binding);
},
relationshipFor: function (name) {
return ember$data$lib$system$relationships$ext$$get(this.constructor, "relationshipsByName").get(name);
},
inverseFor: function (key) {
return this.constructor.inverseFor(key, this.store);
}
});
/**
Ember Data
@module ember-data
@main ember-data
*/
if (Ember.VERSION.match(/^1\.[0-7]\./)) {
throw new Ember.Error("Ember Data requires at least Ember 1.8.0, but you have " + Ember.VERSION + ". Please upgrade your version of Ember, then upgrade Ember Data");
}
if (Ember.VERSION.match(/^1\.12\.0/)) {
throw new Ember.Error("Ember Data does not work with Ember 1.12.0. Please upgrade to Ember 1.12.1 or higher.");
}
// support RSVP 2.x via resolve, but prefer RSVP 3.x's Promise.cast
Ember.RSVP.Promise.cast = Ember.RSVP.Promise.cast || Ember.RSVP.resolve;ember$data$lib$core$$default.Store = ember$data$lib$system$store$$Store;
ember$data$lib$core$$default.PromiseArray = ember$data$lib$system$promise$proxies$$PromiseArray;
ember$data$lib$core$$default.PromiseObject = ember$data$lib$system$promise$proxies$$PromiseObject;
ember$data$lib$core$$default.PromiseManyArray = ember$data$lib$system$promise$proxies$$PromiseManyArray;
ember$data$lib$core$$default.Model = ember$data$lib$system$model$$default;
ember$data$lib$core$$default.RootState = ember$data$lib$system$model$states$$default;
ember$data$lib$core$$default.attr = ember$data$lib$system$model$attributes$$default;
ember$data$lib$core$$default.Errors = ember$data$lib$system$model$errors$$default;
ember$data$lib$core$$default.InternalModel = ember$data$lib$system$model$internal$model$$default;
ember$data$lib$core$$default.Snapshot = ember$data$lib$system$snapshot$$default;
ember$data$lib$core$$default.Adapter = ember$data$lib$system$adapter$$default;
ember$data$lib$core$$default.AdapterError = ember$data$lib$adapters$errors$$AdapterError;
ember$data$lib$core$$default.InvalidError = ember$data$lib$adapters$errors$$InvalidError;
ember$data$lib$core$$default.TimeoutError = ember$data$lib$adapters$errors$$TimeoutError;
ember$data$lib$core$$default.AbortError = ember$data$lib$adapters$errors$$AbortError;
ember$data$lib$core$$default.errorsHashToArray = ember$data$lib$adapters$errors$$errorsHashToArray;
ember$data$lib$core$$default.errorsArrayToHash = ember$data$lib$adapters$errors$$errorsArrayToHash;
ember$data$lib$core$$default.Serializer = ember$data$lib$system$serializer$$default;
ember$data$lib$core$$default.DebugAdapter = ember$data$lib$system$debug$$default;
ember$data$lib$core$$default.RecordArray = ember$data$lib$system$record$arrays$record$array$$default;
ember$data$lib$core$$default.FilteredRecordArray = ember$data$lib$system$record$arrays$filtered$record$array$$default;
ember$data$lib$core$$default.AdapterPopulatedRecordArray = ember$data$lib$system$record$arrays$adapter$populated$record$array$$default;
ember$data$lib$core$$default.ManyArray = ember$data$lib$system$many$array$$default;
ember$data$lib$core$$default.RecordArrayManager = ember$data$lib$system$record$array$manager$$default;
ember$data$lib$core$$default.RESTAdapter = ember$data$lib$adapters$rest$adapter$$default;
ember$data$lib$core$$default.BuildURLMixin = ember$data$lib$adapters$build$url$mixin$$default;
ember$data$lib$core$$default.RESTSerializer = ember$data$lib$serializers$rest$serializer$$default;
ember$data$lib$core$$default.JSONSerializer = ember$data$lib$serializers$json$serializer$$default;
ember$data$lib$core$$default.JSONAPIAdapter = ember$data$lib$adapters$json$api$adapter$$default;
ember$data$lib$core$$default.JSONAPISerializer = ember$data$lib$serializers$json$api$serializer$$default;
ember$data$lib$core$$default.Transform = ember$data$lib$transforms$base$$default;
ember$data$lib$core$$default.DateTransform = ember$data$lib$transforms$date$$default;
ember$data$lib$core$$default.StringTransform = ember$data$lib$transforms$string$$default;
ember$data$lib$core$$default.NumberTransform = ember$data$lib$transforms$number$$default;
ember$data$lib$core$$default.BooleanTransform = ember$data$lib$transforms$boolean$$default;
var ember$data$lib$main$$_ActiveModelAdapter = activemodel$adapter$lib$system$active$model$adapter$$default;
var ember$data$lib$main$$_ActiveModelSerializer = activemodel$adapter$lib$system$active$model$serializer$$default;
if (Ember.platform.hasPropertyAccessors) {
Ember.defineProperty(ember$data$lib$core$$default, "ActiveModelAdapter", {
get: function () {
if (ember$data$lib$main$$_ActiveModelSerializer === activemodel$adapter$lib$system$active$model$adapter$$default) {
Ember.deprecate("The ActiveModelAdapter has been moved into a plugin. It will not be bundled with Ember Data in 2.0", false, {
url: "https://github.com/ember-data/active-model-adapter"
});
}
return ember$data$lib$main$$_ActiveModelAdapter;
},
set: function (ActiveModelAdapter) {
ember$data$lib$main$$_ActiveModelAdapter = ActiveModelAdapter;
}
});
Ember.defineProperty(ember$data$lib$core$$default, "ActiveModelSerializer", {
get: function () {
if (ember$data$lib$main$$_ActiveModelSerializer === activemodel$adapter$lib$system$active$model$serializer$$default) {
Ember.deprecate("The ActiveModelSerializer has been moved into a plugin. It will not be bundled with Ember Data in 2.0", false, {
url: "https://github.com/ember-data/active-model-adapter"
});
}
return ember$data$lib$main$$_ActiveModelSerializer;
},
set: function (ActiveModelSerializer) {
ember$data$lib$main$$_ActiveModelSerializer = ActiveModelSerializer;
}
});
} else {
ember$data$lib$core$$default.ActiveModelAdapter = activemodel$adapter$lib$system$active$model$adapter$$default;
ember$data$lib$core$$default.ActiveModelSerializer = activemodel$adapter$lib$system$active$model$serializer$$default;
}
ember$data$lib$core$$default.EmbeddedRecordsMixin = ember$data$lib$serializers$embedded$records$mixin$$default;
ember$data$lib$core$$default.belongsTo = ember$data$lib$system$relationships$belongs$to$$default;
ember$data$lib$core$$default.hasMany = ember$data$lib$system$relationships$has$many$$default;
ember$data$lib$core$$default.Relationship = ember$data$lib$system$relationships$state$relationship$$default;
ember$data$lib$core$$default.ContainerProxy = ember$data$lib$system$container$proxy$$default;
ember$data$lib$core$$default._setupContainer = ember$data$lib$setup$container$$default;
Ember.defineProperty(ember$data$lib$core$$default, "normalizeModelName", {
enumerable: true,
writable: false,
configurable: false,
value: ember$data$lib$system$normalize$model$name$$default
});
var ember$data$lib$main$$_FixtureAdapter = ember$data$lib$adapters$fixture$adapter$$default;
if (Ember.platform.hasPropertyAccessors) {
Ember.defineProperty(ember$data$lib$core$$default, "FixtureAdapter", {
get: function () {
if (ember$data$lib$main$$_FixtureAdapter === ember$data$lib$adapters$fixture$adapter$$default) {
Ember.deprecate("DS.FixtureAdapter has been deprecated and moved into an unsupported addon: https://github.com/emberjs/ember-data-fixture-adapter/tree/master");
}
return ember$data$lib$main$$_FixtureAdapter;
},
set: function (FixtureAdapter) {
ember$data$lib$main$$_FixtureAdapter = FixtureAdapter;
}
});
} else {
ember$data$lib$core$$default.FixtureAdapter = ember$data$lib$adapters$fixture$adapter$$default;
}
Ember.lookup.DS = ember$data$lib$core$$default;
var ember$data$lib$main$$default = ember$data$lib$core$$default;
}).call(this);
//# sourceMappingURL=ember-data.js.map
|
ajax/libs/material-ui/4.9.8/Select/SelectInput.min.js
|
cdnjs/cdnjs
|
"use strict";var _interopRequireWildcard=require("@babel/runtime/helpers/interopRequireWildcard"),_interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends")),_toConsumableArray2=_interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")),_slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")),_objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties")),_typeof2=_interopRequireDefault(require("@babel/runtime/helpers/typeof")),React=_interopRequireWildcard(require("react")),_reactIs=require("react-is"),_propTypes=_interopRequireDefault(require("prop-types")),_clsx=_interopRequireDefault(require("clsx")),_capitalize=_interopRequireDefault(require("../utils/capitalize")),_utils=require("@material-ui/utils"),_Menu=_interopRequireDefault(require("../Menu/Menu")),_utils2=require("../InputBase/utils"),_useForkRef=_interopRequireDefault(require("../utils/useForkRef")),_useControlled3=_interopRequireDefault(require("../utils/useControlled"));function areEqualValues(e,t){return"object"===(0,_typeof2.default)(t)&&null!==t?e===t:String(e)===String(t)}function isEmpty(e){return null==e||"string"==typeof e&&!e.trim()}var SelectInput=React.forwardRef(function(e,t){var r=e.autoFocus,a=e.autoWidth,l=e.children,n=e.classes,o=e.className,u=e.defaultValue,p=e.disabled,i=e.displayEmpty,s=e.IconComponent,c=e.inputRef,d=e.labelId,f=e.MenuProps,y=void 0===f?{}:f,_=e.multiple,v=e.name,m=e.onBlur,b=e.onChange,R=e.onClose,h=e.onFocus,q=e.onOpen,T=e.open,E=e.readOnly,D=e.renderValue,x=(e.required,e.SelectDisplayProps),I=void 0===x?{}:x,P=e.tabIndex,C=(e.type,e.value),g=e.variant,O=void 0===g?"standard":g,M=(0,_objectWithoutProperties2.default)(e,["autoFocus","autoWidth","children","classes","className","defaultValue","disabled","displayEmpty","IconComponent","inputRef","labelId","MenuProps","multiple","name","onBlur","onChange","onClose","onFocus","onOpen","open","readOnly","renderValue","required","SelectDisplayProps","tabIndex","type","value","variant"]),j=(0,_useControlled3.default)({controlled:C,default:u,name:"SelectInput"}),A=(0,_slicedToArray2.default)(j,2),F=A[0],S=A[1],w=React.useRef(null),V=React.useState(null),W=V[0],N=V[1],k=React.useRef(null!=T).current,U=React.useState(),B=U[0],L=U[1],z=React.useState(!1),K=z[0],H=z[1],G=(0,_useForkRef.default)(t,c);React.useImperativeHandle(G,function(){return{focus:function(){W.focus()},node:w.current,value:F}},[W,F]),React.useEffect(function(){r&&W&&W.focus()},[r,W]);function J(e,t){e?q&&q(t):R&&R(t),k||(L(a?null:W.clientWidth),H(e))}var Q,X,Y=null!==W&&(k?T:K);delete M["aria-invalid"];var Z=[],$=!1,ee=!1;((0,_utils2.isFilled)({value:F})||i)&&(D?Q=D(F):$=!0);var te=React.Children.map(l,function(r){if(!React.isValidElement(r))return null;var e,a;if("production"!==process.env.NODE_ENV&&(0,_reactIs.isFragment)(r)&&console.error(["Material-UI: the Select component doesn't accept a Fragment as a child.","Consider providing an array instead."].join("\n")),_){if(!Array.isArray(F))throw new Error("Material-UI: the `value` prop must be an array when using the `Select` component with `multiple`.");(e=F.some(function(e){return areEqualValues(e,r.props.value)}))&&$&&Z.push(r.props.children)}else(e=areEqualValues(F,r.props.value))&&$&&(X=r.props.children);return e&&(ee=!0),React.cloneElement(r,{"aria-selected":e?"true":void 0,onClick:function(e){var t;if(_||J(!1,e),_){t=Array.isArray(F)?(0,_toConsumableArray2.default)(F):[];var r=F.indexOf(a.props.value);-1===r?t.push(a.props.value):t.splice(r,1)}else t=a.props.value;S(t),b&&(e.persist(),Object.defineProperty(e,"target",{writable:!0,value:{value:t,name:v}}),b(e,a))},onKeyUp:function(e){" "===e.key&&e.preventDefault();var t=r.props.onKeyUp;"function"==typeof t&&t(e)},role:"option",selected:e,value:void 0,"data-value":(a=r).props.value})});"production"!==process.env.NODE_ENV&&React.useEffect(function(){if(!ee&&!_&&""!==F){var e=React.Children.toArray(l).map(function(e){return e.props.value});console.warn(["Material-UI: you have provided an out-of-range value `".concat(F,"` for the select ").concat(v?'(name="'.concat(v,'") '):"","component."),"Consider providing a value that matches one of the available options or ''.","The available values are ".concat(e.filter(function(e){return null!=e}).map(function(e){return"`".concat(e,"`")}).join(", ")||'""',".")].join("\n"))}},[ee,l,_,v,F]),$&&(Q=_?Z.join(", "):X);var re,ae=B;!a&&k&&W&&(ae=W.clientWidth),re=void 0!==P?P:p?null:0;var le=I.id||(v?"mui-component-select-".concat(v):void 0);return React.createElement(React.Fragment,null,React.createElement("div",(0,_extends2.default)({className:(0,_clsx.default)(n.root,n.select,n.selectMenu,n[O],o,p&&n.disabled),ref:N,tabIndex:re,role:"button","aria-expanded":Y?"true":void 0,"aria-labelledby":"".concat(d||""," ").concat(le||""),"aria-haspopup":"listbox",onKeyDown:function(e){if(!E){-1!==[" ","ArrowUp","ArrowDown","Enter"].indexOf(e.key)&&(e.preventDefault(),J(!0,e))}},onMouseDown:p||E?null:function(e){0===e.button&&(e.preventDefault(),W.focus(),J(!0,e))},onBlur:function(e){!Y&&m&&(e.persist(),Object.defineProperty(e,"target",{writable:!0,value:{value:F,name:v}}),m(e))},onFocus:h},I,{id:le}),isEmpty(Q)?React.createElement("span",{dangerouslySetInnerHTML:{__html:"​"}}):Q),React.createElement("input",(0,_extends2.default)({value:Array.isArray(F)?F.join(","):F,name:v,ref:w,type:"hidden",autoFocus:r},M)),React.createElement(s,{className:(0,_clsx.default)(n.icon,n["icon".concat((0,_capitalize.default)(O))],Y&&n.iconOpen,p&&n.disabled)}),React.createElement(_Menu.default,(0,_extends2.default)({id:"menu-".concat(v||""),anchorEl:W,open:Y,onClose:function(e){J(!1,e)}},y,{MenuListProps:(0,_extends2.default)({"aria-labelledby":d,role:"listbox",disableListWrap:!0},y.MenuListProps),PaperProps:(0,_extends2.default)({},y.PaperProps,{style:(0,_extends2.default)({minWidth:ae},null!=y.PaperProps?y.PaperProps.style:null)})}),te))});"production"!==process.env.NODE_ENV&&(SelectInput.propTypes={autoFocus:_propTypes.default.bool,autoWidth:_propTypes.default.bool,children:_propTypes.default.node,classes:_propTypes.default.object.isRequired,className:_propTypes.default.string,defaultValue:_propTypes.default.any,disabled:_propTypes.default.bool,displayEmpty:_propTypes.default.bool,IconComponent:_propTypes.default.elementType.isRequired,inputRef:_utils.refType,labelId:_propTypes.default.string,MenuProps:_propTypes.default.object,multiple:_propTypes.default.bool,name:_propTypes.default.string,onBlur:_propTypes.default.func,onChange:_propTypes.default.func,onClose:_propTypes.default.func,onFocus:_propTypes.default.func,onOpen:_propTypes.default.func,open:_propTypes.default.bool,readOnly:_propTypes.default.bool,renderValue:_propTypes.default.func,required:_propTypes.default.bool,SelectDisplayProps:_propTypes.default.object,tabIndex:_propTypes.default.oneOfType([_propTypes.default.number,_propTypes.default.string]),type:_propTypes.default.any,value:_propTypes.default.any,variant:_propTypes.default.oneOf(["standard","outlined","filled"])});var _default=SelectInput;exports.default=_default;
|
app/javascript/mastodon/features/compose/components/compose_form.js
|
tateisu/mastodon
|
import React from 'react';
import CharacterCounter from './character_counter';
import Button from '../../../components/button';
import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types';
import ReplyIndicatorContainer from '../containers/reply_indicator_container';
import AutosuggestTextarea from '../../../components/autosuggest_textarea';
import AutosuggestInput from '../../../components/autosuggest_input';
import PollButtonContainer from '../containers/poll_button_container';
import UploadButtonContainer from '../containers/upload_button_container';
import { defineMessages, injectIntl } from 'react-intl';
import SpoilerButtonContainer from '../containers/spoiler_button_container';
import PrivacyDropdownContainer from '../containers/privacy_dropdown_container';
import EmojiPickerDropdown from '../containers/emoji_picker_dropdown_container';
import PollFormContainer from '../containers/poll_form_container';
import UploadFormContainer from '../containers/upload_form_container';
import WarningContainer from '../containers/warning_container';
import { isMobile } from '../../../is_mobile';
import ImmutablePureComponent from 'react-immutable-pure-component';
import { length } from 'stringz';
import { countableText } from '../util/counter';
import Icon from 'mastodon/components/icon';
const allowedAroundShortCode = '><\u0085\u0020\u00a0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029\u0009\u000a\u000b\u000c\u000d';
const messages = defineMessages({
placeholder: { id: 'compose_form.placeholder', defaultMessage: 'What is on your mind?' },
spoiler_placeholder: { id: 'compose_form.spoiler_placeholder', defaultMessage: 'Write your warning here' },
publish: { id: 'compose_form.publish', defaultMessage: 'Toot' },
publishLoud: { id: 'compose_form.publish_loud', defaultMessage: '{publish}!' },
});
export default @injectIntl
class ComposeForm extends ImmutablePureComponent {
static contextTypes = {
router: PropTypes.object,
};
static propTypes = {
intl: PropTypes.object.isRequired,
text: PropTypes.string.isRequired,
suggestions: ImmutablePropTypes.list,
spoiler: PropTypes.bool,
privacy: PropTypes.string,
spoilerText: PropTypes.string,
focusDate: PropTypes.instanceOf(Date),
caretPosition: PropTypes.number,
preselectDate: PropTypes.instanceOf(Date),
isSubmitting: PropTypes.bool,
isChangingUpload: PropTypes.bool,
isUploading: PropTypes.bool,
onChange: PropTypes.func.isRequired,
onSubmit: PropTypes.func.isRequired,
onClearSuggestions: PropTypes.func.isRequired,
onFetchSuggestions: PropTypes.func.isRequired,
onSuggestionSelected: PropTypes.func.isRequired,
onChangeSpoilerText: PropTypes.func.isRequired,
onPaste: PropTypes.func.isRequired,
onPickEmoji: PropTypes.func.isRequired,
showSearch: PropTypes.bool,
anyMedia: PropTypes.bool,
singleColumn: PropTypes.bool,
};
static defaultProps = {
showSearch: false,
};
handleChange = (e) => {
this.props.onChange(e.target.value);
}
handleKeyDown = (e) => {
if (e.keyCode === 13 && (e.ctrlKey || e.metaKey)) {
this.handleSubmit();
}
}
handleSubmit = () => {
if (this.props.text !== this.autosuggestTextarea.textarea.value) {
// Something changed the text inside the textarea (e.g. browser extensions like Grammarly)
// Update the state to match the current text
this.props.onChange(this.autosuggestTextarea.textarea.value);
}
// Submit disabled:
const { isSubmitting, isChangingUpload, isUploading, anyMedia } = this.props;
const fulltext = [this.props.spoilerText, countableText(this.props.text)].join('');
if (isSubmitting || isUploading || isChangingUpload || length(fulltext) > 500 || (fulltext.length !== 0 && fulltext.trim().length === 0 && !anyMedia)) {
return;
}
this.props.onSubmit(this.context.router ? this.context.router.history : null);
}
onSuggestionsClearRequested = () => {
this.props.onClearSuggestions();
}
onSuggestionsFetchRequested = (token) => {
this.props.onFetchSuggestions(token);
}
onSuggestionSelected = (tokenStart, token, value) => {
this.props.onSuggestionSelected(tokenStart, token, value, ['text']);
}
onSpoilerSuggestionSelected = (tokenStart, token, value) => {
this.props.onSuggestionSelected(tokenStart, token, value, ['spoiler_text']);
}
handleChangeSpoilerText = (e) => {
this.props.onChangeSpoilerText(e.target.value);
}
handleFocus = () => {
if (this.composeForm && !this.props.singleColumn) {
const { left, right } = this.composeForm.getBoundingClientRect();
if (left < 0 || right > (window.innerWidth || document.documentElement.clientWidth)) {
this.composeForm.scrollIntoView();
}
}
}
componentDidUpdate (prevProps) {
// This statement does several things:
// - If we're beginning a reply, and,
// - Replying to zero or one users, places the cursor at the end of the textbox.
// - Replying to more than one user, selects any usernames past the first;
// this provides a convenient shortcut to drop everyone else from the conversation.
if (this.props.focusDate !== prevProps.focusDate) {
let selectionEnd, selectionStart;
if (this.props.preselectDate !== prevProps.preselectDate) {
selectionEnd = this.props.text.length;
selectionStart = this.props.text.search(/\s/) + 1;
} else if (typeof this.props.caretPosition === 'number') {
selectionStart = this.props.caretPosition;
selectionEnd = this.props.caretPosition;
} else {
selectionEnd = this.props.text.length;
selectionStart = selectionEnd;
}
this.autosuggestTextarea.textarea.setSelectionRange(selectionStart, selectionEnd);
this.autosuggestTextarea.textarea.focus();
} else if(prevProps.isSubmitting && !this.props.isSubmitting) {
this.autosuggestTextarea.textarea.focus();
} else if (this.props.spoiler !== prevProps.spoiler) {
if (this.props.spoiler) {
this.spoilerText.input.focus();
} else {
this.autosuggestTextarea.textarea.focus();
}
}
}
setAutosuggestTextarea = (c) => {
this.autosuggestTextarea = c;
}
setSpoilerText = (c) => {
this.spoilerText = c;
}
setRef = c => {
this.composeForm = c;
};
handleEmojiPick = (data) => {
const { text } = this.props;
const position = this.autosuggestTextarea.textarea.selectionStart;
const needsSpace = data.custom && position > 0 && !allowedAroundShortCode.includes(text[position - 1]);
this.props.onPickEmoji(position, data, needsSpace);
}
render () {
const { intl, onPaste, showSearch, anyMedia } = this.props;
const disabled = this.props.isSubmitting;
const text = [this.props.spoilerText, countableText(this.props.text)].join('');
const disabledButton = disabled || this.props.isUploading || this.props.isChangingUpload || length(text) > 500 || (text.length !== 0 && text.trim().length === 0 && !anyMedia);
let publishText = '';
if (this.props.privacy === 'private' || this.props.privacy === 'direct') {
publishText = <span className='compose-form__publish-private'><Icon id='lock' /> {intl.formatMessage(messages.publish)}</span>;
} else {
publishText = this.props.privacy !== 'unlisted' ? intl.formatMessage(messages.publishLoud, { publish: intl.formatMessage(messages.publish) }) : intl.formatMessage(messages.publish);
}
return (
<div className='compose-form'>
<WarningContainer />
<ReplyIndicatorContainer />
<div className={`spoiler-input ${this.props.spoiler ? 'spoiler-input--visible' : ''}`} ref={this.setRef}>
<AutosuggestInput
placeholder={intl.formatMessage(messages.spoiler_placeholder)}
value={this.props.spoilerText}
onChange={this.handleChangeSpoilerText}
onKeyDown={this.handleKeyDown}
disabled={!this.props.spoiler}
ref={this.setSpoilerText}
suggestions={this.props.suggestions}
onSuggestionsFetchRequested={this.onSuggestionsFetchRequested}
onSuggestionsClearRequested={this.onSuggestionsClearRequested}
onSuggestionSelected={this.onSpoilerSuggestionSelected}
searchTokens={[':']}
id='cw-spoiler-input'
className='spoiler-input__input'
/>
</div>
<AutosuggestTextarea
ref={this.setAutosuggestTextarea}
placeholder={intl.formatMessage(messages.placeholder)}
disabled={disabled}
value={this.props.text}
onChange={this.handleChange}
suggestions={this.props.suggestions}
onFocus={this.handleFocus}
onKeyDown={this.handleKeyDown}
onSuggestionsFetchRequested={this.onSuggestionsFetchRequested}
onSuggestionsClearRequested={this.onSuggestionsClearRequested}
onSuggestionSelected={this.onSuggestionSelected}
onPaste={onPaste}
autoFocus={!showSearch && !isMobile(window.innerWidth)}
>
<EmojiPickerDropdown onPickEmoji={this.handleEmojiPick} />
<div className='compose-form__modifiers'>
<UploadFormContainer />
<PollFormContainer />
</div>
</AutosuggestTextarea>
<div className='compose-form__buttons-wrapper'>
<div className='compose-form__buttons'>
<UploadButtonContainer />
<PollButtonContainer />
<PrivacyDropdownContainer />
<SpoilerButtonContainer />
</div>
<div className='character-counter__wrapper'><CharacterCounter max={500} text={text} /></div>
</div>
<div className='compose-form__publish'>
<div className='compose-form__publish-button-wrapper'><Button text={publishText} onClick={this.handleSubmit} disabled={disabledButton} block /></div>
</div>
</div>
);
}
}
|
classic/src/scenes/wbfa/generated/FABSlack.free.js
|
wavebox/waveboxapp
|
import React from 'react'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faSlack } from '@fortawesome/free-brands-svg-icons/faSlack'
export default class FABSlack extends React.Component {
render () {
return (<FontAwesomeIcon {...this.props} icon={faSlack} />)
}
}
|
router_homemade/with_universal_router/src/Link.js
|
Muzietto/react-playground
|
import React from 'react';
import navigateTo from './navigation'
const transition = event => {
event.preventDefault();
const path = event.currentTarget.pathname;
navigateTo(path);
};
export default ({ href, children }) => (
<React.Fragment>
<a href={href} onClick={transition}>{children}</a>
<br/>
</React.Fragment>
);
|
client/modules/Banner/components/BannerList/BannerList.js
|
lordknight1904/bigvnadmin
|
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { Button, Table, Checkbox } from 'react-bootstrap';
import { fetchBanners, uploadBanner, toggleBanner } from '../../BannerActions';
import { getBanners, getSearch, getCurrentPage } from '../../BannerReducer';
import { getId } from '../../../Login/LoginReducer';
import { setNotify } from '../../../App/AppActions';
import styles from '../../../../main.css';
import dateFormat from 'dateformat';
class BannerList extends Component {
constructor(props) {
super(props);
}
componentDidMount() {
this.props.dispatch(fetchBanners(this.props.search, this.props.currentPage - 1));
}
onClick = (type, a) => {
if (a._id === this.props.id) {
this.props.dispatch(setNotify('Không thể tự Tước quyền/Khôi phục.'));
} else {
this.props.showDialog(type, a._id);
}
};
onToggle = (id) => {
const banner = {
id,
};
this.props.dispatch(toggleBanner(banner)).then(() => {
this.props.dispatch(fetchBanners(this.props.search, this.props.currentPage - 1));
});
};
onUpdate = (id, e) => {
e.preventDefault();
const reader = new FileReader();
const file = e.target.files[0];
let base64image = null;
reader.onload = (readerEvt) => {
base64image = readerEvt.target.result;
};
reader.onloadend = () => {
this.props.dispatch(uploadBanner(base64image, id)).then((res) => {
if (res.banner !== 'error') {
this.setState({
imageDirectory: res.banner,
imagePreview: base64image,
});
}
this.props.dispatch(fetchBanners(this.props.search, this.props.currentPage - 1));
});
};
reader.readAsDataURL(file);
};
render() {
return (
<Table striped bordered condensed hover className={styles.table}>
<thead>
<tr>
<th style={{ width: '30%' }}>Tên</th>
<th style={{ width: '20%' }}>Mô tả</th>
<th style={{ width: '20%' }}>Ngày tạo</th>
<th style={{ width: '10%' }}>Preview</th>
<th style={{ width: '10%' }}>Thao tác</th>
<th style={{ width: '10%' }}>Khóa</th>
</tr>
</thead>
<tbody>
{
this.props.banners.map((a, index) => {
return (
<tr key={index}>
<td>{a.name}</td>
<td>{a.description}</td>
<td>{dateFormat(a.dateCreated, 'dd/mm/yyyy HH:mm')}</td>
<td>
<Button onClick={() => this.props.setPreview(a.imageDirectory)}>Preview Hình</Button>
{/*<div style={{ textAlign: 'center' }}>*/}
{/*<img role="presentation" width={150} height={150} src={`/banner/${a.imageDirectory}`} />*/}
{/*</div>*/}
</td>
<td>
<Button style={{ padding: '0', zIndex: '-1' }}>
<label htmlFor="file-upload" style={{ width: '100%', padding: '6px 12px', zIndex: '1' }}>
Sửa ảnh
</label>
</Button>
<input
id="file-upload"
accept="image/jpeg, image/png"
type="file"
onChange={(e) => this.onUpdate(a._id, e)}
style={{ display: 'none' }}
/>
</td>
<td style={{ textAlign: 'center' }}>
<Checkbox checked={a.disable} onClick={() => this.onToggle(a._id)} />
</td>
</tr>
);
})
}
</tbody>
</Table>
);
}
}
// Retrieve data from store as props
function mapStateToProps(state) {
return {
banners: getBanners(state),
currentPage: getCurrentPage(state),
search: getSearch(state),
id: getId(state),
};
}
BannerList.propTypes = {
dispatch: PropTypes.func.isRequired,
setPreview: PropTypes.func.isRequired,
banners: PropTypes.array.isRequired,
currentPage: PropTypes.number.isRequired,
search: PropTypes.string.isRequired,
id: PropTypes.string.isRequired,
};
BannerList.contextTypes = {
router: PropTypes.object,
};
export default connect(mapStateToProps)(BannerList);
|
src/components/dashboard/recentSales.js
|
simors/HLifeAdmin
|
import React from 'react'
import { Table, Tag } from 'antd'
import styles from './recentSales.less'
import { color } from '../../utils'
const status = {
1: {
color: color.green,
text: 'SALE'
},
2: {
color: color.yellow,
text: 'REJECT'
},
3: {
color: color.red,
text: 'TAX'
},
4: {
color: color.blue,
text: 'EXTENDED'
}
}
function RecentSales (props) {
const columns = [
{
title: 'NAME',
dataIndex: 'name'
}, {
title: 'STATUS',
dataIndex: 'status',
render: text => <Tag color={status[text].color}>{status[text].text}</Tag>
}, {
title: 'DATE',
dataIndex: 'date',
render: text => new Date(text).format('yyyy-MM-dd')
}, {
title: 'PRICE',
dataIndex: 'price',
render: (text, it) => <span style={{color: status[it.status].color}}>${text}</span>
}
]
return (
<div className={styles.recentsales}>
<Table pagination={false} columns={columns} rowKey={(record, key) => key} dataSource={props.data.filter((item, key) => key < 5)} />
</div>
)
}
export default RecentSales
|
lib/components/index.js
|
ryanbahniuk/isomorphic-app-boilerplate
|
'use strict'
import React from 'react';
import store from '../store';
import { incrementClicks } from '../actions/actions';
const Index = React.createClass({
propTypes: {
numClicks: React.PropTypes.number.isRequired
},
handleClick: function() {
const updatedClicks = this.props.numClicks + 1;
store.dispatch(incrementClicks(updatedClicks));
},
render: function() {
return (
<div onClick={this.handleClick}>This has been clicked {this.props.numClicks} times.</div>
);
}
});
export default Index;
|
stories/components/atoms/footer/index.js
|
one-love/storybook
|
import React from 'react';
import cssModules from 'react-css-modules';
import styles from './footer.scss';
function Footer() {
return (
<div styleName="footer">
Made by: <a href="http://tilda.center/" target="_blank">Tilda Center</a>
</div>
);
}
export default cssModules(Footer, styles);
|
server/game/cards/06.2-GtR/GuardingTheRealm.js
|
DukeTax/throneteki
|
const DrawCard = require('../../drawcard.js');
class GuardingTheRealm extends DrawCard {
setupCardAbilities(ability) {
this.action({
title: 'Take control of character in discard pile',
phase: 'marshal',
target: {
cardCondition: card => card.controller !== this.controller && card.location === 'discard pile' &&
card.getType() === 'character' && card.getPrintedCost() <= 3 && this.controller.canPutIntoPlay(card)
},
handler: context => {
this.controller.putIntoPlay(context.target);
this.game.addMessage('{0} uses {1} to put {2} into play from {3}\'s discard pile under their control',
this.controller, this, context.target, context.target.owner);
}
});
this.reaction({
location: 'discard pile',
when: {
afterChallenge: event => event.challenge.winner === this.controller && !event.challenge.isAttackerTheWinner()
},
ignoreEventCosts: true,
cost: ability.costs.payGold(1),
handler: () => {
this.game.addMessage('{0} pays 1 gold to move {1} back to their hand', this.controller, this);
this.controller.moveCard(this, 'hand');
}
});
}
}
GuardingTheRealm.code = '06026';
module.exports = GuardingTheRealm;
|
src/containers/classes/UnattendedClasses.js
|
jinqiupeter/mtsr
|
/**
* Created by peter on 25/11/2016.
*/
import {bindActionCreators} from 'redux';
import {connect} from 'react-redux';
import * as components from '../../components';
import * as actions from '../../actions';
import {default as Unattended} from '../../components/classes/UnattendedClasses'
function mapStateToProps(state) {
let {loading, processing, error, classes, network, input, object, sceneState} = state;
return {
loading,
processing,
error,
sceneKey: 'UnattendedClasses',
network,
unattendedClasses: classes.unattendedClasses,
object,
input,
sceneState,
startDate: classes.startDate,
};
}
function mapDispatchToProps(dispatch) {
return bindActionCreators({
enableLoading: actions.enableLoading,
disableLoading: actions.disableLoading,
errorFlash: actions.errorFlash,
setSceneLastRefreshTime: actions.setSceneLastRefreshTime,
setSceneState: actions.setSceneState,
getUnattendedClasses: actions.unattendedClasses,
saveInput: actions.saveInput,
changeStartDay: actions.changeStartDay,
moreClass: actions.moreUnattendedClassesFromCache,
updateAbsence: actions.updateAbsence,
signInClass: actions.signInClass,
deselectRegular: actions.deselectRegular,
deselectMakeup: actions.deselectMakeup,
}, dispatch);
}
export default connect(mapStateToProps, mapDispatchToProps)(Unattended);
|
admin/client/components/Lightbox.js
|
tony2cssc/keystone
|
import React from 'react';
import blacklist from 'blacklist';
import Portal from './Portal';
import Transition from 'react-addons-css-transition-group';
const BODY = document.getElementsByTagName('body')[0];
var Lightbox = React.createClass({
displayName: 'Lightbox',
propTypes: {
backdropClosesModal: React.PropTypes.bool,
className: React.PropTypes.string,
enableKeyboardInput: React.PropTypes.bool,
height: React.PropTypes.number,
images: React.PropTypes.array,
initialImage: React.PropTypes.number,
isOpen: React.PropTypes.bool,
onCancel: React.PropTypes.func,
showCloseButton: React.PropTypes.bool,
width: React.PropTypes.number,
},
getDefaultProps () {
return {
backdropClosesModal: true,
enableKeyboardInput: true,
initialImage: 0,
height: 600,
width: 900,
};
},
getInitialState () {
return {
currentImage: this.props.initialImage,
};
},
componentWillReceiveProps (nextProps) {
this.setState({
currentImage: nextProps.initialImage,
});
if (nextProps.isOpen && nextProps.enableKeyboardInput) {
window.addEventListener('keydown', this.handleKeyboardInput);
} else {
window.removeEventListener('keydown', this.handleKeyboardInput);
}
if (nextProps.isOpen) {
BODY.style.overflow = 'hidden';
} else {
BODY.style.overflow = null;
}
},
handleKeyboardInput (event) {
if (event.keyCode === 37) {
this.gotoPrevious();
} else if (event.keyCode === 39) {
this.gotoNext();
} else if (event.keyCode === 27) {
this.props.onCancel();
} else {
return false;
}
},
gotoPrevious () {
if (this.state.currentImage === 0) return;
this.setState({
currentImage: this.state.currentImage - 1,
});
},
gotoNext () {
if (this.state.currentImage === (this.props.images.length - 1)) return;
this.setState({
currentImage: this.state.currentImage + 1,
});
},
renderArrowPrev () {
return (
<Transition transitionName="react-transitiongroup-fade" transitionEnterTimeout={200} transitionLeaveTimeout={200}>
{(this.state.currentImage > 0) && <button type="button" style={Object.assign({}, styles.arrow, styles.arrowPrev)} onClick={this.gotoPrevious} className="octicon octicon-chevron-left" />}
</Transition>
);
},
renderArrowNext () {
return (
<Transition transitionName="react-transitiongroup-fade" transitionEnterTimeout={200} transitionLeaveTimeout={200}>
{(this.state.currentImage < (this.props.images.length - 1)) && <button type="button" style={Object.assign({}, styles.arrow, styles.arrowNext)} onClick={this.gotoNext} className="octicon octicon-chevron-right" />}
</Transition>
);
},
renderBackdrop () {
if (!this.props.isOpen) return;
return <div key="backdrop" style={styles.backdrop} onClick={this.props.backdropClosesModal ? this.props.onCancel : null} />;
},
renderCloseButton () {
if (!this.props.showCloseButton) return;
return <button key="close" style={styles.close} onClick={this.props.onCancel}>Close</button>;
},
renderDialog () {
if (!this.props.isOpen) return;
return (
<div key="dialog" style={Object.assign({}, styles.dialog, { height: this.props.height, width: this.props.width })}>
{this.renderImages()}
{this.renderArrowPrev()}
{this.renderArrowNext()}
{this.renderCloseButton()}
</div>
);
},
renderImages () {
const { images } = this.props;
const { currentImage } = this.state;
if (!images || !images.length) return;
return (
<Transition transitionName="react-transitiongroup-fade" style={styles.imageContainer} component="div" transitionEnterTimeout={200} transitionLeaveTimeout={200}>
<img key={'image' + currentImage} src={images[currentImage]} style={styles.image} />
</Transition>
);
},
render () {
const props = blacklist(this.props, 'backdropClosesModal', 'initialImage', 'height', 'images', 'isOpen', 'onCancel', 'showCloseButton', 'width');
return (
<Portal {...props}>
<Transition transitionName="react-transitiongroup-fade" component="div" transitionEnterTimeout={200} transitionLeaveTimeout={200}>
{this.renderDialog()}
</Transition>
<Transition transitionName="react-transitiongroup-fade" component="div" transitionEnterTimeout={200} transitionLeaveTimeout={200}>
{this.renderBackdrop()}
</Transition>
</Portal>
);
},
});
const styles = {
arrow: {
background: 'none',
border: 'none',
bottom: 0,
color: 'white',
fontSize: 48,
right: 0,
outline: 'none',
padding: 0,
position: 'absolute',
top: 0,
width: '10%',
zIndex: 1002,
// disable user select
WebkitTouchCallout: 'none',
WebkitUserSelect: 'none',
MozUserSelect: 'none',
msUserSelect: 'none',
userSelect: 'none',
},
arrowNext: {
right: 0,
},
arrowPrev: {
left: 0,
},
backdrop: {
backgroundColor: 'rgba(0,0,0,0.66)',
bottom: 0,
left: 0,
position: 'fixed',
right: 0,
top: 0,
zIndex: 1000,
},
close: {
background: 'none',
border: 'none',
bottom: -32,
color: 'white',
fontSize: 16,
height: 32,
left: 0,
marginLeft: 'auto',
marginRight: 'auto',
outline: 'none',
padding: 0,
position: 'absolute',
right: 0,
textAlign: 'center',
textTransform: 'uppercase',
width: 100,
},
dialog: {
// backgroundColor: 'rgba(255,255,255,0.26)',
left: 0,
lineHeight: 1,
marginLeft: 'auto',
marginRight: 'auto',
maxHeight: '100%',
maxWidth: '100%',
position: 'fixed',
right: 0,
top: '50%',
zIndex: 1001,
WebkitTransform: 'translateY(-50%)',
MozTransform: 'translateY(-50%)',
msTransform: 'translateY(-50%)',
transform: 'translateY(-50%)',
},
image: {
boxShadow: '0 1px 4px rgba(0,0,0,0.25)',
maxHeight: '100%',
maxWidth: '80%',
position: 'absolute',
// center the image within the dialog
left: '50%',
top: '50%',
WebkitTransform: 'translate(-50%, -50%)',
MozTransform: 'translate(-50%, -50%)',
msTransform: 'translate(-50%, -50%)',
transform: 'translate(-50%, -50%)',
// disable user select
WebkitTouchCallout: 'none',
WebkitUserSelect: 'none',
MozUserSelect: 'none',
msUserSelect: 'none',
userSelect: 'none',
},
};
module.exports = Lightbox;
|
lib/jquery/jquery-1.9.1.min.js
|
crissdev/kvd
|
/*! jQuery v1.9.1 | (c) 2005, 2012 jQuery Foundation, Inc. | jquery.org/license
//@ sourceMappingURL=jquery.min.map
*/(function(e,t){var n,r,i=typeof t,o=e.document,a=e.location,s=e.jQuery,u=e.$,l={},c=[],p="1.9.1",f=c.concat,d=c.push,h=c.slice,g=c.indexOf,m=l.toString,y=l.hasOwnProperty,v=p.trim,b=function(e,t){return new b.fn.init(e,t,r)},x=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,w=/\S+/g,T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,k=/^[\],:{}\s]*$/,E=/(?:^|:|,)(?:\s*\[)+/g,S=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,A=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,j=/^-ms-/,D=/-([\da-z])/gi,L=function(e,t){return t.toUpperCase()},H=function(e){(o.addEventListener||"load"===e.type||"complete"===o.readyState)&&(q(),b.ready())},q=function(){o.addEventListener?(o.removeEventListener("DOMContentLoaded",H,!1),e.removeEventListener("load",H,!1)):(o.detachEvent("onreadystatechange",H),e.detachEvent("onload",H))};b.fn=b.prototype={jquery:p,constructor:b,init:function(e,n,r){var i,a;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!i||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof b?n[0]:n,b.merge(this,b.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:o,!0)),C.test(i[1])&&b.isPlainObject(n))for(i in n)b.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(a=o.getElementById(i[2]),a&&a.parentNode){if(a.id!==i[2])return r.find(e);this.length=1,this[0]=a}return this.context=o,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):b.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),b.makeArray(e,this))},selector:"",length:0,size:function(){return this.length},toArray:function(){return h.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=b.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return b.each(this,e,t)},ready:function(e){return b.ready.promise().done(e),this},slice:function(){return this.pushStack(h.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(b.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:d,sort:[].sort,splice:[].splice},b.fn.init.prototype=b.fn,b.extend=b.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},u=1,l=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},u=2),"object"==typeof s||b.isFunction(s)||(s={}),l===u&&(s=this,--u);l>u;u++)if(null!=(o=arguments[u]))for(i in o)e=s[i],r=o[i],s!==r&&(c&&r&&(b.isPlainObject(r)||(n=b.isArray(r)))?(n?(n=!1,a=e&&b.isArray(e)?e:[]):a=e&&b.isPlainObject(e)?e:{},s[i]=b.extend(c,a,r)):r!==t&&(s[i]=r));return s},b.extend({noConflict:function(t){return e.$===b&&(e.$=u),t&&e.jQuery===b&&(e.jQuery=s),b},isReady:!1,readyWait:1,holdReady:function(e){e?b.readyWait++:b.ready(!0)},ready:function(e){if(e===!0?!--b.readyWait:!b.isReady){if(!o.body)return setTimeout(b.ready);b.isReady=!0,e!==!0&&--b.readyWait>0||(n.resolveWith(o,[b]),b.fn.trigger&&b(o).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===b.type(e)},isArray:Array.isArray||function(e){return"array"===b.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[m.call(e)]||"object":typeof e},isPlainObject:function(e){if(!e||"object"!==b.type(e)||e.nodeType||b.isWindow(e))return!1;try{if(e.constructor&&!y.call(e,"constructor")&&!y.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||y.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||o;var r=C.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=b.buildFragment([e],t,i),i&&b(i).remove(),b.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=b.trim(n),n&&k.test(n.replace(S,"@").replace(A,"]").replace(E,"")))?Function("return "+n)():(b.error("Invalid JSON: "+n),t)},parseXML:function(n){var r,i;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||b.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&b.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(j,"ms-").replace(D,L)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,a=M(e);if(n){if(a){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(a){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:v&&!v.call("\ufeff\u00a0")?function(e){return null==e?"":v.call(e)}:function(e){return null==e?"":(e+"").replace(T,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(M(Object(e))?b.merge(n,"string"==typeof e?[e]:e):d.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(g)return g.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r)for(;r>o;o++)e[i++]=n[o];else while(n[o]!==t)e[i++]=n[o++];return e.length=i,e},grep:function(e,t,n){var r,i=[],o=0,a=e.length;for(n=!!n;a>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,a=M(e),s=[];if(a)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(s[s.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(s[s.length]=r);return f.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),b.isFunction(e)?(r=h.call(arguments,2),i=function(){return e.apply(n||this,r.concat(h.call(arguments)))},i.guid=e.guid=e.guid||b.guid++,i):t},access:function(e,n,r,i,o,a,s){var u=0,l=e.length,c=null==r;if("object"===b.type(r)){o=!0;for(u in r)b.access(e,n,u,r[u],!0,a,s)}else if(i!==t&&(o=!0,b.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(b(e),n)})),n))for(;l>u;u++)n(e[u],r,s?i:i.call(e[u],u,n(e[u],r)));return o?e:c?n.call(e):l?n(e[0],r):a},now:function(){return(new Date).getTime()}}),b.ready.promise=function(t){if(!n)if(n=b.Deferred(),"complete"===o.readyState)setTimeout(b.ready);else if(o.addEventListener)o.addEventListener("DOMContentLoaded",H,!1),e.addEventListener("load",H,!1);else{o.attachEvent("onreadystatechange",H),e.attachEvent("onload",H);var r=!1;try{r=null==e.frameElement&&o.documentElement}catch(i){}r&&r.doScroll&&function a(){if(!b.isReady){try{r.doScroll("left")}catch(e){return setTimeout(a,50)}q(),b.ready()}}()}return n.promise(t)},b.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function M(e){var t=e.length,n=b.type(e);return b.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=b(o);var _={};function F(e){var t=_[e]={};return b.each(e.match(w)||[],function(e,n){t[n]=!0}),t}b.Callbacks=function(e){e="string"==typeof e?_[e]||F(e):b.extend({},e);var n,r,i,o,a,s,u=[],l=!e.once&&[],c=function(t){for(r=e.memory&&t,i=!0,a=s||0,s=0,o=u.length,n=!0;u&&o>a;a++)if(u[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}n=!1,u&&(l?l.length&&c(l.shift()):r?u=[]:p.disable())},p={add:function(){if(u){var t=u.length;(function i(t){b.each(t,function(t,n){var r=b.type(n);"function"===r?e.unique&&p.has(n)||u.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=u.length:r&&(s=t,c(r))}return this},remove:function(){return u&&b.each(arguments,function(e,t){var r;while((r=b.inArray(t,u,r))>-1)u.splice(r,1),n&&(o>=r&&o--,a>=r&&a--)}),this},has:function(e){return e?b.inArray(e,u)>-1:!(!u||!u.length)},empty:function(){return u=[],this},disable:function(){return u=l=r=t,this},disabled:function(){return!u},lock:function(){return l=t,r||p.disable(),this},locked:function(){return!l},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],!u||i&&!l||(n?l.push(t):c(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!i}};return p},b.extend({Deferred:function(e){var t=[["resolve","done",b.Callbacks("once memory"),"resolved"],["reject","fail",b.Callbacks("once memory"),"rejected"],["notify","progress",b.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return b.Deferred(function(n){b.each(t,function(t,o){var a=o[0],s=b.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&b.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?b.extend(e,r):r}},i={};return r.pipe=r.then,b.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=h.call(arguments),r=n.length,i=1!==r||e&&b.isFunction(e.promise)?r:0,o=1===i?e:b.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?h.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,u,l;if(r>1)for(s=Array(r),u=Array(r),l=Array(r);r>t;t++)n[t]&&b.isFunction(n[t].promise)?n[t].promise().done(a(t,l,n)).fail(o.reject).progress(a(t,u,s)):--i;return i||o.resolveWith(l,n),o.promise()}}),b.support=function(){var t,n,r,a,s,u,l,c,p,f,d=o.createElement("div");if(d.setAttribute("className","t"),d.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=d.getElementsByTagName("*"),r=d.getElementsByTagName("a")[0],!n||!r||!n.length)return{};s=o.createElement("select"),l=s.appendChild(o.createElement("option")),a=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t={getSetAttribute:"t"!==d.className,leadingWhitespace:3===d.firstChild.nodeType,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:"/a"===r.getAttribute("href"),opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:!!a.value,optSelected:l.selected,enctype:!!o.createElement("form").enctype,html5Clone:"<:nav></:nav>"!==o.createElement("nav").cloneNode(!0).outerHTML,boxModel:"CSS1Compat"===o.compatMode,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},a.checked=!0,t.noCloneChecked=a.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!l.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}a=o.createElement("input"),a.setAttribute("value",""),t.input=""===a.getAttribute("value"),a.value="t",a.setAttribute("type","radio"),t.radioValue="t"===a.value,a.setAttribute("checked","t"),a.setAttribute("name","t"),u=o.createDocumentFragment(),u.appendChild(a),t.appendChecked=a.checked,t.checkClone=u.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(f in{submit:!0,change:!0,focusin:!0})d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||d.attributes[c].expando===!1;return d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip,b(function(){var n,r,a,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",u=o.getElementsByTagName("body")[0];u&&(n=o.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",u.appendChild(n).appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",a=d.getElementsByTagName("td"),a[0].style.cssText="padding:0;margin:0;border:0;display:none",p=0===a[0].offsetHeight,a[0].style.display="",a[1].style.display="none",t.reliableHiddenOffsets=p&&0===a[0].offsetHeight,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",t.boxSizing=4===d.offsetWidth,t.doesNotIncludeMarginInBodyOffset=1!==u.offsetTop,e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(d,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(d,null)||{width:"4px"}).width,r=d.appendChild(o.createElement("div")),r.style.cssText=d.style.cssText=s,r.style.marginRight=r.style.width="0",d.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),typeof d.style.zoom!==i&&(d.innerHTML="",d.style.cssText=s+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===d.offsetWidth,d.style.display="block",d.innerHTML="<div></div>",d.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==d.offsetWidth,t.inlineBlockNeedsLayout&&(u.style.zoom=1)),u.removeChild(n),n=d=a=r=null)}),n=s=u=l=r=a=null,t}();var O=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,B=/([A-Z])/g;function P(e,n,r,i){if(b.acceptData(e)){var o,a,s=b.expando,u="string"==typeof n,l=e.nodeType,p=l?b.cache:e,f=l?e[s]:e[s]&&s;if(f&&p[f]&&(i||p[f].data)||!u||r!==t)return f||(l?e[s]=f=c.pop()||b.guid++:f=s),p[f]||(p[f]={},l||(p[f].toJSON=b.noop)),("object"==typeof n||"function"==typeof n)&&(i?p[f]=b.extend(p[f],n):p[f].data=b.extend(p[f].data,n)),o=p[f],i||(o.data||(o.data={}),o=o.data),r!==t&&(o[b.camelCase(n)]=r),u?(a=o[n],null==a&&(a=o[b.camelCase(n)])):a=o,a}}function R(e,t,n){if(b.acceptData(e)){var r,i,o,a=e.nodeType,s=a?b.cache:e,u=a?e[b.expando]:b.expando;if(s[u]){if(t&&(o=n?s[u]:s[u].data)){b.isArray(t)?t=t.concat(b.map(t,b.camelCase)):t in o?t=[t]:(t=b.camelCase(t),t=t in o?[t]:t.split(" "));for(r=0,i=t.length;i>r;r++)delete o[t[r]];if(!(n?$:b.isEmptyObject)(o))return}(n||(delete s[u].data,$(s[u])))&&(a?b.cleanData([e],!0):b.support.deleteExpando||s!=s.window?delete s[u]:s[u]=null)}}}b.extend({cache:{},expando:"jQuery"+(p+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?b.cache[e[b.expando]]:e[b.expando],!!e&&!$(e)},data:function(e,t,n){return P(e,t,n)},removeData:function(e,t){return R(e,t)},_data:function(e,t,n){return P(e,t,n,!0)},_removeData:function(e,t){return R(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&b.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),b.fn.extend({data:function(e,n){var r,i,o=this[0],a=0,s=null;if(e===t){if(this.length&&(s=b.data(o),1===o.nodeType&&!b._data(o,"parsedAttrs"))){for(r=o.attributes;r.length>a;a++)i=r[a].name,i.indexOf("data-")||(i=b.camelCase(i.slice(5)),W(o,i,s[i]));b._data(o,"parsedAttrs",!0)}return s}return"object"==typeof e?this.each(function(){b.data(this,e)}):b.access(this,function(n){return n===t?o?W(o,e,b.data(o,e)):null:(this.each(function(){b.data(this,e,n)}),t)},null,n,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){b.removeData(this,e)})}});function W(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(B,"-$1").toLowerCase();if(r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:O.test(r)?b.parseJSON(r):r}catch(o){}b.data(e,n,r)}else r=t}return r}function $(e){var t;for(t in e)if(("data"!==t||!b.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}b.extend({queue:function(e,n,r){var i;return e?(n=(n||"fx")+"queue",i=b._data(e,n),r&&(!i||b.isArray(r)?i=b._data(e,n,b.makeArray(r)):i.push(r)),i||[]):t},dequeue:function(e,t){t=t||"fx";var n=b.queue(e,t),r=n.length,i=n.shift(),o=b._queueHooks(e,t),a=function(){b.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),o.cur=i,i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return b._data(e,n)||b._data(e,n,{empty:b.Callbacks("once memory").add(function(){b._removeData(e,t+"queue"),b._removeData(e,n)})})}}),b.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?b.queue(this[0],e):n===t?this:this.each(function(){var t=b.queue(this,e,n);b._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&b.dequeue(this,e)})},dequeue:function(e){return this.each(function(){b.dequeue(this,e)})},delay:function(e,t){return e=b.fx?b.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,o=b.Deferred(),a=this,s=this.length,u=function(){--i||o.resolveWith(a,[a])};"string"!=typeof e&&(n=e,e=t),e=e||"fx";while(s--)r=b._data(a[s],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(u));return u(),o.promise(n)}});var I,z,X=/[\t\r\n]/g,U=/\r/g,V=/^(?:input|select|textarea|button|object)$/i,Y=/^(?:a|area)$/i,J=/^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i,G=/^(?:checked|selected)$/i,Q=b.support.getSetAttribute,K=b.support.input;b.fn.extend({attr:function(e,t){return b.access(this,b.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){b.removeAttr(this,e)})},prop:function(e,t){return b.access(this,b.prop,e,t,arguments.length>1)},removeProp:function(e){return e=b.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,o,a=0,s=this.length,u="string"==typeof e&&e;if(b.isFunction(e))return this.each(function(t){b(this).addClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(X," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=b.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,a=0,s=this.length,u=0===arguments.length||"string"==typeof e&&e;if(b.isFunction(e))return this.each(function(t){b(this).removeClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(X," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?b.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e,r="boolean"==typeof t;return b.isFunction(e)?this.each(function(n){b(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var o,a=0,s=b(this),u=t,l=e.match(w)||[];while(o=l[a++])u=r?u:!s.hasClass(o),s[u?"addClass":"removeClass"](o)}else(n===i||"boolean"===n)&&(this.className&&b._data(this,"__className__",this.className),this.className=this.className||e===!1?"":b._data(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(X," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,o=this[0];{if(arguments.length)return i=b.isFunction(e),this.each(function(n){var o,a=b(this);1===this.nodeType&&(o=i?e.call(this,n,a.val()):e,null==o?o="":"number"==typeof o?o+="":b.isArray(o)&&(o=b.map(o,function(e){return null==e?"":e+""})),r=b.valHooks[this.type]||b.valHooks[this.nodeName.toLowerCase()],r&&"set"in r&&r.set(this,o,"value")!==t||(this.value=o))});if(o)return r=b.valHooks[o.type]||b.valHooks[o.nodeName.toLowerCase()],r&&"get"in r&&(n=r.get(o,"value"))!==t?n:(n=o.value,"string"==typeof n?n.replace(U,""):null==n?"":n)}}}),b.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,a=o?null:[],s=o?i+1:r.length,u=0>i?s:o?i:0;for(;s>u;u++)if(n=r[u],!(!n.selected&&u!==i||(b.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&b.nodeName(n.parentNode,"optgroup"))){if(t=b(n).val(),o)return t;a.push(t)}return a},set:function(e,t){var n=b.makeArray(t);return b(e).find("option").each(function(){this.selected=b.inArray(b(this).val(),n)>=0}),n.length||(e.selectedIndex=-1),n}}},attr:function(e,n,r){var o,a,s,u=e.nodeType;if(e&&3!==u&&8!==u&&2!==u)return typeof e.getAttribute===i?b.prop(e,n,r):(a=1!==u||!b.isXMLDoc(e),a&&(n=n.toLowerCase(),o=b.attrHooks[n]||(J.test(n)?z:I)),r===t?o&&a&&"get"in o&&null!==(s=o.get(e,n))?s:(typeof e.getAttribute!==i&&(s=e.getAttribute(n)),null==s?t:s):null!==r?o&&a&&"set"in o&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,r+""),r):(b.removeAttr(e,n),t))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(w);if(o&&1===e.nodeType)while(n=o[i++])r=b.propFix[n]||n,J.test(n)?!Q&&G.test(n)?e[b.camelCase("default-"+n)]=e[r]=!1:e[r]=!1:b.attr(e,n,""),e.removeAttribute(Q?n:r)},attrHooks:{type:{set:function(e,t){if(!b.support.radioValue&&"radio"===t&&b.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(e,n,r){var i,o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return a=1!==s||!b.isXMLDoc(e),a&&(n=b.propFix[n]||n,o=b.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&null!==(i=o.get(e,n))?i:e[n]},propHooks:{tabIndex:{get:function(e){var n=e.getAttributeNode("tabindex");return n&&n.specified?parseInt(n.value,10):V.test(e.nodeName)||Y.test(e.nodeName)&&e.href?0:t}}}}),z={get:function(e,n){var r=b.prop(e,n),i="boolean"==typeof r&&e.getAttribute(n),o="boolean"==typeof r?K&&Q?null!=i:G.test(n)?e[b.camelCase("default-"+n)]:!!i:e.getAttributeNode(n);return o&&o.value!==!1?n.toLowerCase():t},set:function(e,t,n){return t===!1?b.removeAttr(e,n):K&&Q||!G.test(n)?e.setAttribute(!Q&&b.propFix[n]||n,n):e[b.camelCase("default-"+n)]=e[n]=!0,n}},K&&Q||(b.attrHooks.value={get:function(e,n){var r=e.getAttributeNode(n);return b.nodeName(e,"input")?e.defaultValue:r&&r.specified?r.value:t},set:function(e,n,r){return b.nodeName(e,"input")?(e.defaultValue=n,t):I&&I.set(e,n,r)}}),Q||(I=b.valHooks.button={get:function(e,n){var r=e.getAttributeNode(n);return r&&("id"===n||"name"===n||"coords"===n?""!==r.value:r.specified)?r.value:t},set:function(e,n,r){var i=e.getAttributeNode(r);return i||e.setAttributeNode(i=e.ownerDocument.createAttribute(r)),i.value=n+="","value"===r||n===e.getAttribute(r)?n:t}},b.attrHooks.contenteditable={get:I.get,set:function(e,t,n){I.set(e,""===t?!1:t,n)}},b.each(["width","height"],function(e,n){b.attrHooks[n]=b.extend(b.attrHooks[n],{set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}})})),b.support.hrefNormalized||(b.each(["href","src","width","height"],function(e,n){b.attrHooks[n]=b.extend(b.attrHooks[n],{get:function(e){var r=e.getAttribute(n,2);return null==r?t:r}})}),b.each(["href","src"],function(e,t){b.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}})),b.support.style||(b.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}),b.support.optSelected||(b.propHooks.selected=b.extend(b.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),b.support.enctype||(b.propFix.enctype="encoding"),b.support.checkOn||b.each(["radio","checkbox"],function(){b.valHooks[this]={get:function(e){return null===e.getAttribute("value")?"on":e.value}}}),b.each(["radio","checkbox"],function(){b.valHooks[this]=b.extend(b.valHooks[this],{set:function(e,n){return b.isArray(n)?e.checked=b.inArray(b(e).val(),n)>=0:t}})});var Z=/^(?:input|select|textarea)$/i,et=/^key/,tt=/^(?:mouse|contextmenu)|click/,nt=/^(?:focusinfocus|focusoutblur)$/,rt=/^([^.]*)(?:\.(.+)|)$/;function it(){return!0}function ot(){return!1}b.event={global:{},add:function(e,n,r,o,a){var s,u,l,c,p,f,d,h,g,m,y,v=b._data(e);if(v){r.handler&&(c=r,r=c.handler,a=c.selector),r.guid||(r.guid=b.guid++),(u=v.events)||(u=v.events={}),(f=v.handle)||(f=v.handle=function(e){return typeof b===i||e&&b.event.triggered===e.type?t:b.event.dispatch.apply(f.elem,arguments)},f.elem=e),n=(n||"").match(w)||[""],l=n.length;while(l--)s=rt.exec(n[l])||[],g=y=s[1],m=(s[2]||"").split(".").sort(),p=b.event.special[g]||{},g=(a?p.delegateType:p.bindType)||g,p=b.event.special[g]||{},d=b.extend({type:g,origType:y,data:o,handler:r,guid:r.guid,selector:a,needsContext:a&&b.expr.match.needsContext.test(a),namespace:m.join(".")},c),(h=u[g])||(h=u[g]=[],h.delegateCount=0,p.setup&&p.setup.call(e,o,m,f)!==!1||(e.addEventListener?e.addEventListener(g,f,!1):e.attachEvent&&e.attachEvent("on"+g,f))),p.add&&(p.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),a?h.splice(h.delegateCount++,0,d):h.push(d),b.event.global[g]=!0;e=null}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,p,f,d,h,g,m=b.hasData(e)&&b._data(e);if(m&&(c=m.events)){t=(t||"").match(w)||[""],l=t.length;while(l--)if(s=rt.exec(t[l])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){p=b.event.special[d]||{},d=(r?p.delegateType:p.bindType)||d,f=c[d]||[],s=s[2]&&RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),u=o=f.length;while(o--)a=f[o],!i&&g!==a.origType||n&&n.guid!==a.guid||s&&!s.test(a.namespace)||r&&r!==a.selector&&("**"!==r||!a.selector)||(f.splice(o,1),a.selector&&f.delegateCount--,p.remove&&p.remove.call(e,a));u&&!f.length&&(p.teardown&&p.teardown.call(e,h,m.handle)!==!1||b.removeEvent(e,d,m.handle),delete c[d])}else for(d in c)b.event.remove(e,d+t[l],n,r,!0);b.isEmptyObject(c)&&(delete m.handle,b._removeData(e,"events"))}},trigger:function(n,r,i,a){var s,u,l,c,p,f,d,h=[i||o],g=y.call(n,"type")?n.type:n,m=y.call(n,"namespace")?n.namespace.split("."):[];if(l=f=i=i||o,3!==i.nodeType&&8!==i.nodeType&&!nt.test(g+b.event.triggered)&&(g.indexOf(".")>=0&&(m=g.split("."),g=m.shift(),m.sort()),u=0>g.indexOf(":")&&"on"+g,n=n[b.expando]?n:new b.Event(g,"object"==typeof n&&n),n.isTrigger=!0,n.namespace=m.join("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=i),r=null==r?[n]:b.makeArray(r,[n]),p=b.event.special[g]||{},a||!p.trigger||p.trigger.apply(i,r)!==!1)){if(!a&&!p.noBubble&&!b.isWindow(i)){for(c=p.delegateType||g,nt.test(c+g)||(l=l.parentNode);l;l=l.parentNode)h.push(l),f=l;f===(i.ownerDocument||o)&&h.push(f.defaultView||f.parentWindow||e)}d=0;while((l=h[d++])&&!n.isPropagationStopped())n.type=d>1?c:p.bindType||g,s=(b._data(l,"events")||{})[n.type]&&b._data(l,"handle"),s&&s.apply(l,r),s=u&&l[u],s&&b.acceptData(l)&&s.apply&&s.apply(l,r)===!1&&n.preventDefault();if(n.type=g,!(a||n.isDefaultPrevented()||p._default&&p._default.apply(i.ownerDocument,r)!==!1||"click"===g&&b.nodeName(i,"a")||!b.acceptData(i)||!u||!i[g]||b.isWindow(i))){f=i[u],f&&(i[u]=null),b.event.triggered=g;try{i[g]()}catch(v){}b.event.triggered=t,f&&(i[u]=f)}return n.result}},dispatch:function(e){e=b.event.fix(e);var n,r,i,o,a,s=[],u=h.call(arguments),l=(b._data(this,"events")||{})[e.type]||[],c=b.event.special[e.type]||{};if(u[0]=e,e.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,e)!==!1){s=b.event.handlers.call(this,e,l),n=0;while((o=s[n++])&&!e.isPropagationStopped()){e.currentTarget=o.elem,a=0;while((i=o.handlers[a++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(i.namespace))&&(e.handleObj=i,e.data=i.data,r=((b.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,u),r!==t&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,n){var r,i,o,a,s=[],u=n.delegateCount,l=e.target;if(u&&l.nodeType&&(!e.button||"click"!==e.type))for(;l!=this;l=l.parentNode||this)if(1===l.nodeType&&(l.disabled!==!0||"click"!==e.type)){for(o=[],a=0;u>a;a++)i=n[a],r=i.selector+" ",o[r]===t&&(o[r]=i.needsContext?b(r,this).index(l)>=0:b.find(r,this,null,[l]).length),o[r]&&o.push(i);o.length&&s.push({elem:l,handlers:o})}return n.length>u&&s.push({elem:this,handlers:n.slice(u)}),s},fix:function(e){if(e[b.expando])return e;var t,n,r,i=e.type,a=e,s=this.fixHooks[i];s||(this.fixHooks[i]=s=tt.test(i)?this.mouseHooks:et.test(i)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,e=new b.Event(a),t=r.length;while(t--)n=r[t],e[n]=a[n];return e.target||(e.target=a.srcElement||o),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,a):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,a,s=n.button,u=n.fromElement;return null==e.pageX&&null!=n.clientX&&(i=e.target.ownerDocument||o,a=i.documentElement,r=i.body,e.pageX=n.clientX+(a&&a.scrollLeft||r&&r.scrollLeft||0)-(a&&a.clientLeft||r&&r.clientLeft||0),e.pageY=n.clientY+(a&&a.scrollTop||r&&r.scrollTop||0)-(a&&a.clientTop||r&&r.clientTop||0)),!e.relatedTarget&&u&&(e.relatedTarget=u===e.target?n.toElement:u),e.which||s===t||(e.which=1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},click:{trigger:function(){return b.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):t}},focus:{trigger:function(){if(this!==o.activeElement&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===o.activeElement&&this.blur?(this.blur(),!1):t},delegateType:"focusout"},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=b.extend(new b.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?b.event.trigger(i,null,t):b.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},b.removeEvent=o.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]===i&&(e[r]=null),e.detachEvent(r,n))},b.Event=function(e,n){return this instanceof b.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?it:ot):this.type=e,n&&b.extend(this,n),this.timeStamp=e&&e.timeStamp||b.now(),this[b.expando]=!0,t):new b.Event(e,n)},b.Event.prototype={isDefaultPrevented:ot,isPropagationStopped:ot,isImmediatePropagationStopped:ot,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=it,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=it,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=it,this.stopPropagation()}},b.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){b.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;
return(!i||i!==r&&!b.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),b.support.submitBubbles||(b.event.special.submit={setup:function(){return b.nodeName(this,"form")?!1:(b.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=b.nodeName(n,"input")||b.nodeName(n,"button")?n.form:t;r&&!b._data(r,"submitBubbles")&&(b.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),b._data(r,"submitBubbles",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&b.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return b.nodeName(this,"form")?!1:(b.event.remove(this,"._submit"),t)}}),b.support.changeBubbles||(b.event.special.change={setup:function(){return Z.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(b.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),b.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),b.event.simulate("change",this,e,!0)})),!1):(b.event.add(this,"beforeactivate._change",function(e){var t=e.target;Z.test(t.nodeName)&&!b._data(t,"changeBubbles")&&(b.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||b.event.simulate("change",this.parentNode,e,!0)}),b._data(t,"changeBubbles",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return b.event.remove(this,"._change"),!Z.test(this.nodeName)}}),b.support.focusinBubbles||b.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){b.event.simulate(t,e.target,b.event.fix(e),!0)};b.event.special[t]={setup:function(){0===n++&&o.addEventListener(e,r,!0)},teardown:function(){0===--n&&o.removeEventListener(e,r,!0)}}}),b.fn.extend({on:function(e,n,r,i,o){var a,s;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(a in e)this.on(a,n,r,e[a],o);return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),i===!1)i=ot;else if(!i)return this;return 1===o&&(s=i,i=function(e){return b().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=b.guid++)),this.each(function(){b.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,b(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(o in e)this.off(o,n,e[o]);return this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=ot),this.each(function(){b.event.remove(this,e,r,n)})},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},trigger:function(e,t){return this.each(function(){b.event.trigger(e,t,this)})},triggerHandler:function(e,n){var r=this[0];return r?b.event.trigger(e,n,r,!0):t}}),function(e,t){var n,r,i,o,a,s,u,l,c,p,f,d,h,g,m,y,v,x="sizzle"+-new Date,w=e.document,T={},N=0,C=0,k=it(),E=it(),S=it(),A=typeof t,j=1<<31,D=[],L=D.pop,H=D.push,q=D.slice,M=D.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},_="[\\x20\\t\\r\\n\\f]",F="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=F.replace("w","w#"),B="([*^$|!~]?=)",P="\\["+_+"*("+F+")"+_+"*(?:"+B+_+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+O+")|)|)"+_+"*\\]",R=":("+F+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+P.replace(3,8)+")*)|.*)\\)|)",W=RegExp("^"+_+"+|((?:^|[^\\\\])(?:\\\\.)*)"+_+"+$","g"),$=RegExp("^"+_+"*,"+_+"*"),I=RegExp("^"+_+"*([\\x20\\t\\r\\n\\f>+~])"+_+"*"),z=RegExp(R),X=RegExp("^"+O+"$"),U={ID:RegExp("^#("+F+")"),CLASS:RegExp("^\\.("+F+")"),NAME:RegExp("^\\[name=['\"]?("+F+")['\"]?\\]"),TAG:RegExp("^("+F.replace("w","w*")+")"),ATTR:RegExp("^"+P),PSEUDO:RegExp("^"+R),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+_+"*(even|odd|(([+-]|)(\\d*)n|)"+_+"*(?:([+-]|)"+_+"*(\\d+)|))"+_+"*\\)|)","i"),needsContext:RegExp("^"+_+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+_+"*((?:-\\d)?\\d*)"+_+"*\\)|)(?=[^-]|$)","i")},V=/[\x20\t\r\n\f]*[+~]/,Y=/^[^{]+\{\s*\[native code/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,G=/^(?:input|select|textarea|button)$/i,Q=/^h\d$/i,K=/'|\\/g,Z=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,et=/\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,tt=function(e,t){var n="0x"+t-65536;return n!==n?t:0>n?String.fromCharCode(n+65536):String.fromCharCode(55296|n>>10,56320|1023&n)};try{q.call(w.documentElement.childNodes,0)[0].nodeType}catch(nt){q=function(e){var t,n=[];while(t=this[e++])n.push(t);return n}}function rt(e){return Y.test(e+"")}function it(){var e,t=[];return e=function(n,r){return t.push(n+=" ")>i.cacheLength&&delete e[t.shift()],e[n]=r}}function ot(e){return e[x]=!0,e}function at(e){var t=p.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}}function st(e,t,n,r){var i,o,a,s,u,l,f,g,m,v;if((t?t.ownerDocument||t:w)!==p&&c(t),t=t||p,n=n||[],!e||"string"!=typeof e)return n;if(1!==(s=t.nodeType)&&9!==s)return[];if(!d&&!r){if(i=J.exec(e))if(a=i[1]){if(9===s){if(o=t.getElementById(a),!o||!o.parentNode)return n;if(o.id===a)return n.push(o),n}else if(t.ownerDocument&&(o=t.ownerDocument.getElementById(a))&&y(t,o)&&o.id===a)return n.push(o),n}else{if(i[2])return H.apply(n,q.call(t.getElementsByTagName(e),0)),n;if((a=i[3])&&T.getByClassName&&t.getElementsByClassName)return H.apply(n,q.call(t.getElementsByClassName(a),0)),n}if(T.qsa&&!h.test(e)){if(f=!0,g=x,m=t,v=9===s&&e,1===s&&"object"!==t.nodeName.toLowerCase()){l=ft(e),(f=t.getAttribute("id"))?g=f.replace(K,"\\$&"):t.setAttribute("id",g),g="[id='"+g+"'] ",u=l.length;while(u--)l[u]=g+dt(l[u]);m=V.test(e)&&t.parentNode||t,v=l.join(",")}if(v)try{return H.apply(n,q.call(m.querySelectorAll(v),0)),n}catch(b){}finally{f||t.removeAttribute("id")}}}return wt(e.replace(W,"$1"),t,n,r)}a=st.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},c=st.setDocument=function(e){var n=e?e.ownerDocument||e:w;return n!==p&&9===n.nodeType&&n.documentElement?(p=n,f=n.documentElement,d=a(n),T.tagNameNoComments=at(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),T.attributes=at(function(e){e.innerHTML="<select></select>";var t=typeof e.lastChild.getAttribute("multiple");return"boolean"!==t&&"string"!==t}),T.getByClassName=at(function(e){return e.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",e.getElementsByClassName&&e.getElementsByClassName("e").length?(e.lastChild.className="e",2===e.getElementsByClassName("e").length):!1}),T.getByName=at(function(e){e.id=x+0,e.innerHTML="<a name='"+x+"'></a><div name='"+x+"'></div>",f.insertBefore(e,f.firstChild);var t=n.getElementsByName&&n.getElementsByName(x).length===2+n.getElementsByName(x+0).length;return T.getIdNotName=!n.getElementById(x),f.removeChild(e),t}),i.attrHandle=at(function(e){return e.innerHTML="<a href='#'></a>",e.firstChild&&typeof e.firstChild.getAttribute!==A&&"#"===e.firstChild.getAttribute("href")})?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},T.getIdNotName?(i.find.ID=function(e,t){if(typeof t.getElementById!==A&&!d){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},i.filter.ID=function(e){var t=e.replace(et,tt);return function(e){return e.getAttribute("id")===t}}):(i.find.ID=function(e,n){if(typeof n.getElementById!==A&&!d){var r=n.getElementById(e);return r?r.id===e||typeof r.getAttributeNode!==A&&r.getAttributeNode("id").value===e?[r]:t:[]}},i.filter.ID=function(e){var t=e.replace(et,tt);return function(e){var n=typeof e.getAttributeNode!==A&&e.getAttributeNode("id");return n&&n.value===t}}),i.find.TAG=T.tagNameNoComments?function(e,n){return typeof n.getElementsByTagName!==A?n.getElementsByTagName(e):t}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},i.find.NAME=T.getByName&&function(e,n){return typeof n.getElementsByName!==A?n.getElementsByName(name):t},i.find.CLASS=T.getByClassName&&function(e,n){return typeof n.getElementsByClassName===A||d?t:n.getElementsByClassName(e)},g=[],h=[":focus"],(T.qsa=rt(n.querySelectorAll))&&(at(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||h.push("\\["+_+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||h.push(":checked")}),at(function(e){e.innerHTML="<input type='hidden' i=''/>",e.querySelectorAll("[i^='']").length&&h.push("[*^$]="+_+"*(?:\"\"|'')"),e.querySelectorAll(":enabled").length||h.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),h.push(",.*:")})),(T.matchesSelector=rt(m=f.matchesSelector||f.mozMatchesSelector||f.webkitMatchesSelector||f.oMatchesSelector||f.msMatchesSelector))&&at(function(e){T.disconnectedMatch=m.call(e,"div"),m.call(e,"[s!='']:x"),g.push("!=",R)}),h=RegExp(h.join("|")),g=RegExp(g.join("|")),y=rt(f.contains)||f.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},v=f.compareDocumentPosition?function(e,t){var r;return e===t?(u=!0,0):(r=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t))?1&r||e.parentNode&&11===e.parentNode.nodeType?e===n||y(w,e)?-1:t===n||y(w,t)?1:0:4&r?-1:1:e.compareDocumentPosition?-1:1}:function(e,t){var r,i=0,o=e.parentNode,a=t.parentNode,s=[e],l=[t];if(e===t)return u=!0,0;if(!o||!a)return e===n?-1:t===n?1:o?-1:a?1:0;if(o===a)return ut(e,t);r=e;while(r=r.parentNode)s.unshift(r);r=t;while(r=r.parentNode)l.unshift(r);while(s[i]===l[i])i++;return i?ut(s[i],l[i]):s[i]===w?-1:l[i]===w?1:0},u=!1,[0,0].sort(v),T.detectDuplicates=u,p):p},st.matches=function(e,t){return st(e,null,null,t)},st.matchesSelector=function(e,t){if((e.ownerDocument||e)!==p&&c(e),t=t.replace(Z,"='$1']"),!(!T.matchesSelector||d||g&&g.test(t)||h.test(t)))try{var n=m.call(e,t);if(n||T.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(r){}return st(t,p,null,[e]).length>0},st.contains=function(e,t){return(e.ownerDocument||e)!==p&&c(e),y(e,t)},st.attr=function(e,t){var n;return(e.ownerDocument||e)!==p&&c(e),d||(t=t.toLowerCase()),(n=i.attrHandle[t])?n(e):d||T.attributes?e.getAttribute(t):((n=e.getAttributeNode(t))||e.getAttribute(t))&&e[t]===!0?t:n&&n.specified?n.value:null},st.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},st.uniqueSort=function(e){var t,n=[],r=1,i=0;if(u=!T.detectDuplicates,e.sort(v),u){for(;t=e[r];r++)t===e[r-1]&&(i=n.push(r));while(i--)e.splice(n[i],1)}return e};function ut(e,t){var n=t&&e,r=n&&(~t.sourceIndex||j)-(~e.sourceIndex||j);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function lt(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function ct(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function pt(e){return ot(function(t){return t=+t,ot(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}o=st.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=o(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=o(t);return n},i=st.selectors={cacheLength:50,createPseudo:ot,match:U,find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(et,tt),e[3]=(e[4]||e[5]||"").replace(et,tt),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||st.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&st.error(e[0]),e},PSEUDO:function(e){var t,n=!e[5]&&e[2];return U.CHILD.test(e[0])?null:(e[4]?e[2]=e[4]:n&&z.test(n)&&(t=ft(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){return"*"===e?function(){return!0}:(e=e.replace(et,tt).toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=k[e+" "];return t||(t=RegExp("(^|"+_+")"+e+"("+_+"|$)"))&&k(e,function(e){return t.test(e.className||typeof e.getAttribute!==A&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=st.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,p,f,d,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!u&&!s;if(m){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===y:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&v){c=m[x]||(m[x]={}),l=c[e]||[],d=l[0]===N&&l[1],f=l[0]===N&&l[2],p=d&&m.childNodes[d];while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if(1===p.nodeType&&++f&&p===t){c[e]=[N,d,f];break}}else if(v&&(l=(t[x]||(t[x]={}))[e])&&l[0]===N)f=l[1];else while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===y:1===p.nodeType)&&++f&&(v&&((p[x]||(p[x]={}))[e]=[N,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||st.error("unsupported pseudo: "+e);return r[x]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?ot(function(e,n){var i,o=r(e,t),a=o.length;while(a--)i=M.call(e,o[a]),e[i]=!(n[i]=o[a])}):function(e){return r(e,0,n)}):r}},pseudos:{not:ot(function(e){var t=[],n=[],r=s(e.replace(W,"$1"));return r[x]?ot(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:ot(function(e){return function(t){return st(e,t).length>0}}),contains:ot(function(e){return function(t){return(t.textContent||t.innerText||o(t)).indexOf(e)>-1}}),lang:ot(function(e){return X.test(e||"")||st.error("unsupported lang: "+e),e=e.replace(et,tt).toLowerCase(),function(t){var n;do if(n=d?t.getAttribute("xml:lang")||t.getAttribute("lang"):t.lang)return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===f},focus:function(e){return e===p.activeElement&&(!p.hasFocus||p.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!i.pseudos.empty(e)},header:function(e){return Q.test(e.nodeName)},input:function(e){return G.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:pt(function(){return[0]}),last:pt(function(e,t){return[t-1]}),eq:pt(function(e,t,n){return[0>n?n+t:n]}),even:pt(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:pt(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:pt(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:pt(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}};for(n in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})i.pseudos[n]=lt(n);for(n in{submit:!0,reset:!0})i.pseudos[n]=ct(n);function ft(e,t){var n,r,o,a,s,u,l,c=E[e+" "];if(c)return t?0:c.slice(0);s=e,u=[],l=i.preFilter;while(s){(!n||(r=$.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),u.push(o=[])),n=!1,(r=I.exec(s))&&(n=r.shift(),o.push({value:n,type:r[0].replace(W," ")}),s=s.slice(n.length));for(a in i.filter)!(r=U[a].exec(s))||l[a]&&!(r=l[a](r))||(n=r.shift(),o.push({value:n,type:a,matches:r}),s=s.slice(n.length));if(!n)break}return t?s.length:s?st.error(e):E(e,u).slice(0)}function dt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function ht(e,t,n){var i=t.dir,o=n&&"parentNode"===i,a=C++;return t.first?function(t,n,r){while(t=t[i])if(1===t.nodeType||o)return e(t,n,r)}:function(t,n,s){var u,l,c,p=N+" "+a;if(s){while(t=t[i])if((1===t.nodeType||o)&&e(t,n,s))return!0}else while(t=t[i])if(1===t.nodeType||o)if(c=t[x]||(t[x]={}),(l=c[i])&&l[0]===p){if((u=l[1])===!0||u===r)return u===!0}else if(l=c[i]=[p],l[1]=e(t,n,s)||r,l[1]===!0)return!0}}function gt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function mt(e,t,n,r,i){var o,a=[],s=0,u=e.length,l=null!=t;for(;u>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),l&&t.push(s));return a}function yt(e,t,n,r,i,o){return r&&!r[x]&&(r=yt(r)),i&&!i[x]&&(i=yt(i,o)),ot(function(o,a,s,u){var l,c,p,f=[],d=[],h=a.length,g=o||xt(t||"*",s.nodeType?[s]:s,[]),m=!e||!o&&t?g:mt(g,f,e,s,u),y=n?i||(o?e:h||r)?[]:a:m;if(n&&n(m,y,s,u),r){l=mt(y,d),r(l,[],s,u),c=l.length;while(c--)(p=l[c])&&(y[d[c]]=!(m[d[c]]=p))}if(o){if(i||e){if(i){l=[],c=y.length;while(c--)(p=y[c])&&l.push(m[c]=p);i(null,y=[],l,u)}c=y.length;while(c--)(p=y[c])&&(l=i?M.call(o,p):f[c])>-1&&(o[l]=!(a[l]=p))}}else y=mt(y===a?y.splice(h,y.length):y),i?i(null,a,y,u):H.apply(a,y)})}function vt(e){var t,n,r,o=e.length,a=i.relative[e[0].type],s=a||i.relative[" "],u=a?1:0,c=ht(function(e){return e===t},s,!0),p=ht(function(e){return M.call(t,e)>-1},s,!0),f=[function(e,n,r){return!a&&(r||n!==l)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;o>u;u++)if(n=i.relative[e[u].type])f=[ht(gt(f),n)];else{if(n=i.filter[e[u].type].apply(null,e[u].matches),n[x]){for(r=++u;o>r;r++)if(i.relative[e[r].type])break;return yt(u>1&>(f),u>1&&dt(e.slice(0,u-1)).replace(W,"$1"),n,r>u&&vt(e.slice(u,r)),o>r&&vt(e=e.slice(r)),o>r&&dt(e))}f.push(n)}return gt(f)}function bt(e,t){var n=0,o=t.length>0,a=e.length>0,s=function(s,u,c,f,d){var h,g,m,y=[],v=0,b="0",x=s&&[],w=null!=d,T=l,C=s||a&&i.find.TAG("*",d&&u.parentNode||u),k=N+=null==T?1:Math.random()||.1;for(w&&(l=u!==p&&u,r=n);null!=(h=C[b]);b++){if(a&&h){g=0;while(m=e[g++])if(m(h,u,c)){f.push(h);break}w&&(N=k,r=++n)}o&&((h=!m&&h)&&v--,s&&x.push(h))}if(v+=b,o&&b!==v){g=0;while(m=t[g++])m(x,y,u,c);if(s){if(v>0)while(b--)x[b]||y[b]||(y[b]=L.call(f));y=mt(y)}H.apply(f,y),w&&!s&&y.length>0&&v+t.length>1&&st.uniqueSort(f)}return w&&(N=k,l=T),x};return o?ot(s):s}s=st.compile=function(e,t){var n,r=[],i=[],o=S[e+" "];if(!o){t||(t=ft(e)),n=t.length;while(n--)o=vt(t[n]),o[x]?r.push(o):i.push(o);o=S(e,bt(i,r))}return o};function xt(e,t,n){var r=0,i=t.length;for(;i>r;r++)st(e,t[r],n);return n}function wt(e,t,n,r){var o,a,u,l,c,p=ft(e);if(!r&&1===p.length){if(a=p[0]=p[0].slice(0),a.length>2&&"ID"===(u=a[0]).type&&9===t.nodeType&&!d&&i.relative[a[1].type]){if(t=i.find.ID(u.matches[0].replace(et,tt),t)[0],!t)return n;e=e.slice(a.shift().value.length)}o=U.needsContext.test(e)?0:a.length;while(o--){if(u=a[o],i.relative[l=u.type])break;if((c=i.find[l])&&(r=c(u.matches[0].replace(et,tt),V.test(a[0].type)&&t.parentNode||t))){if(a.splice(o,1),e=r.length&&dt(a),!e)return H.apply(n,q.call(r,0)),n;break}}}return s(e,p)(r,t,d,n,V.test(e)),n}i.pseudos.nth=i.pseudos.eq;function Tt(){}i.filters=Tt.prototype=i.pseudos,i.setFilters=new Tt,c(),st.attr=b.attr,b.find=st,b.expr=st.selectors,b.expr[":"]=b.expr.pseudos,b.unique=st.uniqueSort,b.text=st.getText,b.isXMLDoc=st.isXML,b.contains=st.contains}(e);var at=/Until$/,st=/^(?:parents|prev(?:Until|All))/,ut=/^.[^:#\[\.,]*$/,lt=b.expr.match.needsContext,ct={children:!0,contents:!0,next:!0,prev:!0};b.fn.extend({find:function(e){var t,n,r,i=this.length;if("string"!=typeof e)return r=this,this.pushStack(b(e).filter(function(){for(t=0;i>t;t++)if(b.contains(r[t],this))return!0}));for(n=[],t=0;i>t;t++)b.find(e,this[t],n);return n=this.pushStack(i>1?b.unique(n):n),n.selector=(this.selector?this.selector+" ":"")+e,n},has:function(e){var t,n=b(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(b.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e,!1))},filter:function(e){return this.pushStack(ft(this,e,!0))},is:function(e){return!!e&&("string"==typeof e?lt.test(e)?b(e,this.context).index(this[0])>=0:b.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,o=[],a=lt.test(e)||"string"!=typeof e?b(e,t||this.context):0;for(;i>r;r++){n=this[r];while(n&&n.ownerDocument&&n!==t&&11!==n.nodeType){if(a?a.index(n)>-1:b.find.matchesSelector(n,e)){o.push(n);break}n=n.parentNode}}return this.pushStack(o.length>1?b.unique(o):o)},index:function(e){return e?"string"==typeof e?b.inArray(this[0],b(e)):b.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?b(e,t):b.makeArray(e&&e.nodeType?[e]:e),r=b.merge(this.get(),n);return this.pushStack(b.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),b.fn.andSelf=b.fn.addBack;function pt(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}b.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return b.dir(e,"parentNode")},parentsUntil:function(e,t,n){return b.dir(e,"parentNode",n)},next:function(e){return pt(e,"nextSibling")},prev:function(e){return pt(e,"previousSibling")},nextAll:function(e){return b.dir(e,"nextSibling")},prevAll:function(e){return b.dir(e,"previousSibling")},nextUntil:function(e,t,n){return b.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return b.dir(e,"previousSibling",n)},siblings:function(e){return b.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return b.sibling(e.firstChild)},contents:function(e){return b.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:b.merge([],e.childNodes)}},function(e,t){b.fn[e]=function(n,r){var i=b.map(this,t,n);return at.test(e)||(r=n),r&&"string"==typeof r&&(i=b.filter(r,i)),i=this.length>1&&!ct[e]?b.unique(i):i,this.length>1&&st.test(e)&&(i=i.reverse()),this.pushStack(i)}}),b.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),1===t.length?b.find.matchesSelector(t[0],e)?[t[0]]:[]:b.find.matches(e,t)},dir:function(e,n,r){var i=[],o=e[n];while(o&&9!==o.nodeType&&(r===t||1!==o.nodeType||!b(o).is(r)))1===o.nodeType&&i.push(o),o=o[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});function ft(e,t,n){if(t=t||0,b.isFunction(t))return b.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return b.grep(e,function(e){return e===t===n});if("string"==typeof t){var r=b.grep(e,function(e){return 1===e.nodeType});if(ut.test(t))return b.filter(t,r,!n);t=b.filter(t,r)}return b.grep(e,function(e){return b.inArray(e,t)>=0===n})}function dt(e){var t=ht.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}var ht="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",gt=/ jQuery\d+="(?:null|\d+)"/g,mt=RegExp("<(?:"+ht+")[\\s/>]","i"),yt=/^\s+/,vt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bt=/<([\w:]+)/,xt=/<tbody/i,wt=/<|&#?\w+;/,Tt=/<(?:script|style|link)/i,Nt=/^(?:checkbox|radio)$/i,Ct=/checked\s*(?:[^=]|=\s*.checked.)/i,kt=/^$|\/(?:java|ecma)script/i,Et=/^true\/(.*)/,St=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,At={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:b.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},jt=dt(o),Dt=jt.appendChild(o.createElement("div"));At.optgroup=At.option,At.tbody=At.tfoot=At.colgroup=At.caption=At.thead,At.th=At.td,b.fn.extend({text:function(e){return b.access(this,function(e){return e===t?b.text(this):this.empty().append((this[0]&&this[0].ownerDocument||o).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(b.isFunction(e))return this.each(function(t){b(this).wrapAll(e.call(this,t))});if(this[0]){var t=b(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&1===e.firstChild.nodeType)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return b.isFunction(e)?this.each(function(t){b(this).wrapInner(e.call(this,t))}):this.each(function(){var t=b(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=b.isFunction(e);return this.each(function(n){b(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){b.nodeName(this,"body")||b(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.insertBefore(e,this.firstChild)})},before:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=0;for(;null!=(n=this[r]);r++)(!e||b.filter(e,[n]).length>0)&&(t||1!==n.nodeType||b.cleanData(Ot(n)),n.parentNode&&(t&&b.contains(n.ownerDocument,n)&&Mt(Ot(n,"script")),n.parentNode.removeChild(n)));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++){1===e.nodeType&&b.cleanData(Ot(e,!1));while(e.firstChild)e.removeChild(e.firstChild);e.options&&b.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return b.clone(this,e,t)})},html:function(e){return b.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return 1===n.nodeType?n.innerHTML.replace(gt,""):t;if(!("string"!=typeof e||Tt.test(e)||!b.support.htmlSerialize&&mt.test(e)||!b.support.leadingWhitespace&&yt.test(e)||At[(bt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(vt,"<$1></$2>");try{for(;i>r;r++)n=this[r]||{},1===n.nodeType&&(b.cleanData(Ot(n,!1)),n.innerHTML=e);n=0}catch(o){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){var t=b.isFunction(e);return t||"string"==typeof e||(e=b(e).not(this).detach()),this.domManip([e],!0,function(e){var t=this.nextSibling,n=this.parentNode;n&&(b(this).remove(),n.insertBefore(e,t))})},detach:function(e){return this.remove(e,!0)},domManip:function(e,n,r){e=f.apply([],e);var i,o,a,s,u,l,c=0,p=this.length,d=this,h=p-1,g=e[0],m=b.isFunction(g);if(m||!(1>=p||"string"!=typeof g||b.support.checkClone)&&Ct.test(g))return this.each(function(i){var o=d.eq(i);m&&(e[0]=g.call(this,i,n?o.html():t)),o.domManip(e,n,r)});if(p&&(l=b.buildFragment(e,this[0].ownerDocument,!1,this),i=l.firstChild,1===l.childNodes.length&&(l=i),i)){for(n=n&&b.nodeName(i,"tr"),s=b.map(Ot(l,"script"),Ht),a=s.length;p>c;c++)o=l,c!==h&&(o=b.clone(o,!0,!0),a&&b.merge(s,Ot(o,"script"))),r.call(n&&b.nodeName(this[c],"table")?Lt(this[c],"tbody"):this[c],o,c);if(a)for(u=s[s.length-1].ownerDocument,b.map(s,qt),c=0;a>c;c++)o=s[c],kt.test(o.type||"")&&!b._data(o,"globalEval")&&b.contains(u,o)&&(o.src?b.ajax({url:o.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):b.globalEval((o.text||o.textContent||o.innerHTML||"").replace(St,"")));l=i=null}return this}});function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function Ht(e){var t=e.getAttributeNode("type");return e.type=(t&&t.specified)+"/"+e.type,e}function qt(e){var t=Et.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function Mt(e,t){var n,r=0;for(;null!=(n=e[r]);r++)b._data(n,"globalEval",!t||b._data(t[r],"globalEval"))}function _t(e,t){if(1===t.nodeType&&b.hasData(e)){var n,r,i,o=b._data(e),a=b._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)b.event.add(t,n,s[n][r])}a.data&&(a.data=b.extend({},a.data))}}function Ft(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!b.support.noCloneEvent&&t[b.expando]){i=b._data(t);for(r in i.events)b.removeEvent(t,r,i.handle);t.removeAttribute(b.expando)}"script"===n&&t.text!==e.text?(Ht(t).text=e.text,qt(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),b.support.html5Clone&&e.innerHTML&&!b.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Nt.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}b.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){b.fn[e]=function(e){var n,r=0,i=[],o=b(e),a=o.length-1;for(;a>=r;r++)n=r===a?this:this.clone(!0),b(o[r])[t](n),d.apply(i,n.get());return this.pushStack(i)}});function Ot(e,n){var r,o,a=0,s=typeof e.getElementsByTagName!==i?e.getElementsByTagName(n||"*"):typeof e.querySelectorAll!==i?e.querySelectorAll(n||"*"):t;if(!s)for(s=[],r=e.childNodes||e;null!=(o=r[a]);a++)!n||b.nodeName(o,n)?s.push(o):b.merge(s,Ot(o,n));return n===t||n&&b.nodeName(e,n)?b.merge([e],s):s}function Bt(e){Nt.test(e.type)&&(e.defaultChecked=e.checked)}b.extend({clone:function(e,t,n){var r,i,o,a,s,u=b.contains(e.ownerDocument,e);if(b.support.html5Clone||b.isXMLDoc(e)||!mt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(Dt.innerHTML=e.outerHTML,Dt.removeChild(o=Dt.firstChild)),!(b.support.noCloneEvent&&b.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||b.isXMLDoc(e)))for(r=Ot(o),s=Ot(e),a=0;null!=(i=s[a]);++a)r[a]&&Ft(i,r[a]);if(t)if(n)for(s=s||Ot(e),r=r||Ot(o),a=0;null!=(i=s[a]);a++)_t(i,r[a]);else _t(e,o);return r=Ot(o,"script"),r.length>0&&Mt(r,!u&&Ot(e,"script")),r=s=i=null,o},buildFragment:function(e,t,n,r){var i,o,a,s,u,l,c,p=e.length,f=dt(t),d=[],h=0;for(;p>h;h++)if(o=e[h],o||0===o)if("object"===b.type(o))b.merge(d,o.nodeType?[o]:o);else if(wt.test(o)){s=s||f.appendChild(t.createElement("div")),u=(bt.exec(o)||["",""])[1].toLowerCase(),c=At[u]||At._default,s.innerHTML=c[1]+o.replace(vt,"<$1></$2>")+c[2],i=c[0];while(i--)s=s.lastChild;if(!b.support.leadingWhitespace&&yt.test(o)&&d.push(t.createTextNode(yt.exec(o)[0])),!b.support.tbody){o="table"!==u||xt.test(o)?"<table>"!==c[1]||xt.test(o)?0:s:s.firstChild,i=o&&o.childNodes.length;while(i--)b.nodeName(l=o.childNodes[i],"tbody")&&!l.childNodes.length&&o.removeChild(l)
}b.merge(d,s.childNodes),s.textContent="";while(s.firstChild)s.removeChild(s.firstChild);s=f.lastChild}else d.push(t.createTextNode(o));s&&f.removeChild(s),b.support.appendChecked||b.grep(Ot(d,"input"),Bt),h=0;while(o=d[h++])if((!r||-1===b.inArray(o,r))&&(a=b.contains(o.ownerDocument,o),s=Ot(f.appendChild(o),"script"),a&&Mt(s),n)){i=0;while(o=s[i++])kt.test(o.type||"")&&n.push(o)}return s=null,f},cleanData:function(e,t){var n,r,o,a,s=0,u=b.expando,l=b.cache,p=b.support.deleteExpando,f=b.event.special;for(;null!=(n=e[s]);s++)if((t||b.acceptData(n))&&(o=n[u],a=o&&l[o])){if(a.events)for(r in a.events)f[r]?b.event.remove(n,r):b.removeEvent(n,r,a.handle);l[o]&&(delete l[o],p?delete n[u]:typeof n.removeAttribute!==i?n.removeAttribute(u):n[u]=null,c.push(o))}}});var Pt,Rt,Wt,$t=/alpha\([^)]*\)/i,It=/opacity\s*=\s*([^)]*)/,zt=/^(top|right|bottom|left)$/,Xt=/^(none|table(?!-c[ea]).+)/,Ut=/^margin/,Vt=RegExp("^("+x+")(.*)$","i"),Yt=RegExp("^("+x+")(?!px)[a-z%]+$","i"),Jt=RegExp("^([+-])=("+x+")","i"),Gt={BODY:"block"},Qt={position:"absolute",visibility:"hidden",display:"block"},Kt={letterSpacing:0,fontWeight:400},Zt=["Top","Right","Bottom","Left"],en=["Webkit","O","Moz","ms"];function tn(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=en.length;while(i--)if(t=en[i]+n,t in e)return t;return r}function nn(e,t){return e=t||e,"none"===b.css(e,"display")||!b.contains(e.ownerDocument,e)}function rn(e,t){var n,r,i,o=[],a=0,s=e.length;for(;s>a;a++)r=e[a],r.style&&(o[a]=b._data(r,"olddisplay"),n=r.style.display,t?(o[a]||"none"!==n||(r.style.display=""),""===r.style.display&&nn(r)&&(o[a]=b._data(r,"olddisplay",un(r.nodeName)))):o[a]||(i=nn(r),(n&&"none"!==n||!i)&&b._data(r,"olddisplay",i?n:b.css(r,"display"))));for(a=0;s>a;a++)r=e[a],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[a]||"":"none"));return e}b.fn.extend({css:function(e,n){return b.access(this,function(e,n,r){var i,o,a={},s=0;if(b.isArray(n)){for(o=Rt(e),i=n.length;i>s;s++)a[n[s]]=b.css(e,n[s],!1,o);return a}return r!==t?b.style(e,n,r):b.css(e,n)},e,n,arguments.length>1)},show:function(){return rn(this,!0)},hide:function(){return rn(this)},toggle:function(e){var t="boolean"==typeof e;return this.each(function(){(t?e:nn(this))?b(this).show():b(this).hide()})}}),b.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Wt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":b.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,u=b.camelCase(n),l=e.style;if(n=b.cssProps[u]||(b.cssProps[u]=tn(l,u)),s=b.cssHooks[n]||b.cssHooks[u],r===t)return s&&"get"in s&&(o=s.get(e,!1,i))!==t?o:l[n];if(a=typeof r,"string"===a&&(o=Jt.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(b.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||b.cssNumber[u]||(r+="px"),b.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(l[n]="inherit"),s&&"set"in s&&(r=s.set(e,r,i))===t)))try{l[n]=r}catch(c){}}},css:function(e,n,r,i){var o,a,s,u=b.camelCase(n);return n=b.cssProps[u]||(b.cssProps[u]=tn(e.style,u)),s=b.cssHooks[n]||b.cssHooks[u],s&&"get"in s&&(a=s.get(e,!0,r)),a===t&&(a=Wt(e,n,i)),"normal"===a&&n in Kt&&(a=Kt[n]),""===r||r?(o=parseFloat(a),r===!0||b.isNumeric(o)?o||0:a):a},swap:function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i}}),e.getComputedStyle?(Rt=function(t){return e.getComputedStyle(t,null)},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),u=s?s.getPropertyValue(n)||s[n]:t,l=e.style;return s&&(""!==u||b.contains(e.ownerDocument,e)||(u=b.style(e,n)),Yt.test(u)&&Ut.test(n)&&(i=l.width,o=l.minWidth,a=l.maxWidth,l.minWidth=l.maxWidth=l.width=u,u=s.width,l.width=i,l.minWidth=o,l.maxWidth=a)),u}):o.documentElement.currentStyle&&(Rt=function(e){return e.currentStyle},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),u=s?s[n]:t,l=e.style;return null==u&&l&&l[n]&&(u=l[n]),Yt.test(u)&&!zt.test(n)&&(i=l.left,o=e.runtimeStyle,a=o&&o.left,a&&(o.left=e.currentStyle.left),l.left="fontSize"===n?"1em":u,u=l.pixelLeft+"px",l.left=i,a&&(o.left=a)),""===u?"auto":u});function on(e,t,n){var r=Vt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function an(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;for(;4>o;o+=2)"margin"===n&&(a+=b.css(e,n+Zt[o],!0,i)),r?("content"===n&&(a-=b.css(e,"padding"+Zt[o],!0,i)),"margin"!==n&&(a-=b.css(e,"border"+Zt[o]+"Width",!0,i))):(a+=b.css(e,"padding"+Zt[o],!0,i),"padding"!==n&&(a+=b.css(e,"border"+Zt[o]+"Width",!0,i)));return a}function sn(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=Rt(e),a=b.support.boxSizing&&"border-box"===b.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=Wt(e,t,o),(0>i||null==i)&&(i=e.style[t]),Yt.test(i))return i;r=a&&(b.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+an(e,t,n||(a?"border":"content"),r,o)+"px"}function un(e){var t=o,n=Gt[e];return n||(n=ln(e,t),"none"!==n&&n||(Pt=(Pt||b("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement),t=(Pt[0].contentWindow||Pt[0].contentDocument).document,t.write("<!doctype html><html><body>"),t.close(),n=ln(e,t),Pt.detach()),Gt[e]=n),n}function ln(e,t){var n=b(t.createElement(e)).appendTo(t.body),r=b.css(n[0],"display");return n.remove(),r}b.each(["height","width"],function(e,n){b.cssHooks[n]={get:function(e,r,i){return r?0===e.offsetWidth&&Xt.test(b.css(e,"display"))?b.swap(e,Qt,function(){return sn(e,n,i)}):sn(e,n,i):t},set:function(e,t,r){var i=r&&Rt(e);return on(e,t,r?an(e,n,r,b.support.boxSizing&&"border-box"===b.css(e,"boxSizing",!1,i),i):0)}}}),b.support.opacity||(b.cssHooks.opacity={get:function(e,t){return It.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=b.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=r&&r.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===b.trim(o.replace($t,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||r&&!r.filter)||(n.filter=$t.test(o)?o.replace($t,i):o+" "+i)}}),b(function(){b.support.reliableMarginRight||(b.cssHooks.marginRight={get:function(e,n){return n?b.swap(e,{display:"inline-block"},Wt,[e,"marginRight"]):t}}),!b.support.pixelPosition&&b.fn.position&&b.each(["top","left"],function(e,n){b.cssHooks[n]={get:function(e,r){return r?(r=Wt(e,n),Yt.test(r)?b(e).position()[n]+"px":r):t}}})}),b.expr&&b.expr.filters&&(b.expr.filters.hidden=function(e){return 0>=e.offsetWidth&&0>=e.offsetHeight||!b.support.reliableHiddenOffsets&&"none"===(e.style&&e.style.display||b.css(e,"display"))},b.expr.filters.visible=function(e){return!b.expr.filters.hidden(e)}),b.each({margin:"",padding:"",border:"Width"},function(e,t){b.cssHooks[e+t]={expand:function(n){var r=0,i={},o="string"==typeof n?n.split(" "):[n];for(;4>r;r++)i[e+Zt[r]+t]=o[r]||o[r-2]||o[0];return i}},Ut.test(e)||(b.cssHooks[e+t].set=on)});var cn=/%20/g,pn=/\[\]$/,fn=/\r?\n/g,dn=/^(?:submit|button|image|reset|file)$/i,hn=/^(?:input|select|textarea|keygen)/i;b.fn.extend({serialize:function(){return b.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=b.prop(this,"elements");return e?b.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!b(this).is(":disabled")&&hn.test(this.nodeName)&&!dn.test(e)&&(this.checked||!Nt.test(e))}).map(function(e,t){var n=b(this).val();return null==n?null:b.isArray(n)?b.map(n,function(e){return{name:t.name,value:e.replace(fn,"\r\n")}}):{name:t.name,value:n.replace(fn,"\r\n")}}).get()}}),b.param=function(e,n){var r,i=[],o=function(e,t){t=b.isFunction(t)?t():null==t?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(n===t&&(n=b.ajaxSettings&&b.ajaxSettings.traditional),b.isArray(e)||e.jquery&&!b.isPlainObject(e))b.each(e,function(){o(this.name,this.value)});else for(r in e)gn(r,e[r],n,o);return i.join("&").replace(cn,"+")};function gn(e,t,n,r){var i;if(b.isArray(t))b.each(t,function(t,i){n||pn.test(e)?r(e,i):gn(e+"["+("object"==typeof i?t:"")+"]",i,n,r)});else if(n||"object"!==b.type(t))r(e,t);else for(i in t)gn(e+"["+i+"]",t[i],n,r)}b.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){b.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),b.fn.hover=function(e,t){return this.mouseenter(e).mouseleave(t||e)};var mn,yn,vn=b.now(),bn=/\?/,xn=/#.*$/,wn=/([?&])_=[^&]*/,Tn=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Nn=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Cn=/^(?:GET|HEAD)$/,kn=/^\/\//,En=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,Sn=b.fn.load,An={},jn={},Dn="*/".concat("*");try{yn=a.href}catch(Ln){yn=o.createElement("a"),yn.href="",yn=yn.href}mn=En.exec(yn.toLowerCase())||[];function Hn(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(w)||[];if(b.isFunction(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function qn(e,n,r,i){var o={},a=e===jn;function s(u){var l;return o[u]=!0,b.each(e[u]||[],function(e,u){var c=u(n,r,i);return"string"!=typeof c||a||o[c]?a?!(l=c):t:(n.dataTypes.unshift(c),s(c),!1)}),l}return s(n.dataTypes[0])||!o["*"]&&s("*")}function Mn(e,n){var r,i,o=b.ajaxSettings.flatOptions||{};for(i in n)n[i]!==t&&((o[i]?e:r||(r={}))[i]=n[i]);return r&&b.extend(!0,e,r),e}b.fn.load=function(e,n,r){if("string"!=typeof e&&Sn)return Sn.apply(this,arguments);var i,o,a,s=this,u=e.indexOf(" ");return u>=0&&(i=e.slice(u,e.length),e=e.slice(0,u)),b.isFunction(n)?(r=n,n=t):n&&"object"==typeof n&&(a="POST"),s.length>0&&b.ajax({url:e,type:a,dataType:"html",data:n}).done(function(e){o=arguments,s.html(i?b("<div>").append(b.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){s.each(r,o||[e.responseText,t,e])}),this},b.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){b.fn[t]=function(e){return this.on(t,e)}}),b.each(["get","post"],function(e,n){b[n]=function(e,r,i,o){return b.isFunction(r)&&(o=o||i,i=r,r=t),b.ajax({url:e,type:n,dataType:o,data:r,success:i})}}),b.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:yn,type:"GET",isLocal:Nn.test(mn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Dn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":b.parseJSON,"text xml":b.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Mn(Mn(e,b.ajaxSettings),t):Mn(b.ajaxSettings,e)},ajaxPrefilter:Hn(An),ajaxTransport:Hn(jn),ajax:function(e,n){"object"==typeof e&&(n=e,e=t),n=n||{};var r,i,o,a,s,u,l,c,p=b.ajaxSetup({},n),f=p.context||p,d=p.context&&(f.nodeType||f.jquery)?b(f):b.event,h=b.Deferred(),g=b.Callbacks("once memory"),m=p.statusCode||{},y={},v={},x=0,T="canceled",N={readyState:0,getResponseHeader:function(e){var t;if(2===x){if(!c){c={};while(t=Tn.exec(a))c[t[1].toLowerCase()]=t[2]}t=c[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===x?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return x||(e=v[n]=v[n]||e,y[e]=t),this},overrideMimeType:function(e){return x||(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>x)for(t in e)m[t]=[m[t],e[t]];else N.always(e[N.status]);return this},abort:function(e){var t=e||T;return l&&l.abort(t),k(0,t),this}};if(h.promise(N).complete=g.add,N.success=N.done,N.error=N.fail,p.url=((e||p.url||yn)+"").replace(xn,"").replace(kn,mn[1]+"//"),p.type=n.method||n.type||p.method||p.type,p.dataTypes=b.trim(p.dataType||"*").toLowerCase().match(w)||[""],null==p.crossDomain&&(r=En.exec(p.url.toLowerCase()),p.crossDomain=!(!r||r[1]===mn[1]&&r[2]===mn[2]&&(r[3]||("http:"===r[1]?80:443))==(mn[3]||("http:"===mn[1]?80:443)))),p.data&&p.processData&&"string"!=typeof p.data&&(p.data=b.param(p.data,p.traditional)),qn(An,p,n,N),2===x)return N;u=p.global,u&&0===b.active++&&b.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Cn.test(p.type),o=p.url,p.hasContent||(p.data&&(o=p.url+=(bn.test(o)?"&":"?")+p.data,delete p.data),p.cache===!1&&(p.url=wn.test(o)?o.replace(wn,"$1_="+vn++):o+(bn.test(o)?"&":"?")+"_="+vn++)),p.ifModified&&(b.lastModified[o]&&N.setRequestHeader("If-Modified-Since",b.lastModified[o]),b.etag[o]&&N.setRequestHeader("If-None-Match",b.etag[o])),(p.data&&p.hasContent&&p.contentType!==!1||n.contentType)&&N.setRequestHeader("Content-Type",p.contentType),N.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+Dn+"; q=0.01":""):p.accepts["*"]);for(i in p.headers)N.setRequestHeader(i,p.headers[i]);if(p.beforeSend&&(p.beforeSend.call(f,N,p)===!1||2===x))return N.abort();T="abort";for(i in{success:1,error:1,complete:1})N[i](p[i]);if(l=qn(jn,p,n,N)){N.readyState=1,u&&d.trigger("ajaxSend",[N,p]),p.async&&p.timeout>0&&(s=setTimeout(function(){N.abort("timeout")},p.timeout));try{x=1,l.send(y,k)}catch(C){if(!(2>x))throw C;k(-1,C)}}else k(-1,"No Transport");function k(e,n,r,i){var c,y,v,w,T,C=n;2!==x&&(x=2,s&&clearTimeout(s),l=t,a=i||"",N.readyState=e>0?4:0,r&&(w=_n(p,N,r)),e>=200&&300>e||304===e?(p.ifModified&&(T=N.getResponseHeader("Last-Modified"),T&&(b.lastModified[o]=T),T=N.getResponseHeader("etag"),T&&(b.etag[o]=T)),204===e?(c=!0,C="nocontent"):304===e?(c=!0,C="notmodified"):(c=Fn(p,w),C=c.state,y=c.data,v=c.error,c=!v)):(v=C,(e||!C)&&(C="error",0>e&&(e=0))),N.status=e,N.statusText=(n||C)+"",c?h.resolveWith(f,[y,C,N]):h.rejectWith(f,[N,C,v]),N.statusCode(m),m=t,u&&d.trigger(c?"ajaxSuccess":"ajaxError",[N,p,c?y:v]),g.fireWith(f,[N,C]),u&&(d.trigger("ajaxComplete",[N,p]),--b.active||b.event.trigger("ajaxStop")))}return N},getScript:function(e,n){return b.get(e,t,n,"script")},getJSON:function(e,t,n){return b.get(e,t,n,"json")}});function _n(e,n,r){var i,o,a,s,u=e.contents,l=e.dataTypes,c=e.responseFields;for(s in c)s in r&&(n[c[s]]=r[s]);while("*"===l[0])l.shift(),o===t&&(o=e.mimeType||n.getResponseHeader("Content-Type"));if(o)for(s in u)if(u[s]&&u[s].test(o)){l.unshift(s);break}if(l[0]in r)a=l[0];else{for(s in r){if(!l[0]||e.converters[s+" "+l[0]]){a=s;break}i||(i=s)}a=a||i}return a?(a!==l[0]&&l.unshift(a),r[a]):t}function Fn(e,t){var n,r,i,o,a={},s=0,u=e.dataTypes.slice(),l=u[0];if(e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u[1])for(i in e.converters)a[i.toLowerCase()]=e.converters[i];for(;r=u[++s];)if("*"!==r){if("*"!==l&&l!==r){if(i=a[l+" "+r]||a["* "+r],!i)for(n in a)if(o=n.split(" "),o[1]===r&&(i=a[l+" "+o[0]]||a["* "+o[0]])){i===!0?i=a[n]:a[n]!==!0&&(r=o[0],u.splice(s--,0,r));break}if(i!==!0)if(i&&e["throws"])t=i(t);else try{t=i(t)}catch(c){return{state:"parsererror",error:i?c:"No conversion from "+l+" to "+r}}}l=r}return{state:"success",data:t}}b.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return b.globalEval(e),e}}}),b.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),b.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=o.head||b("head")[0]||o.documentElement;return{send:function(t,i){n=o.createElement("script"),n.async=!0,e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,t){(t||!n.readyState||/loaded|complete/.test(n.readyState))&&(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),n=null,t||i(200,"success"))},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(t,!0)}}}});var On=[],Bn=/(=)\?(?=&|$)|\?\?/;b.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=On.pop()||b.expando+"_"+vn++;return this[e]=!0,e}}),b.ajaxPrefilter("json jsonp",function(n,r,i){var o,a,s,u=n.jsonp!==!1&&(Bn.test(n.url)?"url":"string"==typeof n.data&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Bn.test(n.data)&&"data");return u||"jsonp"===n.dataTypes[0]?(o=n.jsonpCallback=b.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,u?n[u]=n[u].replace(Bn,"$1"+o):n.jsonp!==!1&&(n.url+=(bn.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return s||b.error(o+" was not called"),s[0]},n.dataTypes[0]="json",a=e[o],e[o]=function(){s=arguments},i.always(function(){e[o]=a,n[o]&&(n.jsonpCallback=r.jsonpCallback,On.push(o)),s&&b.isFunction(a)&&a(s[0]),s=a=t}),"script"):t});var Pn,Rn,Wn=0,$n=e.ActiveXObject&&function(){var e;for(e in Pn)Pn[e](t,!0)};function In(){try{return new e.XMLHttpRequest}catch(t){}}function zn(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}b.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&In()||zn()}:In,Rn=b.ajaxSettings.xhr(),b.support.cors=!!Rn&&"withCredentials"in Rn,Rn=b.support.ajax=!!Rn,Rn&&b.ajaxTransport(function(n){if(!n.crossDomain||b.support.cors){var r;return{send:function(i,o){var a,s,u=n.xhr();if(n.username?u.open(n.type,n.url,n.async,n.username,n.password):u.open(n.type,n.url,n.async),n.xhrFields)for(s in n.xhrFields)u[s]=n.xhrFields[s];n.mimeType&&u.overrideMimeType&&u.overrideMimeType(n.mimeType),n.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");try{for(s in i)u.setRequestHeader(s,i[s])}catch(l){}u.send(n.hasContent&&n.data||null),r=function(e,i){var s,l,c,p;try{if(r&&(i||4===u.readyState))if(r=t,a&&(u.onreadystatechange=b.noop,$n&&delete Pn[a]),i)4!==u.readyState&&u.abort();else{p={},s=u.status,l=u.getAllResponseHeaders(),"string"==typeof u.responseText&&(p.text=u.responseText);try{c=u.statusText}catch(f){c=""}s||!n.isLocal||n.crossDomain?1223===s&&(s=204):s=p.text?200:404}}catch(d){i||o(-1,d)}p&&o(s,c,p,l)},n.async?4===u.readyState?setTimeout(r):(a=++Wn,$n&&(Pn||(Pn={},b(e).unload($n)),Pn[a]=r),u.onreadystatechange=r):r()},abort:function(){r&&r(t,!0)}}}});var Xn,Un,Vn=/^(?:toggle|show|hide)$/,Yn=RegExp("^(?:([+-])=|)("+x+")([a-z%]*)$","i"),Jn=/queueHooks$/,Gn=[nr],Qn={"*":[function(e,t){var n,r,i=this.createTween(e,t),o=Yn.exec(t),a=i.cur(),s=+a||0,u=1,l=20;if(o){if(n=+o[2],r=o[3]||(b.cssNumber[e]?"":"px"),"px"!==r&&s){s=b.css(i.elem,e,!0)||n||1;do u=u||".5",s/=u,b.style(i.elem,e,s+r);while(u!==(u=i.cur()/a)&&1!==u&&--l)}i.unit=r,i.start=s,i.end=o[1]?s+(o[1]+1)*n:n}return i}]};function Kn(){return setTimeout(function(){Xn=t}),Xn=b.now()}function Zn(e,t){b.each(t,function(t,n){var r=(Qn[t]||[]).concat(Qn["*"]),i=0,o=r.length;for(;o>i;i++)if(r[i].call(e,t,n))return})}function er(e,t,n){var r,i,o=0,a=Gn.length,s=b.Deferred().always(function(){delete u.elem}),u=function(){if(i)return!1;var t=Xn||Kn(),n=Math.max(0,l.startTime+l.duration-t),r=n/l.duration||0,o=1-r,a=0,u=l.tweens.length;for(;u>a;a++)l.tweens[a].run(o);return s.notifyWith(e,[l,o,n]),1>o&&u?n:(s.resolveWith(e,[l]),!1)},l=s.promise({elem:e,props:b.extend({},t),opts:b.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Xn||Kn(),duration:n.duration,tweens:[],createTween:function(t,n){var r=b.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)l.tweens[n].run(1);return t?s.resolveWith(e,[l,t]):s.rejectWith(e,[l,t]),this}}),c=l.props;for(tr(c,l.opts.specialEasing);a>o;o++)if(r=Gn[o].call(l,e,c,l.opts))return r;return Zn(l,c),b.isFunction(l.opts.start)&&l.opts.start.call(e,l),b.fx.timer(b.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always)}function tr(e,t){var n,r,i,o,a;for(i in e)if(r=b.camelCase(i),o=t[r],n=e[i],b.isArray(n)&&(o=n[1],n=e[i]=n[0]),i!==r&&(e[r]=n,delete e[i]),a=b.cssHooks[r],a&&"expand"in a){n=a.expand(n),delete e[r];for(i in n)i in e||(e[i]=n[i],t[i]=o)}else t[r]=o}b.Animation=b.extend(er,{tweener:function(e,t){b.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;i>r;r++)n=e[r],Qn[n]=Qn[n]||[],Qn[n].unshift(t)},prefilter:function(e,t){t?Gn.unshift(e):Gn.push(e)}});function nr(e,t,n){var r,i,o,a,s,u,l,c,p,f=this,d=e.style,h={},g=[],m=e.nodeType&&nn(e);n.queue||(c=b._queueHooks(e,"fx"),null==c.unqueued&&(c.unqueued=0,p=c.empty.fire,c.empty.fire=function(){c.unqueued||p()}),c.unqueued++,f.always(function(){f.always(function(){c.unqueued--,b.queue(e,"fx").length||c.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[d.overflow,d.overflowX,d.overflowY],"inline"===b.css(e,"display")&&"none"===b.css(e,"float")&&(b.support.inlineBlockNeedsLayout&&"inline"!==un(e.nodeName)?d.zoom=1:d.display="inline-block")),n.overflow&&(d.overflow="hidden",b.support.shrinkWrapBlocks||f.always(function(){d.overflow=n.overflow[0],d.overflowX=n.overflow[1],d.overflowY=n.overflow[2]}));for(i in t)if(a=t[i],Vn.exec(a)){if(delete t[i],u=u||"toggle"===a,a===(m?"hide":"show"))continue;g.push(i)}if(o=g.length){s=b._data(e,"fxshow")||b._data(e,"fxshow",{}),"hidden"in s&&(m=s.hidden),u&&(s.hidden=!m),m?b(e).show():f.done(function(){b(e).hide()}),f.done(function(){var t;b._removeData(e,"fxshow");for(t in h)b.style(e,t,h[t])});for(i=0;o>i;i++)r=g[i],l=f.createTween(r,m?s[r]:0),h[r]=s[r]||b.style(e,r),r in s||(s[r]=l.start,m&&(l.end=l.start,l.start="width"===r||"height"===r?1:0))}}function rr(e,t,n,r,i){return new rr.prototype.init(e,t,n,r,i)}b.Tween=rr,rr.prototype={constructor:rr,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(b.cssNumber[n]?"":"px")},cur:function(){var e=rr.propHooks[this.prop];return e&&e.get?e.get(this):rr.propHooks._default.get(this)},run:function(e){var t,n=rr.propHooks[this.prop];return this.pos=t=this.options.duration?b.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):rr.propHooks._default.set(this),this}},rr.prototype.init.prototype=rr.prototype,rr.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=b.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){b.fx.step[e.prop]?b.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[b.cssProps[e.prop]]||b.cssHooks[e.prop])?b.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},rr.propHooks.scrollTop=rr.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},b.each(["toggle","show","hide"],function(e,t){var n=b.fn[t];b.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ir(t,!0),e,r,i)}}),b.fn.extend({fadeTo:function(e,t,n,r){return this.filter(nn).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=b.isEmptyObject(e),o=b.speed(t,n,r),a=function(){var t=er(this,b.extend({},e),o);a.finish=function(){t.stop(!0)},(i||b._data(this,"finish"))&&t.stop(!0)};return a.finish=a,i||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",o=b.timers,a=b._data(this);if(n)a[n]&&a[n].stop&&i(a[n]);else for(n in a)a[n]&&a[n].stop&&Jn.test(n)&&i(a[n]);for(n=o.length;n--;)o[n].elem!==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(r),t=!1,o.splice(n,1));(t||!r)&&b.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=b._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=b.timers,a=r?r.length:0;for(n.finish=!0,b.queue(this,e,[]),i&&i.cur&&i.cur.finish&&i.cur.finish.call(this),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;a>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}});function ir(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=Zt[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}b.each({slideDown:ir("show"),slideUp:ir("hide"),slideToggle:ir("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){b.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),b.speed=function(e,t,n){var r=e&&"object"==typeof e?b.extend({},e):{complete:n||!n&&t||b.isFunction(e)&&e,duration:e,easing:n&&t||t&&!b.isFunction(t)&&t};return r.duration=b.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in b.fx.speeds?b.fx.speeds[r.duration]:b.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){b.isFunction(r.old)&&r.old.call(this),r.queue&&b.dequeue(this,r.queue)},r},b.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},b.timers=[],b.fx=rr.prototype.init,b.fx.tick=function(){var e,n=b.timers,r=0;for(Xn=b.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||b.fx.stop(),Xn=t},b.fx.timer=function(e){e()&&b.timers.push(e)&&b.fx.start()},b.fx.interval=13,b.fx.start=function(){Un||(Un=setInterval(b.fx.tick,b.fx.interval))},b.fx.stop=function(){clearInterval(Un),Un=null},b.fx.speeds={slow:600,fast:200,_default:400},b.fx.step={},b.expr&&b.expr.filters&&(b.expr.filters.animated=function(e){return b.grep(b.timers,function(t){return e===t.elem}).length}),b.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){b.offset.setOffset(this,e,t)});var n,r,o={top:0,left:0},a=this[0],s=a&&a.ownerDocument;if(s)return n=s.documentElement,b.contains(n,a)?(typeof a.getBoundingClientRect!==i&&(o=a.getBoundingClientRect()),r=or(s),{top:o.top+(r.pageYOffset||n.scrollTop)-(n.clientTop||0),left:o.left+(r.pageXOffset||n.scrollLeft)-(n.clientLeft||0)}):o},b.offset={setOffset:function(e,t,n){var r=b.css(e,"position");"static"===r&&(e.style.position="relative");var i=b(e),o=i.offset(),a=b.css(e,"top"),s=b.css(e,"left"),u=("absolute"===r||"fixed"===r)&&b.inArray("auto",[a,s])>-1,l={},c={},p,f;u?(c=i.position(),p=c.top,f=c.left):(p=parseFloat(a)||0,f=parseFloat(s)||0),b.isFunction(t)&&(t=t.call(e,n,o)),null!=t.top&&(l.top=t.top-o.top+p),null!=t.left&&(l.left=t.left-o.left+f),"using"in t?t.using.call(e,l):i.css(l)}},b.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===b.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),b.nodeName(e[0],"html")||(n=e.offset()),n.top+=b.css(e[0],"borderTopWidth",!0),n.left+=b.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-b.css(r,"marginTop",!0),left:t.left-n.left-b.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||o.documentElement;while(e&&!b.nodeName(e,"html")&&"static"===b.css(e,"position"))e=e.offsetParent;return e||o.documentElement})}}),b.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);b.fn[e]=function(i){return b.access(this,function(e,i,o){var a=or(e);return o===t?a?n in a?a[n]:a.document.documentElement[i]:e[i]:(a?a.scrollTo(r?b(a).scrollLeft():o,r?o:b(a).scrollTop()):e[i]=o,t)},e,i,arguments.length,null)}});function or(e){return b.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}b.each({Height:"height",Width:"width"},function(e,n){b.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){b.fn[i]=function(i,o){var a=arguments.length&&(r||"boolean"!=typeof i),s=r||(i===!0||o===!0?"margin":"border");return b.access(this,function(n,r,i){var o;return b.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(o=n.documentElement,Math.max(n.body["scroll"+e],o["scroll"+e],n.body["offset"+e],o["offset"+e],o["client"+e])):i===t?b.css(n,r,s):b.style(n,r,i,s)},n,a?i:t,a,null)}})}),e.jQuery=e.$=b,"function"==typeof define&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return b})})(window);
|
assets/javascripts/kitten/components/graphics/icons/title-1-icon/index.js
|
KissKissBankBank/kitten
|
import React from 'react'
import PropTypes from 'prop-types'
export const Title1Icon = ({ color, title, ...props }) => (
<svg
width="14"
height="12"
viewBox="0 0 14 12"
xmlns="http://www.w3.org/2000/svg"
{...props}
>
{title && <title>{title}</title>}
<path
d="M9.008 0v2.56h-3.04v8.64H3.04V2.56H0V0h9.008zm3.442 4.2v5.4h1.53v1.6H9V9.6h1.62V6.24l-.122.08c-.17.102-.369.184-.598.245a3.469 3.469 0 01-.9.115V5.16l.21-.016c.277-.031.544-.104.8-.219a1.47 1.47 0 00.73-.725h1.71z"
fill={color}
/>
</svg>
)
Title1Icon.propTypes = {
color: PropTypes.string,
title: PropTypes.string,
}
Title1Icon.defaultProps = {
color: '#222',
title: '',
}
|
src/Label.js
|
insionng/react-bootstrap
|
import React from 'react';
import classNames from 'classnames';
import BootstrapMixin from './BootstrapMixin';
const Label = React.createClass({
mixins: [BootstrapMixin],
getDefaultProps() {
return {
bsClass: 'label',
bsStyle: 'default'
};
},
render() {
let classes = this.getBsClassSet();
return (
<span {...this.props} className={classNames(this.props.className, classes)}>
{this.props.children}
</span>
);
}
});
export default Label;
|
client/src/App.js
|
JetRunner/epictodo
|
import './css/common.css';
import 'typeface-roboto';
import React, { Component } from 'react';
import { render } from 'react-dom';
import { Router, Route, IndexRoute, hashHistory} from 'react-router';
import Todos from './components/Todos';
import Signup from './components/Signup';
import Login from './components/Login';
import Root from './components/Root';
class App extends Component {
render() {
return (
<Router history={hashHistory}>
<Route path="/" component={Root}>
<IndexRoute component={Todos} />
<Route path="/login" component={Login} />
<Route path="/signup" component={Signup} />
</Route>
</Router>
);
}
}
render(<App />, document.getElementById('react-app'));
|
application/components/profile/Profile.js
|
buildreactnative/assemblies-tutorial
|
import Icon from 'react-native-vector-icons/Ionicons';
import NavigationBar from 'react-native-navbar';
import React, { Component } from 'react';
import { ScrollView, Text, View, Image, TouchableOpacity } from 'react-native';
import Colors from '../../styles/colors';
import BackButton from '../shared/BackButton';
import {API, DEV} from '../../config';
import { globals, groupsStyles, profileStyles } from '../../styles';
import { EmptyGroupBox } from '../groups/Groups';
const styles = profileStyles;
function formatGroups(groups){
if (groups.length % 2 === 1 ){
return groups.concat(null);
} else {
return groups;
}
};
const GroupBoxes = ({ groups}) => {
return (
<View style={groupsStyles.boxContainer}>
{groups.map((group, idx) => {
if (!group) { return <EmptyGroupBox key={idx}/>}
return (
<View key={idx} style={globals.flexRow}>
<Image source={{uri: group.image}} style={groupsStyles.groupImage}>
<View style={[groupsStyles.groupBackground, {backgroundColor: group.color,}]} >
<Text style={groupsStyles.groupText}>{group.name}</Text>
</View>
</Image>
</View>
);
})}
</View>
);
}
class Profile extends React.Component{
constructor(props){
super(props);
this.goBack = this.goBack.bind(this);
this.sendMessage = this.sendMessage.bind(this);
this.state = {
groups: []
}
}
componentDidMount(){
let query = {
members: {
$elemMatch: {userId: this.props.user.id}
}
};
fetch(`${API}/groups?${JSON.stringify(query)}`)
.then(response => response.json())
.then(groups => this.setState({ groups }))
.catch(err => console.log('ERR:', err))
.done();
}
sendMessage(){
this.props.navigator.push({
name: 'Conversation',
user: this.props.user
});
}
goBack(){
this.props.navigator.pop();
}
render(){
let { user } = this.props;
let title = `${user ? user.firstName : "User"}'s Profile`;
return (
<View style={globals.flexContainer}>
<NavigationBar
tintColor={Colors.brandPrimary}
title={{title: title, tintColor: 'white'}}
leftButton={<BackButton handlePress={this.goBack}/> }
/>
<ScrollView style={[globals.flex, globals.mt1]}>
<View style={styles.avatarContainer}>
<Image source={{uri: user.avatar}} style={styles.avatar}/>
</View>
<Text style={[globals.h4, globals.centerText]}>{user.firstName} {user.lastName}</Text>
<Text style={[globals.h5, globals.centerText]}>
{user.location.city.long_name}, {user.location.state.long_name}
</Text>
<TouchableOpacity style={[globals.row, globals.mv2]} onPress={this.sendMessage}>
<Icon name="ios-chatboxes" size={40} style={globals.mr1} color={Colors.brandPrimary}/>
<Text style={globals.h5}>Send a Message</Text>
</TouchableOpacity>
<View style={globals.lightDivider}></View>
<View style={globals.ph1}>
<Text style={[globals.h4, globals.ma1]}>Technologies</Text>
<Text style={[globals.h5, globals.primaryText, globals.ma1]}>{user.technologies.join(', ')}</Text>
<Text style={[globals.h4, globals.ma1]}>Assemblies</Text>
</View>
<View style={globals.flex}>
<GroupBoxes groups={formatGroups(this.state.groups)} />
</View>
</ScrollView>
</View>
)
}
};
export default Profile;
|
client/src/views/Logo.js
|
MissUchiha/CANX
|
import React from 'react'
function Logo() {
return (
<div>
<figure>
<img src="static/img/logo_white_on_transparent.png" alt="CANX" className="logo"/>
</figure>
</div>
)
}
export default Logo
|
vendor/ezsystems/platform-ui-assets-bundle/Resources/public/vendors/yui3/build/event-custom-base/event-custom-base.js
|
pg18/perso_website
|
/*
YUI 3.18.1 (build f7e7bcb)
Copyright 2014 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/
YUI.add('event-custom-base', function (Y, NAME) {
/**
* Custom event engine, DOM event listener abstraction layer, synthetic DOM
* events.
* @module event-custom
*/
Y.Env.evt = {
handles: {},
plugins: {}
};
/**
* Custom event engine, DOM event listener abstraction layer, synthetic DOM
* events.
* @module event-custom
* @submodule event-custom-base
*/
/**
* Allows for the insertion of methods that are executed before or after
* a specified method
* @class Do
* @static
*/
var DO_BEFORE = 0,
DO_AFTER = 1,
DO = {
/**
* Cache of objects touched by the utility
* @property objs
* @static
* @deprecated Since 3.6.0. The `_yuiaop` property on the AOP'd object
* replaces the role of this property, but is considered to be private, and
* is only mentioned to provide a migration path.
*
* If you have a use case which warrants migration to the _yuiaop property,
* please file a ticket to let us know what it's used for and we can see if
* we need to expose hooks for that functionality more formally.
*/
objs: null,
/**
* <p>Execute the supplied method before the specified function. Wrapping
* function may optionally return an instance of the following classes to
* further alter runtime behavior:</p>
* <dl>
* <dt></code>Y.Do.Halt(message, returnValue)</code></dt>
* <dd>Immediatly stop execution and return
* <code>returnValue</code>. No other wrapping functions will be
* executed.</dd>
* <dt></code>Y.Do.AlterArgs(message, newArgArray)</code></dt>
* <dd>Replace the arguments that the original function will be
* called with.</dd>
* <dt></code>Y.Do.Prevent(message)</code></dt>
* <dd>Don't execute the wrapped function. Other before phase
* wrappers will be executed.</dd>
* </dl>
*
* @method before
* @param fn {Function} the function to execute
* @param obj the object hosting the method to displace
* @param sFn {string} the name of the method to displace
* @param c The execution context for fn
* @param arg* {mixed} 0..n additional arguments to supply to the subscriber
* when the event fires.
* @return {EventHandle} handle for the subscription
* @static
*/
before: function(fn, obj, sFn, c) {
var f = fn, a;
if (c) {
a = [fn, c].concat(Y.Array(arguments, 4, true));
f = Y.rbind.apply(Y, a);
}
return this._inject(DO_BEFORE, f, obj, sFn);
},
/**
* <p>Execute the supplied method after the specified function. Wrapping
* function may optionally return an instance of the following classes to
* further alter runtime behavior:</p>
* <dl>
* <dt></code>Y.Do.Halt(message, returnValue)</code></dt>
* <dd>Immediatly stop execution and return
* <code>returnValue</code>. No other wrapping functions will be
* executed.</dd>
* <dt></code>Y.Do.AlterReturn(message, returnValue)</code></dt>
* <dd>Return <code>returnValue</code> instead of the wrapped
* method's original return value. This can be further altered by
* other after phase wrappers.</dd>
* </dl>
*
* <p>The static properties <code>Y.Do.originalRetVal</code> and
* <code>Y.Do.currentRetVal</code> will be populated for reference.</p>
*
* @method after
* @param fn {Function} the function to execute
* @param obj the object hosting the method to displace
* @param sFn {string} the name of the method to displace
* @param c The execution context for fn
* @param arg* {mixed} 0..n additional arguments to supply to the subscriber
* @return {EventHandle} handle for the subscription
* @static
*/
after: function(fn, obj, sFn, c) {
var f = fn, a;
if (c) {
a = [fn, c].concat(Y.Array(arguments, 4, true));
f = Y.rbind.apply(Y, a);
}
return this._inject(DO_AFTER, f, obj, sFn);
},
/**
* Execute the supplied method before or after the specified function.
* Used by <code>before</code> and <code>after</code>.
*
* @method _inject
* @param when {string} before or after
* @param fn {Function} the function to execute
* @param obj the object hosting the method to displace
* @param sFn {string} the name of the method to displace
* @param c The execution context for fn
* @return {EventHandle} handle for the subscription
* @private
* @static
*/
_inject: function(when, fn, obj, sFn) {
// object id
var id = Y.stamp(obj), o, sid;
if (!obj._yuiaop) {
// create a map entry for the obj if it doesn't exist, to hold overridden methods
obj._yuiaop = {};
}
o = obj._yuiaop;
if (!o[sFn]) {
// create a map entry for the method if it doesn't exist
o[sFn] = new Y.Do.Method(obj, sFn);
// re-route the method to our wrapper
obj[sFn] = function() {
return o[sFn].exec.apply(o[sFn], arguments);
};
}
// subscriber id
sid = id + Y.stamp(fn) + sFn;
// register the callback
o[sFn].register(sid, fn, when);
return new Y.EventHandle(o[sFn], sid);
},
/**
* Detach a before or after subscription.
*
* @method detach
* @param handle {EventHandle} the subscription handle
* @static
*/
detach: function(handle) {
if (handle.detach) {
handle.detach();
}
}
};
Y.Do = DO;
//////////////////////////////////////////////////////////////////////////
/**
* Contains the return value from the wrapped method, accessible
* by 'after' event listeners.
*
* @property originalRetVal
* @static
* @since 3.2.0
*/
/**
* Contains the current state of the return value, consumable by
* 'after' event listeners, and updated if an after subscriber
* changes the return value generated by the wrapped function.
*
* @property currentRetVal
* @static
* @since 3.2.0
*/
//////////////////////////////////////////////////////////////////////////
/**
* Wrapper for a displaced method with aop enabled
* @class Do.Method
* @constructor
* @param obj The object to operate on
* @param sFn The name of the method to displace
*/
DO.Method = function(obj, sFn) {
this.obj = obj;
this.methodName = sFn;
this.method = obj[sFn];
this.before = {};
this.after = {};
};
/**
* Register a aop subscriber
* @method register
* @param sid {string} the subscriber id
* @param fn {Function} the function to execute
* @param when {string} when to execute the function
*/
DO.Method.prototype.register = function (sid, fn, when) {
if (when) {
this.after[sid] = fn;
} else {
this.before[sid] = fn;
}
};
/**
* Unregister a aop subscriber
* @method delete
* @param sid {string} the subscriber id
* @param fn {Function} the function to execute
* @param when {string} when to execute the function
*/
DO.Method.prototype._delete = function (sid) {
delete this.before[sid];
delete this.after[sid];
};
/**
* <p>Execute the wrapped method. All arguments are passed into the wrapping
* functions. If any of the before wrappers return an instance of
* <code>Y.Do.Halt</code> or <code>Y.Do.Prevent</code>, neither the wrapped
* function nor any after phase subscribers will be executed.</p>
*
* <p>The return value will be the return value of the wrapped function or one
* provided by a wrapper function via an instance of <code>Y.Do.Halt</code> or
* <code>Y.Do.AlterReturn</code>.
*
* @method exec
* @param arg* {any} Arguments are passed to the wrapping and wrapped functions
* @return {any} Return value of wrapped function unless overwritten (see above)
*/
DO.Method.prototype.exec = function () {
var args = Y.Array(arguments, 0, true),
i, ret, newRet,
bf = this.before,
af = this.after,
prevented = false;
// execute before
for (i in bf) {
if (bf.hasOwnProperty(i)) {
ret = bf[i].apply(this.obj, args);
if (ret) {
switch (ret.constructor) {
case DO.Halt:
return ret.retVal;
case DO.AlterArgs:
args = ret.newArgs;
break;
case DO.Prevent:
prevented = true;
break;
default:
}
}
}
}
// execute method
if (!prevented) {
ret = this.method.apply(this.obj, args);
}
DO.originalRetVal = ret;
DO.currentRetVal = ret;
// execute after methods.
for (i in af) {
if (af.hasOwnProperty(i)) {
newRet = af[i].apply(this.obj, args);
// Stop processing if a Halt object is returned
if (newRet && newRet.constructor === DO.Halt) {
return newRet.retVal;
// Check for a new return value
} else if (newRet && newRet.constructor === DO.AlterReturn) {
ret = newRet.newRetVal;
// Update the static retval state
DO.currentRetVal = ret;
}
}
}
return ret;
};
//////////////////////////////////////////////////////////////////////////
/**
* Return an AlterArgs object when you want to change the arguments that
* were passed into the function. Useful for Do.before subscribers. An
* example would be a service that scrubs out illegal characters prior to
* executing the core business logic.
* @class Do.AlterArgs
* @constructor
* @param msg {String} (optional) Explanation of the altered return value
* @param newArgs {Array} Call parameters to be used for the original method
* instead of the arguments originally passed in.
*/
DO.AlterArgs = function(msg, newArgs) {
this.msg = msg;
this.newArgs = newArgs;
};
/**
* Return an AlterReturn object when you want to change the result returned
* from the core method to the caller. Useful for Do.after subscribers.
* @class Do.AlterReturn
* @constructor
* @param msg {String} (optional) Explanation of the altered return value
* @param newRetVal {any} Return value passed to code that invoked the wrapped
* function.
*/
DO.AlterReturn = function(msg, newRetVal) {
this.msg = msg;
this.newRetVal = newRetVal;
};
/**
* Return a Halt object when you want to terminate the execution
* of all subsequent subscribers as well as the wrapped method
* if it has not exectued yet. Useful for Do.before subscribers.
* @class Do.Halt
* @constructor
* @param msg {String} (optional) Explanation of why the termination was done
* @param retVal {any} Return value passed to code that invoked the wrapped
* function.
*/
DO.Halt = function(msg, retVal) {
this.msg = msg;
this.retVal = retVal;
};
/**
* Return a Prevent object when you want to prevent the wrapped function
* from executing, but want the remaining listeners to execute. Useful
* for Do.before subscribers.
* @class Do.Prevent
* @constructor
* @param msg {String} (optional) Explanation of why the termination was done
*/
DO.Prevent = function(msg) {
this.msg = msg;
};
/**
* Return an Error object when you want to terminate the execution
* of all subsequent method calls.
* @class Do.Error
* @constructor
* @param msg {String} (optional) Explanation of the altered return value
* @param retVal {any} Return value passed to code that invoked the wrapped
* function.
* @deprecated use Y.Do.Halt or Y.Do.Prevent
*/
DO.Error = DO.Halt;
//////////////////////////////////////////////////////////////////////////
/**
* Custom event engine, DOM event listener abstraction layer, synthetic DOM
* events.
* @module event-custom
* @submodule event-custom-base
*/
// var onsubscribeType = "_event:onsub",
var YArray = Y.Array,
AFTER = 'after',
CONFIGS = [
'broadcast',
'monitored',
'bubbles',
'context',
'contextFn',
'currentTarget',
'defaultFn',
'defaultTargetOnly',
'details',
'emitFacade',
'fireOnce',
'async',
'host',
'preventable',
'preventedFn',
'queuable',
'silent',
'stoppedFn',
'target',
'type'
],
CONFIGS_HASH = YArray.hash(CONFIGS),
nativeSlice = Array.prototype.slice,
YUI3_SIGNATURE = 9,
YUI_LOG = 'yui:log',
mixConfigs = function(r, s, ov) {
var p;
for (p in s) {
if (CONFIGS_HASH[p] && (ov || !(p in r))) {
r[p] = s[p];
}
}
return r;
};
/**
* The CustomEvent class lets you define events for your application
* that can be subscribed to by one or more independent component.
*
* @param {String} type The type of event, which is passed to the callback
* when the event fires.
* @param {object} defaults configuration object.
* @class CustomEvent
* @constructor
*/
/**
* The type of event, returned to subscribers when the event fires
* @property type
* @type string
*/
/**
* By default all custom events are logged in the debug build, set silent
* to true to disable debug outpu for this event.
* @property silent
* @type boolean
*/
Y.CustomEvent = function(type, defaults) {
this._kds = Y.CustomEvent.keepDeprecatedSubs;
this.id = Y.guid();
this.type = type;
this.silent = this.logSystem = (type === YUI_LOG);
if (this._kds) {
/**
* The subscribers to this event
* @property subscribers
* @type Subscriber {}
* @deprecated
*/
/**
* 'After' subscribers
* @property afters
* @type Subscriber {}
* @deprecated
*/
this.subscribers = {};
this.afters = {};
}
if (defaults) {
mixConfigs(this, defaults, true);
}
};
/**
* Static flag to enable population of the <a href="#property_subscribers">`subscribers`</a>
* and <a href="#property_subscribers">`afters`</a> properties held on a `CustomEvent` instance.
*
* These properties were changed to private properties (`_subscribers` and `_afters`), and
* converted from objects to arrays for performance reasons.
*
* Setting this property to true will populate the deprecated `subscribers` and `afters`
* properties for people who may be using them (which is expected to be rare). There will
* be a performance hit, compared to the new array based implementation.
*
* If you are using these deprecated properties for a use case which the public API
* does not support, please file an enhancement request, and we can provide an alternate
* public implementation which doesn't have the performance cost required to maintiain the
* properties as objects.
*
* @property keepDeprecatedSubs
* @static
* @for CustomEvent
* @type boolean
* @default false
* @deprecated
*/
Y.CustomEvent.keepDeprecatedSubs = false;
Y.CustomEvent.mixConfigs = mixConfigs;
Y.CustomEvent.prototype = {
constructor: Y.CustomEvent,
/**
* Monitor when an event is attached or detached.
*
* @property monitored
* @type boolean
*/
/**
* If 0, this event does not broadcast. If 1, the YUI instance is notified
* every time this event fires. If 2, the YUI instance and the YUI global
* (if event is enabled on the global) are notified every time this event
* fires.
* @property broadcast
* @type int
*/
/**
* Specifies whether this event should be queued when the host is actively
* processing an event. This will effect exectution order of the callbacks
* for the various events.
* @property queuable
* @type boolean
* @default false
*/
/**
* This event has fired if true
*
* @property fired
* @type boolean
* @default false;
*/
/**
* An array containing the arguments the custom event
* was last fired with.
* @property firedWith
* @type Array
*/
/**
* This event should only fire one time if true, and if
* it has fired, any new subscribers should be notified
* immediately.
*
* @property fireOnce
* @type boolean
* @default false;
*/
/**
* fireOnce listeners will fire syncronously unless async
* is set to true
* @property async
* @type boolean
* @default false
*/
/**
* Flag for stopPropagation that is modified during fire()
* 1 means to stop propagation to bubble targets. 2 means
* to also stop additional subscribers on this target.
* @property stopped
* @type int
*/
/**
* Flag for preventDefault that is modified during fire().
* if it is not 0, the default behavior for this event
* @property prevented
* @type int
*/
/**
* Specifies the host for this custom event. This is used
* to enable event bubbling
* @property host
* @type EventTarget
*/
/**
* The default function to execute after event listeners
* have fire, but only if the default action was not
* prevented.
* @property defaultFn
* @type Function
*/
/**
* Flag for the default function to execute only if the
* firing event is the current target. This happens only
* when using custom event delegation and setting the
* flag to `true` mimics the behavior of event delegation
* in the DOM.
*
* @property defaultTargetOnly
* @type Boolean
* @default false
*/
/**
* The function to execute if a subscriber calls
* stopPropagation or stopImmediatePropagation
* @property stoppedFn
* @type Function
*/
/**
* The function to execute if a subscriber calls
* preventDefault
* @property preventedFn
* @type Function
*/
/**
* The subscribers to this event
* @property _subscribers
* @type Subscriber []
* @private
*/
/**
* 'After' subscribers
* @property _afters
* @type Subscriber []
* @private
*/
/**
* If set to true, the custom event will deliver an EventFacade object
* that is similar to a DOM event object.
* @property emitFacade
* @type boolean
* @default false
*/
/**
* Supports multiple options for listener signatures in order to
* port YUI 2 apps.
* @property signature
* @type int
* @default 9
*/
signature : YUI3_SIGNATURE,
/**
* The context the the event will fire from by default. Defaults to the YUI
* instance.
* @property context
* @type object
*/
context : Y,
/**
* Specifies whether or not this event's default function
* can be cancelled by a subscriber by executing preventDefault()
* on the event facade
* @property preventable
* @type boolean
* @default true
*/
preventable : true,
/**
* Specifies whether or not a subscriber can stop the event propagation
* via stopPropagation(), stopImmediatePropagation(), or halt()
*
* Events can only bubble if emitFacade is true.
*
* @property bubbles
* @type boolean
* @default true
*/
bubbles : true,
/**
* Returns the number of subscribers for this event as the sum of the on()
* subscribers and after() subscribers.
*
* @method hasSubs
* @return Number
*/
hasSubs: function(when) {
var s = 0,
a = 0,
subs = this._subscribers,
afters = this._afters,
sib = this.sibling;
if (subs) {
s = subs.length;
}
if (afters) {
a = afters.length;
}
if (sib) {
subs = sib._subscribers;
afters = sib._afters;
if (subs) {
s += subs.length;
}
if (afters) {
a += afters.length;
}
}
if (when) {
return (when === 'after') ? a : s;
}
return (s + a);
},
/**
* Monitor the event state for the subscribed event. The first parameter
* is what should be monitored, the rest are the normal parameters when
* subscribing to an event.
* @method monitor
* @param what {string} what to monitor ('detach', 'attach', 'publish').
* @return {EventHandle} return value from the monitor event subscription.
*/
monitor: function(what) {
this.monitored = true;
var type = this.id + '|' + this.type + '_' + what,
args = nativeSlice.call(arguments, 0);
args[0] = type;
return this.host.on.apply(this.host, args);
},
/**
* Get all of the subscribers to this event and any sibling event
* @method getSubs
* @return {Array} first item is the on subscribers, second the after.
*/
getSubs: function() {
var sibling = this.sibling,
subs = this._subscribers,
afters = this._afters,
siblingSubs,
siblingAfters;
if (sibling) {
siblingSubs = sibling._subscribers;
siblingAfters = sibling._afters;
}
if (siblingSubs) {
if (subs) {
subs = subs.concat(siblingSubs);
} else {
subs = siblingSubs.concat();
}
} else {
if (subs) {
subs = subs.concat();
} else {
subs = [];
}
}
if (siblingAfters) {
if (afters) {
afters = afters.concat(siblingAfters);
} else {
afters = siblingAfters.concat();
}
} else {
if (afters) {
afters = afters.concat();
} else {
afters = [];
}
}
return [subs, afters];
},
/**
* Apply configuration properties. Only applies the CONFIG whitelist
* @method applyConfig
* @param o hash of properties to apply.
* @param force {boolean} if true, properties that exist on the event
* will be overwritten.
*/
applyConfig: function(o, force) {
mixConfigs(this, o, force);
},
/**
* Create the Subscription for subscribing function, context, and bound
* arguments. If this is a fireOnce event, the subscriber is immediately
* notified.
*
* @method _on
* @param fn {Function} Subscription callback
* @param [context] {Object} Override `this` in the callback
* @param [args] {Array} bound arguments that will be passed to the callback after the arguments generated by fire()
* @param [when] {String} "after" to slot into after subscribers
* @return {EventHandle}
* @protected
*/
_on: function(fn, context, args, when) {
var s = new Y.Subscriber(fn, context, args, when),
firedWith;
if (this.fireOnce && this.fired) {
firedWith = this.firedWith;
// It's a little ugly for this to know about facades,
// but given the current breakup, not much choice without
// moving a whole lot of stuff around.
if (this.emitFacade && this._addFacadeToArgs) {
this._addFacadeToArgs(firedWith);
}
if (this.async) {
setTimeout(Y.bind(this._notify, this, s, firedWith), 0);
} else {
this._notify(s, firedWith);
}
}
if (when === AFTER) {
if (!this._afters) {
this._afters = [];
}
this._afters.push(s);
} else {
if (!this._subscribers) {
this._subscribers = [];
}
this._subscribers.push(s);
}
if (this._kds) {
if (when === AFTER) {
this.afters[s.id] = s;
} else {
this.subscribers[s.id] = s;
}
}
return new Y.EventHandle(this, s);
},
/**
* Listen for this event
* @method subscribe
* @param {Function} fn The function to execute.
* @return {EventHandle} Unsubscribe handle.
* @deprecated use on.
*/
subscribe: function(fn, context) {
var a = (arguments.length > 2) ? nativeSlice.call(arguments, 2) : null;
return this._on(fn, context, a, true);
},
/**
* Listen for this event
* @method on
* @param {Function} fn The function to execute.
* @param {object} context optional execution context.
* @param {mixed} arg* 0..n additional arguments to supply to the subscriber
* when the event fires.
* @return {EventHandle} An object with a detach method to detch the handler(s).
*/
on: function(fn, context) {
var a = (arguments.length > 2) ? nativeSlice.call(arguments, 2) : null;
if (this.monitored && this.host) {
this.host._monitor('attach', this, {
args: arguments
});
}
return this._on(fn, context, a, true);
},
/**
* Listen for this event after the normal subscribers have been notified and
* the default behavior has been applied. If a normal subscriber prevents the
* default behavior, it also prevents after listeners from firing.
* @method after
* @param {Function} fn The function to execute.
* @param {object} context optional execution context.
* @param {mixed} arg* 0..n additional arguments to supply to the subscriber
* when the event fires.
* @return {EventHandle} handle Unsubscribe handle.
*/
after: function(fn, context) {
var a = (arguments.length > 2) ? nativeSlice.call(arguments, 2) : null;
return this._on(fn, context, a, AFTER);
},
/**
* Detach listeners.
* @method detach
* @param {Function} fn The subscribed function to remove, if not supplied
* all will be removed.
* @param {Object} context The context object passed to subscribe.
* @return {Number} returns the number of subscribers unsubscribed.
*/
detach: function(fn, context) {
// unsubscribe handle
if (fn && fn.detach) {
return fn.detach();
}
var i, s,
found = 0,
subs = this._subscribers,
afters = this._afters;
if (subs) {
for (i = subs.length; i >= 0; i--) {
s = subs[i];
if (s && (!fn || fn === s.fn)) {
this._delete(s, subs, i);
found++;
}
}
}
if (afters) {
for (i = afters.length; i >= 0; i--) {
s = afters[i];
if (s && (!fn || fn === s.fn)) {
this._delete(s, afters, i);
found++;
}
}
}
return found;
},
/**
* Detach listeners.
* @method unsubscribe
* @param {Function} fn The subscribed function to remove, if not supplied
* all will be removed.
* @param {Object} context The context object passed to subscribe.
* @return {int|undefined} returns the number of subscribers unsubscribed.
* @deprecated use detach.
*/
unsubscribe: function() {
return this.detach.apply(this, arguments);
},
/**
* Notify a single subscriber
* @method _notify
* @param {Subscriber} s the subscriber.
* @param {Array} args the arguments array to apply to the listener.
* @protected
*/
_notify: function(s, args, ef) {
var ret;
ret = s.notify(args, this);
if (false === ret || this.stopped > 1) {
return false;
}
return true;
},
/**
* Logger abstraction to centralize the application of the silent flag
* @method log
* @param {string} msg message to log.
* @param {string} cat log category.
*/
log: function(msg, cat) {
},
/**
* Notifies the subscribers. The callback functions will be executed
* from the context specified when the event was created, and with the
* following parameters:
* <ul>
* <li>The type of event</li>
* <li>All of the arguments fire() was executed with as an array</li>
* <li>The custom object (if any) that was passed into the subscribe()
* method</li>
* </ul>
* @method fire
* @param {Object*} arguments an arbitrary set of parameters to pass to
* the handler.
* @return {boolean} false if one of the subscribers returned false,
* true otherwise.
*
*/
fire: function() {
// push is the fastest way to go from arguments to arrays
// for most browsers currently
// http://jsperf.com/push-vs-concat-vs-slice/2
var args = [];
args.push.apply(args, arguments);
return this._fire(args);
},
/**
* Private internal implementation for `fire`, which is can be used directly by
* `EventTarget` and other event module classes which have already converted from
* an `arguments` list to an array, to avoid the repeated overhead.
*
* @method _fire
* @private
* @param {Array} args The array of arguments passed to be passed to handlers.
* @return {boolean} false if one of the subscribers returned false, true otherwise.
*/
_fire: function(args) {
if (this.fireOnce && this.fired) {
return true;
} else {
// this doesn't happen if the event isn't published
// this.host._monitor('fire', this.type, args);
this.fired = true;
if (this.fireOnce) {
this.firedWith = args;
}
if (this.emitFacade) {
return this.fireComplex(args);
} else {
return this.fireSimple(args);
}
}
},
/**
* Set up for notifying subscribers of non-emitFacade events.
*
* @method fireSimple
* @param args {Array} Arguments passed to fire()
* @return Boolean false if a subscriber returned false
* @protected
*/
fireSimple: function(args) {
this.stopped = 0;
this.prevented = 0;
if (this.hasSubs()) {
var subs = this.getSubs();
this._procSubs(subs[0], args);
this._procSubs(subs[1], args);
}
if (this.broadcast) {
this._broadcast(args);
}
return this.stopped ? false : true;
},
// Requires the event-custom-complex module for full funcitonality.
fireComplex: function(args) {
args[0] = args[0] || {};
return this.fireSimple(args);
},
/**
* Notifies a list of subscribers.
*
* @method _procSubs
* @param subs {Array} List of subscribers
* @param args {Array} Arguments passed to fire()
* @param ef {}
* @return Boolean false if a subscriber returns false or stops the event
* propagation via e.stopPropagation(),
* e.stopImmediatePropagation(), or e.halt()
* @private
*/
_procSubs: function(subs, args, ef) {
var s, i, l;
for (i = 0, l = subs.length; i < l; i++) {
s = subs[i];
if (s && s.fn) {
if (false === this._notify(s, args, ef)) {
this.stopped = 2;
}
if (this.stopped === 2) {
return false;
}
}
}
return true;
},
/**
* Notifies the YUI instance if the event is configured with broadcast = 1,
* and both the YUI instance and Y.Global if configured with broadcast = 2.
*
* @method _broadcast
* @param args {Array} Arguments sent to fire()
* @private
*/
_broadcast: function(args) {
if (!this.stopped && this.broadcast) {
var a = args.concat();
a.unshift(this.type);
if (this.host !== Y) {
Y.fire.apply(Y, a);
}
if (this.broadcast === 2) {
Y.Global.fire.apply(Y.Global, a);
}
}
},
/**
* Removes all listeners
* @method unsubscribeAll
* @return {Number} The number of listeners unsubscribed.
* @deprecated use detachAll.
*/
unsubscribeAll: function() {
return this.detachAll.apply(this, arguments);
},
/**
* Removes all listeners
* @method detachAll
* @return {Number} The number of listeners unsubscribed.
*/
detachAll: function() {
return this.detach();
},
/**
* Deletes the subscriber from the internal store of on() and after()
* subscribers.
*
* @method _delete
* @param s subscriber object.
* @param subs (optional) on or after subscriber array
* @param index (optional) The index found.
* @private
*/
_delete: function(s, subs, i) {
var when = s._when;
if (!subs) {
subs = (when === AFTER) ? this._afters : this._subscribers;
}
if (subs) {
i = YArray.indexOf(subs, s, 0);
if (s && subs[i] === s) {
subs.splice(i, 1);
}
}
if (this._kds) {
if (when === AFTER) {
delete this.afters[s.id];
} else {
delete this.subscribers[s.id];
}
}
if (this.monitored && this.host) {
this.host._monitor('detach', this, {
ce: this,
sub: s
});
}
if (s) {
s.deleted = true;
}
}
};
/**
* Stores the subscriber information to be used when the event fires.
* @param {Function} fn The wrapped function to execute.
* @param {Object} context The value of the keyword 'this' in the listener.
* @param {Array} args* 0..n additional arguments to supply the listener.
*
* @class Subscriber
* @constructor
*/
Y.Subscriber = function(fn, context, args, when) {
/**
* The callback that will be execute when the event fires
* This is wrapped by Y.rbind if obj was supplied.
* @property fn
* @type Function
*/
this.fn = fn;
/**
* Optional 'this' keyword for the listener
* @property context
* @type Object
*/
this.context = context;
/**
* Unique subscriber id
* @property id
* @type String
*/
this.id = Y.guid();
/**
* Additional arguments to propagate to the subscriber
* @property args
* @type Array
*/
this.args = args;
this._when = when;
/**
* Custom events for a given fire transaction.
* @property events
* @type {EventTarget}
*/
// this.events = null;
/**
* This listener only reacts to the event once
* @property once
*/
// this.once = false;
};
Y.Subscriber.prototype = {
constructor: Y.Subscriber,
_notify: function(c, args, ce) {
if (this.deleted && !this.postponed) {
if (this.postponed) {
delete this.fn;
delete this.context;
} else {
delete this.postponed;
return null;
}
}
var a = this.args, ret;
switch (ce.signature) {
case 0:
ret = this.fn.call(c, ce.type, args, c);
break;
case 1:
ret = this.fn.call(c, args[0] || null, c);
break;
default:
if (a || args) {
args = args || [];
a = (a) ? args.concat(a) : args;
ret = this.fn.apply(c, a);
} else {
ret = this.fn.call(c);
}
}
if (this.once) {
ce._delete(this);
}
return ret;
},
/**
* Executes the subscriber.
* @method notify
* @param args {Array} Arguments array for the subscriber.
* @param ce {CustomEvent} The custom event that sent the notification.
*/
notify: function(args, ce) {
var c = this.context,
ret = true;
if (!c) {
c = (ce.contextFn) ? ce.contextFn() : ce.context;
}
// only catch errors if we will not re-throw them.
if (Y.config && Y.config.throwFail) {
ret = this._notify(c, args, ce);
} else {
try {
ret = this._notify(c, args, ce);
} catch (e) {
Y.error(this + ' failed: ' + e.message, e);
}
}
return ret;
},
/**
* Returns true if the fn and obj match this objects properties.
* Used by the unsubscribe method to match the right subscriber.
*
* @method contains
* @param {Function} fn the function to execute.
* @param {Object} context optional 'this' keyword for the listener.
* @return {boolean} true if the supplied arguments match this
* subscriber's signature.
*/
contains: function(fn, context) {
if (context) {
return ((this.fn === fn) && this.context === context);
} else {
return (this.fn === fn);
}
},
valueOf : function() {
return this.id;
}
};
/**
* Return value from all subscribe operations
* @class EventHandle
* @constructor
* @param {CustomEvent} evt the custom event.
* @param {Subscriber} sub the subscriber.
*/
Y.EventHandle = function(evt, sub) {
/**
* The custom event
*
* @property evt
* @type CustomEvent
*/
this.evt = evt;
/**
* The subscriber object
*
* @property sub
* @type Subscriber
*/
this.sub = sub;
};
Y.EventHandle.prototype = {
batch: function(f, c) {
f.call(c || this, this);
if (Y.Lang.isArray(this.evt)) {
Y.Array.each(this.evt, function(h) {
h.batch.call(c || h, f);
});
}
},
/**
* Detaches this subscriber
* @method detach
* @return {Number} the number of detached listeners
*/
detach: function() {
var evt = this.evt, detached = 0, i;
if (evt) {
if (Y.Lang.isArray(evt)) {
for (i = 0; i < evt.length; i++) {
detached += evt[i].detach();
}
} else {
evt._delete(this.sub);
detached = 1;
}
}
return detached;
},
/**
* Monitor the event state for the subscribed event. The first parameter
* is what should be monitored, the rest are the normal parameters when
* subscribing to an event.
* @method monitor
* @param what {string} what to monitor ('attach', 'detach', 'publish').
* @return {EventHandle} return value from the monitor event subscription.
*/
monitor: function(what) {
return this.evt.monitor.apply(this.evt, arguments);
}
};
/**
* Custom event engine, DOM event listener abstraction layer, synthetic DOM
* events.
* @module event-custom
* @submodule event-custom-base
*/
/**
* EventTarget provides the implementation for any object to
* publish, subscribe and fire to custom events, and also
* alows other EventTargets to target the object with events
* sourced from the other object.
* EventTarget is designed to be used with Y.augment to wrap
* EventCustom in an interface that allows events to be listened to
* and fired by name. This makes it possible for implementing code to
* subscribe to an event that either has not been created yet, or will
* not be created at all.
* @class EventTarget
* @param opts a configuration object
* @config emitFacade {boolean} if true, all events will emit event
* facade payloads by default (default false)
* @config prefix {String} the prefix to apply to non-prefixed event names
*/
var L = Y.Lang,
PREFIX_DELIMITER = ':',
CATEGORY_DELIMITER = '|',
AFTER_PREFIX = '~AFTER~',
WILD_TYPE_RE = /(.*?)(:)(.*?)/,
_wildType = Y.cached(function(type) {
return type.replace(WILD_TYPE_RE, "*$2$3");
}),
/**
* If the instance has a prefix attribute and the
* event type is not prefixed, the instance prefix is
* applied to the supplied type.
* @method _getType
* @private
*/
_getType = function(type, pre) {
if (!pre || !type || type.indexOf(PREFIX_DELIMITER) > -1) {
return type;
}
return pre + PREFIX_DELIMITER + type;
},
/**
* Returns an array with the detach key (if provided),
* and the prefixed event name from _getType
* Y.on('detachcategory| menu:click', fn)
* @method _parseType
* @private
*/
_parseType = Y.cached(function(type, pre) {
var t = type, detachcategory, after, i;
if (!L.isString(t)) {
return t;
}
i = t.indexOf(AFTER_PREFIX);
if (i > -1) {
after = true;
t = t.substr(AFTER_PREFIX.length);
}
i = t.indexOf(CATEGORY_DELIMITER);
if (i > -1) {
detachcategory = t.substr(0, (i));
t = t.substr(i+1);
if (t === '*') {
t = null;
}
}
// detach category, full type with instance prefix, is this an after listener, short type
return [detachcategory, (pre) ? _getType(t, pre) : t, after, t];
}),
ET = function(opts) {
var etState = this._yuievt,
etConfig;
if (!etState) {
etState = this._yuievt = {
events: {}, // PERF: Not much point instantiating lazily. We're bound to have events
targets: null, // PERF: Instantiate lazily, if user actually adds target,
config: {
host: this,
context: this
},
chain: Y.config.chain
};
}
etConfig = etState.config;
if (opts) {
mixConfigs(etConfig, opts, true);
if (opts.chain !== undefined) {
etState.chain = opts.chain;
}
if (opts.prefix) {
etConfig.prefix = opts.prefix;
}
}
};
ET.prototype = {
constructor: ET,
/**
* Listen to a custom event hosted by this object one time.
* This is the equivalent to <code>on</code> except the
* listener is immediatelly detached when it is executed.
* @method once
* @param {String} type The name of the event
* @param {Function} fn The callback to execute in response to the event
* @param {Object} [context] Override `this` object in callback
* @param {Any} [arg*] 0..n additional arguments to supply to the subscriber
* @return {EventHandle} A subscription handle capable of detaching the
* subscription
*/
once: function() {
var handle = this.on.apply(this, arguments);
handle.batch(function(hand) {
if (hand.sub) {
hand.sub.once = true;
}
});
return handle;
},
/**
* Listen to a custom event hosted by this object one time.
* This is the equivalent to <code>after</code> except the
* listener is immediatelly detached when it is executed.
* @method onceAfter
* @param {String} type The name of the event
* @param {Function} fn The callback to execute in response to the event
* @param {Object} [context] Override `this` object in callback
* @param {Any} [arg*] 0..n additional arguments to supply to the subscriber
* @return {EventHandle} A subscription handle capable of detaching that
* subscription
*/
onceAfter: function() {
var handle = this.after.apply(this, arguments);
handle.batch(function(hand) {
if (hand.sub) {
hand.sub.once = true;
}
});
return handle;
},
/**
* Takes the type parameter passed to 'on' and parses out the
* various pieces that could be included in the type. If the
* event type is passed without a prefix, it will be expanded
* to include the prefix one is supplied or the event target
* is configured with a default prefix.
* @method parseType
* @param {String} type the type
* @param {String} [pre] The prefix. Defaults to this._yuievt.config.prefix
* @since 3.3.0
* @return {Array} an array containing:
* * the detach category, if supplied,
* * the prefixed event type,
* * whether or not this is an after listener,
* * the supplied event type
*/
parseType: function(type, pre) {
return _parseType(type, pre || this._yuievt.config.prefix);
},
/**
* Subscribe a callback function to a custom event fired by this object or
* from an object that bubbles its events to this object.
*
* this.on("change", this._onChange, this);
*
* Callback functions for events published with `emitFacade = true` will
* receive an `EventFacade` as the first argument (typically named "e").
* These callbacks can then call `e.preventDefault()` to disable the
* behavior published to that event's `defaultFn`. See the `EventFacade`
* API for all available properties and methods. Subscribers to
* non-`emitFacade` events will receive the arguments passed to `fire()`
* after the event name.
*
* To subscribe to multiple events at once, pass an object as the first
* argument, where the key:value pairs correspond to the eventName:callback.
*
* this.on({
* "attrChange" : this._onAttrChange,
* "change" : this._onChange
* });
*
* You can also pass an array of event names as the first argument to
* subscribe to all listed events with the same callback.
*
* this.on([ "change", "attrChange" ], this._onChange);
*
* Returning `false` from a callback is supported as an alternative to
* calling `e.preventDefault(); e.stopPropagation();`. However, it is
* recommended to use the event methods whenever possible.
*
* @method on
* @param {String} type The name of the event
* @param {Function} fn The callback to execute in response to the event
* @param {Object} [context] Override `this` object in callback
* @param {Any} [arg*] 0..n additional arguments to supply to the subscriber
* @return {EventHandle} A subscription handle capable of detaching that
* subscription
*/
on: function(type, fn, context) {
var yuievt = this._yuievt,
parts = _parseType(type, yuievt.config.prefix), f, c, args, ret, ce,
detachcategory, handle, store = Y.Env.evt.handles, after, adapt, shorttype,
Node = Y.Node, n, domevent, isArr;
// full name, args, detachcategory, after
this._monitor('attach', parts[1], {
args: arguments,
category: parts[0],
after: parts[2]
});
if (L.isObject(type)) {
if (L.isFunction(type)) {
return Y.Do.before.apply(Y.Do, arguments);
}
f = fn;
c = context;
args = nativeSlice.call(arguments, 0);
ret = [];
if (L.isArray(type)) {
isArr = true;
}
after = type._after;
delete type._after;
Y.each(type, function(v, k) {
if (L.isObject(v)) {
f = v.fn || ((L.isFunction(v)) ? v : f);
c = v.context || c;
}
var nv = (after) ? AFTER_PREFIX : '';
args[0] = nv + ((isArr) ? v : k);
args[1] = f;
args[2] = c;
ret.push(this.on.apply(this, args));
}, this);
return (yuievt.chain) ? this : new Y.EventHandle(ret);
}
detachcategory = parts[0];
after = parts[2];
shorttype = parts[3];
// extra redirection so we catch adaptor events too. take a look at this.
if (Node && Y.instanceOf(this, Node) && (shorttype in Node.DOM_EVENTS)) {
args = nativeSlice.call(arguments, 0);
args.splice(2, 0, Node.getDOMNode(this));
return Y.on.apply(Y, args);
}
type = parts[1];
if (Y.instanceOf(this, YUI)) {
adapt = Y.Env.evt.plugins[type];
args = nativeSlice.call(arguments, 0);
args[0] = shorttype;
if (Node) {
n = args[2];
if (Y.instanceOf(n, Y.NodeList)) {
n = Y.NodeList.getDOMNodes(n);
} else if (Y.instanceOf(n, Node)) {
n = Node.getDOMNode(n);
}
domevent = (shorttype in Node.DOM_EVENTS);
// Captures both DOM events and event plugins.
if (domevent) {
args[2] = n;
}
}
// check for the existance of an event adaptor
if (adapt) {
handle = adapt.on.apply(Y, args);
} else if ((!type) || domevent) {
handle = Y.Event._attach(args);
}
}
if (!handle) {
ce = yuievt.events[type] || this.publish(type);
handle = ce._on(fn, context, (arguments.length > 3) ? nativeSlice.call(arguments, 3) : null, (after) ? 'after' : true);
// TODO: More robust regex, accounting for category
if (type.indexOf("*:") !== -1) {
this._hasSiblings = true;
}
}
if (detachcategory) {
store[detachcategory] = store[detachcategory] || {};
store[detachcategory][type] = store[detachcategory][type] || [];
store[detachcategory][type].push(handle);
}
return (yuievt.chain) ? this : handle;
},
/**
* subscribe to an event
* @method subscribe
* @deprecated use on
*/
subscribe: function() {
return this.on.apply(this, arguments);
},
/**
* Detach one or more listeners the from the specified event
* @method detach
* @param type {string|Object} Either the handle to the subscriber or the
* type of event. If the type
* is not specified, it will attempt to remove
* the listener from all hosted events.
* @param fn {Function} The subscribed function to unsubscribe, if not
* supplied, all subscribers will be removed.
* @param context {Object} The custom object passed to subscribe. This is
* optional, but if supplied will be used to
* disambiguate multiple listeners that are the same
* (e.g., you subscribe many object using a function
* that lives on the prototype)
* @return {EventTarget} the host
*/
detach: function(type, fn, context) {
var evts = this._yuievt.events,
i,
Node = Y.Node,
isNode = Node && (Y.instanceOf(this, Node));
// detachAll disabled on the Y instance.
if (!type && (this !== Y)) {
for (i in evts) {
if (evts.hasOwnProperty(i)) {
evts[i].detach(fn, context);
}
}
if (isNode) {
Y.Event.purgeElement(Node.getDOMNode(this));
}
return this;
}
var parts = _parseType(type, this._yuievt.config.prefix),
detachcategory = L.isArray(parts) ? parts[0] : null,
shorttype = (parts) ? parts[3] : null,
adapt, store = Y.Env.evt.handles, detachhost, cat, args,
ce,
keyDetacher = function(lcat, ltype, host) {
var handles = lcat[ltype], ce, i;
if (handles) {
for (i = handles.length - 1; i >= 0; --i) {
ce = handles[i].evt;
if (ce.host === host || ce.el === host) {
handles[i].detach();
}
}
}
};
if (detachcategory) {
cat = store[detachcategory];
type = parts[1];
detachhost = (isNode) ? Y.Node.getDOMNode(this) : this;
if (cat) {
if (type) {
keyDetacher(cat, type, detachhost);
} else {
for (i in cat) {
if (cat.hasOwnProperty(i)) {
keyDetacher(cat, i, detachhost);
}
}
}
return this;
}
// If this is an event handle, use it to detach
} else if (L.isObject(type) && type.detach) {
type.detach();
return this;
// extra redirection so we catch adaptor events too. take a look at this.
} else if (isNode && ((!shorttype) || (shorttype in Node.DOM_EVENTS))) {
args = nativeSlice.call(arguments, 0);
args[2] = Node.getDOMNode(this);
Y.detach.apply(Y, args);
return this;
}
adapt = Y.Env.evt.plugins[shorttype];
// The YUI instance handles DOM events and adaptors
if (Y.instanceOf(this, YUI)) {
args = nativeSlice.call(arguments, 0);
// use the adaptor specific detach code if
if (adapt && adapt.detach) {
adapt.detach.apply(Y, args);
return this;
// DOM event fork
} else if (!type || (!adapt && Node && (type in Node.DOM_EVENTS))) {
args[0] = type;
Y.Event.detach.apply(Y.Event, args);
return this;
}
}
// ce = evts[type];
ce = evts[parts[1]];
if (ce) {
ce.detach(fn, context);
}
return this;
},
/**
* detach a listener
* @method unsubscribe
* @deprecated use detach
*/
unsubscribe: function() {
return this.detach.apply(this, arguments);
},
/**
* Removes all listeners from the specified event. If the event type
* is not specified, all listeners from all hosted custom events will
* be removed.
* @method detachAll
* @param type {String} The type, or name of the event
*/
detachAll: function(type) {
return this.detach(type);
},
/**
* Removes all listeners from the specified event. If the event type
* is not specified, all listeners from all hosted custom events will
* be removed.
* @method unsubscribeAll
* @param type {String} The type, or name of the event
* @deprecated use detachAll
*/
unsubscribeAll: function() {
return this.detachAll.apply(this, arguments);
},
/**
* Creates a new custom event of the specified type. If a custom event
* by that name already exists, it will not be re-created. In either
* case the custom event is returned.
*
* @method publish
*
* @param type {String} the type, or name of the event
* @param opts {object} optional config params. Valid properties are:
* @param [opts.broadcast=false] {Boolean} whether or not the YUI instance and YUI global
* are notified when the event is fired.
* @param [opts.bubbles=true] {Boolean} Whether or not this event bubbles. Events can
* only bubble if `emitFacade` is true.
* @param [opts.context=this] {Object} the default execution context for the listeners.
* @param [opts.defaultFn] {Function} the default function to execute when this event
* fires if preventDefault was not called.
* @param [opts.emitFacade=false] {Boolean} whether or not this event emits a facade.
* @param [opts.prefix] {String} the prefix for this targets events, e.g., 'menu' in 'menu:click'.
* @param [opts.fireOnce=false] {Boolean} if an event is configured to fire once,
* new subscribers after the fire will be notified immediately.
* @param [opts.async=false] {Boolean} fireOnce event listeners will fire synchronously
* if the event has already fired unless `async` is `true`.
* @param [opts.preventable=true] {Boolean} whether or not `preventDefault()` has an effect.
* @param [opts.preventedFn] {Function} a function that is executed when `preventDefault()` is called.
* @param [opts.queuable=false] {Boolean} whether or not this event can be queued during bubbling.
* @param [opts.silent] {Boolean} if silent is true, debug messages are not provided for this event.
* @param [opts.stoppedFn] {Function} a function that is executed when stopPropagation is called.
* @param [opts.monitored] {Boolean} specifies whether or not this event should send notifications about
* when the event has been attached, detached, or published.
* @param [opts.type] {String} the event type (valid option if not provided as the first parameter to publish).
*
* @return {CustomEvent} the custom event
*
*/
publish: function(type, opts) {
var ret,
etState = this._yuievt,
etConfig = etState.config,
pre = etConfig.prefix;
if (typeof type === "string") {
if (pre) {
type = _getType(type, pre);
}
ret = this._publish(type, etConfig, opts);
} else {
ret = {};
Y.each(type, function(v, k) {
if (pre) {
k = _getType(k, pre);
}
ret[k] = this._publish(k, etConfig, v || opts);
}, this);
}
return ret;
},
/**
* Returns the fully qualified type, given a short type string.
* That is, returns "foo:bar" when given "bar" if "foo" is the configured prefix.
*
* NOTE: This method, unlike _getType, does no checking of the value passed in, and
* is designed to be used with the low level _publish() method, for critical path
* implementations which need to fast-track publish for performance reasons.
*
* @method _getFullType
* @private
* @param {String} type The short type to prefix
* @return {String} The prefixed type, if a prefix is set, otherwise the type passed in
*/
_getFullType : function(type) {
var pre = this._yuievt.config.prefix;
if (pre) {
return pre + PREFIX_DELIMITER + type;
} else {
return type;
}
},
/**
* The low level event publish implementation. It expects all the massaging to have been done
* outside of this method. e.g. the `type` to `fullType` conversion. It's designed to be a fast
* path publish, which can be used by critical code paths to improve performance.
*
* @method _publish
* @private
* @param {String} fullType The prefixed type of the event to publish.
* @param {Object} etOpts The EventTarget specific configuration to mix into the published event.
* @param {Object} ceOpts The publish specific configuration to mix into the published event.
* @return {CustomEvent} The published event. If called without `etOpts` or `ceOpts`, this will
* be the default `CustomEvent` instance, and can be configured independently.
*/
_publish : function(fullType, etOpts, ceOpts) {
var ce,
etState = this._yuievt,
etConfig = etState.config,
host = etConfig.host,
context = etConfig.context,
events = etState.events;
ce = events[fullType];
// PERF: Hate to pull the check out of monitor, but trying to keep critical path tight.
if ((etConfig.monitored && !ce) || (ce && ce.monitored)) {
this._monitor('publish', fullType, {
args: arguments
});
}
if (!ce) {
// Publish event
ce = events[fullType] = new Y.CustomEvent(fullType, etOpts);
if (!etOpts) {
ce.host = host;
ce.context = context;
}
}
if (ceOpts) {
mixConfigs(ce, ceOpts, true);
}
return ce;
},
/**
* This is the entry point for the event monitoring system.
* You can monitor 'attach', 'detach', 'fire', and 'publish'.
* When configured, these events generate an event. click ->
* click_attach, click_detach, click_publish -- these can
* be subscribed to like other events to monitor the event
* system. Inividual published events can have monitoring
* turned on or off (publish can't be turned off before it
* it published) by setting the events 'monitor' config.
*
* @method _monitor
* @param what {String} 'attach', 'detach', 'fire', or 'publish'
* @param eventType {String|CustomEvent} The prefixed name of the event being monitored, or the CustomEvent object.
* @param o {Object} Information about the event interaction, such as
* fire() args, subscription category, publish config
* @private
*/
_monitor: function(what, eventType, o) {
var monitorevt, ce, type;
if (eventType) {
if (typeof eventType === "string") {
type = eventType;
ce = this.getEvent(eventType, true);
} else {
ce = eventType;
type = eventType.type;
}
if ((this._yuievt.config.monitored && (!ce || ce.monitored)) || (ce && ce.monitored)) {
monitorevt = type + '_' + what;
o.monitored = what;
this.fire.call(this, monitorevt, o);
}
}
},
/**
* Fire a custom event by name. The callback functions will be executed
* from the context specified when the event was created, and with the
* following parameters.
*
* The first argument is the event type, and any additional arguments are
* passed to the listeners as parameters. If the first of these is an
* object literal, and the event is configured to emit an event facade,
* that object is mixed into the event facade and the facade is provided
* in place of the original object.
*
* If the custom event object hasn't been created, then the event hasn't
* been published and it has no subscribers. For performance sake, we
* immediate exit in this case. This means the event won't bubble, so
* if the intention is that a bubble target be notified, the event must
* be published on this object first.
*
* @method fire
* @param type {String|Object} The type of the event, or an object that contains
* a 'type' property.
* @param arguments {Object*} an arbitrary set of parameters to pass to
* the handler. If the first of these is an object literal and the event is
* configured to emit an event facade, the event facade will replace that
* parameter after the properties the object literal contains are copied to
* the event facade.
* @return {Boolean} True if the whole lifecycle of the event went through,
* false if at any point the event propagation was halted.
*/
fire: function(type) {
var typeIncluded = (typeof type === "string"),
argCount = arguments.length,
t = type,
yuievt = this._yuievt,
etConfig = yuievt.config,
pre = etConfig.prefix,
ret,
ce,
ce2,
args;
if (typeIncluded && argCount <= 3) {
// PERF: Try to avoid slice/iteration for the common signatures
// Most common
if (argCount === 2) {
args = [arguments[1]]; // fire("foo", {})
} else if (argCount === 3) {
args = [arguments[1], arguments[2]]; // fire("foo", {}, opts)
} else {
args = []; // fire("foo")
}
} else {
args = nativeSlice.call(arguments, ((typeIncluded) ? 1 : 0));
}
if (!typeIncluded) {
t = (type && type.type);
}
if (pre) {
t = _getType(t, pre);
}
ce = yuievt.events[t];
if (this._hasSiblings) {
ce2 = this.getSibling(t, ce);
if (ce2 && !ce) {
ce = this.publish(t);
}
}
// PERF: trying to avoid function call, since this is a critical path
if ((etConfig.monitored && (!ce || ce.monitored)) || (ce && ce.monitored)) {
this._monitor('fire', (ce || t), {
args: args
});
}
// this event has not been published or subscribed to
if (!ce) {
if (yuievt.hasTargets) {
return this.bubble({ type: t }, args, this);
}
// otherwise there is nothing to be done
ret = true;
} else {
if (ce2) {
ce.sibling = ce2;
}
ret = ce._fire(args);
}
return (yuievt.chain) ? this : ret;
},
getSibling: function(type, ce) {
var ce2;
// delegate to *:type events if there are subscribers
if (type.indexOf(PREFIX_DELIMITER) > -1) {
type = _wildType(type);
ce2 = this.getEvent(type, true);
if (ce2) {
ce2.applyConfig(ce);
ce2.bubbles = false;
ce2.broadcast = 0;
}
}
return ce2;
},
/**
* Returns the custom event of the provided type has been created, a
* falsy value otherwise
* @method getEvent
* @param type {String} the type, or name of the event
* @param prefixed {String} if true, the type is prefixed already
* @return {CustomEvent} the custom event or null
*/
getEvent: function(type, prefixed) {
var pre, e;
if (!prefixed) {
pre = this._yuievt.config.prefix;
type = (pre) ? _getType(type, pre) : type;
}
e = this._yuievt.events;
return e[type] || null;
},
/**
* Subscribe to a custom event hosted by this object. The
* supplied callback will execute after any listeners add
* via the subscribe method, and after the default function,
* if configured for the event, has executed.
*
* @method after
* @param {String} type The name of the event
* @param {Function} fn The callback to execute in response to the event
* @param {Object} [context] Override `this` object in callback
* @param {Any} [arg*] 0..n additional arguments to supply to the subscriber
* @return {EventHandle} A subscription handle capable of detaching the
* subscription
*/
after: function(type, fn) {
var a = nativeSlice.call(arguments, 0);
switch (L.type(type)) {
case 'function':
return Y.Do.after.apply(Y.Do, arguments);
case 'array':
// YArray.each(a[0], function(v) {
// v = AFTER_PREFIX + v;
// });
// break;
case 'object':
a[0]._after = true;
break;
default:
a[0] = AFTER_PREFIX + type;
}
return this.on.apply(this, a);
},
/**
* Executes the callback before a DOM event, custom event
* or method. If the first argument is a function, it
* is assumed the target is a method. For DOM and custom
* events, this is an alias for Y.on.
*
* For DOM and custom events:
* type, callback, context, 0-n arguments
*
* For methods:
* callback, object (method host), methodName, context, 0-n arguments
*
* @method before
* @return detach handle
*/
before: function() {
return this.on.apply(this, arguments);
}
};
Y.EventTarget = ET;
// make Y an event target
Y.mix(Y, ET.prototype);
ET.call(Y, { bubbles: false });
YUI.Env.globalEvents = YUI.Env.globalEvents || new ET();
/**
* Hosts YUI page level events. This is where events bubble to
* when the broadcast config is set to 2. This property is
* only available if the custom event module is loaded.
* @property Global
* @type EventTarget
* @for YUI
*/
Y.Global = YUI.Env.globalEvents;
// @TODO implement a global namespace function on Y.Global?
/**
`Y.on()` can do many things:
<ul>
<li>Subscribe to custom events `publish`ed and `fire`d from Y</li>
<li>Subscribe to custom events `publish`ed with `broadcast` 1 or 2 and
`fire`d from any object in the YUI instance sandbox</li>
<li>Subscribe to DOM events</li>
<li>Subscribe to the execution of a method on any object, effectively
treating that method as an event</li>
</ul>
For custom event subscriptions, pass the custom event name as the first argument
and callback as the second. The `this` object in the callback will be `Y` unless
an override is passed as the third argument.
Y.on('io:complete', function () {
Y.MyApp.updateStatus('Transaction complete');
});
To subscribe to DOM events, pass the name of a DOM event as the first argument
and a CSS selector string as the third argument after the callback function.
Alternately, the third argument can be a `Node`, `NodeList`, `HTMLElement`,
array, or simply omitted (the default is the `window` object).
Y.on('click', function (e) {
e.preventDefault();
// proceed with ajax form submission
var url = this.get('action');
...
}, '#my-form');
The `this` object in DOM event callbacks will be the `Node` targeted by the CSS
selector or other identifier.
`on()` subscribers for DOM events or custom events `publish`ed with a
`defaultFn` can prevent the default behavior with `e.preventDefault()` from the
event object passed as the first parameter to the subscription callback.
To subscribe to the execution of an object method, pass arguments corresponding to the call signature for
<a href="../classes/Do.html#methods_before">`Y.Do.before(...)`</a>.
NOTE: The formal parameter list below is for events, not for function
injection. See `Y.Do.before` for that signature.
@method on
@param {String} type DOM or custom event name
@param {Function} fn The callback to execute in response to the event
@param {Object} [context] Override `this` object in callback
@param {Any} [arg*] 0..n additional arguments to supply to the subscriber
@return {EventHandle} A subscription handle capable of detaching the
subscription
@see Do.before
@for YUI
**/
/**
Listen for an event one time. Equivalent to `on()`, except that
the listener is immediately detached when executed.
See the <a href="#methods_on">`on()` method</a> for additional subscription
options.
@see on
@method once
@param {String} type DOM or custom event name
@param {Function} fn The callback to execute in response to the event
@param {Object} [context] Override `this` object in callback
@param {Any} [arg*] 0..n additional arguments to supply to the subscriber
@return {EventHandle} A subscription handle capable of detaching the
subscription
@for YUI
**/
/**
Listen for an event one time. Equivalent to `once()`, except, like `after()`,
the subscription callback executes after all `on()` subscribers and the event's
`defaultFn` (if configured) have executed. Like `after()` if any `on()` phase
subscriber calls `e.preventDefault()`, neither the `defaultFn` nor the `after()`
subscribers will execute.
The listener is immediately detached when executed.
See the <a href="#methods_on">`on()` method</a> for additional subscription
options.
@see once
@method onceAfter
@param {String} type The custom event name
@param {Function} fn The callback to execute in response to the event
@param {Object} [context] Override `this` object in callback
@param {Any} [arg*] 0..n additional arguments to supply to the subscriber
@return {EventHandle} A subscription handle capable of detaching the
subscription
@for YUI
**/
/**
Like `on()`, this method creates a subscription to a custom event or to the
execution of a method on an object.
For events, `after()` subscribers are executed after the event's
`defaultFn` unless `e.preventDefault()` was called from an `on()` subscriber.
See the <a href="#methods_on">`on()` method</a> for additional subscription
options.
NOTE: The subscription signature shown is for events, not for function
injection. See <a href="../classes/Do.html#methods_after">`Y.Do.after`</a>
for that signature.
@see on
@see Do.after
@method after
@param {String} type The custom event name
@param {Function} fn The callback to execute in response to the event
@param {Object} [context] Override `this` object in callback
@param {Any} [args*] 0..n additional arguments to supply to the subscriber
@return {EventHandle} A subscription handle capable of detaching the
subscription
@for YUI
**/
}, '3.18.1', {"requires": ["oop"]});
|
4.2.0/src/components/PureInput.js
|
erikras/redux-form-docs
|
import React, { Component, PropTypes } from 'react'
class PureInput extends Component {
shouldComponentUpdate(nextProps) {
return this.props.field !== nextProps.field
}
render() {
const { field, ...rest } = this.props
return <input {...field} {...rest}/>
}
}
PureInput.propTypes = {
field: PropTypes.object.isRequired
}
export default PureInput
|
src/CollapsibleMixin.js
|
PeterDaveHello/react-bootstrap
|
import React from 'react';
import TransitionEvents from './utils/TransitionEvents';
import deprecationWarning from './utils/deprecationWarning';
let warned = false;
const CollapsibleMixin = {
propTypes: {
defaultExpanded: React.PropTypes.bool,
expanded: React.PropTypes.bool
},
getInitialState(){
let defaultExpanded = this.props.defaultExpanded != null ?
this.props.defaultExpanded :
this.props.expanded != null ?
this.props.expanded :
false;
return {
expanded: defaultExpanded,
collapsing: false
};
},
componentWillMount(){
if ( !warned ){
deprecationWarning('CollapsibleMixin', 'Collapse Component');
warned = true;
}
},
componentWillUpdate(nextProps, nextState){
let willExpanded = nextProps.expanded != null ? nextProps.expanded : nextState.expanded;
if (willExpanded === this.isExpanded()) {
return;
}
// if the expanded state is being toggled, ensure node has a dimension value
// this is needed for the animation to work and needs to be set before
// the collapsing class is applied (after collapsing is applied the in class
// is removed and the node's dimension will be wrong)
let node = this.getCollapsibleDOMNode();
let dimension = this.dimension();
let value = '0';
if(!willExpanded){
value = this.getCollapsibleDimensionValue();
}
node.style[dimension] = value + 'px';
this._afterWillUpdate();
},
componentDidUpdate(prevProps, prevState){
// check if expanded is being toggled; if so, set collapsing
this._checkToggleCollapsing(prevProps, prevState);
// check if collapsing was turned on; if so, start animation
this._checkStartAnimation();
},
// helps enable test stubs
_afterWillUpdate(){
},
_checkStartAnimation(){
if(!this.state.collapsing) {
return;
}
let node = this.getCollapsibleDOMNode();
let dimension = this.dimension();
let value = this.getCollapsibleDimensionValue();
// setting the dimension here starts the transition animation
let result;
if(this.isExpanded()) {
result = value + 'px';
} else {
result = '0px';
}
node.style[dimension] = result;
},
_checkToggleCollapsing(prevProps, prevState){
let wasExpanded = prevProps.expanded != null ? prevProps.expanded : prevState.expanded;
let isExpanded = this.isExpanded();
if(wasExpanded !== isExpanded){
if(wasExpanded) {
this._handleCollapse();
} else {
this._handleExpand();
}
}
},
_handleExpand(){
let node = this.getCollapsibleDOMNode();
let dimension = this.dimension();
let complete = () => {
this._removeEndEventListener(node, complete);
// remove dimension value - this ensures the collapsible item can grow
// in dimension after initial display (such as an image loading)
node.style[dimension] = '';
this.setState({
collapsing:false
});
};
this._addEndEventListener(node, complete);
this.setState({
collapsing: true
});
},
_handleCollapse(){
let node = this.getCollapsibleDOMNode();
let complete = () => {
this._removeEndEventListener(node, complete);
this.setState({
collapsing: false
});
};
this._addEndEventListener(node, complete);
this.setState({
collapsing: true
});
},
// helps enable test stubs
_addEndEventListener(node, complete){
TransitionEvents.addEndEventListener(node, complete);
},
// helps enable test stubs
_removeEndEventListener(node, complete){
TransitionEvents.removeEndEventListener(node, complete);
},
dimension(){
return (typeof this.getCollapsibleDimension === 'function') ?
this.getCollapsibleDimension() :
'height';
},
isExpanded(){
return this.props.expanded != null ? this.props.expanded : this.state.expanded;
},
getCollapsibleClassSet(className) {
let classes = {};
if (typeof className === 'string') {
className.split(' ').forEach(subClasses => {
if (subClasses) {
classes[subClasses] = true;
}
});
}
classes.collapsing = this.state.collapsing;
classes.collapse = !this.state.collapsing;
classes.in = this.isExpanded() && !this.state.collapsing;
return classes;
}
};
export default CollapsibleMixin;
|
ajax/libs/alexandernst-angular-multi-select/7.4.3/angular-multi-select.js
|
jonobr1/cdnjs
|
"use strict";
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof 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 _templateObject = _taggedTemplateLiteral(["\n\n\t\t<div class=\"ams-button\" ng-click=\"open = !open\">\n\t\t\t<div class=\"ams-button-text\" ng-bind-html=\"amssh.create_dropdown_label(stats, outputModelNotFormatted, self.output_type)\"></div>\n\t\t\t<div class=\"ams-caret\"></div>\n\t\t</div>\n\n\t\t<div class=\"ams-container ng-cloak\" ng-show=\"open\">\n\n\t\t\t<div class=\"ams-helpers\">\n\t\t\t\t<div class=\"selects\">\n\t\t\t\t\t<button class=\"all ams-btn\" type=\"button\" accesskey=\"a\" ng-click=\"amse.check_all()\" ng-hide=\"hide_helpers.indexOf('check_all') > -1\">{{ 'CHECK_ALL' | translate }}</button>\n\t\t\t\t\t<button class=\"none ams-btn\" type=\"button\" accesskey=\"n\" ng-click=\"amse.uncheck_all()\" ng-hide=\"hide_helpers.indexOf('check_none') > -1\">{{ 'CHECK_NONE' | translate }}</button>\n\t\t\t\t</div>\n\n\t\t\t\t<div class=\"resets\">\n\t\t\t\t\t<button class=\"reset ams-btn\" type=\"button\" accesskey=\"r\" ng-click=\"reset()\" ng-hide=\"hide_helpers.indexOf('reset') > -1\">{{ 'RESET' | translate }}</button>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t<div class=\"ams-search\" ng-show=\"search_field !== null\">\n\t\t\t\t<input class=\"ams-search-field\" type=\"text\" name=\"ams-search-field\" value=\"\" placeholder=\"{{ 'SEARCH' | translate }}\" ng-model=\"search\" autofocus>\n\t\t\t\t<div class=\"ams-spinner\" ng-show=\"search_spinner_visible\"></div>\n\t\t\t\t<button class=\"clear ams-btn\" type=\"button\" accesskey=\"c\" name=\"clear\" title=\"{{ 'CLEAR' | translate }}\" ng-click=\"search = ''\"></button>\n\t\t\t</div>\n\n\t\t\t<div class=\"ams-items\">\n\t\t\t\t<div\n\t\t\t\t\tng-repeat=\"item in items track by item[ops.ID_PROPERTY]\"\n\t\t\t\t\tclass=\"ams-item {{ amssh.get_level_class(item) }} {{ amssh.get_type_class(item) }} {{ amssh.get_open_class(item) }} {{ $index === focused_index ? 'ams-item-focused' : '' }}\"\n\t\t\t\t>\n\t\t\t\t\t<!-- Caret -->\n\t\t\t\t\t<div\n\t\t\t\t\t\tclass=\"ams-caret {{ amssh.get_open_class(item) }}\"\n\t\t\t\t\t\tng-click=\"toggle_open_node(item)\"\n\t\t\t\t\t></div>\n\n\t\t\t\t\t<!-- Text of the element -->\n\t\t\t\t\t<div class=\"ams-item-text\" ng-bind-html=\"amssh.create_label(item)\"></div>\n\n\t\t\t\t\t<!-- Check holder -->\n\t\t\t\t\t<div\n\t\t\t\t\t\tclass=\"check {{ amssh.get_checked_class(item) }}\"\n\t\t\t\t\t\tng-click=\"toggle_check_node(item)\"\n\t\t\t\t\t>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t</div>\n\n\t"], ["\n\n\t\t<div class=\"ams-button\" ng-click=\"open = !open\">\n\t\t\t<div class=\"ams-button-text\" ng-bind-html=\"amssh.create_dropdown_label(stats, outputModelNotFormatted, self.output_type)\"></div>\n\t\t\t<div class=\"ams-caret\"></div>\n\t\t</div>\n\n\t\t<div class=\"ams-container ng-cloak\" ng-show=\"open\">\n\n\t\t\t<div class=\"ams-helpers\">\n\t\t\t\t<div class=\"selects\">\n\t\t\t\t\t<button class=\"all ams-btn\" type=\"button\" accesskey=\"a\" ng-click=\"amse.check_all()\" ng-hide=\"hide_helpers.indexOf('check_all') > -1\">{{ 'CHECK_ALL' | translate }}</button>\n\t\t\t\t\t<button class=\"none ams-btn\" type=\"button\" accesskey=\"n\" ng-click=\"amse.uncheck_all()\" ng-hide=\"hide_helpers.indexOf('check_none') > -1\">{{ 'CHECK_NONE' | translate }}</button>\n\t\t\t\t</div>\n\n\t\t\t\t<div class=\"resets\">\n\t\t\t\t\t<button class=\"reset ams-btn\" type=\"button\" accesskey=\"r\" ng-click=\"reset()\" ng-hide=\"hide_helpers.indexOf('reset') > -1\">{{ 'RESET' | translate }}</button>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t<div class=\"ams-search\" ng-show=\"search_field !== null\">\n\t\t\t\t<input class=\"ams-search-field\" type=\"text\" name=\"ams-search-field\" value=\"\" placeholder=\"{{ 'SEARCH' | translate }}\" ng-model=\"search\" autofocus>\n\t\t\t\t<div class=\"ams-spinner\" ng-show=\"search_spinner_visible\"></div>\n\t\t\t\t<button class=\"clear ams-btn\" type=\"button\" accesskey=\"c\" name=\"clear\" title=\"{{ 'CLEAR' | translate }}\" ng-click=\"search = ''\"></button>\n\t\t\t</div>\n\n\t\t\t<div class=\"ams-items\">\n\t\t\t\t<div\n\t\t\t\t\tng-repeat=\"item in items track by item[ops.ID_PROPERTY]\"\n\t\t\t\t\tclass=\"ams-item {{ amssh.get_level_class(item) }} {{ amssh.get_type_class(item) }} {{ amssh.get_open_class(item) }} {{ $index === focused_index ? 'ams-item-focused' : '' }}\"\n\t\t\t\t>\n\t\t\t\t\t<!-- Caret -->\n\t\t\t\t\t<div\n\t\t\t\t\t\tclass=\"ams-caret {{ amssh.get_open_class(item) }}\"\n\t\t\t\t\t\tng-click=\"toggle_open_node(item)\"\n\t\t\t\t\t></div>\n\n\t\t\t\t\t<!-- Text of the element -->\n\t\t\t\t\t<div class=\"ams-item-text\" ng-bind-html=\"amssh.create_label(item)\"></div>\n\n\t\t\t\t\t<!-- Check holder -->\n\t\t\t\t\t<div\n\t\t\t\t\t\tclass=\"check {{ amssh.get_checked_class(item) }}\"\n\t\t\t\t\t\tng-click=\"toggle_check_node(item)\"\n\t\t\t\t\t>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t</div>\n\n\t"]);
function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
(function (e) {
function f(a, c) {
function b(a) {
if (!this || this.constructor !== b) return new b(a);this._keys = [];this._values = [];this._itp = [];this.objectOnly = c;a && v.call(this, a);
}c || w(a, "size", { get: x });a.constructor = b;b.prototype = a;return b;
}function v(a) {
this.add ? a.forEach(this.add, this) : a.forEach(function (a) {
this.set(a[0], a[1]);
}, this);
}function d(a) {
this.has(a) && (this._keys.splice(b, 1), this._values.splice(b, 1), this._itp.forEach(function (a) {
b < a[0] && a[0]--;
}));return -1 < b;
}function m(a) {
return this.has(a) ? this._values[b] : void 0;
}function n(a, c) {
if (this.objectOnly && c !== Object(c)) throw new TypeError("Invalid value used as weak collection key");if (c != c || 0 === c) for (b = a.length; b-- && !y(a[b], c);) {} else b = a.indexOf(c);return -1 < b;
}function p(a) {
return n.call(this, this._values, a);
}function q(a) {
return n.call(this, this._keys, a);
}function r(a, c) {
this.has(a) ? this._values[b] = c : this._values[this._keys.push(a) - 1] = c;return this;
}function t(a) {
this.has(a) || this._values.push(a);return this;
}function h() {
(this._keys || 0).length = this._values.length = 0;
}function z() {
return k(this._itp, this._keys);
}function l() {
return k(this._itp, this._values);
}function A() {
return k(this._itp, this._keys, this._values);
}function B() {
return k(this._itp, this._values, this._values);
}function k(a, c, b) {
var g = [0],
e = !1;a.push(g);return { next: function next() {
var f,
d = g[0];!e && d < c.length ? (f = b ? [c[d], b[d]] : c[d], g[0]++) : (e = !0, a.splice(a.indexOf(g), 1));return { done: e, value: f };
} };
}function x() {
return this._values.length;
}function u(a, c) {
for (var b = this.entries();;) {
var d = b.next();if (d.done) break;
a.call(c, d.value[1], d.value[0], this);
}
}var b,
w = Object.defineProperty,
y = function y(a, b) {
return isNaN(a) ? isNaN(b) : a === b;
};"undefined" == typeof WeakMap && (e.WeakMap = f({ "delete": d, clear: h, get: m, has: q, set: r }, !0));"undefined" != typeof Map && "function" === typeof new Map().values && new Map().values().next || (e.Map = f({ "delete": d, has: q, get: m, set: r, keys: z, values: l, entries: A, forEach: u, clear: h }));"undefined" != typeof Set && "function" === typeof new Set().values && new Set().values().next || (e.Set = f({ has: p, add: t, "delete": d, clear: h,
keys: l, values: l, entries: B, forEach: u }));"undefined" == typeof WeakSet && (e.WeakSet = f({ "delete": d, add: t, clear: h, has: p }, !0));
})("undefined" != typeof exports && "undefined" != typeof global ? global : window);
var angular_multi_select_consts = angular.module('angular-multi-select-constants', []);
angular_multi_select_consts.constant("angularMultiSelectConstants", {
/*
* Default key names of the input data
*/
ID_PROPERTY: 'id',
OPEN_PROPERTY: 'open',
CHECKED_PROPERTY: 'checked',
CHILDREN_PROPERTY: 'children',
/*
* Internal data keys
*/
INTERNAL_KEY_LEVEL: '$ams_level',
INTERNAL_KEY_ORDER: '$ams_order',
INTERNAL_KEY_PARENTS_ID: '$ams_parents_id',
INTERNAL_KEY_CHILDREN_LEAFS: '$ams_children_leafs',
INTERNAL_KEY_CHILDREN_NODES: '$ams_children_nodes',
INTERNAL_KEY_CHECKED_CHILDREN: '$ams_checked_children',
INTERNAL_KEY_TREE_VISIBILITY: '$ams_tree_visibility',
INTERNAL_KEY_CHECKED_MODIFICATION: '$ams_checked_modification',
/*
* This gets injected while processing the stats, in the dropdown
* label. This allows us to iterate over the output model when
* generating the dropdown label.
*/
INTERNAL_KEY_OUTPUT_MODEL_HACK: '$ams_output_model_hack',
INTERNAL_KEY_OUTPUT_TYPE_HACK: '$ams_output_type_hack',
/*
* Possible values of the input/internal data
*/
INPUT_DATA_OPEN: true,
INPUT_DATA_CLOSED: false,
INTERNAL_DATA_OPEN: true,
INTERNAL_DATA_CLOSED: false,
INPUT_DATA_CHECKED: true,
INPUT_DATA_UNCHECKED: false,
INTERNAL_DATA_LEAF_CHECKED: true,
INTERNAL_DATA_LEAF_UNCHECKED: false,
INTERNAL_DATA_NODE_CHECKED: 1,
INTERNAL_DATA_NODE_MIXED: 0,
INTERNAL_DATA_NODE_UNCHECKED: -1,
INTERNAL_DATA_NODE_CHECK_UNDEFINED: null,
INTERNAL_DATA_VISIBLE: true,
INTERNAL_DATA_INVISIBLE: false,
INTERNAL_DATA_VISIBILITY_UNDEFINED: null,
INTERNAL_STATS_CHECKED_LEAFS: '$ams_stats_checked_leafs',
INTERNAL_STATS_CHECKED_NODES: '$ams_stats_checked_nodes',
INTERNAL_STATS_UNCHECKED_NODES: '$ams_stats_unchecked_nodes',
INTERNAL_STATS_TOTAL_LEAFS: '$ams_stats_total_leafs',
INTERNAL_STATS_TOTAL_NODES: '$ams_stats_total_nodes',
/*
* Possible values of the output type of data
*/
OUTPUT_DATA_TYPE_OBJECTS: 'objects',
OUTPUT_DATA_TYPE_ARRAYS: 'arrays',
OUTPUT_DATA_TYPE_OBJECT: 'object',
OUTPUT_DATA_TYPE_ARRAY: 'array',
OUTPUT_DATA_TYPE_VALUES: 'values',
OUTPUT_DATA_TYPE_VALUE: 'value',
/*
* CSS classes helpers
*/
CSS_OPEN: 'open',
CSS_CLOSED: 'closed',
CSS_LEAF_CHECKED: 'checked',
CSS_LEAF_UNCHECKED: 'unchecked',
CSS_NODE_MIXED: 'mixed',
CSS_NODE_CHECKED: 'checked',
CSS_NODE_UNCHECKED: 'unchecked',
CSS_LEAF: 'leaf',
CSS_NODE: 'node',
/*
* Possible values for the output data query
*/
FIND_LEAFS: 'leafs',
FIND_LEAFS_MIXED_NODES: 'leafs_mixed_nodes',
FIND_LEAFS_CHECKED_NODES: 'leafs_checked_nodes',
FIND_LEAFS_MIXED_CHECKED_NODES: 'leafs_mixed_checked_nodes',
FIND_MIXED_NODES: 'midex_nodes',
FIND_CHECKED_NODES: 'checked_nodes',
FIND_MIXED_CHECKED_NODES: 'mixed_checked_nodes'
});
var angular_multi_select_data_converter = angular.module('angular-multi-select-data-converter', ['angular-multi-select-utils', 'angular-multi-select-constants']);
angular_multi_select_data_converter.factory('angularMultiSelectDataConverter', ['angularMultiSelectUtils', 'angularMultiSelectConstants', function (angularMultiSelectUtils, angularMultiSelectConstants) {
'use strict';
/*
██████ ██████ ███ ██ ███████ ████████ ██████ ██ ██ ██████ ████████ ██████ ██████
██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ ██ ███████ ██ ██████ ██ ██ ██ ██ ██ ██ ██████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████ ██████ ██ ████ ███████ ██ ██ ██ ██████ ██████ ██ ██████ ██ ██
*/
var DataConverter = function DataConverter(ops) {
this.amsu = new angularMultiSelectUtils();
_extends(this, this.amsu.sanitize_ops(ops));
};
/*
██████ ██ ██ ███████ ██████ ██ ██ ██████ ██████ ███████ ██████ ███████ ██████ ██ ██ ██ ███████ ██ ████████ ███████ ███████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ███████ █████ ██ █████ ██████ ██████ █████ ██████ █████ ██ ██ ██ ██ ██ ███████ ██ ██ █████ ███████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ▄▄ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████ ██ ██ ███████ ██████ ██ ██ ██ ██ ██ ███████ ██ ██ ███████ ██████ ██████ ██ ███████ ██ ██ ███████ ███████
▀▀
*/
DataConverter.prototype.check_prerequisites = function (data) {
/*
* Takes an array of data and walks through each element object
* and checks if each object has:
*
* - a valid ID. If it doesn't, it generates one.
* - open property. If it's not 'true' (strictly compared), it
* creates one and set's it to false.
* - children property. If it's not an array or if it's empty,
* it deletes the property, else it will delete the checked
* property. Note that nodes can't have a checked property at
* this step of the process.
* - checked property. If it's not 'true' (strictly compared),
* creates one and set's it to false.
*
* Note that you can completely skip this step (thus saving some
* CPU cycles) if you are sure that all objects in your input data:
*
* - have valid and unique ID.
* - have open property, which is boolean and false for leafs
* - children properties are non-empty arrays
* - only leafs have a checked property and it's a boolean
*/
if (this.DEBUG === true) console.time(this.NAME + ' -> check_prerequisites');
if (!Array.isArray(data)) return false;
var ids = new Set();
var ctx = this;
var correct = true;
var id_seed = Date.now();
function process_items(items) {
if (correct === false) return;
for (var i = 0; i < items.length; i++) {
var item = items[i];
if (item.constructor.toString().indexOf('Array') !== -1) {
return correct = false;
}
// Check for id field.
// If not present, assign one
if (!(ctx.ID_PROPERTY in item) || ids.has(item[ctx.ID_PROPERTY])) {
while (ids.has(id_seed)) {
id_seed++;
}
item[ctx.ID_PROPERTY] = id_seed++;
}
ids.add(item[ctx.ID_PROPERTY]);
// Check for open field.
// If open field doesn't exist or is not "true", set to false
if (!(ctx.OPEN_PROPERTY in item) || item[ctx.OPEN_PROPERTY] !== angularMultiSelectConstants.INPUT_DATA_OPEN) {
item[ctx.OPEN_PROPERTY] = angularMultiSelectConstants.INPUT_DATA_CLOSED;
}
// Check for children field.
// If not an array or empty array, remove it.
if (ctx.CHILDREN_PROPERTY in item && (!Array.isArray(item[ctx.CHILDREN_PROPERTY]) || item[ctx.CHILDREN_PROPERTY].length === 0)) {
delete item[ctx.CHILDREN_PROPERTY];
}
// If children field is present, remove "checked" field.
// If checked field is present, but value is not boolean or 1,
// set to false.
if (ctx.CHILDREN_PROPERTY in item) {
delete item[ctx.CHECKED_PROPERTY];
}
if (ctx.CHECKED_PROPERTY in item && item[ctx.CHECKED_PROPERTY] !== angularMultiSelectConstants.INPUT_DATA_CHECKED) {
item[ctx.CHECKED_PROPERTY] = angularMultiSelectConstants.INPUT_DATA_UNCHECKED;
}
if (!(ctx.CHILDREN_PROPERTY in item) && !(ctx.CHECKED_PROPERTY in item)) {
item[ctx.CHECKED_PROPERTY] = angularMultiSelectConstants.INPUT_DATA_UNCHECKED;
}
if (ctx.CHILDREN_PROPERTY in item) {
process_items(item[ctx.CHILDREN_PROPERTY]);
}
}
}
process_items(data);
if (this.DEBUG === true) console.timeEnd(this.NAME + ' -> check_prerequisites');
// Return data array or false if something is wrong.
return correct ? data : correct;
};
/*
████████ ██████ ██ ███ ██ ████████ ███████ ██████ ███ ██ █████ ██
██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██
██ ██ ██ ██ ██ ██ ██ ██ █████ ██████ ██ ██ ██ ███████ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██████ ██ ██ ████ ██ ███████ ██ ██ ██ ████ ██ ██ ███████
*/
DataConverter.prototype.to_internal = function (data) {
/*
* Takes an array of (nested) objects and flattens it, while
* also adding some internal properties required for faster
* un/check and state actions.
*
* Note that you can skip this step (thus saving some CPU cycles)
* only if you're completely sure how this method works, what and
* how it does what it does.
*/
if (this.DEBUG === true) console.time(this.NAME + ' -> to_internal');
var order = 1;
var ctx = this;
var i, j, item;
var final_data = [];
function process_items(items, level) {
for (var i = 0; i < items.length; i++) {
item = items[i];
var final_item = _extends({}, item);
delete final_item[ctx.CHECKED_PROPERTY];
delete final_item[ctx.CHILDREN_PROPERTY];
if (ctx.CHECKED_PROPERTY in item && typeof item[ctx.CHECKED_PROPERTY] === 'boolean') {
final_item[ctx.CHECKED_PROPERTY] = item[ctx.CHECKED_PROPERTY];
} else {
final_item[ctx.CHECKED_PROPERTY] = angularMultiSelectConstants.INTERNAL_DATA_NODE_CHECK_UNDEFINED;
}
//Assigned in order
final_item[angularMultiSelectConstants.INTERNAL_KEY_LEVEL] = level;
final_item[angularMultiSelectConstants.INTERNAL_KEY_ORDER] = order++;
//Required to be present for further calculation
final_item[angularMultiSelectConstants.INTERNAL_KEY_PARENTS_ID] = [];
final_item[angularMultiSelectConstants.INTERNAL_KEY_CHILDREN_LEAFS] = 0;
final_item[angularMultiSelectConstants.INTERNAL_KEY_CHILDREN_NODES] = 0;
final_item[angularMultiSelectConstants.INTERNAL_KEY_CHECKED_CHILDREN] = 0;
final_item[angularMultiSelectConstants.INTERNAL_KEY_TREE_VISIBILITY] = angularMultiSelectConstants.INTERNAL_DATA_VISIBILITY_UNDEFINED;
final_item[angularMultiSelectConstants.INTERNAL_KEY_CHECKED_MODIFICATION] = 0;
final_data.push(final_item);
if (ctx.CHILDREN_PROPERTY in item) {
process_items(item[ctx.CHILDREN_PROPERTY], level + 1);
}
}
}
process_items(data, 0);
// calculate parents_id, visibility, children and checked properties
var parents = [];
var time_seed = Date.now();
for (i = 0; i < final_data.length; i++) {
item = final_data[i];
item[angularMultiSelectConstants.INTERNAL_KEY_CHECKED_MODIFICATION] = time_seed++;
// Assign all the parent node IDs
parents[item[angularMultiSelectConstants.INTERNAL_KEY_LEVEL]] = item[ctx.ID_PROPERTY];
if (item[angularMultiSelectConstants.INTERNAL_KEY_LEVEL] !== 0) {
item[angularMultiSelectConstants.INTERNAL_KEY_PARENTS_ID] = parents.slice(0, item[angularMultiSelectConstants.INTERNAL_KEY_LEVEL]);
}
// If this is a root element, it should be visible
if (item[angularMultiSelectConstants.INTERNAL_KEY_LEVEL] === 0) item[angularMultiSelectConstants.INTERNAL_KEY_TREE_VISIBILITY] = angularMultiSelectConstants.INTERNAL_DATA_VISIBLE;
// we are guaranteed to have a checked property for leafs
// if the current item is a leaf, it won't have children, hence skip
if (typeof item[this.CHECKED_PROPERTY] === 'boolean') continue;
var counter_checked = 0;
var counter_unchecked = 0;
var counter_null = 0;
for (j = i + 1; j < final_data.length; j++) {
var child = final_data[j];
// Decide if children should be visible in the tree
if (item[angularMultiSelectConstants.INTERNAL_KEY_LEVEL] === child[angularMultiSelectConstants.INTERNAL_KEY_LEVEL] - 1) {
child[angularMultiSelectConstants.INTERNAL_KEY_TREE_VISIBILITY] = item[this.OPEN_PROPERTY];
}
if (item[angularMultiSelectConstants.INTERNAL_KEY_LEVEL] >= child[angularMultiSelectConstants.INTERNAL_KEY_LEVEL]) break;
// Logic that decides the checked state of node items
if (child[this.CHECKED_PROPERTY] === angularMultiSelectConstants.INTERNAL_DATA_LEAF_CHECKED) {
counter_checked++;
item[angularMultiSelectConstants.INTERNAL_KEY_CHILDREN_LEAFS]++;
} else if (child[this.CHECKED_PROPERTY] === angularMultiSelectConstants.INTERNAL_DATA_LEAF_UNCHECKED) {
counter_unchecked++;
item[angularMultiSelectConstants.INTERNAL_KEY_CHILDREN_LEAFS]++;
} else if (child[this.CHECKED_PROPERTY] === angularMultiSelectConstants.INTERNAL_DATA_NODE_CHECK_UNDEFINED) {
counter_null++;
item[angularMultiSelectConstants.INTERNAL_KEY_CHILDREN_NODES]++;
}
}
// If the number of checked or unchecked elements equals to
// the number of children, then the current item should be
// either 1 or -1 (checked or unchecked). Else, it should be
// marked as 0 (mixed state).
if (item[angularMultiSelectConstants.INTERNAL_KEY_CHILDREN_LEAFS] === counter_checked) {
item[this.CHECKED_PROPERTY] = angularMultiSelectConstants.INTERNAL_DATA_NODE_CHECKED;
} else if (item[angularMultiSelectConstants.INTERNAL_KEY_CHILDREN_LEAFS] === counter_unchecked) {
item[this.CHECKED_PROPERTY] = angularMultiSelectConstants.INTERNAL_DATA_NODE_UNCHECKED;
} else {
item[this.CHECKED_PROPERTY] = angularMultiSelectConstants.INTERNAL_DATA_NODE_MIXED;
}
item[angularMultiSelectConstants.INTERNAL_KEY_CHECKED_CHILDREN] = counter_checked;
}
if (this.DEBUG === true) console.timeEnd(this.NAME + ' -> to_internal');
return final_data;
};
/*
████████ ██████ ███████ ██ ██ ████████ ███████ ██████ ███ ██ █████ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██
██ ██ ██ █████ ███ ██ █████ ██████ ██ ██ ██ ███████ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██████ ███████ ██ ██ ██ ███████ ██ ██ ██ ████ ██ ██ ███████
*/
DataConverter.prototype.to_external = function (data) {
/*
* This is the opposite of what 'to_internal' is supposed to do.
* This will take an array of objects, usually the output of
* get_*_tree and delete all the metadata of the engine, leaving
* only the data that the user cares about.
*/
if (!Array.isArray(data) || data.length === 0) {
return [];
}
if (this.DEBUG === true) console.time(this.NAME + ' -> to_external');
data = JSON.parse(JSON.stringify(data));
for (var i = 0; i < data.length; i++) {
//AMS engine metadata
delete data[i][angularMultiSelectConstants.INTERNAL_KEY_LEVEL];
delete data[i][angularMultiSelectConstants.INTERNAL_KEY_ORDER];
delete data[i][angularMultiSelectConstants.INTERNAL_KEY_PARENTS_ID];
delete data[i][angularMultiSelectConstants.INTERNAL_KEY_CHILDREN_LEAFS];
delete data[i][angularMultiSelectConstants.INTERNAL_KEY_CHILDREN_NODES];
delete data[i][angularMultiSelectConstants.INTERNAL_KEY_CHECKED_CHILDREN];
delete data[i][angularMultiSelectConstants.INTERNAL_KEY_TREE_VISIBILITY];
delete data[i][angularMultiSelectConstants.INTERNAL_KEY_CHECKED_MODIFICATION];
//TODO: Remove after https://github.com/techfort/LokiJS/issues/346
delete data[i].meta;
delete data[i].$loki;
}
if (this.DEBUG === true) console.timeEnd(this.NAME + ' -> to_external');
return data;
};
/*
████████ ██████ ███████ ██████ ██████ ███ ███ █████ ████████
██ ██ ██ ██ ██ ██ ██ ██ ████ ████ ██ ██ ██
██ ██ ██ █████ ██ ██ ██████ ██ ████ ██ ███████ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██████ ██ ██████ ██ ██ ██ ██ ██ ██ ██
*/
DataConverter.prototype.to_format = function (data, format, keys) {
/*
* Converts the input data to the desired output.
*/
var res;
switch (format) {
case angularMultiSelectConstants.OUTPUT_DATA_TYPE_OBJECTS:
res = this.to_array_of_objects(data, keys);
break;
case angularMultiSelectConstants.OUTPUT_DATA_TYPE_ARRAYS:
res = this.to_array_of_arrays(data, keys);
break;
case angularMultiSelectConstants.OUTPUT_DATA_TYPE_OBJECT:
res = this.to_object(data, keys);
break;
case angularMultiSelectConstants.OUTPUT_DATA_TYPE_ARRAY:
res = this.to_array(data, keys);
break;
case angularMultiSelectConstants.OUTPUT_DATA_TYPE_VALUES:
res = this.to_values(data, keys);
break;
case angularMultiSelectConstants.OUTPUT_DATA_TYPE_VALUE:
res = this.to_value(data, keys);
break;
}
return res;
};
/*
████████ ██████ █████ ██████ ██████ █████ ██ ██ ██████ ███████ ██████ ██████ ██ ███████ ██████ ████████ ███████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██ ███████ ██████ ██████ ███████ ████ ██ ██ █████ ██ ██ ██████ ██ █████ ██ ██ ███████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██████ ██ ██████ ██████ █████ ███████ ██████ ██ ███████
*/
DataConverter.prototype.to_array_of_objects = function (data, keys) {
/*
* Takes an array of objects (the result of get_checked_tree usually)
* and returns it as is if the "keys" argument hasn't been passed or
* an array of objects, each object containing only the keys in the
* "key" argument.
*/
if (!Array.isArray(data) || data.length === 0) {
return [];
}
if (this.DEBUG === true) console.time(this.NAME + ' -> to_array_of_objects');
if (keys === undefined) {
keys = [];
}
var new_data = [];
for (var i = 0; i < data.length; i++) {
var new_obj = {};
var obj = data[i];
if ((typeof obj === "undefined" ? "undefined" : _typeof(obj)) !== 'object' || Array.isArray(obj)) {
continue;
}
if (keys.length === 0) {
new_data.push(obj);
} else {
for (var j = 0; j < keys.length; j++) {
if (!(keys[j] in obj)) {
continue;
}
new_obj[keys[j]] = obj[keys[j]];
}
new_data.push(new_obj);
}
}
if (this.DEBUG === true) console.timeEnd(this.NAME + ' -> to_array_of_objects');
return new_data;
};
/*
████████ ██████ █████ ██████ ██████ █████ ██ ██ ██████ ███████ █████ ██████ ██████ █████ ██ ██ ███████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██ ███████ ██████ ██████ ███████ ████ ██ ██ █████ ███████ ██████ ██████ ███████ ████ ███████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███████
*/
DataConverter.prototype.to_array_of_arrays = function (data, keys) {
/*
* Takes an array of objects (the result of get_checked_tree usually)
* and returns an array of arrays. Each array inside the returned
* array contains the values of the keys that result of the
* intersection of the object's keys and the argument "keys". The
* array will contain the values in the order they have in the "key"
* argument.
*/
if (!Array.isArray(data) || data.length === 0) {
return [];
}
if (this.DEBUG === true) console.time(this.NAME + ' -> to_array_of_arrays');
if (keys === undefined) {
keys = [];
}
function vals(obj) {
return Object.keys(obj).map(function (key) {
return obj[key];
});
}
var new_data = [];
for (var i = 0; i < data.length; i++) {
var new_arr = [];
var obj = data[i];
if ((typeof obj === "undefined" ? "undefined" : _typeof(obj)) !== 'object' || Array.isArray(obj)) {
continue;
}
if (keys.length === 0) {
new_data.push(vals(obj));
} else {
for (var j = 0; j < keys.length; j++) {
if (!(keys[j] in obj)) {
continue;
}
new_arr.push(obj[keys[j]]);
}
new_data.push(new_arr);
}
}
if (this.DEBUG === true) console.timeEnd(this.NAME + ' -> to_array_of_arrays');
return new_data;
};
/*
████████ ██████ █████ ██████ ██████ █████ ██ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██ ███████ ██████ ██████ ███████ ████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██████ ██ ██ ██ ██ ██ ██ ██ ██ ██
*/
DataConverter.prototype.to_array = function (data, keys) {
/*
* Takes an array of objects (the result of get_checked_tree usually)
* and returns a single array filled with the values of all the
* objects's keys that are contained in the "keys" argument.
* This usually doesn't make much sense when more than 1 item in the
* tree is selected, but you're free to use it however you like.
*/
if (!Array.isArray(data) || data.length === 0) {
return [];
}
if (this.DEBUG === true) console.time(this.NAME + ' -> to_array');
if (keys === undefined) {
keys = [];
}
function vals(obj) {
return Object.keys(obj).map(function (key) {
return obj[key];
});
}
var j;
var obj = data[0];
var ret = [];
if ((typeof obj === "undefined" ? "undefined" : _typeof(obj)) !== 'object' || Array.isArray(obj)) {
//do nothing
} else {
if (keys.length === 0) {
var obj_vals = vals(obj);
for (j = 0; j < obj_vals.length; j++) {
ret.push(obj_vals[j]);
}
} else {
for (j = 0; j < keys.length; j++) {
if (!(keys[j] in obj)) {
continue;
}
ret.push(obj[keys[j]]);
}
}
}
if (this.DEBUG === true) console.timeEnd(this.NAME + ' -> to_array');
return ret;
};
/*
████████ ██████ ██████ ██████ ██ ███████ ██████ ████████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ ██████ ██ █████ ██ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██████ ██████ ██████ █████ ███████ ██████ ██
*/
DataConverter.prototype.to_object = function (data, keys) {
/*
* Takes an array of objects (the result of get_checked_tree usually)
* and returns the first object.
* If the "keys" argument is passed, only the keys of the object that
* match the values in the "keys" argument will be returned.
* This usually doesn't make much sense when more than 1 item in the tree
* is selected, but you're free to use it however you like.
*/
if (!Array.isArray(data) || data.length === 0) {
return {};
}
if (this.DEBUG === true) console.time(this.NAME + ' -> to_object');
if (keys === undefined) {
keys = [];
}
var ret;
var obj = data[0];
if ((typeof obj === "undefined" ? "undefined" : _typeof(obj)) !== 'object' || Array.isArray(obj)) {
ret = {};
} else {
if (keys.length === 0) {
ret = obj;
} else {
var new_obj = {};
for (var i = 0; i < keys.length; i++) {
if (!(keys[i] in obj)) {
continue;
}
new_obj[keys[i]] = obj[keys[i]];
}
ret = new_obj;
}
}
if (this.DEBUG === true) console.timeEnd(this.NAME + ' -> to_object');
return ret;
};
/*
████████ ██████ ██ ██ █████ ██ ██ ██ ███████ ███████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ ███████ ██ ██ ██ █████ ███████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██████ ████ ██ ██ ███████ ██████ ███████ ███████
*/
DataConverter.prototype.to_values = function (data, keys) {
/*
* Takes an array of one object (the result of get_checked_tree usually)
* and returns the value of the key in the object that is passed as the
* "key" argument.
* If "key" hasn't been passed, the first available value in the object
* will be returned.
*/
if (!Array.isArray(data) || data.length === 0) {
return [];
}
if (this.DEBUG === true) console.time(this.NAME + ' -> to_values');
if (keys === undefined) {
keys = [];
}
var ret = [];
if ((typeof data === "undefined" ? "undefined" : _typeof(data)) !== 'object' || !Array.isArray(data) || keys.length === 0) {
//do nothing
} else {
for (var i = 0; i < data.length; i++) {
for (var j = 0; j < keys.length; j++) {
if (!(keys[j] in data[i])) {
continue;
}
ret.push(data[i][keys[j]]);
}
}
}
if (this.DEBUG === true) console.timeEnd(this.NAME + ' -> to_values');
return ret;
};
/*
████████ ██████ ██ ██ █████ ██ ██ ██ ███████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ ███████ ██ ██ ██ █████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██████ ████ ██ ██ ███████ ██████ ███████
*/
DataConverter.prototype.to_value = function (data, key) {
/*
* Takes an array of one object (the result of get_checked_tree usually)
* and returns the value of the key in the object that is passed as the
* "key" argument.
* If "key" hasn't been passed, the first available value in the object
* will be returned.
*/
if (!Array.isArray(data) || data.length === 0) {
return undefined;
}
if (this.DEBUG === true) console.time(this.NAME + ' -> to_value');
var ret;
var obj = data[0];
if ((typeof obj === "undefined" ? "undefined" : _typeof(obj)) !== 'object' || Array.isArray(obj)) {
ret = undefined;
} else {
if (key === undefined) {
var keys = Object.keys(obj);
if (keys.length === 0) {
ret = undefined;
} else {
key = keys[0];
ret = key in obj ? obj[key] : undefined;
}
} else {
key = Array.isArray(key) ? key[0] : key;
ret = key in obj ? obj[key] : undefined;
}
}
if (this.DEBUG === true) console.timeEnd(this.NAME + ' -> to_value');
return ret;
};
return DataConverter;
}]);
var angular_multi_select_engine = angular.module('angular-multi-select-engine', ['angular-multi-select-utils', 'angular-multi-select-constants']);
angular_multi_select_engine.factory('angularMultiSelectEngine', ['angularMultiSelectUtils', 'angularMultiSelectConstants', function (angularMultiSelectUtils, angularMultiSelectConstants) {
'use strict';
/*
██████ ██████ ███ ██ ███████ ████████ ██████ ██ ██ ██████ ████████ ██████ ██████
██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ ██ ███████ ██ ██████ ██ ██ ██ ██ ██ ██ ██████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████ ██████ ██ ████ ███████ ██ ██ ██ ██████ ██████ ██ ██████ ██ ██
*/
var Engine = function Engine(ops) {
this.amsu = new angularMultiSelectUtils();
_extends(this, this.amsu.sanitize_ops(ops));
/*
* Initiate the database and setup index fields.
*/
this.db = new loki();
this.on_data_change_fn = null;
this.on_visual_change_fn = null;
};
/*
██████ ███ ██ ██████ █████ ████████ █████ ██████ ██ ██ █████ ███ ██ ██████ ███████
██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██
██ ██ ██ ██ ██ ██ ██ ███████ ██ ███████ ██ ███████ ███████ ██ ██ ██ ██ ███ █████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████ ██ ████ ██████ ██ ██ ██ ██ ██ ██████ ██ ██ ██ ██ ██ ████ ██████ ███████
*/
Engine.prototype.on_data_change = function (ops) {
/*
* Will be executed when the data in one or more of the items in the
* tree are changed. Changes such as open/close (visibility related)
* won't trigger this function.
*
* Note that this method will be ran only once after applying
* multiple data updates if there are more than one, like for example
* when checking a node that has multiple children.
*/
var default_ops = {
skip_internal: false
};
ops = ops || {};
for (var k in default_ops) {
if (!ops.hasOwnProperty(k)) {
ops[k] = default_ops[k];
}
}
if (ops.skip_internal === false) {
/*
* Handle situation where a maximum amount of checked leafs has been specified.
*/
if (this.MAX_CHECKED_LEAFS > -1 && this.stats[angularMultiSelectConstants.INTERNAL_STATS_CHECKED_LEAFS] > this.MAX_CHECKED_LEAFS) {
this.uncheck_first(this.stats[angularMultiSelectConstants.INTERNAL_STATS_CHECKED_LEAFS] - this.MAX_CHECKED_LEAFS);
}
}
if (typeof this.on_data_change_fn === 'function') {
this.on_data_change_fn();
}
};
/*
██████ ███ ██ ██ ██ ██ ███████ ██ ██ █████ ██ ██████ ██ ██ █████ ███ ██ ██████ ███████
██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██
██ ██ ██ ██ ██ ██ ██ ██ ███████ ██ ██ ███████ ██ ██ ███████ ███████ ██ ██ ██ ██ ███ █████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████ ██ ████ ████ ██ ███████ ██████ ██ ██ ███████ ██████ ██ ██ ██ ██ ██ ████ ██████ ███████
*/
Engine.prototype.on_visual_change = function (ops) {
/*
* Will be executed when the tree changed somehow, visually speaking.
* This function could be triggered by an open/close action for example.
* Changes such as un/checking an item won't trigger this function.
*
* Note that this method will be ran only once, after applying all the
* visual changes required by the action, like for example when closing
* a node that has multiple children.
*/
var default_ops = {
skip_internal: false
};
ops = ops || {};
for (var k in default_ops) {
if (!ops.hasOwnProperty(k)) {
ops[k] = default_ops[k];
}
}
if (ops.skip_internal === false) {
//Do something here?
}
if (typeof this.on_visual_change_fn === 'function') {
this.on_visual_change_fn();
}
};
/*
██████ ██████ ███████ █████ ████████ ███████ ██████ ██████ ██ ██ ███████ ██████ ████████ ██ ██████ ███ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██
██ ██████ █████ ███████ ██ █████ ██ ██ ██ ██ ██ █████ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████ ██ ██ ███████ ██ ██ ██ ███████ ██████ ██████ ███████ ███████ ███████ ██████ ██ ██ ██████ ██ ████
*/
Engine.prototype.create_collection = function (name) {
/*
* Create a collection in the database and create indices.
*/
if (this.DEBUG === true) console.time(this.NAME + " -> create_collection");
this.collection = this.db.addCollection(name, {
indices: [this.ID_PROPERTY, this.CHECKED_PROPERTY, angularMultiSelectConstants.INTERNAL_KEY_LEVEL, angularMultiSelectConstants.INTERNAL_KEY_PARENTS_ID, angularMultiSelectConstants.INTERNAL_KEY_TREE_VISIBILITY]
});
if (this.DEBUG === true) console.timeEnd(this.NAME + " -> create_collection");
};
/*
██████ ███████ ███ ███ ██████ ██ ██ ███████ ██████ ██████ ██ ██ ███████ ██████ ████████ ██ ██████ ███ ██
██ ██ ██ ████ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██
██████ █████ ██ ████ ██ ██ ██ ██ ██ █████ ██ ██ ██ ██ ██ █████ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ███████ ██ ██ ██████ ████ ███████ ██████ ██████ ███████ ███████ ███████ ██████ ██ ██ ██████ ██ ████
*/
Engine.prototype.remove_collection = function (name) {
/*
* Remove a collection from the database.
*/
if (this.DEBUG === true) console.time(this.NAME + " -> remove_collection");
name = name || this.NAME;
this.db.removeCollection(name);
if (this.DEBUG === true) console.timeEnd(this.NAME + " -> remove_collection");
};
/*
██ ███ ██ ███████ ███████ ██████ ████████
██ ████ ██ ██ ██ ██ ██ ██
██ ██ ██ ██ ███████ █████ ██████ ██
██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ████ ███████ ███████ ██ ██ ██
*/
Engine.prototype.insert = function (items) {
/*
* Iterate over an array of items and insert them.
*/
if (this.DEBUG === true) console.time(this.NAME + " -> insert");
this.remove_collection(this.NAME);
this.create_collection(this.NAME);
this.reset_stats();
items = items || [];
if (Array.isArray(items)) {
for (var i = 0; i < items.length; i++) {
this.collection.insert(items[i]);
this.update_stats(items[i]);
}
} else {
this.collection.insert(items);
this.update_stats(items);
}
if (this.DEBUG === true) console.timeEnd(this.NAME + " -> insert");
this.on_data_change();
};
/*
██████ ███████ ████████ ███████ ████████ █████ ████████ ███████
██ ██ ██ ██ ██ ██ ██ ██ ██
██ ███ █████ ██ ███████ ██ ███████ ██ ███████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████ ███████ ██ ███████ ██ ██ ██ ██ ███████
*/
Engine.prototype.get_stats = function () {
return this.stats;
};
/*
██ ██ ██████ ██████ █████ ████████ ███████ ███████ ████████ █████ ████████ ███████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██████ ██ ██ ███████ ██ █████ ███████ ██ ███████ ██ ███████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████ ██ ██████ ██ ██ ██ ███████ ███████ ██ ██ ██ ██ ███████
*/
Engine.prototype.update_stats = function (item) {
switch (item[this.CHECKED_PROPERTY]) {
case angularMultiSelectConstants.INTERNAL_DATA_NODE_CHECKED:
this.stats[angularMultiSelectConstants.INTERNAL_STATS_CHECKED_NODES]++;
this.stats[angularMultiSelectConstants.INTERNAL_STATS_TOTAL_NODES]++;
break;
case angularMultiSelectConstants.INTERNAL_DATA_NODE_UNCHECKED:
this.stats[angularMultiSelectConstants.INTERNAL_STATS_UNCHECKED_NODES]++;
this.stats[angularMultiSelectConstants.INTERNAL_STATS_TOTAL_NODES]++;
break;
case angularMultiSelectConstants.INTERNAL_DATA_NODE_MIXED:
this.stats[angularMultiSelectConstants.INTERNAL_STATS_TOTAL_NODES]++;
break;
case angularMultiSelectConstants.INTERNAL_DATA_LEAF_CHECKED:
this.stats[angularMultiSelectConstants.INTERNAL_STATS_CHECKED_LEAFS]++;
this.stats[angularMultiSelectConstants.INTERNAL_STATS_TOTAL_LEAFS]++;
break;
case angularMultiSelectConstants.INTERNAL_DATA_LEAF_UNCHECKED:
this.stats[angularMultiSelectConstants.INTERNAL_STATS_TOTAL_LEAFS]++;
break;
}
};
/*
██████ ███████ ███████ ███████ ████████ ███████ ████████ █████ ████████ ███████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████ █████ ███████ █████ ██ ███████ ██ ███████ ██ ███████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ███████ ███████ ███████ ██ ███████ ██ ██ ██ ██ ███████
*/
Engine.prototype.reset_stats = function () {
var _stats;
this.stats = (_stats = {}, _defineProperty(_stats, angularMultiSelectConstants.INTERNAL_STATS_CHECKED_LEAFS, 0), _defineProperty(_stats, angularMultiSelectConstants.INTERNAL_STATS_CHECKED_NODES, 0), _defineProperty(_stats, angularMultiSelectConstants.INTERNAL_STATS_UNCHECKED_NODES, 0), _defineProperty(_stats, angularMultiSelectConstants.INTERNAL_STATS_TOTAL_LEAFS, 0), _defineProperty(_stats, angularMultiSelectConstants.INTERNAL_STATS_TOTAL_NODES, 0), _stats);
};
/*
██████ ███████ ████████ ███████ ██ ██ ██ ██ ████████ ██████ ███████ ███████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ███ █████ ██ █████ ██ ██ ██ ██ ██ ██████ █████ █████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████ ███████ ██ ██ ██████ ███████ ███████ ██ ██ ██ ███████ ███████
*/
Engine.prototype.get_full_tree = function () {
/*
* Get the entire set of data currently inserted in Loki.
*/
if (this.DEBUG === true) console.time(this.NAME + " -> get_full_tree");
//TODO: Strip LokiJS metadata. https://github.com/techfort/LokiJS/issues/346
var tree = this.collection.chain().find({}).simplesort(angularMultiSelectConstants.INTERNAL_KEY_ORDER, false).data();
if (this.DEBUG === true) console.time(this.NAME + " -> get_full_tree");
return tree;
};
/*
██████ ███████ ████████ ██ ██ ██ ███████ ██ ██████ ██ ███████ ████████ ██████ ███████ ███████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ███ █████ ██ ██ ██ ██ ███████ ██ ██████ ██ █████ ██ ██████ █████ █████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████ ███████ ██ ████ ██ ███████ ██ ██████ ███████ ███████ ██ ██ ██ ███████ ███████
*/
Engine.prototype.get_visible_tree = function () {
/*
* Get only the visible elements from Loki.
*/
if (this.DEBUG === true) console.time(this.NAME + " -> get_visible_tree");
//TODO: Strip LokiJS metadata. https://github.com/techfort/LokiJS/issues/346
var tree = this.collection.chain().find(_defineProperty({}, angularMultiSelectConstants.INTERNAL_KEY_TREE_VISIBILITY, angularMultiSelectConstants.INTERNAL_DATA_VISIBLE)).simplesort(angularMultiSelectConstants.INTERNAL_KEY_ORDER, false).data();
if (this.DEBUG === true) console.timeEnd(this.NAME + " -> get_visible_tree");
return tree;
};
/*
██████ ███████ ████████ ███████ ██ ██ ████████ ███████ ██████ ███████ ██████ ████████ ██████ ███████ ███████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ███ █████ ██ █████ ██ ██ ██ █████ ██████ █████ ██ ██ ██ ██████ █████ █████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████ ███████ ██ ██ ██ ███████ ██ ███████ ██ ██ ███████ ██████ ██ ██ ██ ███████ ███████
*/
Engine.prototype.get_filtered_tree = function (query) {
if (this.DEBUG === true) console.time(this.NAME + " -> get_filtered_tree");
var filter = [];
for (var i = 0; i < query.length; i++) {
var item = query[i];
filter.push(_defineProperty({}, item.field, {
'$contains': item.query
}));
}
//TODO: Strip LokiJS metadata. https://github.com/techfort/LokiJS/issues/346
var tree = this.collection.chain().find({
'$and': filter
}).simplesort(angularMultiSelectConstants.INTERNAL_KEY_ORDER, false).data();
if (this.DEBUG === true) console.timeEnd(this.NAME + " -> get_filtered_tree");
return tree;
};
/*
██████ ███████ ████████ ██████ ██ ██ ███████ ██████ ██ ██ ███████ ██████ ████████ ██████ ███████ ███████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ███ █████ ██ ██ ███████ █████ ██ █████ █████ ██ ██ ██ ██████ █████ █████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████ ███████ ██ ██████ ██ ██ ███████ ██████ ██ ██ ███████ ██████ ██ ██ ██ ███████ ███████
*/
Engine.prototype.get_checked_tree = function (filter) {
/*
* Get only the checked elements from Loki.
*/
if (this.DEBUG === true) console.time(this.NAME + " -> get_checked_tree");
var query_filter;
switch (filter) {
case angularMultiSelectConstants.FIND_LEAFS:
query_filter = [angularMultiSelectConstants.INTERNAL_DATA_LEAF_CHECKED];
break;
case angularMultiSelectConstants.FIND_LEAFS_MIXED_NODES:
query_filter = [angularMultiSelectConstants.INTERNAL_DATA_LEAF_CHECKED, angularMultiSelectConstants.INTERNAL_DATA_NODE_MIXED];
break;
case angularMultiSelectConstants.FIND_LEAFS_CHECKED_NODES:
query_filter = [angularMultiSelectConstants.INTERNAL_DATA_LEAF_CHECKED, angularMultiSelectConstants.INTERNAL_DATA_NODE_CHECKED];
break;
case angularMultiSelectConstants.FIND_LEAFS_MIXED_CHECKED_NODES:
query_filter = [angularMultiSelectConstants.INTERNAL_DATA_LEAF_CHECKED, angularMultiSelectConstants.INTERNAL_DATA_NODE_CHECKED, angularMultiSelectConstants.INTERNAL_DATA_NODE_MIXED];
break;
case angularMultiSelectConstants.FIND_MIXED_NODES:
query_filter = [angularMultiSelectConstants.INTERNAL_DATA_NODE_MIXED];
break;
case angularMultiSelectConstants.FIND_CHECKED_NODES:
query_filter = [angularMultiSelectConstants.INTERNAL_DATA_NODE_CHECKED];
break;
case angularMultiSelectConstants.FIND_MIXED_CHECKED_NODES:
query_filter = [angularMultiSelectConstants.INTERNAL_DATA_NODE_CHECKED, angularMultiSelectConstants.INTERNAL_DATA_NODE_MIXED];
break;
default:
query_filter = [angularMultiSelectConstants.INTERNAL_DATA_LEAF_CHECKED];
break;
}
//TODO: Strip LokiJS metadata. https://github.com/techfort/LokiJS/issues/346
var tree = this.collection.chain().find(_defineProperty({}, this.CHECKED_PROPERTY, {
'$in': query_filter
})).simplesort(angularMultiSelectConstants.INTERNAL_KEY_ORDER, false).data();
if (this.DEBUG === true) console.timeEnd(this.NAME + " -> get_checked_tree");
return tree;
};
/*
██████ ███████ ████████ ██ ████████ ███████ ███ ███
██ ██ ██ ██ ██ ██ ████ ████
██ ███ █████ ██ ██ ██ █████ ██ ████ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████ ███████ ██ ██ ██ ███████ ██ ██
*/
Engine.prototype.get_item = function (item) {
if ((typeof item === "undefined" ? "undefined" : _typeof(item)) !== 'object' || Object.keys(item).length === 0) return {};
var filter = [];
for (var k in item) {
filter.push(_defineProperty({}, k, item[k]));
}
var res = this.collection.find({
'$and': filter
});
if (Array.isArray(res) && res.length > 0) {
return res[0];
} else {
return {};
}
};
/*
████████ ██████ ██████ ██████ ██ ███████ ██████ ██████ ███████ ███ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██
██ ██ ██ ██ ███ ██ ███ ██ █████ ██ ██ ██████ █████ ██ ██ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██████ ██████ ██████ ███████ ███████ ██████ ██ ███████ ██ ████
*/
Engine.prototype.toggle_open_node = function (item) {
/*
* Toggle the open/closed state of an element.
* Note that leafs are not supposed to be toggleable.
*/
if (item[angularMultiSelectConstants.INTERNAL_KEY_CHILDREN_LEAFS] === 0) return;
if (item[this.OPEN_PROPERTY] === angularMultiSelectConstants.INTERNAL_DATA_OPEN) {
this.close_node(item);
} else {
this.open_node(item);
}
this.on_visual_change();
};
/*
██████ ██████ ███████ ███ ██ ███ ██ ██████ ██████ ███████
██ ██ ██ ██ ██ ████ ██ ████ ██ ██ ██ ██ ██ ██
██ ██ ██████ █████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ █████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████ ██ ███████ ██ ████ ██ ████ ██████ ██████ ███████
*/
Engine.prototype.open_node = function (item) {
var _this = this;
/*
* Open an item.
* First, mark the item itself as open, then find all
* the children items of that item and iterate over the
* results. For each item:
*
* If the item is a node and it's closed, we'll create
* a rule such that it will skip the next N items on the
* result. Else mark the item as visible.
*/
if (this.DEBUG === true) console.time(this.NAME + " -> open_node");
var skip = 0;
this.collection.chain().find(_defineProperty({}, this.ID_PROPERTY, item[this.ID_PROPERTY])).update(function (obj) {
obj[_this.OPEN_PROPERTY] = angularMultiSelectConstants.INTERNAL_DATA_OPEN;
});
this.collection.chain().find({
'$and': [_defineProperty({}, angularMultiSelectConstants.INTERNAL_KEY_PARENTS_ID, {
'$contains': item[this.ID_PROPERTY]
}), _defineProperty({}, angularMultiSelectConstants.INTERNAL_KEY_LEVEL, {
'$gte': item[angularMultiSelectConstants.INTERNAL_KEY_LEVEL] + 1
})]
}).limit(item[angularMultiSelectConstants.INTERNAL_KEY_CHILDREN_LEAFS] + item[angularMultiSelectConstants.INTERNAL_KEY_CHILDREN_NODES]).update(function (obj) {
if (skip > 0) {
skip--;
return;
}
if (obj[angularMultiSelectConstants.INTERNAL_KEY_CHILDREN_LEAFS] > 0 && obj[_this.OPEN_PROPERTY] === angularMultiSelectConstants.INTERNAL_DATA_CLOSED) {
skip = obj[angularMultiSelectConstants.INTERNAL_KEY_CHILDREN_LEAFS] + obj[angularMultiSelectConstants.INTERNAL_KEY_CHILDREN_NODES];
}
obj[angularMultiSelectConstants.INTERNAL_KEY_TREE_VISIBILITY] = angularMultiSelectConstants.INTERNAL_DATA_VISIBLE;
});
if (this.DEBUG === true) console.timeEnd(this.NAME + " -> open_node");
};
/*
██████ ██ ██████ ███████ ███████ ███ ██ ██████ ██████ ███████
██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██
██ ██ ██ ██ ███████ █████ ██ ██ ██ ██ ██ ██ ██ █████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████ ███████ ██████ ███████ ███████ ██ ████ ██████ ██████ ███████
*/
Engine.prototype.close_node = function (item) {
var _this2 = this;
/*
* Close an item.
* First, mark the item itself as closed, then find all
* children and mark then as invisible.
*/
if (this.DEBUG === true) console.time(this.NAME + " -> close_node");
this.collection.chain().find(_defineProperty({}, this.ID_PROPERTY, item[this.ID_PROPERTY])).update(function (obj) {
obj[_this2.OPEN_PROPERTY] = angularMultiSelectConstants.INTERNAL_DATA_CLOSED;
});
this.collection.chain().find({
'$and': [_defineProperty({}, angularMultiSelectConstants.INTERNAL_KEY_PARENTS_ID, {
'$contains': item[this.ID_PROPERTY]
}), _defineProperty({}, angularMultiSelectConstants.INTERNAL_KEY_LEVEL, {
'$gte': item[angularMultiSelectConstants.INTERNAL_KEY_LEVEL] + 1
})]
}).limit(item[angularMultiSelectConstants.INTERNAL_KEY_CHILDREN_LEAFS] + item[angularMultiSelectConstants.INTERNAL_KEY_CHILDREN_NODES]).update(function (obj) {
obj[angularMultiSelectConstants.INTERNAL_KEY_TREE_VISIBILITY] = angularMultiSelectConstants.INTERNAL_DATA_INVISIBLE;
});
if (this.DEBUG === true) console.timeEnd(this.NAME + " -> close_node");
};
/*
██████ ██ ██ ███████ ██████ ██ ██ █████ ██ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ███████ █████ ██ █████ ███████ ██ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████ ██ ██ ███████ ██████ ██ ██ ██ ██ ███████ ███████
*/
Engine.prototype.check_all = function () {
var _this3 = this;
if (this.DEBUG === true) console.time(this.NAME + " -> check_all");
this.collection.chain().find({}).update(function (obj) {
if (obj[angularMultiSelectConstants.INTERNAL_KEY_CHILDREN_LEAFS] === 0) {
obj[_this3.CHECKED_PROPERTY] = angularMultiSelectConstants.INTERNAL_DATA_LEAF_CHECKED;
} else {
obj[_this3.CHECKED_PROPERTY] = angularMultiSelectConstants.INTERNAL_DATA_NODE_CHECKED;
obj[angularMultiSelectConstants.INTERNAL_KEY_CHECKED_CHILDREN] = obj[angularMultiSelectConstants.INTERNAL_KEY_CHILDREN_LEAFS];
}
});
this.stats[angularMultiSelectConstants.INTERNAL_STATS_UNCHECKED_NODES] = 0;
this.stats[angularMultiSelectConstants.INTERNAL_STATS_CHECKED_LEAFS] = this.stats[angularMultiSelectConstants.INTERNAL_STATS_TOTAL_LEAFS];
this.stats[angularMultiSelectConstants.INTERNAL_STATS_CHECKED_NODES] = this.stats[angularMultiSelectConstants.INTERNAL_STATS_TOTAL_NODES];
if (this.DEBUG === true) console.time(this.NAME + " -> check_all");
this.on_data_change();
};
/*
██ ██ ███ ██ ██████ ██ ██ ███████ ██████ ██ ██ █████ ██ ██
██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ ██ ███████ █████ ██ █████ ███████ ██ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████ ██ ████ ██████ ██ ██ ███████ ██████ ██ ██ ██ ██ ███████ ███████
*/
Engine.prototype.uncheck_all = function () {
var _this4 = this;
if (this.DEBUG === true) console.time(this.NAME + " -> uncheck_all");
this.collection.chain().find({}).update(function (obj) {
if (obj[angularMultiSelectConstants.INTERNAL_KEY_CHILDREN_LEAFS] === 0) {
obj[_this4.CHECKED_PROPERTY] = angularMultiSelectConstants.INTERNAL_DATA_LEAF_UNCHECKED;
} else {
obj[_this4.CHECKED_PROPERTY] = angularMultiSelectConstants.INTERNAL_DATA_NODE_UNCHECKED;
obj[angularMultiSelectConstants.INTERNAL_KEY_CHECKED_CHILDREN] = 0;
}
});
this.stats[angularMultiSelectConstants.INTERNAL_STATS_CHECKED_LEAFS] = 0;
this.stats[angularMultiSelectConstants.INTERNAL_STATS_CHECKED_NODES] = 0;
this.stats[angularMultiSelectConstants.INTERNAL_STATS_UNCHECKED_NODES] = this.stats[angularMultiSelectConstants.INTERNAL_STATS_TOTAL_NODES];
if (this.DEBUG === true) console.time(this.NAME + " -> uncheck_all");
this.on_data_change();
};
/*
████████ ██████ ██████ ██████ ██ ███████ ██████ ██ ██ ███████ ██████ ██ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██ ██ ███ ██ ███ ██ █████ ██ ███████ █████ ██ █████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██████ ██████ ██████ ███████ ███████ ██████ ██ ██ ███████ ██████ ██ ██
*/
Engine.prototype.toggle_check_node = function (item, ops) {
/*
* Toggle the checked state on an item.
* Note that there are, in total, 5 different states:
*
* true: checked leaf.
* false: unchecked leaf.
* -1: all children leafs of the node are unchecked.
* 0: at least one children leaf of the node is checked.
* 1: all children leafs of the node are checked.
*
* If the node/item is (fully) checked, uncheck, else check.
*/
switch (item[this.CHECKED_PROPERTY]) {
case angularMultiSelectConstants.INTERNAL_DATA_NODE_CHECKED:
case angularMultiSelectConstants.INTERNAL_DATA_LEAF_CHECKED:
this.uncheck_node(item, ops);
break;
case angularMultiSelectConstants.INTERNAL_DATA_NODE_MIXED:
case angularMultiSelectConstants.INTERNAL_DATA_NODE_UNCHECKED:
case angularMultiSelectConstants.INTERNAL_DATA_LEAF_UNCHECKED:
this.check_node(item, ops);
break;
}
};
/*
██████ ██ ██ ███████ ██████ ██ ██ ███ ██ ██████ ██████ ███████ ██████ ██ ██
██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ███████ █████ ██ █████ ██ ██ ██ ██ ██ ██ ██ █████ ██████ ████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████ ██ ██ ███████ ██████ ██ ██ ██ ████ ██████ ██████ ███████ ██████ ██
*/
Engine.prototype.check_node_by = function (where) {
if (this.DEBUG === true) console.time(this.NAME + " -> check_node_by");
var _where = _slicedToArray(where, 2);
var key = _where[0];
var value = _where[1];
var item = this.collection.findOne({
"$and": [_defineProperty({}, key, value), _defineProperty({}, this.CHECKED_PROPERTY, {
'$nin': [angularMultiSelectConstants.INTERNAL_DATA_NODE_CHECKED, angularMultiSelectConstants.INTERNAL_DATA_LEAF_CHECKED]
})]
});
if (item !== null) {
this.check_node(item);
}
if (this.DEBUG === true) console.timeEnd(this.NAME + " -> check_node_by");
};
/*
██████ ██ ██ ███████ ██████ ██ ██ ███ ██ ██████ ██████ ███████
██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██
██ ███████ █████ ██ █████ ██ ██ ██ ██ ██ ██ ██ █████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████ ██ ██ ███████ ██████ ██ ██ ██ ████ ██████ ██████ ███████
*/
Engine.prototype.check_node = function (item, ops) {
var _this5 = this;
if (this.DEBUG === true) console.time(this.NAME + " -> check_node");
var default_ops = {
call_on_data_change: true
};
ops = ops || {};
for (var k in default_ops) {
if (!ops.hasOwnProperty(k)) {
ops[k] = default_ops[k];
}
}
/*
* Used for internal calculations.
*/
var time = new Date();
var diff_checked_children = 0;
var currently_checked_children = item[angularMultiSelectConstants.INTERNAL_KEY_CHECKED_CHILDREN];
//TODO: Optimize when MAX_CHECKED_LEAFS is set?
/*
* If the item is a leaf, mark it as checked.
* If the item is a note, set it's counter of checked leafs to the number of leafs it contains.
*/
this.collection.chain().find(_defineProperty({}, this.ID_PROPERTY, item[this.ID_PROPERTY])).update(function (obj) {
if (item[angularMultiSelectConstants.INTERNAL_KEY_CHILDREN_LEAFS] === 0) {
_this5.stats[angularMultiSelectConstants.INTERNAL_STATS_CHECKED_LEAFS]++;
obj[_this5.CHECKED_PROPERTY] = angularMultiSelectConstants.INTERNAL_DATA_LEAF_CHECKED;
} else {
if (obj[_this5.CHECKED_PROPERTY] === angularMultiSelectConstants.INTERNAL_DATA_NODE_UNCHECKED) {
_this5.stats[angularMultiSelectConstants.INTERNAL_STATS_UNCHECKED_NODES]--;
}
_this5.stats[angularMultiSelectConstants.INTERNAL_STATS_CHECKED_NODES]++;
obj[_this5.CHECKED_PROPERTY] = angularMultiSelectConstants.INTERNAL_DATA_NODE_CHECKED;
obj[angularMultiSelectConstants.INTERNAL_KEY_CHECKED_CHILDREN] = obj[angularMultiSelectConstants.INTERNAL_KEY_CHILDREN_LEAFS];
diff_checked_children = obj[angularMultiSelectConstants.INTERNAL_KEY_CHECKED_CHILDREN] - currently_checked_children;
}
obj[angularMultiSelectConstants.INTERNAL_KEY_CHECKED_MODIFICATION] = time.getTime();
});
/*
* If the passed item is a leaf, search all parent nodes,
* add 1 to their checked_children counter and set their
* checked state based on the checked_children counter.
*
*/
if (item[angularMultiSelectConstants.INTERNAL_KEY_CHILDREN_LEAFS] === 0) {
this.collection.chain().find(_defineProperty({}, this.ID_PROPERTY, {
'$in': item[angularMultiSelectConstants.INTERNAL_KEY_PARENTS_ID]
})).simplesort(angularMultiSelectConstants.INTERNAL_KEY_ORDER, true).update(function (obj) {
if (obj[_this5.CHECKED_PROPERTY] === angularMultiSelectConstants.INTERNAL_DATA_NODE_UNCHECKED) {
_this5.stats[angularMultiSelectConstants.INTERNAL_STATS_UNCHECKED_NODES]--;
}
if (obj[angularMultiSelectConstants.INTERNAL_KEY_CHECKED_CHILDREN] + 1 === obj[angularMultiSelectConstants.INTERNAL_KEY_CHILDREN_LEAFS]) {
_this5.stats[angularMultiSelectConstants.INTERNAL_STATS_CHECKED_NODES]++;
}
obj[angularMultiSelectConstants.INTERNAL_KEY_CHECKED_CHILDREN]++; // We can't overflow this as we're checking an unchecked item
if (obj[angularMultiSelectConstants.INTERNAL_KEY_CHECKED_CHILDREN] === obj[angularMultiSelectConstants.INTERNAL_KEY_CHILDREN_LEAFS]) {
obj[_this5.CHECKED_PROPERTY] = angularMultiSelectConstants.INTERNAL_DATA_NODE_CHECKED;
} else {
obj[_this5.CHECKED_PROPERTY] = angularMultiSelectConstants.INTERNAL_DATA_NODE_MIXED;
}
obj[angularMultiSelectConstants.INTERNAL_KEY_CHECKED_MODIFICATION] = time.getTime();
});
/*
* If it's a node:
* 1. Search all children leafs and nodes and mark them as checked.
* 2. Search all parent nodes,
* add N to their checked_children counter and
* set their checked state based on the checked_children counter.
* N is the difference between the checked leafs of the nodes we're checking
* before and after the operation.
*/
} else {
this.collection.chain().find({
'$and': [_defineProperty({}, angularMultiSelectConstants.INTERNAL_KEY_PARENTS_ID, {
'$contains': item[this.ID_PROPERTY]
}), _defineProperty({}, angularMultiSelectConstants.INTERNAL_KEY_LEVEL, {
'$gte': item[angularMultiSelectConstants.INTERNAL_KEY_LEVEL] + 1
}), _defineProperty({}, this.CHECKED_PROPERTY, {
'$in': [angularMultiSelectConstants.INTERNAL_DATA_NODE_MIXED, angularMultiSelectConstants.INTERNAL_DATA_NODE_UNCHECKED, angularMultiSelectConstants.INTERNAL_DATA_LEAF_UNCHECKED]
})]
}).simplesort(angularMultiSelectConstants.INTERNAL_KEY_ORDER, false).update(function (obj) {
if (obj[angularMultiSelectConstants.INTERNAL_KEY_CHILDREN_LEAFS] === 0) {
_this5.stats[angularMultiSelectConstants.INTERNAL_STATS_CHECKED_LEAFS]++;
obj[_this5.CHECKED_PROPERTY] = angularMultiSelectConstants.INTERNAL_DATA_LEAF_CHECKED;
} else {
_this5.stats[angularMultiSelectConstants.INTERNAL_STATS_CHECKED_NODES]++;
if (obj[_this5.CHECKED_PROPERTY] === angularMultiSelectConstants.INTERNAL_DATA_NODE_UNCHECKED) {
_this5.stats[angularMultiSelectConstants.INTERNAL_STATS_UNCHECKED_NODES]--;
}
obj[_this5.CHECKED_PROPERTY] = angularMultiSelectConstants.INTERNAL_DATA_NODE_CHECKED;
obj[angularMultiSelectConstants.INTERNAL_KEY_CHECKED_CHILDREN] = obj[angularMultiSelectConstants.INTERNAL_KEY_CHILDREN_LEAFS];
}
obj[angularMultiSelectConstants.INTERNAL_KEY_CHECKED_MODIFICATION] = time.getTime();
});
this.collection.chain().find(_defineProperty({}, this.ID_PROPERTY, {
'$in': item[angularMultiSelectConstants.INTERNAL_KEY_PARENTS_ID]
})).simplesort(angularMultiSelectConstants.INTERNAL_KEY_ORDER, true).update(function (obj) {
if (obj[_this5.CHECKED_PROPERTY] === angularMultiSelectConstants.INTERNAL_DATA_NODE_UNCHECKED) {
_this5.stats[angularMultiSelectConstants.INTERNAL_STATS_UNCHECKED_NODES]--;
}
if (obj[angularMultiSelectConstants.INTERNAL_KEY_CHECKED_CHILDREN] + diff_checked_children === obj[angularMultiSelectConstants.INTERNAL_KEY_CHILDREN_LEAFS]) {
_this5.stats[angularMultiSelectConstants.INTERNAL_STATS_CHECKED_NODES]++;
}
obj[angularMultiSelectConstants.INTERNAL_KEY_CHECKED_CHILDREN] += diff_checked_children;
if (obj[angularMultiSelectConstants.INTERNAL_KEY_CHECKED_CHILDREN] === obj[angularMultiSelectConstants.INTERNAL_KEY_CHILDREN_LEAFS]) {
obj[_this5.CHECKED_PROPERTY] = angularMultiSelectConstants.INTERNAL_DATA_NODE_CHECKED;
} else {
obj[_this5.CHECKED_PROPERTY] = angularMultiSelectConstants.INTERNAL_DATA_NODE_MIXED;
}
obj[angularMultiSelectConstants.INTERNAL_KEY_CHECKED_MODIFICATION] = time.getTime();
});
}
if (this.DEBUG === true) console.timeEnd(this.NAME + " -> check_node");
if (ops.call_on_data_change) {
this.on_data_change();
}
};
/*
██ ██ ███ ██ ██████ ██ ██ ███████ ██████ ██ ██ ███ ██ ██████ ██████ ███████
██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ ██ ███████ █████ ██ █████ ██ ██ ██ ██ ██ ██ ██ █████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████ ██ ████ ██████ ██ ██ ███████ ██████ ██ ██ ██ ████ ██████ ██████ ███████
*/
Engine.prototype.uncheck_node = function (item, ops) {
var _this6 = this;
if (this.DEBUG === true) console.time(this.NAME + " -> uncheck_node");
var default_ops = {
call_on_data_change: true
};
ops = ops || {};
for (var k in default_ops) {
if (!ops.hasOwnProperty(k)) {
ops[k] = default_ops[k];
}
}
/*
* Used for internal calculations.
*/
var time = new Date();
var diff_checked_children = 0;
var currently_checked_children = item[angularMultiSelectConstants.INTERNAL_KEY_CHECKED_CHILDREN];
/*
* If the item is a leaf, mark it as unchecked.
* If the item is a note, set it's counter of checked leafs to the number of leafs it contains.
*/
this.collection.chain().find(_defineProperty({}, this.ID_PROPERTY, item[this.ID_PROPERTY])).update(function (obj) {
if (item[angularMultiSelectConstants.INTERNAL_KEY_CHILDREN_LEAFS] === 0) {
_this6.stats[angularMultiSelectConstants.INTERNAL_STATS_CHECKED_LEAFS]--;
obj[_this6.CHECKED_PROPERTY] = angularMultiSelectConstants.INTERNAL_DATA_LEAF_UNCHECKED;
} else {
_this6.stats[angularMultiSelectConstants.INTERNAL_STATS_CHECKED_NODES]--;
_this6.stats[angularMultiSelectConstants.INTERNAL_STATS_UNCHECKED_NODES]++;
obj[_this6.CHECKED_PROPERTY] = angularMultiSelectConstants.INTERNAL_DATA_NODE_UNCHECKED;
obj[angularMultiSelectConstants.INTERNAL_KEY_CHECKED_CHILDREN] = 0;
diff_checked_children = currently_checked_children - obj[angularMultiSelectConstants.INTERNAL_KEY_CHECKED_CHILDREN];
}
obj[angularMultiSelectConstants.INTERNAL_KEY_CHECKED_MODIFICATION] = time.getTime();
});
/*
* If the passed item is a leaf, search all parent nodes,
* substract 1 from their checked_children counter and set their
* checked state based on the checked_children counter.
*/
if (item[angularMultiSelectConstants.INTERNAL_KEY_CHILDREN_LEAFS] === 0) {
this.collection.chain().find(_defineProperty({}, this.ID_PROPERTY, {
'$in': item[angularMultiSelectConstants.INTERNAL_KEY_PARENTS_ID]
})).simplesort(angularMultiSelectConstants.INTERNAL_KEY_ORDER, true).update(function (obj) {
if (obj[_this6.CHECKED_PROPERTY] === angularMultiSelectConstants.INTERNAL_DATA_NODE_CHECKED) {
_this6.stats[angularMultiSelectConstants.INTERNAL_STATS_CHECKED_NODES]--;
}
if (obj[angularMultiSelectConstants.INTERNAL_KEY_CHECKED_CHILDREN] - 1 === 0) {
_this6.stats[angularMultiSelectConstants.INTERNAL_STATS_UNCHECKED_NODES]++;
}
obj[angularMultiSelectConstants.INTERNAL_KEY_CHECKED_CHILDREN]--; // We can't underflow this as we're unchecking a checked item
if (obj[angularMultiSelectConstants.INTERNAL_KEY_CHECKED_CHILDREN] === 0) {
obj[_this6.CHECKED_PROPERTY] = angularMultiSelectConstants.INTERNAL_DATA_NODE_UNCHECKED;
} else {
obj[_this6.CHECKED_PROPERTY] = angularMultiSelectConstants.INTERNAL_DATA_NODE_MIXED;
}
obj[angularMultiSelectConstants.INTERNAL_KEY_CHECKED_MODIFICATION] = time.getTime();
});
/*
* If it's a node:
* 1. Search all children leafs and nodes and mark them as unchecked.
* 2. Search all parent nodes,
* substract N from their checked_children counter and
* set their checked state based on the checked_children counter.
* N is the difference between the checked leafs of the nodes we're checking
* before and after the operation.
*/
} else {
this.collection.chain().find({
'$and': [_defineProperty({}, angularMultiSelectConstants.INTERNAL_KEY_PARENTS_ID, {
'$contains': item[this.ID_PROPERTY]
}), _defineProperty({}, angularMultiSelectConstants.INTERNAL_KEY_LEVEL, {
'$gte': item[angularMultiSelectConstants.INTERNAL_KEY_LEVEL] + 1
}), _defineProperty({}, this.CHECKED_PROPERTY, {
'$in': [angularMultiSelectConstants.INTERNAL_DATA_NODE_MIXED, angularMultiSelectConstants.INTERNAL_DATA_NODE_CHECKED, angularMultiSelectConstants.INTERNAL_DATA_LEAF_CHECKED]
})]
}).simplesort(angularMultiSelectConstants.INTERNAL_KEY_ORDER, false).update(function (obj) {
if (obj[angularMultiSelectConstants.INTERNAL_KEY_CHILDREN_LEAFS] === 0) {
_this6.stats[angularMultiSelectConstants.INTERNAL_STATS_CHECKED_LEAFS]--;
obj[_this6.CHECKED_PROPERTY] = angularMultiSelectConstants.INTERNAL_DATA_LEAF_UNCHECKED;
} else {
_this6.stats[angularMultiSelectConstants.INTERNAL_STATS_UNCHECKED_NODES]++;
if (obj[_this6.CHECKED_PROPERTY] === angularMultiSelectConstants.INTERNAL_DATA_NODE_CHECKED) {
_this6.stats[angularMultiSelectConstants.INTERNAL_STATS_CHECKED_NODES]--;
}
obj[_this6.CHECKED_PROPERTY] = angularMultiSelectConstants.INTERNAL_DATA_NODE_UNCHECKED;
obj[angularMultiSelectConstants.INTERNAL_KEY_CHECKED_CHILDREN] = 0;
}
obj[angularMultiSelectConstants.INTERNAL_KEY_CHECKED_MODIFICATION] = time.getTime();
});
this.collection.chain().find(_defineProperty({}, this.ID_PROPERTY, {
'$in': item[angularMultiSelectConstants.INTERNAL_KEY_PARENTS_ID]
})).simplesort(angularMultiSelectConstants.INTERNAL_KEY_ORDER, true).update(function (obj) {
if (obj[_this6.CHECKED_PROPERTY] === angularMultiSelectConstants.INTERNAL_DATA_NODE_CHECKED) {
_this6.stats[angularMultiSelectConstants.INTERNAL_STATS_CHECKED_NODES]--;
}
if (obj[angularMultiSelectConstants.INTERNAL_KEY_CHECKED_CHILDREN] - diff_checked_children === 0) {
_this6.stats[angularMultiSelectConstants.INTERNAL_STATS_UNCHECKED_NODES]++;
}
obj[angularMultiSelectConstants.INTERNAL_KEY_CHECKED_CHILDREN] -= diff_checked_children;
if (obj[angularMultiSelectConstants.INTERNAL_KEY_CHECKED_CHILDREN] === 0) {
obj[_this6.CHECKED_PROPERTY] = angularMultiSelectConstants.INTERNAL_DATA_NODE_UNCHECKED;
} else {
obj[_this6.CHECKED_PROPERTY] = angularMultiSelectConstants.INTERNAL_DATA_NODE_MIXED;
}
obj[angularMultiSelectConstants.INTERNAL_KEY_CHECKED_MODIFICATION] = time.getTime();
});
}
if (this.DEBUG === true) console.timeEnd(this.NAME + " -> uncheck_node");
if (ops.call_on_data_change) {
this.on_data_change();
}
};
/*
██ ██ ███ ██ ██████ ██ ██ ███████ ██████ ██ ██ ███████ ██ ██████ ███████ ████████
██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ ██ ███████ █████ ██ █████ █████ ██ ██████ ███████ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████ ██ ████ ██████ ██ ██ ███████ ██████ ██ ██ ██ ██ ██ ██ ███████ ██
*/
Engine.prototype.uncheck_first = function (n) {
/*
* Find the oldest n leaf that have been marked as checked and uncheck them.
* This function is used to control the maximum amount of checked leafs.
*/
if (this.DEBUG === true) console.time(this.NAME + " -> uncheck_first");
n = n || 1;
var leaf = this.collection.chain().find({
'$and': [_defineProperty({}, this.CHECKED_PROPERTY, angularMultiSelectConstants.INTERNAL_DATA_LEAF_CHECKED), _defineProperty({}, angularMultiSelectConstants.INTERNAL_KEY_CHILDREN_LEAFS, 0)]
})
/*
* Each element is guaranteed to have an INTERNAL_KEY_CHECKED_MODIFICATION
* field that contains a unixtime date of the last time the item has
* changed it's checked state.
* If the fields of two elements match, then sort by the order field.
* This exception should happen only when this method is called on a verbatim
* tree that hasn't been modified in any way, meaning, right after a
* call to this.insert().
*/
.sort(function (a, b) {
var diff = a[angularMultiSelectConstants.INTERNAL_KEY_CHECKED_MODIFICATION] - b[angularMultiSelectConstants.INTERNAL_KEY_CHECKED_MODIFICATION];
if (diff === 0) {
return a[angularMultiSelectConstants.INTERNAL_KEY_ORDER] - b[angularMultiSelectConstants.INTERNAL_KEY_ORDER];
} else {
return diff;
}
}).limit(n).data();
for (var i = 0; i < leaf.length; i++) {
this.toggle_check_node(leaf[i], {
call_on_data_change: false
});
}
if (this.DEBUG === true) console.timeEnd(this.NAME + " -> uncheck_first");
};
return Engine;
}]);
var angular_multi_select_styles_helper = angular.module('angular-multi-select-styles-helper', ['angular-multi-select-utils', 'angular-multi-select-constants']);
angular_multi_select_styles_helper.run([function () {
'use strict';
/*
* This is used to generate some CSS styling at runtime.
* This code as ran after everything else is loaded and
* uses "document.styleSheets" to read the loaded CSS styling.
*
* * The right padding of each element is extended with as many
* pixels as the width of the check marker.
*
* * 20 levels of indent classes are generated based on the
* width of the first level.
*/
var inject = angular.element("<style>");
//Default values, just in case...
var check_width = 10;
var level_width = 20;
var styles = document.styleSheets || [];
for (var i = 0; i < styles.length; i++) {
var style = styles[i];
if (!style.href || style.href.indexOf("angular-multi-select") === -1) {
continue;
}
var rules = style.cssRules || [];
for (var j = 0; j < rules.length; j++) {
var rule = rules[j];
switch (rule.selectorText) {
case ".ams-item .check":
check_width = parseInt(rule.style.width);
break;
case ".ams-item-level-0":
level_width = parseInt(rule.style.paddingLeft);
break;
}
}
}
var indent = "";
for (i = 1; i < 20; i++) {
indent += ".ams-item-level-" + i + " { padding-left: " + (i + 1) * level_width + "px; }";
}
inject.text(".ams-item { padding-right: " + (check_width + 10) + "px; } " + indent);
angular.element(document.getElementsByTagName('head')).append(inject);
}]);
angular_multi_select_styles_helper.factory('angularMultiSelectStylesHelper', ['$sce', '$interpolate', 'angularMultiSelectUtils', 'angularMultiSelectConstants', function ($sce, $interpolate, angularMultiSelectUtils, angularMultiSelectConstants) {
'use strict';
/*
██████ ██████ ███ ██ ███████ ████████ ██████ ██ ██ ██████ ████████ ██████ ██████
██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ ██ ███████ ██ ██████ ██ ██ ██ ██ ██ ██ ██████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████ ██████ ██ ████ ███████ ██ ██ ██ ██████ ██████ ██ ██████ ██ ██
*/
var StylesHelper = function StylesHelper(ops, attrs) {
attrs = attrs || {};
this.amsu = new angularMultiSelectUtils();
_extends(this, this.amsu.sanitize_ops(ops));
this.START_REPLACE_SYMBOL_REGEX = /<\[/g;
this.END_REPLACE_SYMBOL_REGEX = /\]>/g;
this.START_INTERPOLATE_SYMBOL = $interpolate.startSymbol();
this.END_INTERPOLATE_SYMBOL = $interpolate.endSymbol();
this.START_REPLACE_SYMBOL_ALTERNATIVE_REGEX = /<#/g;
this.END_REPLACE_SYMBOL_ALTERNATIVE_REGEX = /#>/g;
this.START_INTERPOLATE_SYMBOL_ALTERNATIVE = $interpolate.startSymbol();
this.END_INTERPOLATE_SYMBOL_ALTERNATIVE = $interpolate.endSymbol();
this.START_REPLACE_SYMBOL_ALTERNATIVE2_REGEX = /<\(/g;
this.END_REPLACE_SYMBOL_ALTERNATIVE2_REGEX = /\)>/g;
this.START_INTERPOLATE_SYMBOL_ALTERNATIVE2 = $interpolate.startSymbol();
this.END_INTERPOLATE_SYMBOL_ALTERNATIVE2 = $interpolate.endSymbol();
this.START_REPLACE_SYMBOL_ALTERNATIVE_REPETITIVE_REGEX = /<#/g;
this.END_REPLACE_SYMBOL_ALTERNATIVE_REPETITIVE_REGEX = /#>/g;
this.START_INTERPOLATE_SYMBOL_ALTERNATIVE_REPETITIVE = '<[' + $interpolate.startSymbol();
this.END_INTERPOLATE_SYMBOL_ALTERNATIVE_REPETITIVE = $interpolate.endSymbol() + ']>';
/*
* String representation of nodes/leafs and dropdown label.
*/
this.dropdown_repr_attr = attrs.dropdownLabel || "";
this.dropdown_repr = this.interpolate_alternative(this.dropdown_repr_attr)({ angularMultiSelectConstants: angularMultiSelectConstants });
this.dropdown_repr = this.interpolate(this.dropdown_repr);
this.node_repr_attr = attrs.nodeLabel || "";
this.node_repr = this.interpolate_alternative_repetitive(this.node_repr_attr)({ angularMultiSelectConstants: angularMultiSelectConstants });
this.node_repr = this.interpolate(this.node_repr);
this.leaf_repr_attr = attrs.leafLabel || "";
this.leaf_repr = this.interpolate_alternative_repetitive(this.leaf_repr_attr)({ angularMultiSelectConstants: angularMultiSelectConstants });
this.leaf_repr = this.interpolate(this.leaf_repr);
};
/*
██████ ███████ ████████ ██ ███████ ██ ██ ███████ ██ ██████ ██ █████ ███████ ███████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ███ █████ ██ ██ █████ ██ ██ █████ ██ ██ ██ ███████ ███████ ███████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████ ███████ ██ ███████ ███████ ████ ███████ ███████ ██████ ███████ ██ ██ ███████ ███████
*/
StylesHelper.prototype.get_level_class = function (item) {
return "ams-item-level-" + item[angularMultiSelectConstants.INTERNAL_KEY_LEVEL];
};
/*
██████ ███████ ████████ ██████ ██████ ███████ ███ ██ ██████ ██ █████ ███████ ███████
██ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██
██ ███ █████ ██ ██ ██ ██████ █████ ██ ██ ██ ██ ██ ███████ ███████ ███████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████ ███████ ██ ██████ ██ ███████ ██ ████ ██████ ███████ ██ ██ ███████ ███████
*/
StylesHelper.prototype.get_open_class = function (item) {
if (item[angularMultiSelectConstants.INTERNAL_KEY_CHILDREN_LEAFS] === 0) {
return '';
}
return item[this.OPEN_PROPERTY] === true ? angularMultiSelectConstants.CSS_OPEN : angularMultiSelectConstants.CSS_CLOSED;
};
/*
██████ ███████ ████████ ██████ ██ ██ ███████ ██████ ██ ██ ███████ ██████ ██████ ██ █████ ███████ ███████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ███ █████ ██ ██ ███████ █████ ██ █████ █████ ██ ██ ██ ██ ███████ ███████ ███████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████ ███████ ██ ██████ ██ ██ ███████ ██████ ██ ██ ███████ ██████ ██████ ███████ ██ ██ ███████ ███████
*/
StylesHelper.prototype.get_checked_class = function (item) {
if (typeof item[this.CHECKED_PROPERTY] === 'boolean') {
return item[this.CHECKED_PROPERTY] ? angularMultiSelectConstants.CSS_LEAF_CHECKED : angularMultiSelectConstants.CSS_LEAF_UNCHECKED;
} else {
return item[this.CHECKED_PROPERTY] < 0 ? angularMultiSelectConstants.CSS_NODE_UNCHECKED : item[this.CHECKED_PROPERTY] > 0 ? angularMultiSelectConstants.CSS_NODE_CHECKED : angularMultiSelectConstants.CSS_NODE_MIXED;
}
};
/*
██████ ███████ ████████ ████████ ██ ██ ██████ ███████ ██████ ██ █████ ███████ ███████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ███ █████ ██ ██ ████ ██████ █████ ██ ██ ███████ ███████ ███████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████ ███████ ██ ██ ██ ██ ███████ ██████ ███████ ██ ██ ███████ ███████
*/
StylesHelper.prototype.get_type_class = function (item) {
return item[angularMultiSelectConstants.INTERNAL_KEY_CHILDREN_LEAFS] === 0 ? angularMultiSelectConstants.CSS_LEAF : angularMultiSelectConstants.CSS_NODE;
};
/*
██ ███ ██ ████████ ███████ ██████ ██████ ██████ ██ █████ ████████ ███████
██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ █████ ██████ ██████ ██ ██ ██ ███████ ██ █████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ████ ██ ███████ ██ ██ ██ ██████ ███████ ██ ██ ██ ███████
*/
StylesHelper.prototype.interpolate = function (str) {
/*
* Interpolation method used to interpolate <[ ]>.
* This is normaly used to interpolate the data of nodes/leafs.
*/
str = str.replace(this.START_REPLACE_SYMBOL_REGEX, this.START_INTERPOLATE_SYMBOL).replace(this.END_REPLACE_SYMBOL_REGEX, this.END_INTERPOLATE_SYMBOL);
return $interpolate(str);
};
/*
██ ███ ██ ████████ ███████ ██████ ██████ ██████ ██ █████ ████████ ███████ █████ ██ ████████ ███████ ██████ ███ ██ █████ ████████ ██ ██ ██ ███████
██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ █████ ██████ ██████ ██ ██ ██ ███████ ██ █████ ███████ ██ ██ █████ ██████ ██ ██ ██ ███████ ██ ██ ██ ██ █████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ████ ██ ███████ ██ ██ ██ ██████ ███████ ██ ██ ██ ███████ ██ ██ ███████ ██ ███████ ██ ██ ██ ████ ██ ██ ██ ██ ████ ███████
*/
StylesHelper.prototype.interpolate_alternative = function (str) {
/*
* Interpolation method used to interpolate <# #>.
* This is normaly used to interpolate the data of the dropdown label, but
* can also be used to interpolate internal data.
*/
str = str.replace(this.START_REPLACE_SYMBOL_ALTERNATIVE_REGEX, this.START_INTERPOLATE_SYMBOL_ALTERNATIVE).replace(this.END_REPLACE_SYMBOL_ALTERNATIVE_REGEX, this.END_INTERPOLATE_SYMBOL_ALTERNATIVE);
return $interpolate(str);
};
/*
██ ███ ██ ████████ ███████ ██████ ██████ ██████ ██ █████ ████████ ███████ █████ ██ ████████ ███████ ██████ ███ ██ █████ ████████ ██ ██ ██ ███████ ██████
██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ █████ ██████ ██████ ██ ██ ██ ███████ ██ █████ ███████ ██ ██ █████ ██████ ██ ██ ██ ███████ ██ ██ ██ ██ █████ █████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ████ ██ ███████ ██ ██ ██ ██████ ███████ ██ ██ ██ ███████ ██ ██ ███████ ██ ███████ ██ ██ ██ ████ ██ ██ ██ ██ ████ ███████ ███████
*/
StylesHelper.prototype.interpolate_alternative2 = function (str) {
/*
* Interpolation method used to interpolate <( )>.
* This is normaly used to interpolate the data of each output model
* item in the dropdown label.
*/
str = str.replace(this.START_REPLACE_SYMBOL_ALTERNATIVE2_REGEX, this.START_INTERPOLATE_SYMBOL_ALTERNATIVE2).replace(this.END_REPLACE_SYMBOL_ALTERNATIVE2_REGEX, this.END_INTERPOLATE_SYMBOL_ALTERNATIVE2);
return $interpolate(str);
};
/*
██ ███ ██ ████████ ███████ ██████ ██████ ██████ ██ █████ ████████ ███████ █████ ██ ████████ ███████ ██████ ███ ██ █████ ████████ ██ ██ ██ ███████ ██████ ███████ ██████ ███████ ████████ ██ ████████ ██ ██ ██ ███████
██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ █████ ██████ ██████ ██ ██ ██ ███████ ██ █████ ███████ ██ ██ █████ ██████ ██ ██ ██ ███████ ██ ██ ██ ██ █████ ██████ █████ ██████ █████ ██ ██ ██ ██ ██ ██ █████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ████ ██ ███████ ██ ██ ██ ██████ ███████ ██ ██ ██ ███████ ██ ██ ███████ ██ ███████ ██ ██ ██ ████ ██ ██ ██ ██ ████ ███████ ██ ██ ███████ ██ ███████ ██ ██ ██ ██ ████ ███████
*/
StylesHelper.prototype.interpolate_alternative_repetitive = function (str) {
/*
* Interpolation method used to interpolate <# #>.
* This is normaly used to interpolate the data of the nodes/leafs, but
* there is one difference between this method and 'interpolate'. This method
* is suitable to be called and then chain a call to 'interpolate'. This is
* useful when the user wants to interpolate some constant values from
* angularMultiSelectConstants and then interpolate those values with a node/leaf.
*/
str = str.replace(this.START_REPLACE_SYMBOL_ALTERNATIVE_REPETITIVE_REGEX, this.START_INTERPOLATE_SYMBOL_ALTERNATIVE_REPETITIVE).replace(this.END_REPLACE_SYMBOL_ALTERNATIVE_REPETITIVE_REGEX, this.END_INTERPOLATE_SYMBOL_ALTERNATIVE_REPETITIVE);
return $interpolate(str);
};
/*
██████ ██████ ███████ █████ ████████ ███████ ██████ ██████ ██████ ██████ ██████ ██████ ██ ██ ███ ██ ██ █████ ██████ ███████ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██
██ ██████ █████ ███████ ██ █████ ██ ██ ██████ ██ ██ ██████ ██ ██ ██ ██ ██ █ ██ ██ ██ ██ ██ ███████ ██████ █████ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ███ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████ ██ ██ ███████ ██ ██ ██ ███████ ██████ ██ ██ ██████ ██ ██████ ██████ ███ ███ ██ ████ ███████ ██ ██ ██████ ███████ ███████
*/
StylesHelper.prototype.create_dropdown_label = function (stats, outputModel, output_type) {
//TODO: Cache + cache invalidation on data change
if (stats === undefined) {
return '';
}
/*
* This is kind of a hack... 'stats' is an object that is used to interpolate
* the dropdown label. Since the interpolation string might contain a call to the
* 'outputModelIterator' filter, we need to pass somehow the output model and the
* output type. The easiest way (and the cleanest, AFAIK) is to attach temporarily
* those to the 'stats' object and then delete them.
*/
stats[angularMultiSelectConstants.INTERNAL_KEY_OUTPUT_MODEL_HACK] = outputModel;
stats[angularMultiSelectConstants.INTERNAL_KEY_OUTPUT_TYPE_HACK] = output_type;
var _interpolated = this.dropdown_repr(stats);
delete stats[angularMultiSelectConstants.INTERNAL_KEY_OUTPUT_MODEL_HACK];
delete stats[angularMultiSelectConstants.INTERNAL_KEY_OUTPUT_TYPE_HACK];
return $sce.trustAsHtml(_interpolated);
};
/*
██████ ██████ ███████ █████ ████████ ███████ ██ █████ ██████ ███████ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██████ █████ ███████ ██ █████ ██ ███████ ██████ █████ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████ ██ ██ ███████ ██ ██ ██ ███████ ███████ ██ ██ ██████ ███████ ███████
*/
StylesHelper.prototype.create_label = function (item) {
//TODO: Cache + cache invalidation on data change
var _interpolated;
if (item[angularMultiSelectConstants.INTERNAL_KEY_CHILDREN_LEAFS] === 0) {
_interpolated = this.leaf_repr(item);
} else {
_interpolated = this.node_repr(item);
}
return $sce.trustAsHtml(_interpolated);
};
/*
████████ ██████ █████ ███ ██ ███████ ███████ ██████ ██████ ███ ███ ██████ ██████ ███████ ██ ████████ ██ ██████ ███ ██
██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ████ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██
██ ██████ ███████ ██ ██ ██ ███████ █████ ██ ██ ██████ ██ ████ ██ ██████ ██ ██ ███████ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ ██ ████ ███████ ██ ██████ ██ ██ ██ ██ ██ ██████ ███████ ██ ██ ██ ██████ ██ ████
*/
StylesHelper.prototype.transform_position = function (element) {
var btn = element[0].getElementsByClassName('ams-button')[0];
var container = element[0].getElementsByClassName('ams-container')[0];
var translateX = 0,
translateY = 0;
var btn_rect = btn.getBoundingClientRect();
var container_rect = container.getBoundingClientRect();
/*
* If the available width to the right is not enough and there is
* enough available width to the left, flip the X position.
*/
if (document.documentElement.clientWidth - (btn_rect.left + btn_rect.width) < container_rect.width && btn_rect.left + btn_rect.width >= container_rect.width) {
translateX -= container_rect.width - btn_rect.width;
}
/*
* If the available height to the bottom is not enough and there is
* enough available height to the top, flip the Y position.
*/
if (document.documentElement.clientHeight - (btn_rect.top + btn_rect.height) < container_rect.height && btn_rect.top >= container_rect.height) {
translateY -= container_rect.height + btn_rect.height;
}
container.style.transform = "translate(" + translateX + "px, " + translateY + "px)";
};
return StylesHelper;
}]);
var angular_multi_select_utils = angular.module('angular-multi-select-utils', ['angular-multi-select-constants']);
angular_multi_select_utils.factory('angularMultiSelectUtils', ['angularMultiSelectConstants', function (angularMultiSelectConstants) {
var Utils = function Utils() {};
/*
███████ █████ ███ ██ ██ ████████ ██ ███████ ███████ ██████ ██████ ███████
██ ██ ██ ████ ██ ██ ██ ██ ███ ██ ██ ██ ██ ██ ██
███████ ███████ ██ ██ ██ ██ ██ ██ ███ █████ ██ ██ ██████ ███████
██ ██ ██ ██ ██ ██ ██ ██ ██ ███ ██ ██ ██ ██ ██
███████ ██ ██ ██ ████ ██ ██ ██ ███████ ███████ ██████ ██ ███████
*/
Utils.prototype.sanitize_ops = function (ops) {
/*
* This will set all basic and required values to
* "sane" defaults if none are provided.
*/
ops = ops || {};
return {
DEBUG: ops.DEBUG || false,
NAME: ops.NAME || 'angular-multi-select-' + Math.round(Date.now() / 1000) + '' + Math.random(),
MAX_CHECKED_LEAFS: ops.MAX_CHECKED_LEAFS || -1,
ID_PROPERTY: ops.ID_PROPERTY || angularMultiSelectConstants.ID_PROPERTY,
OPEN_PROPERTY: ops.OPEN_PROPERTY || angularMultiSelectConstants.OPEN_PROPERTY,
CHECKED_PROPERTY: ops.CHECKED_PROPERTY || angularMultiSelectConstants.CHECKED_PROPERTY,
CHILDREN_PROPERTY: ops.CHILDREN_PROPERTY || angularMultiSelectConstants.CHILDREN_PROPERTY
};
};
/*
█████ ██████ ██████ █████ ██ ██ ███████ ██████ ██████ ███ ███ █████ ████████ ████████ ██████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ████ ██ ██ ██ ██ ██ ██
███████ ██████ ██████ ███████ ████ █████ ██████ ██ ██ ██ ████ ██ ███████ ██ ██ ██████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██████ ██ ██ ██ ██ ██ ██ ██ ██
*/
Utils.prototype.array_from_attr = function (str) {
/*
* This will take a string and try to split it
* using ',' as separator and return the resulting
* array or undefined.
*/
if (typeof str === 'string' && str.length > 0) {
return str.split(",").map(function (s) {
return s.replace(/^\s+|\s+$/g, '');
});
} else {
return [];
}
};
/*
██████ █████ ██████ ███████ ███████ ██████ █████ ██ ██████ ███████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████ ███████ ██████ ███████ █████ ██████ ███████ ██ ██████ ███████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ ███████ ███████ ██ ██ ██ ██ ██ ██ ███████
*/
Utils.prototype.parse_pairs = function (arr) {
/*
* Takes an array of primitives and checks if the second
* value of each pair of values looks line a number (int or float),
* and if it does, it converts it to a Number.
*
* Note that the function modifies the passed array instead
* of creating a new one.
*/
for (var i = 0; i < arr.length; i += 2) {
var value = arr[i + 1];
if (value.match(/^'(.*)'$/gi) !== null || value.match(/^"(.*)"$/gi) !== null) {
arr[i + 1] = value.substring(1, value.length - 1);
} else if (value.match(/^([0-9\.]*)$/gi) !== null) {
arr[i + 1] = Number(value);
}
}
};
/*
███████ ██ ███████ ███ ███ ███████ ███ ██ ████████ ██████ ███████ ██ ██████ ███ ██ ██████ ███████ ████████ ██████ ██████ ██ ██████ ███████ ██████ ████████ ██ ██ ██ ███████
██ ██ ██ ████ ████ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
█████ ██ █████ ██ ████ ██ █████ ██ ██ ██ ██ ██████ █████ ██ ██ ██ ██ ██ ██ ██ ███ ███████ ██ ██ ██ ██ ██ ██ ██████ █████ ██ ██ ██ ██ ██ █████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
███████ ███████ ███████ ██ ██ ███████ ██ ████ ██ ██████ ███████ ███████ ██████ ██ ████ ██████ ███████ ██ ██████ ██████ ██ ██ ██ ███████ ██████ ██ ██ ████ ███████
*/
Utils.prototype.element_belongs_to_directive = function (element, directive_name) {
/*
* Check if the passed DOM element is somewhere inside the DOM tree of the
* directive identified by directive_name.
*/
var res = false;
var p = angular.element(element).parent();
while (p.length > 0) {
if (p.attr("name") === directive_name) {
res = true;
break;
}
p = p.parent();
}
return res;
};
/*
██████ ██████ ███████ ██ ██ ███████ ███ ██ ████████ ███████ ██████ ██████ ██████ ██ ██ ██████ ██ ██ ██████ ██████ ██ ██ ███ ██ ██████
██ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██
██████ ██████ █████ ██ ██ █████ ██ ██ ██ ██ ███████ ██ ██████ ██ ██ ██ ██ ██████ ██ ██ ██████ ██████ ██ ██ ██ ██ ██ ██ ███
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██ ███████ ████ ███████ ██ ████ ██ ███████ ██████ ██ ██ ██████ ███████ ███████ ██████ ██████ ██████ ██████ ███████ ██ ██ ████ ██████
*/
Utils.prototype.prevent_scroll_bubbling = function (element) {
element.addEventListener('mousewheel', function (e) {
if (element.clientHeight + element.scrollTop + e.deltaY >= element.scrollHeight) {
e.preventDefault();
element.scrollTop = element.scrollHeight;
} else if (element.scrollTop + e.deltaY <= 0) {
e.preventDefault();
element.scrollTop = 0;
}
}, false);
};
/*
██████ ██████ ██████ ██████ ███████ ███████ ███████ ██ ██ ██████ ██ ███ ██ ██████ ██ ██ ████████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██
██████ ██████ ██ ██ ██ █████ ███████ ███████ █████ ██████ ██ ██ ██ ██ ██████ ██ ██ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██ ██████ ██████ ███████ ███████ ███████ ██ ██ ██████ ██ ██ ████ ██ ██████ ██
*/
Utils.prototype.process_kb_input = function (event, $scope, element) {
/*
* Kb events handler. React as follows based on key code:
*
* * escape - close the opened AMS instance.
* * spacebar - toggle the checked state of the focused item.
* * keyup - focus the previos item, or if at the top, the last one.
* * keydown - focus the next item, or if at the bottom, the first one.
* * keyleft - close the current item.
* * keyright - open the current item.
*
* There is an exception in keyup/keydown handlers. Both should "skip"
* one key hit in order to allow an "empty" focus.
*/
var item;
var prevent = true;
var code = event.keyCode ? event.keyCode : event.which;
switch (code) {
case 27:
//escape
$scope.open = false;
break;
case 32:
//spacebar
item = $scope.items[$scope.focused_index];
if (item !== undefined) {
$scope.amse.toggle_check_node(item);
}
break;
case 37:
//keyleft
item = $scope.items[$scope.focused_index];
if (item !== undefined && item[angularMultiSelectConstants.OPEN_PROPERTY] === angularMultiSelectConstants.INTERNAL_DATA_OPEN) {
$scope.amse.toggle_open_node(item);
}
break;
case 38:
//keyup
$scope.focused_index = $scope.focused_index === -1 ? $scope.items.length - 1 : $scope.focused_index - 1;
break;
case 39:
//keyright
item = $scope.items[$scope.focused_index];
if (item !== undefined && item[angularMultiSelectConstants.OPEN_PROPERTY] === angularMultiSelectConstants.INTERNAL_DATA_CLOSED) {
$scope.amse.toggle_open_node(item);
}
break;
case 40:
//keydown
$scope.focused_index = $scope.focused_index + 1 > $scope.items.length ? 0 : $scope.focused_index + 1;
break;
default:
prevent = false;
break;
}
if (prevent === true) {
event.preventDefault();
}
$scope.$apply();
/*
* This must be done after the $apply() call
*/
if (code === 38 || code === 40) {
if ($scope.focused_index !== -1) {
this.scroll_to_item(element);
}
}
};
/*
███████ ██████ ██████ ██████ ██ ██ ████████ ██████ ██ ████████ ███████ ███ ███
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ████
███████ ██ ██████ ██ ██ ██ ██ ██ ██ ██ ██ ██ █████ ██ ████ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
███████ ██████ ██ ██ ██████ ███████ ███████ ██ ██████ ██ ██ ███████ ██ ██
*/
Utils.prototype.scroll_to_item = function (element) {
/*
* Change the scroll position of the items container in such a way that
* the focused item gets to be visible.
*/
var item = element[0].getElementsByClassName('ams-item-focused')[0];
if (item === undefined) {
return;
}
var container = element[0].getElementsByClassName('ams-items')[0];
container.scrollTop = item.offsetTop + item.offsetHeight - container.offsetHeight;
};
return Utils;
}]);
var angular_multi_select = angular.module('angular-multi-select', ['angular-multi-select-utils', 'angular-multi-select-engine', 'angular-multi-select-constants', 'angular-multi-select-styles-helper', 'angular-multi-select-data-converter']);
angular_multi_select.directive('angularMultiSelect', ['$http', '$compile', '$timeout', '$rootScope', '$templateCache', 'angularMultiSelectUtils', 'angularMultiSelectEngine', 'angularMultiSelectConstants', 'angularMultiSelectStylesHelper', 'angularMultiSelectDataConverter', function ($http, $compile, $timeout, $rootScope, $templateCache, angularMultiSelectUtils, angularMultiSelectEngine, angularMultiSelectConstants, angularMultiSelectStylesHelper, angularMultiSelectDataConverter) {
'use strict';
return {
restrict: 'AE',
scope: {
inputModel: '=',
outputModel: '=?'
},
link: function link($scope, element, attrs) {
var template = $templateCache.get('angular-multi-select.tpl');
var content = $compile(template)($scope);
element.append(content);
var self = {};
$scope.self = self; //We need to access 'self' from the template
//TODO. Replace all the $scope pollution with calls to 'self' from the template
self.react_to_data_changes = false;
self.react_to_visual_changes = true;
var amsu = new angularMultiSelectUtils();
/*
█████ ████████ ████████ ██████ ██ ██████ ██ ██ ████████ ███████ ███████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
███████ ██ ██ ██████ ██ ██████ ██ ██ ██ █████ ███████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ ██ ██ ██████ ██████ ██ ███████ ███████
*/
/*
* Find out what are the properties names of the important bits
* of the input data.
*/
$scope.ops = {
DEBUG: attrs.debug === "true" ? true : false,
NAME: attrs.name,
MAX_CHECKED_LEAFS: parseInt(attrs.maxCheckedLeafs),
ID_PROPERTY: attrs.idProperty,
OPEN_PROPERTY: attrs.openProperty,
CHECKED_PROPERTY: attrs.checkedProperty,
CHILDREN_PROPERTY: attrs.childrenProperty
};
$scope.ops = amsu.sanitize_ops($scope.ops);
/*
* Set the directive's name as attribute. If it exists, it will be overriten with
* the same value, else, it will be set with the autogenerated value. This is required
* for the visibility code.
*/
element.attr("name", $scope.ops.NAME);
/*
* Find out if the input data should be threated in some special way.
*/
self.do_not_check_data = attrs.doNotCheckData === "true" ? true : false;
self.do_not_convert_data = attrs.doNotConvertData === "true" ? true : false;
/*
* Find out if the output data should be converted in some special way.
*/
self.output_keys = amsu.array_from_attr(attrs.outputKeys);
self.output_type = attrs.outputType === undefined ? 'objects' : attrs.outputType;
self.output_filter = attrs.outputFilter === undefined ? angularMultiSelectConstants.FIND_LEAFS : attrs.outputFilter;
/*
* Find out which field to use for the 'search' functionality.
*/
$scope.search_field = attrs.searchField === undefined ? null : attrs.searchField;
/*
* Find out if something should be preselected.
*/
self.preselect = amsu.array_from_attr(attrs.preselect);
amsu.parse_pairs(self.preselect);
/*
* Find out if some of the helpers should be hidden.
*/
$scope.hide_helpers = amsu.array_from_attr(attrs.hideHelpers);
/*
█████ ███ ███ ███████ ██████ ██████ ██ ███████ ██████ ████████ ███████
██ ██ ████ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
███████ ██ ████ ██ ███████ ██ ██ ██████ ██ █████ ██ ██ ███████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██ ██ ███████ ██████ ██████ █████ ███████ ██████ ██ ███████
*/
$scope.amsc = angularMultiSelectConstants;
var amse = new angularMultiSelectEngine($scope.ops);
var amssh = new angularMultiSelectStylesHelper($scope.ops, attrs);
var amsdc = new angularMultiSelectDataConverter($scope.ops);
$scope.amse = amse;
$scope.amssh = amssh;
/*
██████ ██████ ██████ █████ ██████ ██████ █████ ███████ ████████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████ ██████ ██ ██ ███████ ██ ██ ██ ███████ ███████ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████ ██ ██ ██████ ██ ██ ██████ ██████ ██ ██ ███████ ██
*/
$scope.toggle_open_node = function (item) {
$rootScope.$broadcast('ams_toggle_open_node', {
name: $scope.ops.NAME,
item: JSON.parse(JSON.stringify(amsdc.to_external([item])[0]))
});
amse.toggle_open_node(item);
};
$scope.toggle_check_node = function (item) {
$rootScope.$broadcast('ams_toggle_check_node', {
name: $scope.ops.NAME,
item: JSON.parse(JSON.stringify(amsdc.to_external([item])[0]))
});
amse.toggle_check_node(item);
};
/*
██████ ███ ██ ███████ ██ ██ ███████ ███ ██ ████████ ███████
██ ██ ████ ██ ██ ██ ██ ██ ████ ██ ██ ██
██ ██ ██ ██ ██ █████ ██ ██ █████ ██ ██ ██ ██ ███████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████ ██ ████ ███████ ████ ███████ ██ ████ ██ ███████
*/
$rootScope.$on('ams_do_check_all', function (event, args) {
if (args.name === $scope.ops.NAME || args.name === '*') amse.check_all();
});
$rootScope.$on('ams_do_uncheck_all', function (event, args) {
if (args.name === $scope.ops.NAME || args.name === '*') amse.uncheck_all();
});
$rootScope.$on('ams_do_reset', function (event, args) {
if (args.name === $scope.ops.NAME || args.name === '*') $scope.reset();
});
$rootScope.$on('ams_do_toggle_open_node', function (event, args) {
if (args.name === $scope.ops.NAME || args.name === '*') amse.toggle_open_node(amse.get_item(args.item));
});
$rootScope.$on('ams_do_toggle_check_node', function (event, args) {
if (args.name === $scope.ops.NAME || args.name === '*') amse.toggle_check_node(amse.get_item(args.item));
});
$rootScope.$on('ams_open', function (event, args) {
if (args.name === $scope.ops.NAME || args.name === '*') $scope.open = true;
});
$rootScope.$on('ams_close', function (event, args) {
if (args.name === $scope.ops.NAME || args.name === '*') $scope.open = false;
});
/*
██ ██ ██ ███████ ██ ██████ ██ ██ ██ ████████ ██ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██ ███████ ██ ██████ ██ ██ ██ ██ ████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
████ ██ ███████ ██ ██████ ██ ███████ ██ ██ ██
*/
$scope.open = false;
$scope.onclick_listener = function (event) {
if (!event.target) {
return;
}
if (!amsu.element_belongs_to_directive(event.target, $scope.ops.NAME)) {
$scope.open = false;
$scope.$apply();
}
};
document.addEventListener('click', $scope.onclick_listener);
/*
* Show the directive to the left/right and at the top/bottom
* of the button itself, depending on the available space.
*/
$scope.$watch('open', function (_new, _old) {
if (_new !== true) {
return;
}
$timeout(function () {
amssh.transform_position(element);
});
});
/*
████████ ██ ██ ███████ █████ ██ ██ ███████
██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ █ ██ █████ ███████ █████ ███████
██ ██ ███ ██ ██ ██ ██ ██ ██ ██
██ ███ ███ ███████ ██ ██ ██ ██ ███████
*/
/*
* Prevent the scroll event bubbling to the parents on the DOM.
*/
amsu.prevent_scroll_bubbling(element[0].getElementsByClassName('ams-items')[0]);
/*
* Make keyboard navigation possible.
*/
$scope.focused_index = -1;
$scope.onkeypress_listener = function (event) {
if ($scope.open === false) {
return;
}
amsu.process_kb_input(event, $scope, element);
};
document.addEventListener('keydown', $scope.onkeypress_listener);
/*
██ ██ ███████ ██ ██████ ███████ ██████ ███████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██
███████ █████ ██ ██████ █████ ██████ ███████
██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ███████ ███████ ██ ███████ ██ ██ ███████
*/
/*
* The 'reset_model' will be filled in with the first available
* data from the input model and will be used when the 'reset'
* function is triggered.
*/
$scope.reset_model = null;
$scope.reset = function () {
self.init($scope.reset_model);
};
/*
███████ ███████ █████ ██████ ██████ ██ ██
██ ██ ██ ██ ██ ██ ██ ██ ██
███████ █████ ███████ ██████ ██ ███████
██ ██ ██ ██ ██ ██ ██ ██ ██
███████ ███████ ██ ██ ██ ██ ██████ ██ ██
*/
$scope.search = "";
self.search_promise = null;
$scope.search_spinner_visible = false;
$scope.$watch('search', function (_new, _old) {
if (_new === _old && _new === "") {
return;
}
if ($scope.search_field === null) {
return;
}
/*
* This means that there was a search, but it was deleted
* and now the normal tree should be repainted.
*/
if (_new === "") {
if (self.search_promise !== null) {
$timeout.cancel(self.search_promise);
}
$scope.items = amse.get_visible_tree();
$scope.search_spinner_visible = false;
$timeout(function () {
amssh.transform_position(element);
});
return;
}
/*
* If the code execution gets here, it means that there is
* a search that should be performed
*/
if (self.search_promise !== null) {
$timeout.cancel(self.search_promise);
}
$scope.search_spinner_visible = true;
var _search_fn = function _search_fn(query) {
self.search_promise = $timeout(function () {
//TODO: this needs a lot of improving. Maybe use lunar.js?
var filter = [];
filter.push({
field: $scope.search_field,
query: query
});
$scope.items = amse.get_filtered_tree(filter);
$scope.search_spinner_visible = false;
$timeout(function () {
amssh.transform_position(element);
});
}, 1500, true);
};
_search_fn(_new); // Hack for Angular <1.4 support
});
/*
██████ ███ ██ ██████ █████ ████████ █████ ██████ ██ ██ █████ ███ ██ ██████ ███████
██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██
██ ██ ██ ██ ██ ██ ██ ███████ ██ ███████ ██ ███████ ███████ ██ ██ ██ ██ ███ █████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████ ██ ████ ██████ ██ ██ ██ ██ ██ ██████ ██ ██ ██ ██ ██ ████ ██████ ███████
*/
amse.on_data_change_fn = function () {
if (self.react_to_data_changes === false) {
return;
}
/*
* Will be triggered every time the internal model data is changed.
* That could happen on check/uncheck, for example.
*/
$scope.stats = amse.get_stats();
/*
* Get the visible tree only once. Consecutive calls on un/check
* will automatically propagate to the rendered tree.
*/
$scope.items = amse.get_visible_tree();
var checked_tree = amse.get_checked_tree(self.output_filter);
/*
* Remove internal (undeeded) data.
*/
var res = amsdc.to_external(checked_tree);
/*
* This is used to create the dropdown label.
*/
if (typeof attrs.dropdownLabel === "string" && attrs.dropdownLabel.indexOf("outputModelIterator" > -1)) {
$scope.outputModelNotFormatted = JSON.parse(JSON.stringify(res));
}
/*
* Convert the data to the desired output.
*/
res = amsdc.to_format(res, self.output_type, self.output_keys);
/*
* Don't do anything else if the output model hasn't changed.
*/
if (angular.equals($scope.outputModel, res)) {
return;
}
$scope.outputModel = res;
$timeout(function () {
$rootScope.$broadcast('ams_output_model_change', {
name: $scope.ops.NAME
});
});
};
/*
██████ ███ ██ ██ ██ ██ ███████ ██ ██ █████ ██ ██████ ██ ██ █████ ███ ██ ██████ ███████
██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ████ ██ ██ ██
██ ██ ██ ██ ██ ██ ██ ██ ███████ ██ ██ ███████ ██ ██ ███████ ███████ ██ ██ ██ ██ ███ █████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██████ ██ ████ ████ ██ ███████ ██████ ██ ██ ███████ ██████ ██ ██ ██ ██ ██ ████ ██████ ███████
*/
amse.on_visual_change_fn = function () {
/*
* Will be triggered when a change that requires a visual change happende.
* This is normaly on open/close actions.
*/
$scope.items = amse.get_visible_tree();
/*
* This is required to avoid weird gaps appearing between the items
* container and the button if the amount of shown items changes.
*/
$timeout(function () {
amssh.transform_position(element);
});
};
/*
███ ███ █████ ██ ███ ██
████ ████ ██ ██ ██ ████ ██
██ ████ ██ ███████ ██ ██ ██ ██
██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ ██ ████
*/
self.prepare_data = function (data) {
if (!Array.isArray(data)) {
return [];
}
var checked_data = self.do_not_check_data ? data : amsdc.check_prerequisites(data);
var internal_data = self.do_not_convert_data ? checked_data : amsdc.to_internal(checked_data);
return internal_data;
};
self.init = function (data) {
$scope.reset_model = JSON.parse(JSON.stringify(data));
amse.insert(data);
for (var i = 0; i < self.preselect.length; i += 2) {
amse.check_node_by([self.preselect[i], self.preselect[i + 1]]);
}
$timeout(function () {
$rootScope.$broadcast('ams_input_model_change', {
name: $scope.ops.NAME
});
});
};
$scope.$watch('inputModel', function (_new, _old) {
self.react_to_data_changes = false;
/*
* The entry point of the directive. This monitors the input data and
* decides when to populate the internal data model and how to do it.
*/
var data;
if (typeof _new === "string") {
try {
data = self.prepare_data(JSON.parse(_new));
self.init(data);
self.react_to_data_changes = true;
amse.on_data_change();
} catch (e) {
$http.get(_new).then(function (response) {
data = self.prepare_data(response.data);
self.init(data);
self.react_to_data_changes = true;
amse.on_data_change();
});
}
} else {
data = self.prepare_data(_new);
self.init(data);
self.react_to_data_changes = true;
amse.on_data_change();
}
});
$scope.$on('$destroy', function () {
amse.remove_collection($scope.ops.NAME);
document.removeEventListener('click', $scope.onclick_listener);
document.removeEventListener('keydown', $scope.onkeypress_listener);
});
}
};
}]);
var angular_multi_select = angular.module('angular-multi-select');
angular_multi_select.run(['$templateCache', function ($templateCache) {
var html = function html(s) {
return s.toString();
};
$templateCache.put('angular-multi-select.tpl', html(_templateObject));
}]);
var angular_multi_select = angular.module('angular-multi-select');
angular_multi_select.filter('translate', ['angularMultiSelectI18n', function (angularMultiSelectI18n) {
return function (text) {
return angularMultiSelectI18n.translate(text);
};
}]);
angular_multi_select.filter('outputModelIterator', ['angularMultiSelectConstants', 'angularMultiSelectStylesHelper', function (angularMultiSelectConstants, angularMultiSelectStylesHelper) {
return function (text, data, glue, default_str) {
var exp,
output = [];
var amssh = new angularMultiSelectStylesHelper();
if (!data[angularMultiSelectConstants.INTERNAL_KEY_OUTPUT_MODEL_HACK] || data[angularMultiSelectConstants.INTERNAL_KEY_OUTPUT_MODEL_HACK].length === 0) {
return default_str || "";
}
switch (data[angularMultiSelectConstants.INTERNAL_KEY_OUTPUT_TYPE_HACK]) {
case angularMultiSelectConstants.OUTPUT_DATA_TYPE_OBJECTS:
case angularMultiSelectConstants.OUTPUT_DATA_TYPE_ARRAYS:
case angularMultiSelectConstants.OUTPUT_DATA_TYPE_VALUES:
data[angularMultiSelectConstants.INTERNAL_KEY_OUTPUT_MODEL_HACK].map(function (v) {
exp = amssh.interpolate_alternative2(text);
output.push(exp(v));
});
break;
case angularMultiSelectConstants.OUTPUT_DATA_TYPE_OBJECT:
case angularMultiSelectConstants.OUTPUT_DATA_TYPE_ARRAY:
case angularMultiSelectConstants.OUTPUT_DATA_TYPE_VALUE:
exp = amssh.interpolate_alternative2(text);
output.push(exp(data[angularMultiSelectConstants.INTERNAL_KEY_OUTPUT_MODEL_HACK][0]));
break;
}
return output.join(glue) || default_str || "";
};
}]);
var angular_multi_select = angular.module('angular-multi-select');
angular_multi_select.provider('angularMultiSelectI18n', function () {
var lang = "en";
var langs = {
'en': {
CHECK_ALL: 'Check all',
CHECK_NONE: 'Uncheck all',
RESET: 'Reset',
SEARCH: 'Search...',
CLEAR: 'Clear'
}
};
function getTranslation(lang) {
return langs[lang];
}
function createTranslation(lang, texts) {
langs[lang] = texts;
}
function setLang(newLang) {
lang = newLang;
}
function instantiate$18n() {
function translate(text) {
return langs[lang][text] || langs.en[text];
}
return {
translate: translate
};
}
return {
getTranslation: getTranslation,
createTranslation: createTranslation,
setLang: setLang,
$get: instantiate$18n
};
});
|
ajax/libs/react-sortable-hoc/0.2.0/react-sortable-hoc.min.js
|
sashberd/cdnjs
|
!function(root,factory){"object"==typeof exports&&"object"==typeof module?module.exports=factory(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],factory):"object"==typeof exports?exports.SortableHOC=factory(require("react"),require("react-dom")):root.SortableHOC=factory(root.React,root.ReactDOM)}(this,function(__WEBPACK_EXTERNAL_MODULE_112__,__WEBPACK_EXTERNAL_MODULE_113__){return function(modules){function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={exports:{},id:moduleId,loaded:!1};return modules[moduleId].call(module.exports,module,module.exports,__webpack_require__),module.loaded=!0,module.exports}var installedModules={};return __webpack_require__.m=modules,__webpack_require__.c=installedModules,__webpack_require__.p="",__webpack_require__(0)}([function(module,exports,__webpack_require__){module.exports=__webpack_require__(1)},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.arrayMove=exports.SortableHandle=exports.SortableElement=exports.SortableContainer=void 0;var _utils=__webpack_require__(2);Object.defineProperty(exports,"arrayMove",{enumerable:!0,get:function(){return _utils.arrayMove}});var _SortableContainer2=__webpack_require__(3),_SortableContainer3=_interopRequireDefault(_SortableContainer2),_SortableElement2=__webpack_require__(248),_SortableElement3=_interopRequireDefault(_SortableElement2),_SortableHandle2=__webpack_require__(249),_SortableHandle3=_interopRequireDefault(_SortableHandle2);exports.SortableContainer=_SortableContainer3["default"],exports.SortableElement=_SortableElement3["default"],exports.SortableHandle=_SortableHandle3["default"]},function(module,exports){"use strict";function arrayMove(arr,previousIndex,newIndex){var array=arr.slice(0);if(newIndex>=array.length)for(var k=newIndex-array.length;k--+1;)array.push(void 0);return array.splice(newIndex,0,array.splice(previousIndex,1)[0]),array}function closest(el,fn){for(;el;){if(fn(el))return el;el=el.parentNode}}function limit(min,max,value){return value<min?min:value>max?max:value}function getCSSPixelValue(stringValue){return"px"===stringValue.substr(-2)?parseFloat(stringValue):0}function getElementMargin(element){var style=window.getComputedStyle(element);return{top:getCSSPixelValue(style.marginTop),right:getCSSPixelValue(style.marginRight),bottom:getCSSPixelValue(style.marginBottom),left:getCSSPixelValue(style.marginLeft)}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.arrayMove=arrayMove,exports.closest=closest,exports.limit=limit,exports.getElementMargin=getElementMargin;exports.events={start:["touchstart","mousedown"],move:["touchmove","mousemove"],end:["touchend","touchcancel","mouseup"]},exports.vendorPrefix=function(){if("undefined"==typeof window||"undefined"==typeof document)return"";var styles=window.getComputedStyle(document.documentElement,""),pre=(Array.prototype.slice.call(styles).join("").match(/-(moz|webkit|ms)-/)||""===styles.OLink&&["","o"])[1];switch(pre){case"ms":return"ms";default:return pre&&pre.length?pre[0].toUpperCase()+pre.substr(1):""}}()},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}function SortableContainer(WrappedComponent){var _class,_temp,config=arguments.length<=1||void 0===arguments[1]?{withRef:!1}:arguments[1];return _temp=_class=function(_Component){function _class(props){(0,_classCallCheck3["default"])(this,_class);var _this=(0,_possibleConstructorReturn3["default"])(this,(0,_getPrototypeOf2["default"])(_class).call(this,props));return _this.handleStart=function(e){var _this$props=_this.props,distance=_this$props.distance,shouldCancelStart=_this$props.shouldCancelStart;if(2===e.button||shouldCancelStart(e))return!1;_this._touched=!0,_this._pos={x:e.clientX,y:e.clientY};var node=(0,_utils.closest)(e.target,function(el){return null!=el.sortableInfo});if(node&&node.sortableInfo&&!_this.state.sorting){var useDragHandle=_this.props.useDragHandle,_node$sortableInfo=node.sortableInfo,index=_node$sortableInfo.index,collection=_node$sortableInfo.collection;if(useDragHandle&&!(0,_utils.closest)(e.target,function(el){return null!=el.sortableHandle}))return;_this.manager.active={index:index,collection:collection},distance||(_this.pressTimer=setTimeout(function(){return _this.handlePress(e)},_this.props.pressDelay))}},_this.handleMove=function(e){var distance=_this.props.distance;if(!_this.state.sorting&&_this._touched){_this._delta={x:_this._pos.x-e.clientX,y:_this._pos.y-e.clientY};var delta=Math.abs(_this._delta.x)+Math.abs(_this._delta.y);distance?delta>=distance&&_this.handlePress(e):_this.cancel()}},_this.handleEnd=function(){var distance=_this.props.distance;_this._touched=!1,distance||_this.cancel()},_this.cancel=function(){_this.state.sorting||(clearTimeout(_this.pressTimer),_this.manager.active=null)},_this.handlePress=function(e){var active=_this.manager.getActive();if(active){var _this$props2=_this.props,axis=_this$props2.axis,onSortStart=_this$props2.onSortStart,helperClass=_this$props2.helperClass,hideSortableGhost=_this$props2.hideSortableGhost,useWindowAsScrollContainer=_this$props2.useWindowAsScrollContainer,getHelperDimensions=_this$props2.getHelperDimensions,node=active.node,collection=active.collection,index=node.sortableInfo.index,margin=(0,_utils.getElementMargin)(node),containerBoundingRect=_this.container.getBoundingClientRect(),dimensions=getHelperDimensions({index:index,node:node,collection:collection});_this.node=node,_this.width=dimensions.width,_this.height=dimensions.height,_this.margin=margin,_this.dimension="x"===axis?_this.width:_this.height,_this.marginOffset={x:_this.margin.left+_this.margin.right,y:Math.max(_this.margin.top,_this.margin.bottom)},_this.boundingClientRect=node.getBoundingClientRect(),_this.index=index,_this.newIndex=index;var edge=_this.edge="x"===axis?"Left":"Top";if(_this.offsetEdge=_this.getEdgeOffset(edge,node),_this.initialOffset=_this.getOffset(e),_this.initialScroll=_this.scrollContainer["scroll"+edge],_this.helper=_this.document.body.appendChild(node.cloneNode(!0)),_this.helper.style.position="fixed",_this.helper.style.top=_this.boundingClientRect.top-margin.top+"px",_this.helper.style.left=_this.boundingClientRect.left-margin.left+"px",_this.helper.style.width=_this.width+"px",_this.helper.style.boxSizing="border-box",hideSortableGhost&&(_this.sortableGhost=node,node.style.visibility="hidden"),"x"===axis?(_this.minTranslate=(useWindowAsScrollContainer?0:containerBoundingRect.left)-_this.boundingClientRect.left-_this.width/2,_this.maxTranslate=(useWindowAsScrollContainer?_this.contentWindow.innerWidth:containerBoundingRect.left+containerBoundingRect.width)-_this.boundingClientRect.left-_this.width/2):(_this.minTranslate=(useWindowAsScrollContainer?0:containerBoundingRect.top)-_this.boundingClientRect.top-_this.height/2,_this.maxTranslate=(useWindowAsScrollContainer?_this.contentWindow.innerHeight:containerBoundingRect.top+containerBoundingRect.height)-_this.boundingClientRect.top-_this.height/2),helperClass){var _this$helper$classLis;(_this$helper$classLis=_this.helper.classList).add.apply(_this$helper$classLis,(0,_toConsumableArray3["default"])(helperClass.split(" ")))}_this.listenerNode=e.touches?node:_this.contentWindow,_utils.events.move.forEach(function(eventName){return _this.listenerNode.addEventListener(eventName,_this.handleSortMove,!1)}),_utils.events.end.forEach(function(eventName){return _this.listenerNode.addEventListener(eventName,_this.handleSortEnd,!1)}),_this.setState({sorting:!0,sortingIndex:index}),onSortStart&&onSortStart({node:node,index:index,collection:collection},e)}},_this.handleSortMove=function(e){var onSortMove=_this.props.onSortMove;e.preventDefault(),_this.updatePosition(e),_this.animateNodes(),_this.autoscroll(),onSortMove&&onSortMove(e)},_this.handleSortEnd=function(e){var _this$props3=_this.props,hideSortableGhost=_this$props3.hideSortableGhost,onSortEnd=_this$props3.onSortEnd,collection=_this.manager.active.collection;_this.listenerNode&&(_utils.events.move.forEach(function(eventName){return _this.listenerNode.removeEventListener(eventName,_this.handleSortMove)}),_utils.events.end.forEach(function(eventName){return _this.listenerNode.removeEventListener(eventName,_this.handleSortEnd)})),_this.helper.parentNode.removeChild(_this.helper),hideSortableGhost&&_this.sortableGhost&&(_this.sortableGhost.style.visibility="");for(var nodes=_this.manager.refs[collection],i=0,len=nodes.length;i<len;i++){var node=nodes[i],el=node.node;node.edgeOffset=null,el.style[_utils.vendorPrefix+"Transform"]="",el.style[_utils.vendorPrefix+"TransitionDuration"]=""}"function"==typeof onSortEnd&&onSortEnd({oldIndex:_this.index,newIndex:_this.newIndex,collection:collection},e),clearInterval(_this.autoscrollInterval),_this.autoscrollInterval=null,_this.manager.active=null,_this.setState({sorting:!1,sortingIndex:null}),_this._touched=!1},_this.autoscroll=function(){var translate=_this.translate,direction=0,speed=1,acceleration=10;translate>=_this.maxTranslate-_this.dimension/2?(direction=1,speed=acceleration*Math.abs((_this.maxTranslate-_this.dimension/2-translate)/_this.dimension)):translate<=_this.minTranslate+_this.dimension/2&&(direction=-1,speed=acceleration*Math.abs((translate-_this.dimension/2-_this.minTranslate)/_this.dimension)),_this.autoscrollInterval&&(clearTimeout(_this.autoscrollInterval),_this.autoscrollInterval=null,_this.isAutoScrolling=!1),0!==direction&&(_this.autoscrollInterval=setInterval(function(){_this.isAutoScrolling=!0;var offset=1*speed*direction;_this.scrollContainer["scroll"+_this.edge]+=offset,_this.translate+=offset,_this.animateNodes()},5))},_this.manager=new _Manager2["default"],_this.events={start:_this.handleStart,move:_this.handleMove,end:_this.handleEnd},(0,_invariant2["default"])(!(props.distance&&props.pressDelay),"Attempted to set both `pressDelay` and `distance` on SortableContainer, you may only use one or the other, not both at the same time."),_this.state={},_this}return(0,_inherits3["default"])(_class,_Component),(0,_createClass3["default"])(_class,[{key:"getChildContext",value:function(){return{manager:this.manager}}},{key:"componentDidMount",value:function(){var _this2=this,_props=this.props,contentWindow=_props.contentWindow,getContainer=_props.getContainer,useWindowAsScrollContainer=_props.useWindowAsScrollContainer;this.container="function"==typeof getContainer?getContainer(this.getWrappedInstance()):_reactDom2["default"].findDOMNode(this),this.document=this.container.ownerDocument||document,this.scrollContainer=useWindowAsScrollContainer?this.document.body:this.container,this.contentWindow="function"==typeof contentWindow?contentWindow():contentWindow;var _loop=function(key){_utils.events[key].forEach(function(eventName){return _this2.container.addEventListener(eventName,_this2.events[key],!1)})};for(var key in this.events)_loop(key)}},{key:"componentWillUnmount",value:function(){var _this3=this,_loop2=function(key){_utils.events[key].forEach(function(eventName){return _this3.container.removeEventListener(eventName,_this3.events[key])})};for(var key in this.events)_loop2(key)}},{key:"getEdgeOffset",value:function(edge,node){var offset=arguments.length<=2||void 0===arguments[2]?0:arguments[2];if(node)return node.parentNode!==this.container?this.getEdgeOffset(edge,node.parentNode,offset+node["offset"+edge]):node["offset"+edge]+offset}},{key:"getOffset",value:function(e){return{x:e.touches?e.touches[0].clientX:e.clientX,y:e.touches?e.touches[0].clientY:e.clientY}}},{key:"getLockPixelOffsets",value:function(){var lockOffset=this.props.lockOffset;Array.isArray(lockOffset)||(lockOffset=[lockOffset,lockOffset]),(0,_invariant2["default"])(2===lockOffset.length,"lockOffset prop of SortableContainer should be a single value or an array of exactly two values. Given %s",lockOffset);var _lockOffset=lockOffset,_lockOffset2=(0,_slicedToArray3["default"])(_lockOffset,2),minLockOffset=_lockOffset2[0],maxLockOffset=_lockOffset2[1];return[this.getLockPixelOffset(minLockOffset),this.getLockPixelOffset(maxLockOffset)]}},{key:"getLockPixelOffset",value:function(lockOffset){var offset=lockOffset,unit="px";if("string"==typeof lockOffset){var match=/^[+-]?\d*(?:\.\d*)?(px|%)$/.exec(lockOffset);(0,_invariant2["default"])(null!==match,'lockOffset value should be a number or a string of a number followed by "px" or "%". Given %s',lockOffset),offset=parseFloat(lockOffset),unit=match[1]}return(0,_invariant2["default"])(isFinite(offset),"lockOffset value should be a finite. Given %s",lockOffset),"%"===unit&&(offset=offset*this.dimension/100),offset}},{key:"updatePosition",value:function(e){var _props2=this.props,axis=_props2.axis,lockAxis=_props2.lockAxis,lockToContainerEdges=_props2.lockToContainerEdges,offset=this.getOffset(e),translate={x:offset.x-this.initialOffset.x,y:offset.y-this.initialOffset.y};if(this.translate=translate[axis],lockToContainerEdges){var _getLockPixelOffsets=this.getLockPixelOffsets(),_getLockPixelOffsets2=(0,_slicedToArray3["default"])(_getLockPixelOffsets,2),minLockOffset=_getLockPixelOffsets2[0],maxLockOffset=_getLockPixelOffsets2[1],minOffset=this.dimension/2-minLockOffset,maxOffset=this.dimension/2-maxLockOffset;translate[axis]=(0,_utils.limit)(this.minTranslate+minOffset,this.maxTranslate-maxOffset,translate[axis])}switch(lockAxis){case"x":translate.y=0;break;case"y":translate.x=0}this.helper.style[_utils.vendorPrefix+"Transform"]="translate3d("+translate.x+"px,"+translate.y+"px, 0)"}},{key:"animateNodes",value:function(){var _props3=this.props,axis=_props3.axis,transitionDuration=_props3.transitionDuration,hideSortableGhost=_props3.hideSortableGhost,nodes=this.manager.getOrderedRefs(),deltaScroll=this.scrollContainer["scroll"+this.edge]-this.initialScroll,sortingOffset=this.offsetEdge+this.translate+deltaScroll;this.newIndex=null;for(var i=0,len=nodes.length;i<len;i++){var _nodes$i=nodes[i],node=_nodes$i.node,edgeOffset=_nodes$i.edgeOffset,index=node.sortableInfo.index,dimension="x"===axis?node.offsetWidth:node.offsetHeight,offset=this.dimension>dimension?dimension/2:this.dimension/2,translate=0,translateX=0,translateY=0;null==edgeOffset&&(nodes[i].edgeOffset=edgeOffset=this.getEdgeOffset(this.edge,node)),index!==this.index?(transitionDuration&&(node.style[_utils.vendorPrefix+"TransitionDuration"]=transitionDuration+"ms"),index>this.index&&sortingOffset+offset>=edgeOffset?(translate=-(this.dimension+this.marginOffset[axis]),this.newIndex=index):index<this.index&&sortingOffset<=edgeOffset+offset&&(translate=this.dimension+this.marginOffset[axis],null==this.newIndex&&(this.newIndex=index)),"x"===axis?translateX=translate:translateY=translate,node.style[_utils.vendorPrefix+"Transform"]="translate3d("+translateX+"px,"+translateY+"px,0)"):hideSortableGhost&&(this.sortableGhost=node,node.style.visibility="hidden")}null==this.newIndex&&(this.newIndex=this.index)}},{key:"getWrappedInstance",value:function(){return(0,_invariant2["default"])(config.withRef,"To access the wrapped instance, you need to pass in {withRef: true} as the second argument of the SortableContainer() call"),this.refs.wrappedInstance}},{key:"render",value:function(){var ref=config.withRef?"wrappedInstance":null;return _react2["default"].createElement(WrappedComponent,(0,_extends3["default"])({ref:ref},this.props,this.state))}}]),_class}(_react.Component),_class.displayName=WrappedComponent.displayName?"SortableList("+WrappedComponent.displayName+")":"SortableList",_class.WrappedComponent=WrappedComponent,_class.defaultProps={axis:"y",transitionDuration:300,pressDelay:0,distance:0,useWindowAsScrollContainer:!1,hideSortableGhost:!0,contentWindow:"undefined"!=typeof window?window:null,shouldCancelStart:function(e){if(["input","textarea","select","option"].indexOf(e.target.tagName.toLowerCase())!==-1)return!0},lockToContainerEdges:!1,lockOffset:"50%",getHelperDimensions:function(_ref){var node=_ref.node;return{width:node.offsetWidth,height:node.offsetHeight}}},_class.propTypes={axis:_react.PropTypes.oneOf(["x","y"]),distance:_react.PropTypes.number,lockAxis:_react.PropTypes.string,helperClass:_react.PropTypes.string,transitionDuration:_react.PropTypes.number,contentWindow:_react.PropTypes.any,onSortStart:_react.PropTypes.func,onSortMove:_react.PropTypes.func,onSortEnd:_react.PropTypes.func,shouldCancelStart:_react.PropTypes.func,pressDelay:_react.PropTypes.number,useDragHandle:_react.PropTypes.bool,useWindowAsScrollContainer:_react.PropTypes.bool,hideSortableGhost:_react.PropTypes.bool,lockToContainerEdges:_react.PropTypes.bool,lockOffset:_react.PropTypes.oneOfType([_react.PropTypes.number,_react.PropTypes.string,_react.PropTypes.arrayOf(_react.PropTypes.oneOfType([_react.PropTypes.number,_react.PropTypes.string]))]),getContainer:_react.PropTypes.func,getHelperDimensions:_react.PropTypes.func},_class.childContextTypes={manager:_react.PropTypes.object.isRequired},_temp}Object.defineProperty(exports,"__esModule",{value:!0});var _extends2=__webpack_require__(4),_extends3=_interopRequireDefault(_extends2),_slicedToArray2=__webpack_require__(42),_slicedToArray3=_interopRequireDefault(_slicedToArray2),_toConsumableArray2=__webpack_require__(68),_toConsumableArray3=_interopRequireDefault(_toConsumableArray2),_getPrototypeOf=__webpack_require__(76),_getPrototypeOf2=_interopRequireDefault(_getPrototypeOf),_classCallCheck2=__webpack_require__(80),_classCallCheck3=_interopRequireDefault(_classCallCheck2),_createClass2=__webpack_require__(81),_createClass3=_interopRequireDefault(_createClass2),_possibleConstructorReturn2=__webpack_require__(85),_possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2),_inherits2=__webpack_require__(104),_inherits3=_interopRequireDefault(_inherits2);exports["default"]=SortableContainer;var _react=__webpack_require__(112),_react2=_interopRequireDefault(_react),_reactDom=__webpack_require__(113),_reactDom2=_interopRequireDefault(_reactDom),_Manager=__webpack_require__(114),_Manager2=_interopRequireDefault(_Manager),_utils=__webpack_require__(2),_invariant=__webpack_require__(246),_invariant2=_interopRequireDefault(_invariant)},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}exports.__esModule=!0;var _assign=__webpack_require__(5),_assign2=_interopRequireDefault(_assign);exports["default"]=_assign2["default"]||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key])}return target}},function(module,exports,__webpack_require__){module.exports={"default":__webpack_require__(6),__esModule:!0}},function(module,exports,__webpack_require__){__webpack_require__(7),module.exports=__webpack_require__(10).Object.assign},function(module,exports,__webpack_require__){var $export=__webpack_require__(8);$export($export.S+$export.F,"Object",{assign:__webpack_require__(23)})},function(module,exports,__webpack_require__){var global=__webpack_require__(9),core=__webpack_require__(10),ctx=__webpack_require__(11),hide=__webpack_require__(13),PROTOTYPE="prototype",$export=function(type,name,source){var key,own,out,IS_FORCED=type&$export.F,IS_GLOBAL=type&$export.G,IS_STATIC=type&$export.S,IS_PROTO=type&$export.P,IS_BIND=type&$export.B,IS_WRAP=type&$export.W,exports=IS_GLOBAL?core:core[name]||(core[name]={}),expProto=exports[PROTOTYPE],target=IS_GLOBAL?global:IS_STATIC?global[name]:(global[name]||{})[PROTOTYPE];IS_GLOBAL&&(source=name);for(key in source)own=!IS_FORCED&&target&&void 0!==target[key],own&&key in exports||(out=own?target[key]:source[key],exports[key]=IS_GLOBAL&&"function"!=typeof target[key]?source[key]:IS_BIND&&own?ctx(out,global):IS_WRAP&&target[key]==out?function(C){var F=function(a,b,c){if(this instanceof C){switch(arguments.length){case 0:return new C;case 1:return new C(a);case 2:return new C(a,b)}return new C(a,b,c)}return C.apply(this,arguments)};return F[PROTOTYPE]=C[PROTOTYPE],F}(out):IS_PROTO&&"function"==typeof out?ctx(Function.call,out):out,IS_PROTO&&((exports.virtual||(exports.virtual={}))[key]=out,type&$export.R&&expProto&&!expProto[key]&&hide(expProto,key,out)))};$export.F=1,$export.G=2,$export.S=4,$export.P=8,$export.B=16,$export.W=32,$export.U=64,$export.R=128,module.exports=$export},function(module,exports){var global=module.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=global)},function(module,exports){var core=module.exports={version:"2.4.0"};"number"==typeof __e&&(__e=core)},function(module,exports,__webpack_require__){var aFunction=__webpack_require__(12);module.exports=function(fn,that,length){if(aFunction(fn),void 0===that)return fn;switch(length){case 1:return function(a){return fn.call(that,a)};case 2:return function(a,b){return fn.call(that,a,b)};case 3:return function(a,b,c){return fn.call(that,a,b,c)}}return function(){return fn.apply(that,arguments)}}},function(module,exports){module.exports=function(it){if("function"!=typeof it)throw TypeError(it+" is not a function!");return it}},function(module,exports,__webpack_require__){var dP=__webpack_require__(14),createDesc=__webpack_require__(22);module.exports=__webpack_require__(18)?function(object,key,value){return dP.f(object,key,createDesc(1,value))}:function(object,key,value){return object[key]=value,object}},function(module,exports,__webpack_require__){var anObject=__webpack_require__(15),IE8_DOM_DEFINE=__webpack_require__(17),toPrimitive=__webpack_require__(21),dP=Object.defineProperty;exports.f=__webpack_require__(18)?Object.defineProperty:function(O,P,Attributes){if(anObject(O),P=toPrimitive(P,!0),anObject(Attributes),IE8_DOM_DEFINE)try{return dP(O,P,Attributes)}catch(e){}if("get"in Attributes||"set"in Attributes)throw TypeError("Accessors not supported!");return"value"in Attributes&&(O[P]=Attributes.value),O}},function(module,exports,__webpack_require__){var isObject=__webpack_require__(16);module.exports=function(it){if(!isObject(it))throw TypeError(it+" is not an object!");return it}},function(module,exports){module.exports=function(it){return"object"==typeof it?null!==it:"function"==typeof it}},function(module,exports,__webpack_require__){module.exports=!__webpack_require__(18)&&!__webpack_require__(19)(function(){return 7!=Object.defineProperty(__webpack_require__(20)("div"),"a",{get:function(){return 7}}).a})},function(module,exports,__webpack_require__){module.exports=!__webpack_require__(19)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(module,exports){module.exports=function(exec){try{return!!exec()}catch(e){return!0}}},function(module,exports,__webpack_require__){var isObject=__webpack_require__(16),document=__webpack_require__(9).document,is=isObject(document)&&isObject(document.createElement);module.exports=function(it){return is?document.createElement(it):{}}},function(module,exports,__webpack_require__){var isObject=__webpack_require__(16);module.exports=function(it,S){if(!isObject(it))return it;var fn,val;if(S&&"function"==typeof(fn=it.toString)&&!isObject(val=fn.call(it)))return val;if("function"==typeof(fn=it.valueOf)&&!isObject(val=fn.call(it)))return val;if(!S&&"function"==typeof(fn=it.toString)&&!isObject(val=fn.call(it)))return val;throw TypeError("Can't convert object to primitive value")}},function(module,exports){module.exports=function(bitmap,value){return{enumerable:!(1&bitmap),configurable:!(2&bitmap),writable:!(4&bitmap),value:value}}},function(module,exports,__webpack_require__){"use strict";var getKeys=__webpack_require__(24),gOPS=__webpack_require__(39),pIE=__webpack_require__(40),toObject=__webpack_require__(41),IObject=__webpack_require__(28),$assign=Object.assign;module.exports=!$assign||__webpack_require__(19)(function(){var A={},B={},S=Symbol(),K="abcdefghijklmnopqrst";return A[S]=7,K.split("").forEach(function(k){B[k]=k}),7!=$assign({},A)[S]||Object.keys($assign({},B)).join("")!=K})?function(target,source){for(var T=toObject(target),aLen=arguments.length,index=1,getSymbols=gOPS.f,isEnum=pIE.f;aLen>index;)for(var key,S=IObject(arguments[index++]),keys=getSymbols?getKeys(S).concat(getSymbols(S)):getKeys(S),length=keys.length,j=0;length>j;)isEnum.call(S,key=keys[j++])&&(T[key]=S[key]);return T}:$assign},function(module,exports,__webpack_require__){var $keys=__webpack_require__(25),enumBugKeys=__webpack_require__(38);module.exports=Object.keys||function(O){return $keys(O,enumBugKeys)}},function(module,exports,__webpack_require__){var has=__webpack_require__(26),toIObject=__webpack_require__(27),arrayIndexOf=__webpack_require__(31)(!1),IE_PROTO=__webpack_require__(35)("IE_PROTO");module.exports=function(object,names){var key,O=toIObject(object),i=0,result=[];for(key in O)key!=IE_PROTO&&has(O,key)&&result.push(key);for(;names.length>i;)has(O,key=names[i++])&&(~arrayIndexOf(result,key)||result.push(key));return result}},function(module,exports){var hasOwnProperty={}.hasOwnProperty;module.exports=function(it,key){return hasOwnProperty.call(it,key)}},function(module,exports,__webpack_require__){var IObject=__webpack_require__(28),defined=__webpack_require__(30);module.exports=function(it){return IObject(defined(it))}},function(module,exports,__webpack_require__){var cof=__webpack_require__(29);module.exports=Object("z").propertyIsEnumerable(0)?Object:function(it){return"String"==cof(it)?it.split(""):Object(it)}},function(module,exports){var toString={}.toString;module.exports=function(it){return toString.call(it).slice(8,-1)}},function(module,exports){module.exports=function(it){if(void 0==it)throw TypeError("Can't call method on "+it);return it}},function(module,exports,__webpack_require__){var toIObject=__webpack_require__(27),toLength=__webpack_require__(32),toIndex=__webpack_require__(34);module.exports=function(IS_INCLUDES){return function($this,el,fromIndex){var value,O=toIObject($this),length=toLength(O.length),index=toIndex(fromIndex,length);if(IS_INCLUDES&&el!=el){for(;length>index;)if(value=O[index++],value!=value)return!0}else for(;length>index;index++)if((IS_INCLUDES||index in O)&&O[index]===el)return IS_INCLUDES||index||0;return!IS_INCLUDES&&-1}}},function(module,exports,__webpack_require__){var toInteger=__webpack_require__(33),min=Math.min;module.exports=function(it){return it>0?min(toInteger(it),9007199254740991):0}},function(module,exports){var ceil=Math.ceil,floor=Math.floor;module.exports=function(it){return isNaN(it=+it)?0:(it>0?floor:ceil)(it)}},function(module,exports,__webpack_require__){var toInteger=__webpack_require__(33),max=Math.max,min=Math.min;module.exports=function(index,length){return index=toInteger(index),index<0?max(index+length,0):min(index,length)}},function(module,exports,__webpack_require__){var shared=__webpack_require__(36)("keys"),uid=__webpack_require__(37);module.exports=function(key){return shared[key]||(shared[key]=uid(key))}},function(module,exports,__webpack_require__){var global=__webpack_require__(9),SHARED="__core-js_shared__",store=global[SHARED]||(global[SHARED]={});module.exports=function(key){return store[key]||(store[key]={})}},function(module,exports){var id=0,px=Math.random();module.exports=function(key){return"Symbol(".concat(void 0===key?"":key,")_",(++id+px).toString(36))}},function(module,exports){module.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(module,exports){exports.f=Object.getOwnPropertySymbols},function(module,exports){exports.f={}.propertyIsEnumerable},function(module,exports,__webpack_require__){var defined=__webpack_require__(30);module.exports=function(it){return Object(defined(it))}},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}exports.__esModule=!0;var _isIterable2=__webpack_require__(43),_isIterable3=_interopRequireDefault(_isIterable2),_getIterator2=__webpack_require__(64),_getIterator3=_interopRequireDefault(_getIterator2);exports["default"]=function(){function sliceIterator(arr,i){var _arr=[],_n=!0,_d=!1,_e=void 0;try{for(var _s,_i=(0,_getIterator3["default"])(arr);!(_n=(_s=_i.next()).done)&&(_arr.push(_s.value),!i||_arr.length!==i);_n=!0);}catch(err){_d=!0,_e=err}finally{try{!_n&&_i["return"]&&_i["return"]()}finally{if(_d)throw _e}}return _arr}return function(arr,i){if(Array.isArray(arr))return arr;if((0,_isIterable3["default"])(Object(arr)))return sliceIterator(arr,i);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}()},function(module,exports,__webpack_require__){module.exports={"default":__webpack_require__(44),__esModule:!0}},function(module,exports,__webpack_require__){__webpack_require__(45),__webpack_require__(60),module.exports=__webpack_require__(62)},function(module,exports,__webpack_require__){__webpack_require__(46);for(var global=__webpack_require__(9),hide=__webpack_require__(13),Iterators=__webpack_require__(49),TO_STRING_TAG=__webpack_require__(58)("toStringTag"),collections=["NodeList","DOMTokenList","MediaList","StyleSheetList","CSSRuleList"],i=0;i<5;i++){var NAME=collections[i],Collection=global[NAME],proto=Collection&&Collection.prototype;proto&&!proto[TO_STRING_TAG]&&hide(proto,TO_STRING_TAG,NAME),Iterators[NAME]=Iterators.Array}},function(module,exports,__webpack_require__){"use strict";var addToUnscopables=__webpack_require__(47),step=__webpack_require__(48),Iterators=__webpack_require__(49),toIObject=__webpack_require__(27);module.exports=__webpack_require__(50)(Array,"Array",function(iterated,kind){this._t=toIObject(iterated),this._i=0,this._k=kind},function(){var O=this._t,kind=this._k,index=this._i++;return!O||index>=O.length?(this._t=void 0,step(1)):"keys"==kind?step(0,index):"values"==kind?step(0,O[index]):step(0,[index,O[index]])},"values"),Iterators.Arguments=Iterators.Array,addToUnscopables("keys"),addToUnscopables("values"),addToUnscopables("entries")},function(module,exports){module.exports=function(){}},function(module,exports){module.exports=function(done,value){return{value:value,done:!!done}}},function(module,exports){module.exports={}},function(module,exports,__webpack_require__){"use strict";var LIBRARY=__webpack_require__(51),$export=__webpack_require__(8),redefine=__webpack_require__(52),hide=__webpack_require__(13),has=__webpack_require__(26),Iterators=__webpack_require__(49),$iterCreate=__webpack_require__(53),setToStringTag=__webpack_require__(57),getPrototypeOf=__webpack_require__(59),ITERATOR=__webpack_require__(58)("iterator"),BUGGY=!([].keys&&"next"in[].keys()),FF_ITERATOR="@@iterator",KEYS="keys",VALUES="values",returnThis=function(){return this};module.exports=function(Base,NAME,Constructor,next,DEFAULT,IS_SET,FORCED){$iterCreate(Constructor,NAME,next);var methods,key,IteratorPrototype,getMethod=function(kind){if(!BUGGY&&kind in proto)return proto[kind];switch(kind){case KEYS:return function(){return new Constructor(this,kind)};case VALUES:return function(){return new Constructor(this,kind)}}return function(){return new Constructor(this,kind)}},TAG=NAME+" Iterator",DEF_VALUES=DEFAULT==VALUES,VALUES_BUG=!1,proto=Base.prototype,$native=proto[ITERATOR]||proto[FF_ITERATOR]||DEFAULT&&proto[DEFAULT],$default=$native||getMethod(DEFAULT),$entries=DEFAULT?DEF_VALUES?getMethod("entries"):$default:void 0,$anyNative="Array"==NAME?proto.entries||$native:$native;if($anyNative&&(IteratorPrototype=getPrototypeOf($anyNative.call(new Base)),IteratorPrototype!==Object.prototype&&(setToStringTag(IteratorPrototype,TAG,!0),LIBRARY||has(IteratorPrototype,ITERATOR)||hide(IteratorPrototype,ITERATOR,returnThis))),
DEF_VALUES&&$native&&$native.name!==VALUES&&(VALUES_BUG=!0,$default=function(){return $native.call(this)}),LIBRARY&&!FORCED||!BUGGY&&!VALUES_BUG&&proto[ITERATOR]||hide(proto,ITERATOR,$default),Iterators[NAME]=$default,Iterators[TAG]=returnThis,DEFAULT)if(methods={values:DEF_VALUES?$default:getMethod(VALUES),keys:IS_SET?$default:getMethod(KEYS),entries:$entries},FORCED)for(key in methods)key in proto||redefine(proto,key,methods[key]);else $export($export.P+$export.F*(BUGGY||VALUES_BUG),NAME,methods);return methods}},function(module,exports){module.exports=!0},function(module,exports,__webpack_require__){module.exports=__webpack_require__(13)},function(module,exports,__webpack_require__){"use strict";var create=__webpack_require__(54),descriptor=__webpack_require__(22),setToStringTag=__webpack_require__(57),IteratorPrototype={};__webpack_require__(13)(IteratorPrototype,__webpack_require__(58)("iterator"),function(){return this}),module.exports=function(Constructor,NAME,next){Constructor.prototype=create(IteratorPrototype,{next:descriptor(1,next)}),setToStringTag(Constructor,NAME+" Iterator")}},function(module,exports,__webpack_require__){var anObject=__webpack_require__(15),dPs=__webpack_require__(55),enumBugKeys=__webpack_require__(38),IE_PROTO=__webpack_require__(35)("IE_PROTO"),Empty=function(){},PROTOTYPE="prototype",createDict=function(){var iframeDocument,iframe=__webpack_require__(20)("iframe"),i=enumBugKeys.length,gt=">";for(iframe.style.display="none",__webpack_require__(56).appendChild(iframe),iframe.src="javascript:",iframeDocument=iframe.contentWindow.document,iframeDocument.open(),iframeDocument.write("<script>document.F=Object</script"+gt),iframeDocument.close(),createDict=iframeDocument.F;i--;)delete createDict[PROTOTYPE][enumBugKeys[i]];return createDict()};module.exports=Object.create||function(O,Properties){var result;return null!==O?(Empty[PROTOTYPE]=anObject(O),result=new Empty,Empty[PROTOTYPE]=null,result[IE_PROTO]=O):result=createDict(),void 0===Properties?result:dPs(result,Properties)}},function(module,exports,__webpack_require__){var dP=__webpack_require__(14),anObject=__webpack_require__(15),getKeys=__webpack_require__(24);module.exports=__webpack_require__(18)?Object.defineProperties:function(O,Properties){anObject(O);for(var P,keys=getKeys(Properties),length=keys.length,i=0;length>i;)dP.f(O,P=keys[i++],Properties[P]);return O}},function(module,exports,__webpack_require__){module.exports=__webpack_require__(9).document&&document.documentElement},function(module,exports,__webpack_require__){var def=__webpack_require__(14).f,has=__webpack_require__(26),TAG=__webpack_require__(58)("toStringTag");module.exports=function(it,tag,stat){it&&!has(it=stat?it:it.prototype,TAG)&&def(it,TAG,{configurable:!0,value:tag})}},function(module,exports,__webpack_require__){var store=__webpack_require__(36)("wks"),uid=__webpack_require__(37),Symbol=__webpack_require__(9).Symbol,USE_SYMBOL="function"==typeof Symbol,$exports=module.exports=function(name){return store[name]||(store[name]=USE_SYMBOL&&Symbol[name]||(USE_SYMBOL?Symbol:uid)("Symbol."+name))};$exports.store=store},function(module,exports,__webpack_require__){var has=__webpack_require__(26),toObject=__webpack_require__(41),IE_PROTO=__webpack_require__(35)("IE_PROTO"),ObjectProto=Object.prototype;module.exports=Object.getPrototypeOf||function(O){return O=toObject(O),has(O,IE_PROTO)?O[IE_PROTO]:"function"==typeof O.constructor&&O instanceof O.constructor?O.constructor.prototype:O instanceof Object?ObjectProto:null}},function(module,exports,__webpack_require__){"use strict";var $at=__webpack_require__(61)(!0);__webpack_require__(50)(String,"String",function(iterated){this._t=String(iterated),this._i=0},function(){var point,O=this._t,index=this._i;return index>=O.length?{value:void 0,done:!0}:(point=$at(O,index),this._i+=point.length,{value:point,done:!1})})},function(module,exports,__webpack_require__){var toInteger=__webpack_require__(33),defined=__webpack_require__(30);module.exports=function(TO_STRING){return function(that,pos){var a,b,s=String(defined(that)),i=toInteger(pos),l=s.length;return i<0||i>=l?TO_STRING?"":void 0:(a=s.charCodeAt(i),a<55296||a>56319||i+1===l||(b=s.charCodeAt(i+1))<56320||b>57343?TO_STRING?s.charAt(i):a:TO_STRING?s.slice(i,i+2):(a-55296<<10)+(b-56320)+65536)}}},function(module,exports,__webpack_require__){var classof=__webpack_require__(63),ITERATOR=__webpack_require__(58)("iterator"),Iterators=__webpack_require__(49);module.exports=__webpack_require__(10).isIterable=function(it){var O=Object(it);return void 0!==O[ITERATOR]||"@@iterator"in O||Iterators.hasOwnProperty(classof(O))}},function(module,exports,__webpack_require__){var cof=__webpack_require__(29),TAG=__webpack_require__(58)("toStringTag"),ARG="Arguments"==cof(function(){return arguments}()),tryGet=function(it,key){try{return it[key]}catch(e){}};module.exports=function(it){var O,T,B;return void 0===it?"Undefined":null===it?"Null":"string"==typeof(T=tryGet(O=Object(it),TAG))?T:ARG?cof(O):"Object"==(B=cof(O))&&"function"==typeof O.callee?"Arguments":B}},function(module,exports,__webpack_require__){module.exports={"default":__webpack_require__(65),__esModule:!0}},function(module,exports,__webpack_require__){__webpack_require__(45),__webpack_require__(60),module.exports=__webpack_require__(66)},function(module,exports,__webpack_require__){var anObject=__webpack_require__(15),get=__webpack_require__(67);module.exports=__webpack_require__(10).getIterator=function(it){var iterFn=get(it);if("function"!=typeof iterFn)throw TypeError(it+" is not iterable!");return anObject(iterFn.call(it))}},function(module,exports,__webpack_require__){var classof=__webpack_require__(63),ITERATOR=__webpack_require__(58)("iterator"),Iterators=__webpack_require__(49);module.exports=__webpack_require__(10).getIteratorMethod=function(it){if(void 0!=it)return it[ITERATOR]||it["@@iterator"]||Iterators[classof(it)]}},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}exports.__esModule=!0;var _from=__webpack_require__(69),_from2=_interopRequireDefault(_from);exports["default"]=function(arr){if(Array.isArray(arr)){for(var i=0,arr2=Array(arr.length);i<arr.length;i++)arr2[i]=arr[i];return arr2}return(0,_from2["default"])(arr)}},function(module,exports,__webpack_require__){module.exports={"default":__webpack_require__(70),__esModule:!0}},function(module,exports,__webpack_require__){__webpack_require__(60),__webpack_require__(71),module.exports=__webpack_require__(10).Array.from},function(module,exports,__webpack_require__){"use strict";var ctx=__webpack_require__(11),$export=__webpack_require__(8),toObject=__webpack_require__(41),call=__webpack_require__(72),isArrayIter=__webpack_require__(73),toLength=__webpack_require__(32),createProperty=__webpack_require__(74),getIterFn=__webpack_require__(67);$export($export.S+$export.F*!__webpack_require__(75)(function(iter){Array.from(iter)}),"Array",{from:function(arrayLike){var length,result,step,iterator,O=toObject(arrayLike),C="function"==typeof this?this:Array,aLen=arguments.length,mapfn=aLen>1?arguments[1]:void 0,mapping=void 0!==mapfn,index=0,iterFn=getIterFn(O);if(mapping&&(mapfn=ctx(mapfn,aLen>2?arguments[2]:void 0,2)),void 0==iterFn||C==Array&&isArrayIter(iterFn))for(length=toLength(O.length),result=new C(length);length>index;index++)createProperty(result,index,mapping?mapfn(O[index],index):O[index]);else for(iterator=iterFn.call(O),result=new C;!(step=iterator.next()).done;index++)createProperty(result,index,mapping?call(iterator,mapfn,[step.value,index],!0):step.value);return result.length=index,result}})},function(module,exports,__webpack_require__){var anObject=__webpack_require__(15);module.exports=function(iterator,fn,value,entries){try{return entries?fn(anObject(value)[0],value[1]):fn(value)}catch(e){var ret=iterator["return"];throw void 0!==ret&&anObject(ret.call(iterator)),e}}},function(module,exports,__webpack_require__){var Iterators=__webpack_require__(49),ITERATOR=__webpack_require__(58)("iterator"),ArrayProto=Array.prototype;module.exports=function(it){return void 0!==it&&(Iterators.Array===it||ArrayProto[ITERATOR]===it)}},function(module,exports,__webpack_require__){"use strict";var $defineProperty=__webpack_require__(14),createDesc=__webpack_require__(22);module.exports=function(object,index,value){index in object?$defineProperty.f(object,index,createDesc(0,value)):object[index]=value}},function(module,exports,__webpack_require__){var ITERATOR=__webpack_require__(58)("iterator"),SAFE_CLOSING=!1;try{var riter=[7][ITERATOR]();riter["return"]=function(){SAFE_CLOSING=!0},Array.from(riter,function(){throw 2})}catch(e){}module.exports=function(exec,skipClosing){if(!skipClosing&&!SAFE_CLOSING)return!1;var safe=!1;try{var arr=[7],iter=arr[ITERATOR]();iter.next=function(){return{done:safe=!0}},arr[ITERATOR]=function(){return iter},exec(arr)}catch(e){}return safe}},function(module,exports,__webpack_require__){module.exports={"default":__webpack_require__(77),__esModule:!0}},function(module,exports,__webpack_require__){__webpack_require__(78),module.exports=__webpack_require__(10).Object.getPrototypeOf},function(module,exports,__webpack_require__){var toObject=__webpack_require__(41),$getPrototypeOf=__webpack_require__(59);__webpack_require__(79)("getPrototypeOf",function(){return function(it){return $getPrototypeOf(toObject(it))}})},function(module,exports,__webpack_require__){var $export=__webpack_require__(8),core=__webpack_require__(10),fails=__webpack_require__(19);module.exports=function(KEY,exec){var fn=(core.Object||{})[KEY]||Object[KEY],exp={};exp[KEY]=exec(fn),$export($export.S+$export.F*fails(function(){fn(1)}),"Object",exp)}},function(module,exports){"use strict";exports.__esModule=!0,exports["default"]=function(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}exports.__esModule=!0;var _defineProperty=__webpack_require__(82),_defineProperty2=_interopRequireDefault(_defineProperty);exports["default"]=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),(0,_defineProperty2["default"])(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){return protoProps&&defineProperties(Constructor.prototype,protoProps),staticProps&&defineProperties(Constructor,staticProps),Constructor}}()},function(module,exports,__webpack_require__){module.exports={"default":__webpack_require__(83),__esModule:!0}},function(module,exports,__webpack_require__){__webpack_require__(84);var $Object=__webpack_require__(10).Object;module.exports=function(it,key,desc){return $Object.defineProperty(it,key,desc)}},function(module,exports,__webpack_require__){var $export=__webpack_require__(8);$export($export.S+$export.F*!__webpack_require__(18),"Object",{defineProperty:__webpack_require__(14).f})},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}exports.__esModule=!0;var _typeof2=__webpack_require__(86),_typeof3=_interopRequireDefault(_typeof2);exports["default"]=function(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!==("undefined"==typeof call?"undefined":(0,_typeof3["default"])(call))&&"function"!=typeof call?self:call}},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}exports.__esModule=!0;var _iterator=__webpack_require__(87),_iterator2=_interopRequireDefault(_iterator),_symbol=__webpack_require__(90),_symbol2=_interopRequireDefault(_symbol),_typeof="function"==typeof _symbol2["default"]&&"symbol"==typeof _iterator2["default"]?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof _symbol2["default"]&&obj.constructor===_symbol2["default"]?"symbol":typeof obj};exports["default"]="function"==typeof _symbol2["default"]&&"symbol"===_typeof(_iterator2["default"])?function(obj){return"undefined"==typeof obj?"undefined":_typeof(obj)}:function(obj){return obj&&"function"==typeof _symbol2["default"]&&obj.constructor===_symbol2["default"]?"symbol":"undefined"==typeof obj?"undefined":_typeof(obj)}},function(module,exports,__webpack_require__){module.exports={"default":__webpack_require__(88),__esModule:!0}},function(module,exports,__webpack_require__){__webpack_require__(60),__webpack_require__(45),module.exports=__webpack_require__(89).f("iterator")},function(module,exports,__webpack_require__){exports.f=__webpack_require__(58)},function(module,exports,__webpack_require__){module.exports={"default":__webpack_require__(91),__esModule:!0}},function(module,exports,__webpack_require__){__webpack_require__(92),__webpack_require__(101),__webpack_require__(102),__webpack_require__(103),module.exports=__webpack_require__(10).Symbol},function(module,exports,__webpack_require__){"use strict";var global=__webpack_require__(9),has=__webpack_require__(26),DESCRIPTORS=__webpack_require__(18),$export=__webpack_require__(8),redefine=__webpack_require__(52),META=__webpack_require__(93).KEY,$fails=__webpack_require__(19),shared=__webpack_require__(36),setToStringTag=__webpack_require__(57),uid=__webpack_require__(37),wks=__webpack_require__(58),wksExt=__webpack_require__(89),wksDefine=__webpack_require__(94),keyOf=__webpack_require__(95),enumKeys=__webpack_require__(96),isArray=__webpack_require__(97),anObject=__webpack_require__(15),toIObject=__webpack_require__(27),toPrimitive=__webpack_require__(21),createDesc=__webpack_require__(22),_create=__webpack_require__(54),gOPNExt=__webpack_require__(98),$GOPD=__webpack_require__(100),$DP=__webpack_require__(14),$keys=__webpack_require__(24),gOPD=$GOPD.f,dP=$DP.f,gOPN=gOPNExt.f,$Symbol=global.Symbol,$JSON=global.JSON,_stringify=$JSON&&$JSON.stringify,PROTOTYPE="prototype",HIDDEN=wks("_hidden"),TO_PRIMITIVE=wks("toPrimitive"),isEnum={}.propertyIsEnumerable,SymbolRegistry=shared("symbol-registry"),AllSymbols=shared("symbols"),OPSymbols=shared("op-symbols"),ObjectProto=Object[PROTOTYPE],USE_NATIVE="function"==typeof $Symbol,QObject=global.QObject,setter=!QObject||!QObject[PROTOTYPE]||!QObject[PROTOTYPE].findChild,setSymbolDesc=DESCRIPTORS&&$fails(function(){return 7!=_create(dP({},"a",{get:function(){return dP(this,"a",{value:7}).a}})).a})?function(it,key,D){var protoDesc=gOPD(ObjectProto,key);protoDesc&&delete ObjectProto[key],dP(it,key,D),protoDesc&&it!==ObjectProto&&dP(ObjectProto,key,protoDesc)}:dP,wrap=function(tag){var sym=AllSymbols[tag]=_create($Symbol[PROTOTYPE]);return sym._k=tag,sym},isSymbol=USE_NATIVE&&"symbol"==typeof $Symbol.iterator?function(it){return"symbol"==typeof it}:function(it){return it instanceof $Symbol},$defineProperty=function(it,key,D){return it===ObjectProto&&$defineProperty(OPSymbols,key,D),anObject(it),key=toPrimitive(key,!0),anObject(D),has(AllSymbols,key)?(D.enumerable?(has(it,HIDDEN)&&it[HIDDEN][key]&&(it[HIDDEN][key]=!1),D=_create(D,{enumerable:createDesc(0,!1)})):(has(it,HIDDEN)||dP(it,HIDDEN,createDesc(1,{})),it[HIDDEN][key]=!0),setSymbolDesc(it,key,D)):dP(it,key,D)},$defineProperties=function(it,P){anObject(it);for(var key,keys=enumKeys(P=toIObject(P)),i=0,l=keys.length;l>i;)$defineProperty(it,key=keys[i++],P[key]);return it},$create=function(it,P){return void 0===P?_create(it):$defineProperties(_create(it),P)},$propertyIsEnumerable=function(key){var E=isEnum.call(this,key=toPrimitive(key,!0));return!(this===ObjectProto&&has(AllSymbols,key)&&!has(OPSymbols,key))&&(!(E||!has(this,key)||!has(AllSymbols,key)||has(this,HIDDEN)&&this[HIDDEN][key])||E)},$getOwnPropertyDescriptor=function(it,key){if(it=toIObject(it),key=toPrimitive(key,!0),it!==ObjectProto||!has(AllSymbols,key)||has(OPSymbols,key)){var D=gOPD(it,key);return!D||!has(AllSymbols,key)||has(it,HIDDEN)&&it[HIDDEN][key]||(D.enumerable=!0),D}},$getOwnPropertyNames=function(it){for(var key,names=gOPN(toIObject(it)),result=[],i=0;names.length>i;)has(AllSymbols,key=names[i++])||key==HIDDEN||key==META||result.push(key);return result},$getOwnPropertySymbols=function(it){for(var key,IS_OP=it===ObjectProto,names=gOPN(IS_OP?OPSymbols:toIObject(it)),result=[],i=0;names.length>i;)!has(AllSymbols,key=names[i++])||IS_OP&&!has(ObjectProto,key)||result.push(AllSymbols[key]);return result};USE_NATIVE||($Symbol=function(){if(this instanceof $Symbol)throw TypeError("Symbol is not a constructor!");var tag=uid(arguments.length>0?arguments[0]:void 0),$set=function(value){this===ObjectProto&&$set.call(OPSymbols,value),has(this,HIDDEN)&&has(this[HIDDEN],tag)&&(this[HIDDEN][tag]=!1),setSymbolDesc(this,tag,createDesc(1,value))};return DESCRIPTORS&&setter&&setSymbolDesc(ObjectProto,tag,{configurable:!0,set:$set}),wrap(tag)},redefine($Symbol[PROTOTYPE],"toString",function(){return this._k}),$GOPD.f=$getOwnPropertyDescriptor,$DP.f=$defineProperty,__webpack_require__(99).f=gOPNExt.f=$getOwnPropertyNames,__webpack_require__(40).f=$propertyIsEnumerable,__webpack_require__(39).f=$getOwnPropertySymbols,DESCRIPTORS&&!__webpack_require__(51)&&redefine(ObjectProto,"propertyIsEnumerable",$propertyIsEnumerable,!0),wksExt.f=function(name){return wrap(wks(name))}),$export($export.G+$export.W+$export.F*!USE_NATIVE,{Symbol:$Symbol});for(var symbols="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),i=0;symbols.length>i;)wks(symbols[i++]);for(var symbols=$keys(wks.store),i=0;symbols.length>i;)wksDefine(symbols[i++]);$export($export.S+$export.F*!USE_NATIVE,"Symbol",{"for":function(key){return has(SymbolRegistry,key+="")?SymbolRegistry[key]:SymbolRegistry[key]=$Symbol(key)},keyFor:function(key){if(isSymbol(key))return keyOf(SymbolRegistry,key);throw TypeError(key+" is not a symbol!")},useSetter:function(){setter=!0},useSimple:function(){setter=!1}}),$export($export.S+$export.F*!USE_NATIVE,"Object",{create:$create,defineProperty:$defineProperty,defineProperties:$defineProperties,getOwnPropertyDescriptor:$getOwnPropertyDescriptor,getOwnPropertyNames:$getOwnPropertyNames,getOwnPropertySymbols:$getOwnPropertySymbols}),$JSON&&$export($export.S+$export.F*(!USE_NATIVE||$fails(function(){var S=$Symbol();return"[null]"!=_stringify([S])||"{}"!=_stringify({a:S})||"{}"!=_stringify(Object(S))})),"JSON",{stringify:function(it){if(void 0!==it&&!isSymbol(it)){for(var replacer,$replacer,args=[it],i=1;arguments.length>i;)args.push(arguments[i++]);return replacer=args[1],"function"==typeof replacer&&($replacer=replacer),!$replacer&&isArray(replacer)||(replacer=function(key,value){if($replacer&&(value=$replacer.call(this,key,value)),!isSymbol(value))return value}),args[1]=replacer,_stringify.apply($JSON,args)}}}),$Symbol[PROTOTYPE][TO_PRIMITIVE]||__webpack_require__(13)($Symbol[PROTOTYPE],TO_PRIMITIVE,$Symbol[PROTOTYPE].valueOf),setToStringTag($Symbol,"Symbol"),setToStringTag(Math,"Math",!0),setToStringTag(global.JSON,"JSON",!0)},function(module,exports,__webpack_require__){var META=__webpack_require__(37)("meta"),isObject=__webpack_require__(16),has=__webpack_require__(26),setDesc=__webpack_require__(14).f,id=0,isExtensible=Object.isExtensible||function(){return!0},FREEZE=!__webpack_require__(19)(function(){return isExtensible(Object.preventExtensions({}))}),setMeta=function(it){setDesc(it,META,{value:{i:"O"+ ++id,w:{}}})},fastKey=function(it,create){if(!isObject(it))return"symbol"==typeof it?it:("string"==typeof it?"S":"P")+it;if(!has(it,META)){if(!isExtensible(it))return"F";if(!create)return"E";setMeta(it)}return it[META].i},getWeak=function(it,create){if(!has(it,META)){if(!isExtensible(it))return!0;if(!create)return!1;setMeta(it)}return it[META].w},onFreeze=function(it){return FREEZE&&meta.NEED&&isExtensible(it)&&!has(it,META)&&setMeta(it),it},meta=module.exports={KEY:META,NEED:!1,fastKey:fastKey,getWeak:getWeak,onFreeze:onFreeze}},function(module,exports,__webpack_require__){var global=__webpack_require__(9),core=__webpack_require__(10),LIBRARY=__webpack_require__(51),wksExt=__webpack_require__(89),defineProperty=__webpack_require__(14).f;module.exports=function(name){var $Symbol=core.Symbol||(core.Symbol=LIBRARY?{}:global.Symbol||{});"_"==name.charAt(0)||name in $Symbol||defineProperty($Symbol,name,{value:wksExt.f(name)})}},function(module,exports,__webpack_require__){var getKeys=__webpack_require__(24),toIObject=__webpack_require__(27);module.exports=function(object,el){for(var key,O=toIObject(object),keys=getKeys(O),length=keys.length,index=0;length>index;)if(O[key=keys[index++]]===el)return key}},function(module,exports,__webpack_require__){var getKeys=__webpack_require__(24),gOPS=__webpack_require__(39),pIE=__webpack_require__(40);module.exports=function(it){var result=getKeys(it),getSymbols=gOPS.f;if(getSymbols)for(var key,symbols=getSymbols(it),isEnum=pIE.f,i=0;symbols.length>i;)isEnum.call(it,key=symbols[i++])&&result.push(key);return result}},function(module,exports,__webpack_require__){var cof=__webpack_require__(29);module.exports=Array.isArray||function(arg){return"Array"==cof(arg)}},function(module,exports,__webpack_require__){var toIObject=__webpack_require__(27),gOPN=__webpack_require__(99).f,toString={}.toString,windowNames="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],getWindowNames=function(it){try{return gOPN(it)}catch(e){return windowNames.slice()}};module.exports.f=function(it){return windowNames&&"[object Window]"==toString.call(it)?getWindowNames(it):gOPN(toIObject(it))}},function(module,exports,__webpack_require__){var $keys=__webpack_require__(25),hiddenKeys=__webpack_require__(38).concat("length","prototype");exports.f=Object.getOwnPropertyNames||function(O){return $keys(O,hiddenKeys)}},function(module,exports,__webpack_require__){var pIE=__webpack_require__(40),createDesc=__webpack_require__(22),toIObject=__webpack_require__(27),toPrimitive=__webpack_require__(21),has=__webpack_require__(26),IE8_DOM_DEFINE=__webpack_require__(17),gOPD=Object.getOwnPropertyDescriptor;exports.f=__webpack_require__(18)?gOPD:function(O,P){if(O=toIObject(O),P=toPrimitive(P,!0),IE8_DOM_DEFINE)try{return gOPD(O,P)}catch(e){}if(has(O,P))return createDesc(!pIE.f.call(O,P),O[P])}},function(module,exports){},function(module,exports,__webpack_require__){__webpack_require__(94)("asyncIterator")},function(module,exports,__webpack_require__){__webpack_require__(94)("observable")},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}exports.__esModule=!0;var _setPrototypeOf=__webpack_require__(105),_setPrototypeOf2=_interopRequireDefault(_setPrototypeOf),_create=__webpack_require__(109),_create2=_interopRequireDefault(_create),_typeof2=__webpack_require__(86),_typeof3=_interopRequireDefault(_typeof2);exports["default"]=function(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+("undefined"==typeof superClass?"undefined":(0,_typeof3["default"])(superClass)));subClass.prototype=(0,_create2["default"])(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(_setPrototypeOf2["default"]?(0,_setPrototypeOf2["default"])(subClass,superClass):subClass.__proto__=superClass)}},function(module,exports,__webpack_require__){module.exports={"default":__webpack_require__(106),__esModule:!0}},function(module,exports,__webpack_require__){__webpack_require__(107),module.exports=__webpack_require__(10).Object.setPrototypeOf},function(module,exports,__webpack_require__){var $export=__webpack_require__(8);$export($export.S,"Object",{setPrototypeOf:__webpack_require__(108).set})},function(module,exports,__webpack_require__){var isObject=__webpack_require__(16),anObject=__webpack_require__(15),check=function(O,proto){if(anObject(O),!isObject(proto)&&null!==proto)throw TypeError(proto+": can't set as prototype!")};module.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(test,buggy,set){try{set=__webpack_require__(11)(Function.call,__webpack_require__(100).f(Object.prototype,"__proto__").set,2),set(test,[]),buggy=!(test instanceof Array)}catch(e){buggy=!0}return function(O,proto){return check(O,proto),buggy?O.__proto__=proto:set(O,proto),O}}({},!1):void 0),check:check}},function(module,exports,__webpack_require__){module.exports={"default":__webpack_require__(110),__esModule:!0}},function(module,exports,__webpack_require__){__webpack_require__(111);var $Object=__webpack_require__(10).Object;module.exports=function(P,D){return $Object.create(P,D)}},function(module,exports,__webpack_require__){var $export=__webpack_require__(8);$export($export.S,"Object",{create:__webpack_require__(54)})},function(module,exports){module.exports=__WEBPACK_EXTERNAL_MODULE_112__},function(module,exports){module.exports=__WEBPACK_EXTERNAL_MODULE_113__},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}Object.defineProperty(exports,"__esModule",{value:!0});var _classCallCheck2=__webpack_require__(80),_classCallCheck3=_interopRequireDefault(_classCallCheck2),_createClass2=__webpack_require__(81),_createClass3=_interopRequireDefault(_createClass2),_find=__webpack_require__(115),_find2=_interopRequireDefault(_find),_sortBy=__webpack_require__(228),_sortBy2=_interopRequireDefault(_sortBy),Manager=function(){function Manager(){(0,_classCallCheck3["default"])(this,Manager),this.refs={}}return(0,_createClass3["default"])(Manager,[{key:"add",value:function(collection,ref){this.refs[collection]||(this.refs[collection]=[]),this.refs[collection].push(ref)}},{key:"remove",value:function(collection,ref){var index=this.getIndex(collection,ref);index!==-1&&this.refs[collection].splice(index,1)}},{key:"getActive",value:function(){var _this=this;return(0,_find2["default"])(this.refs[this.active.collection],function(_ref){var node=_ref.node;return node.sortableInfo.index==_this.active.index})}},{key:"getIndex",value:function(collection,ref){return this.refs[collection].indexOf(ref)}},{key:"getOrderedRefs",value:function(){var collection=arguments.length<=0||void 0===arguments[0]?this.active.collection:arguments[0];return(0,_sortBy2["default"])(this.refs[collection],function(_ref2){var node=_ref2.node;return node.sortableInfo.index})}}]),Manager}();exports["default"]=Manager},function(module,exports,__webpack_require__){var createFind=__webpack_require__(116),findIndex=__webpack_require__(223),find=createFind(findIndex);module.exports=find},function(module,exports,__webpack_require__){function createFind(findIndexFunc){return function(collection,predicate,fromIndex){var iterable=Object(collection);if(!isArrayLike(collection)){var iteratee=baseIteratee(predicate,3);collection=keys(collection),predicate=function(key){return iteratee(iterable[key],key,iterable)}}var index=findIndexFunc(collection,predicate,fromIndex);return index>-1?iterable[iteratee?collection[index]:index]:void 0}}var baseIteratee=__webpack_require__(117),isArrayLike=__webpack_require__(183),keys=__webpack_require__(177);module.exports=createFind},function(module,exports,__webpack_require__){function baseIteratee(value){return"function"==typeof value?value:null==value?identity:"object"==typeof value?isArray(value)?baseMatchesProperty(value[0],value[1]):baseMatches(value):property(value)}var baseMatches=__webpack_require__(118),baseMatchesProperty=__webpack_require__(206),identity=__webpack_require__(220),isArray=__webpack_require__(188),property=__webpack_require__(221);module.exports=baseIteratee},function(module,exports,__webpack_require__){function baseMatches(source){var matchData=getMatchData(source);return 1==matchData.length&&matchData[0][2]?matchesStrictComparable(matchData[0][0],matchData[0][1]):function(object){return object===source||baseIsMatch(object,source,matchData)}}var baseIsMatch=__webpack_require__(119),getMatchData=__webpack_require__(203),matchesStrictComparable=__webpack_require__(205);module.exports=baseMatches},function(module,exports,__webpack_require__){function baseIsMatch(object,source,matchData,customizer){var index=matchData.length,length=index,noCustomizer=!customizer;if(null==object)return!length;for(object=Object(object);index--;){var data=matchData[index];if(noCustomizer&&data[2]?data[1]!==object[data[0]]:!(data[0]in object))return!1}for(;++index<length;){data=matchData[index];var key=data[0],objValue=object[key],srcValue=data[1];if(noCustomizer&&data[2]){if(void 0===objValue&&!(key in object))return!1}else{var stack=new Stack;if(customizer)var result=customizer(objValue,srcValue,key,object,source,stack);if(!(void 0===result?baseIsEqual(srcValue,objValue,customizer,UNORDERED_COMPARE_FLAG|PARTIAL_COMPARE_FLAG,stack):result))return!1}}return!0}var Stack=__webpack_require__(120),baseIsEqual=__webpack_require__(161),UNORDERED_COMPARE_FLAG=1,PARTIAL_COMPARE_FLAG=2;module.exports=baseIsMatch},function(module,exports,__webpack_require__){function Stack(entries){this.__data__=new ListCache(entries)}var ListCache=__webpack_require__(121),stackClear=__webpack_require__(129),stackDelete=__webpack_require__(130),stackGet=__webpack_require__(131),stackHas=__webpack_require__(132),stackSet=__webpack_require__(133);Stack.prototype.clear=stackClear,Stack.prototype["delete"]=stackDelete,Stack.prototype.get=stackGet,Stack.prototype.has=stackHas,Stack.prototype.set=stackSet,module.exports=Stack},function(module,exports,__webpack_require__){function ListCache(entries){var index=-1,length=entries?entries.length:0;for(this.clear();++index<length;){var entry=entries[index];this.set(entry[0],entry[1])}}var listCacheClear=__webpack_require__(122),listCacheDelete=__webpack_require__(123),listCacheGet=__webpack_require__(126),listCacheHas=__webpack_require__(127),listCacheSet=__webpack_require__(128);ListCache.prototype.clear=listCacheClear,ListCache.prototype["delete"]=listCacheDelete,ListCache.prototype.get=listCacheGet,ListCache.prototype.has=listCacheHas,ListCache.prototype.set=listCacheSet,module.exports=ListCache},function(module,exports){function listCacheClear(){this.__data__=[]}module.exports=listCacheClear},function(module,exports,__webpack_require__){function listCacheDelete(key){var data=this.__data__,index=assocIndexOf(data,key);if(index<0)return!1;var lastIndex=data.length-1;return index==lastIndex?data.pop():splice.call(data,index,1),!0}var assocIndexOf=__webpack_require__(124),arrayProto=Array.prototype,splice=arrayProto.splice;module.exports=listCacheDelete},function(module,exports,__webpack_require__){function assocIndexOf(array,key){for(var length=array.length;length--;)if(eq(array[length][0],key))return length;return-1}var eq=__webpack_require__(125);module.exports=assocIndexOf},function(module,exports){function eq(value,other){return value===other||value!==value&&other!==other}module.exports=eq},function(module,exports,__webpack_require__){function listCacheGet(key){var data=this.__data__,index=assocIndexOf(data,key);return index<0?void 0:data[index][1]}var assocIndexOf=__webpack_require__(124);module.exports=listCacheGet},function(module,exports,__webpack_require__){function listCacheHas(key){return assocIndexOf(this.__data__,key)>-1}var assocIndexOf=__webpack_require__(124);module.exports=listCacheHas},function(module,exports,__webpack_require__){function listCacheSet(key,value){var data=this.__data__,index=assocIndexOf(data,key);return index<0?data.push([key,value]):data[index][1]=value,this}var assocIndexOf=__webpack_require__(124);
module.exports=listCacheSet},function(module,exports,__webpack_require__){function stackClear(){this.__data__=new ListCache}var ListCache=__webpack_require__(121);module.exports=stackClear},function(module,exports){function stackDelete(key){return this.__data__["delete"](key)}module.exports=stackDelete},function(module,exports){function stackGet(key){return this.__data__.get(key)}module.exports=stackGet},function(module,exports){function stackHas(key){return this.__data__.has(key)}module.exports=stackHas},function(module,exports,__webpack_require__){function stackSet(key,value){var cache=this.__data__;if(cache instanceof ListCache){var pairs=cache.__data__;if(!Map||pairs.length<LARGE_ARRAY_SIZE-1)return pairs.push([key,value]),this;cache=this.__data__=new MapCache(pairs)}return cache.set(key,value),this}var ListCache=__webpack_require__(121),Map=__webpack_require__(134),MapCache=__webpack_require__(146),LARGE_ARRAY_SIZE=200;module.exports=stackSet},function(module,exports,__webpack_require__){var getNative=__webpack_require__(135),root=__webpack_require__(142),Map=getNative(root,"Map");module.exports=Map},function(module,exports,__webpack_require__){function getNative(object,key){var value=getValue(object,key);return baseIsNative(value)?value:void 0}var baseIsNative=__webpack_require__(136),getValue=__webpack_require__(145);module.exports=getNative},function(module,exports,__webpack_require__){function baseIsNative(value){if(!isObject(value)||isMasked(value))return!1;var pattern=isFunction(value)||isHostObject(value)?reIsNative:reIsHostCtor;return pattern.test(toSource(value))}var isFunction=__webpack_require__(137),isHostObject=__webpack_require__(139),isMasked=__webpack_require__(140),isObject=__webpack_require__(138),toSource=__webpack_require__(144),reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reIsHostCtor=/^\[object .+?Constructor\]$/,objectProto=Object.prototype,funcToString=Function.prototype.toString,hasOwnProperty=objectProto.hasOwnProperty,reIsNative=RegExp("^"+funcToString.call(hasOwnProperty).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");module.exports=baseIsNative},function(module,exports,__webpack_require__){function isFunction(value){var tag=isObject(value)?objectToString.call(value):"";return tag==funcTag||tag==genTag}var isObject=__webpack_require__(138),funcTag="[object Function]",genTag="[object GeneratorFunction]",objectProto=Object.prototype,objectToString=objectProto.toString;module.exports=isFunction},function(module,exports){function isObject(value){var type=typeof value;return!!value&&("object"==type||"function"==type)}module.exports=isObject},function(module,exports){function isHostObject(value){var result=!1;if(null!=value&&"function"!=typeof value.toString)try{result=!!(value+"")}catch(e){}return result}module.exports=isHostObject},function(module,exports,__webpack_require__){function isMasked(func){return!!maskSrcKey&&maskSrcKey in func}var coreJsData=__webpack_require__(141),maskSrcKey=function(){var uid=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||"");return uid?"Symbol(src)_1."+uid:""}();module.exports=isMasked},function(module,exports,__webpack_require__){var root=__webpack_require__(142),coreJsData=root["__core-js_shared__"];module.exports=coreJsData},function(module,exports,__webpack_require__){var freeGlobal=__webpack_require__(143),freeSelf="object"==typeof self&&self&&self.Object===Object&&self,root=freeGlobal||freeSelf||Function("return this")();module.exports=root},function(module,exports){(function(global){var freeGlobal="object"==typeof global&&global&&global.Object===Object&&global;module.exports=freeGlobal}).call(exports,function(){return this}())},function(module,exports){function toSource(func){if(null!=func){try{return funcToString.call(func)}catch(e){}try{return func+""}catch(e){}}return""}var funcToString=Function.prototype.toString;module.exports=toSource},function(module,exports){function getValue(object,key){return null==object?void 0:object[key]}module.exports=getValue},function(module,exports,__webpack_require__){function MapCache(entries){var index=-1,length=entries?entries.length:0;for(this.clear();++index<length;){var entry=entries[index];this.set(entry[0],entry[1])}}var mapCacheClear=__webpack_require__(147),mapCacheDelete=__webpack_require__(155),mapCacheGet=__webpack_require__(158),mapCacheHas=__webpack_require__(159),mapCacheSet=__webpack_require__(160);MapCache.prototype.clear=mapCacheClear,MapCache.prototype["delete"]=mapCacheDelete,MapCache.prototype.get=mapCacheGet,MapCache.prototype.has=mapCacheHas,MapCache.prototype.set=mapCacheSet,module.exports=MapCache},function(module,exports,__webpack_require__){function mapCacheClear(){this.__data__={hash:new Hash,map:new(Map||ListCache),string:new Hash}}var Hash=__webpack_require__(148),ListCache=__webpack_require__(121),Map=__webpack_require__(134);module.exports=mapCacheClear},function(module,exports,__webpack_require__){function Hash(entries){var index=-1,length=entries?entries.length:0;for(this.clear();++index<length;){var entry=entries[index];this.set(entry[0],entry[1])}}var hashClear=__webpack_require__(149),hashDelete=__webpack_require__(151),hashGet=__webpack_require__(152),hashHas=__webpack_require__(153),hashSet=__webpack_require__(154);Hash.prototype.clear=hashClear,Hash.prototype["delete"]=hashDelete,Hash.prototype.get=hashGet,Hash.prototype.has=hashHas,Hash.prototype.set=hashSet,module.exports=Hash},function(module,exports,__webpack_require__){function hashClear(){this.__data__=nativeCreate?nativeCreate(null):{}}var nativeCreate=__webpack_require__(150);module.exports=hashClear},function(module,exports,__webpack_require__){var getNative=__webpack_require__(135),nativeCreate=getNative(Object,"create");module.exports=nativeCreate},function(module,exports){function hashDelete(key){return this.has(key)&&delete this.__data__[key]}module.exports=hashDelete},function(module,exports,__webpack_require__){function hashGet(key){var data=this.__data__;if(nativeCreate){var result=data[key];return result===HASH_UNDEFINED?void 0:result}return hasOwnProperty.call(data,key)?data[key]:void 0}var nativeCreate=__webpack_require__(150),HASH_UNDEFINED="__lodash_hash_undefined__",objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty;module.exports=hashGet},function(module,exports,__webpack_require__){function hashHas(key){var data=this.__data__;return nativeCreate?void 0!==data[key]:hasOwnProperty.call(data,key)}var nativeCreate=__webpack_require__(150),objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty;module.exports=hashHas},function(module,exports,__webpack_require__){function hashSet(key,value){var data=this.__data__;return data[key]=nativeCreate&&void 0===value?HASH_UNDEFINED:value,this}var nativeCreate=__webpack_require__(150),HASH_UNDEFINED="__lodash_hash_undefined__";module.exports=hashSet},function(module,exports,__webpack_require__){function mapCacheDelete(key){return getMapData(this,key)["delete"](key)}var getMapData=__webpack_require__(156);module.exports=mapCacheDelete},function(module,exports,__webpack_require__){function getMapData(map,key){var data=map.__data__;return isKeyable(key)?data["string"==typeof key?"string":"hash"]:data.map}var isKeyable=__webpack_require__(157);module.exports=getMapData},function(module,exports){function isKeyable(value){var type=typeof value;return"string"==type||"number"==type||"symbol"==type||"boolean"==type?"__proto__"!==value:null===value}module.exports=isKeyable},function(module,exports,__webpack_require__){function mapCacheGet(key){return getMapData(this,key).get(key)}var getMapData=__webpack_require__(156);module.exports=mapCacheGet},function(module,exports,__webpack_require__){function mapCacheHas(key){return getMapData(this,key).has(key)}var getMapData=__webpack_require__(156);module.exports=mapCacheHas},function(module,exports,__webpack_require__){function mapCacheSet(key,value){return getMapData(this,key).set(key,value),this}var getMapData=__webpack_require__(156);module.exports=mapCacheSet},function(module,exports,__webpack_require__){function baseIsEqual(value,other,customizer,bitmask,stack){return value===other||(null==value||null==other||!isObject(value)&&!isObjectLike(other)?value!==value&&other!==other:baseIsEqualDeep(value,other,baseIsEqual,customizer,bitmask,stack))}var baseIsEqualDeep=__webpack_require__(162),isObject=__webpack_require__(138),isObjectLike=__webpack_require__(187);module.exports=baseIsEqual},function(module,exports,__webpack_require__){function baseIsEqualDeep(object,other,equalFunc,customizer,bitmask,stack){var objIsArr=isArray(object),othIsArr=isArray(other),objTag=arrayTag,othTag=arrayTag;objIsArr||(objTag=getTag(object),objTag=objTag==argsTag?objectTag:objTag),othIsArr||(othTag=getTag(other),othTag=othTag==argsTag?objectTag:othTag);var objIsObj=objTag==objectTag&&!isHostObject(object),othIsObj=othTag==objectTag&&!isHostObject(other),isSameTag=objTag==othTag;if(isSameTag&&!objIsObj)return stack||(stack=new Stack),objIsArr||isTypedArray(object)?equalArrays(object,other,equalFunc,customizer,bitmask,stack):equalByTag(object,other,objTag,equalFunc,customizer,bitmask,stack);if(!(bitmask&PARTIAL_COMPARE_FLAG)){var objIsWrapped=objIsObj&&hasOwnProperty.call(object,"__wrapped__"),othIsWrapped=othIsObj&&hasOwnProperty.call(other,"__wrapped__");if(objIsWrapped||othIsWrapped){var objUnwrapped=objIsWrapped?object.value():object,othUnwrapped=othIsWrapped?other.value():other;return stack||(stack=new Stack),equalFunc(objUnwrapped,othUnwrapped,customizer,bitmask,stack)}}return!!isSameTag&&(stack||(stack=new Stack),equalObjects(object,other,equalFunc,customizer,bitmask,stack))}var Stack=__webpack_require__(120),equalArrays=__webpack_require__(163),equalByTag=__webpack_require__(168),equalObjects=__webpack_require__(173),getTag=__webpack_require__(192),isArray=__webpack_require__(188),isHostObject=__webpack_require__(139),isTypedArray=__webpack_require__(198),PARTIAL_COMPARE_FLAG=2,argsTag="[object Arguments]",arrayTag="[object Array]",objectTag="[object Object]",objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty;module.exports=baseIsEqualDeep},function(module,exports,__webpack_require__){function equalArrays(array,other,equalFunc,customizer,bitmask,stack){var isPartial=bitmask&PARTIAL_COMPARE_FLAG,arrLength=array.length,othLength=other.length;if(arrLength!=othLength&&!(isPartial&&othLength>arrLength))return!1;var stacked=stack.get(array);if(stacked&&stack.get(other))return stacked==other;var index=-1,result=!0,seen=bitmask&UNORDERED_COMPARE_FLAG?new SetCache:void 0;for(stack.set(array,other),stack.set(other,array);++index<arrLength;){var arrValue=array[index],othValue=other[index];if(customizer)var compared=isPartial?customizer(othValue,arrValue,index,other,array,stack):customizer(arrValue,othValue,index,array,other,stack);if(void 0!==compared){if(compared)continue;result=!1;break}if(seen){if(!arraySome(other,function(othValue,othIndex){if(!seen.has(othIndex)&&(arrValue===othValue||equalFunc(arrValue,othValue,customizer,bitmask,stack)))return seen.add(othIndex)})){result=!1;break}}else if(arrValue!==othValue&&!equalFunc(arrValue,othValue,customizer,bitmask,stack)){result=!1;break}}return stack["delete"](array),result}var SetCache=__webpack_require__(164),arraySome=__webpack_require__(167),UNORDERED_COMPARE_FLAG=1,PARTIAL_COMPARE_FLAG=2;module.exports=equalArrays},function(module,exports,__webpack_require__){function SetCache(values){var index=-1,length=values?values.length:0;for(this.__data__=new MapCache;++index<length;)this.add(values[index])}var MapCache=__webpack_require__(146),setCacheAdd=__webpack_require__(165),setCacheHas=__webpack_require__(166);SetCache.prototype.add=SetCache.prototype.push=setCacheAdd,SetCache.prototype.has=setCacheHas,module.exports=SetCache},function(module,exports){function setCacheAdd(value){return this.__data__.set(value,HASH_UNDEFINED),this}var HASH_UNDEFINED="__lodash_hash_undefined__";module.exports=setCacheAdd},function(module,exports){function setCacheHas(value){return this.__data__.has(value)}module.exports=setCacheHas},function(module,exports){function arraySome(array,predicate){for(var index=-1,length=array?array.length:0;++index<length;)if(predicate(array[index],index,array))return!0;return!1}module.exports=arraySome},function(module,exports,__webpack_require__){function equalByTag(object,other,tag,equalFunc,customizer,bitmask,stack){switch(tag){case dataViewTag:if(object.byteLength!=other.byteLength||object.byteOffset!=other.byteOffset)return!1;object=object.buffer,other=other.buffer;case arrayBufferTag:return!(object.byteLength!=other.byteLength||!equalFunc(new Uint8Array(object),new Uint8Array(other)));case boolTag:case dateTag:case numberTag:return eq(+object,+other);case errorTag:return object.name==other.name&&object.message==other.message;case regexpTag:case stringTag:return object==other+"";case mapTag:var convert=mapToArray;case setTag:var isPartial=bitmask&PARTIAL_COMPARE_FLAG;if(convert||(convert=setToArray),object.size!=other.size&&!isPartial)return!1;var stacked=stack.get(object);if(stacked)return stacked==other;bitmask|=UNORDERED_COMPARE_FLAG,stack.set(object,other);var result=equalArrays(convert(object),convert(other),equalFunc,customizer,bitmask,stack);return stack["delete"](object),result;case symbolTag:if(symbolValueOf)return symbolValueOf.call(object)==symbolValueOf.call(other)}return!1}var Symbol=__webpack_require__(169),Uint8Array=__webpack_require__(170),eq=__webpack_require__(125),equalArrays=__webpack_require__(163),mapToArray=__webpack_require__(171),setToArray=__webpack_require__(172),UNORDERED_COMPARE_FLAG=1,PARTIAL_COMPARE_FLAG=2,boolTag="[object Boolean]",dateTag="[object Date]",errorTag="[object Error]",mapTag="[object Map]",numberTag="[object Number]",regexpTag="[object RegExp]",setTag="[object Set]",stringTag="[object String]",symbolTag="[object Symbol]",arrayBufferTag="[object ArrayBuffer]",dataViewTag="[object DataView]",symbolProto=Symbol?Symbol.prototype:void 0,symbolValueOf=symbolProto?symbolProto.valueOf:void 0;module.exports=equalByTag},function(module,exports,__webpack_require__){var root=__webpack_require__(142),Symbol=root.Symbol;module.exports=Symbol},function(module,exports,__webpack_require__){var root=__webpack_require__(142),Uint8Array=root.Uint8Array;module.exports=Uint8Array},function(module,exports){function mapToArray(map){var index=-1,result=Array(map.size);return map.forEach(function(value,key){result[++index]=[key,value]}),result}module.exports=mapToArray},function(module,exports){function setToArray(set){var index=-1,result=Array(set.size);return set.forEach(function(value){result[++index]=value}),result}module.exports=setToArray},function(module,exports,__webpack_require__){function equalObjects(object,other,equalFunc,customizer,bitmask,stack){var isPartial=bitmask&PARTIAL_COMPARE_FLAG,objProps=keys(object),objLength=objProps.length,othProps=keys(other),othLength=othProps.length;if(objLength!=othLength&&!isPartial)return!1;for(var index=objLength;index--;){var key=objProps[index];if(!(isPartial?key in other:baseHas(other,key)))return!1}var stacked=stack.get(object);if(stacked&&stack.get(other))return stacked==other;var result=!0;stack.set(object,other),stack.set(other,object);for(var skipCtor=isPartial;++index<objLength;){key=objProps[index];var objValue=object[key],othValue=other[key];if(customizer)var compared=isPartial?customizer(othValue,objValue,key,other,object,stack):customizer(objValue,othValue,key,object,other,stack);if(!(void 0===compared?objValue===othValue||equalFunc(objValue,othValue,customizer,bitmask,stack):compared)){result=!1;break}skipCtor||(skipCtor="constructor"==key)}if(result&&!skipCtor){var objCtor=object.constructor,othCtor=other.constructor;objCtor!=othCtor&&"constructor"in object&&"constructor"in other&&!("function"==typeof objCtor&&objCtor instanceof objCtor&&"function"==typeof othCtor&&othCtor instanceof othCtor)&&(result=!1)}return stack["delete"](object),result}var baseHas=__webpack_require__(174),keys=__webpack_require__(177),PARTIAL_COMPARE_FLAG=2;module.exports=equalObjects},function(module,exports,__webpack_require__){function baseHas(object,key){return null!=object&&(hasOwnProperty.call(object,key)||"object"==typeof object&&key in object&&null===getPrototype(object))}var getPrototype=__webpack_require__(175),objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty;module.exports=baseHas},function(module,exports,__webpack_require__){var overArg=__webpack_require__(176),nativeGetPrototype=Object.getPrototypeOf,getPrototype=overArg(nativeGetPrototype,Object);module.exports=getPrototype},function(module,exports){function overArg(func,transform){return function(arg){return func(transform(arg))}}module.exports=overArg},function(module,exports,__webpack_require__){function keys(object){var isProto=isPrototype(object);if(!isProto&&!isArrayLike(object))return baseKeys(object);var indexes=indexKeys(object),skipIndexes=!!indexes,result=indexes||[],length=result.length;for(var key in object)!baseHas(object,key)||skipIndexes&&("length"==key||isIndex(key,length))||isProto&&"constructor"==key||result.push(key);return result}var baseHas=__webpack_require__(174),baseKeys=__webpack_require__(178),indexKeys=__webpack_require__(179),isArrayLike=__webpack_require__(183),isIndex=__webpack_require__(190),isPrototype=__webpack_require__(191);module.exports=keys},function(module,exports,__webpack_require__){var overArg=__webpack_require__(176),nativeKeys=Object.keys,baseKeys=overArg(nativeKeys,Object);module.exports=baseKeys},function(module,exports,__webpack_require__){function indexKeys(object){var length=object?object.length:void 0;return isLength(length)&&(isArray(object)||isString(object)||isArguments(object))?baseTimes(length,String):null}var baseTimes=__webpack_require__(180),isArguments=__webpack_require__(181),isArray=__webpack_require__(188),isLength=__webpack_require__(186),isString=__webpack_require__(189);module.exports=indexKeys},function(module,exports){function baseTimes(n,iteratee){for(var index=-1,result=Array(n);++index<n;)result[index]=iteratee(index);return result}module.exports=baseTimes},function(module,exports,__webpack_require__){function isArguments(value){return isArrayLikeObject(value)&&hasOwnProperty.call(value,"callee")&&(!propertyIsEnumerable.call(value,"callee")||objectToString.call(value)==argsTag)}var isArrayLikeObject=__webpack_require__(182),argsTag="[object Arguments]",objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty,objectToString=objectProto.toString,propertyIsEnumerable=objectProto.propertyIsEnumerable;module.exports=isArguments},function(module,exports,__webpack_require__){function isArrayLikeObject(value){return isObjectLike(value)&&isArrayLike(value)}var isArrayLike=__webpack_require__(183),isObjectLike=__webpack_require__(187);module.exports=isArrayLikeObject},function(module,exports,__webpack_require__){function isArrayLike(value){return null!=value&&isLength(getLength(value))&&!isFunction(value)}var getLength=__webpack_require__(184),isFunction=__webpack_require__(137),isLength=__webpack_require__(186);module.exports=isArrayLike},function(module,exports,__webpack_require__){var baseProperty=__webpack_require__(185),getLength=baseProperty("length");module.exports=getLength},function(module,exports){function baseProperty(key){return function(object){return null==object?void 0:object[key]}}module.exports=baseProperty},function(module,exports){function isLength(value){return"number"==typeof value&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}var MAX_SAFE_INTEGER=9007199254740991;module.exports=isLength},function(module,exports){function isObjectLike(value){return!!value&&"object"==typeof value}module.exports=isObjectLike},function(module,exports){var isArray=Array.isArray;module.exports=isArray},function(module,exports,__webpack_require__){function isString(value){return"string"==typeof value||!isArray(value)&&isObjectLike(value)&&objectToString.call(value)==stringTag}var isArray=__webpack_require__(188),isObjectLike=__webpack_require__(187),stringTag="[object String]",objectProto=Object.prototype,objectToString=objectProto.toString;module.exports=isString},function(module,exports){function isIndex(value,length){return length=null==length?MAX_SAFE_INTEGER:length,!!length&&("number"==typeof value||reIsUint.test(value))&&value>-1&&value%1==0&&value<length}var MAX_SAFE_INTEGER=9007199254740991,reIsUint=/^(?:0|[1-9]\d*)$/;module.exports=isIndex},function(module,exports){function isPrototype(value){var Ctor=value&&value.constructor,proto="function"==typeof Ctor&&Ctor.prototype||objectProto;return value===proto}var objectProto=Object.prototype;module.exports=isPrototype},function(module,exports,__webpack_require__){var DataView=__webpack_require__(193),Map=__webpack_require__(134),Promise=__webpack_require__(194),Set=__webpack_require__(195),WeakMap=__webpack_require__(196),baseGetTag=__webpack_require__(197),toSource=__webpack_require__(144),mapTag="[object Map]",objectTag="[object Object]",promiseTag="[object Promise]",setTag="[object Set]",weakMapTag="[object WeakMap]",dataViewTag="[object DataView]",objectProto=Object.prototype,objectToString=objectProto.toString,dataViewCtorString=toSource(DataView),mapCtorString=toSource(Map),promiseCtorString=toSource(Promise),setCtorString=toSource(Set),weakMapCtorString=toSource(WeakMap),getTag=baseGetTag;(DataView&&getTag(new DataView(new ArrayBuffer(1)))!=dataViewTag||Map&&getTag(new Map)!=mapTag||Promise&&getTag(Promise.resolve())!=promiseTag||Set&&getTag(new Set)!=setTag||WeakMap&&getTag(new WeakMap)!=weakMapTag)&&(getTag=function(value){var result=objectToString.call(value),Ctor=result==objectTag?value.constructor:void 0,ctorString=Ctor?toSource(Ctor):void 0;if(ctorString)switch(ctorString){case dataViewCtorString:return dataViewTag;case mapCtorString:return mapTag;case promiseCtorString:return promiseTag;case setCtorString:return setTag;case weakMapCtorString:return weakMapTag}return result}),module.exports=getTag},function(module,exports,__webpack_require__){var getNative=__webpack_require__(135),root=__webpack_require__(142),DataView=getNative(root,"DataView");module.exports=DataView},function(module,exports,__webpack_require__){var getNative=__webpack_require__(135),root=__webpack_require__(142),Promise=getNative(root,"Promise");module.exports=Promise},function(module,exports,__webpack_require__){var getNative=__webpack_require__(135),root=__webpack_require__(142),Set=getNative(root,"Set");module.exports=Set},function(module,exports,__webpack_require__){var getNative=__webpack_require__(135),root=__webpack_require__(142),WeakMap=getNative(root,"WeakMap");module.exports=WeakMap},function(module,exports){function baseGetTag(value){return objectToString.call(value)}var objectProto=Object.prototype,objectToString=objectProto.toString;module.exports=baseGetTag},function(module,exports,__webpack_require__){var baseIsTypedArray=__webpack_require__(199),baseUnary=__webpack_require__(200),nodeUtil=__webpack_require__(201),nodeIsTypedArray=nodeUtil&&nodeUtil.isTypedArray,isTypedArray=nodeIsTypedArray?baseUnary(nodeIsTypedArray):baseIsTypedArray;module.exports=isTypedArray},function(module,exports,__webpack_require__){function baseIsTypedArray(value){return isObjectLike(value)&&isLength(value.length)&&!!typedArrayTags[objectToString.call(value)]}var isLength=__webpack_require__(186),isObjectLike=__webpack_require__(187),argsTag="[object Arguments]",arrayTag="[object Array]",boolTag="[object Boolean]",dateTag="[object Date]",errorTag="[object Error]",funcTag="[object Function]",mapTag="[object Map]",numberTag="[object Number]",objectTag="[object Object]",regexpTag="[object RegExp]",setTag="[object Set]",stringTag="[object String]",weakMapTag="[object WeakMap]",arrayBufferTag="[object ArrayBuffer]",dataViewTag="[object DataView]",float32Tag="[object Float32Array]",float64Tag="[object Float64Array]",int8Tag="[object Int8Array]",int16Tag="[object Int16Array]",int32Tag="[object Int32Array]",uint8Tag="[object Uint8Array]",uint8ClampedTag="[object Uint8ClampedArray]",uint16Tag="[object Uint16Array]",uint32Tag="[object Uint32Array]",typedArrayTags={};typedArrayTags[float32Tag]=typedArrayTags[float64Tag]=typedArrayTags[int8Tag]=typedArrayTags[int16Tag]=typedArrayTags[int32Tag]=typedArrayTags[uint8Tag]=typedArrayTags[uint8ClampedTag]=typedArrayTags[uint16Tag]=typedArrayTags[uint32Tag]=!0,typedArrayTags[argsTag]=typedArrayTags[arrayTag]=typedArrayTags[arrayBufferTag]=typedArrayTags[boolTag]=typedArrayTags[dataViewTag]=typedArrayTags[dateTag]=typedArrayTags[errorTag]=typedArrayTags[funcTag]=typedArrayTags[mapTag]=typedArrayTags[numberTag]=typedArrayTags[objectTag]=typedArrayTags[regexpTag]=typedArrayTags[setTag]=typedArrayTags[stringTag]=typedArrayTags[weakMapTag]=!1;var objectProto=Object.prototype,objectToString=objectProto.toString;module.exports=baseIsTypedArray},function(module,exports){function baseUnary(func){return function(value){return func(value)}}module.exports=baseUnary},function(module,exports,__webpack_require__){(function(module){var freeGlobal=__webpack_require__(143),freeExports=freeGlobal&&"object"==typeof exports&&exports,freeModule=freeExports&&"object"==typeof module&&module,moduleExports=freeModule&&freeModule.exports===freeExports,freeProcess=moduleExports&&freeGlobal.process,nodeUtil=function(){try{return freeProcess&&freeProcess.binding("util")}catch(e){}}();module.exports=nodeUtil}).call(exports,__webpack_require__(202)(module))},function(module,exports){module.exports=function(module){return module.webpackPolyfill||(module.deprecate=function(){},module.paths=[],module.children=[],module.webpackPolyfill=1),module}},function(module,exports,__webpack_require__){function getMatchData(object){for(var result=keys(object),length=result.length;length--;){var key=result[length],value=object[key];result[length]=[key,value,isStrictComparable(value)]}return result}var isStrictComparable=__webpack_require__(204),keys=__webpack_require__(177);module.exports=getMatchData},function(module,exports,__webpack_require__){function isStrictComparable(value){return value===value&&!isObject(value)}var isObject=__webpack_require__(138);module.exports=isStrictComparable},function(module,exports){function matchesStrictComparable(key,srcValue){return function(object){return null!=object&&(object[key]===srcValue&&(void 0!==srcValue||key in Object(object)))}}module.exports=matchesStrictComparable},function(module,exports,__webpack_require__){function baseMatchesProperty(path,srcValue){return isKey(path)&&isStrictComparable(srcValue)?matchesStrictComparable(toKey(path),srcValue):function(object){var objValue=get(object,path);return void 0===objValue&&objValue===srcValue?hasIn(object,path):baseIsEqual(srcValue,objValue,void 0,UNORDERED_COMPARE_FLAG|PARTIAL_COMPARE_FLAG)}}var baseIsEqual=__webpack_require__(161),get=__webpack_require__(207),hasIn=__webpack_require__(217),isKey=__webpack_require__(215),isStrictComparable=__webpack_require__(204),matchesStrictComparable=__webpack_require__(205),toKey=__webpack_require__(216),UNORDERED_COMPARE_FLAG=1,PARTIAL_COMPARE_FLAG=2;module.exports=baseMatchesProperty},function(module,exports,__webpack_require__){function get(object,path,defaultValue){var result=null==object?void 0:baseGet(object,path);return void 0===result?defaultValue:result}var baseGet=__webpack_require__(208);module.exports=get},function(module,exports,__webpack_require__){function baseGet(object,path){path=isKey(path,object)?[path]:castPath(path);for(var index=0,length=path.length;null!=object&&index<length;)object=object[toKey(path[index++])];return index&&index==length?object:void 0}var castPath=__webpack_require__(209),isKey=__webpack_require__(215),toKey=__webpack_require__(216);module.exports=baseGet},function(module,exports,__webpack_require__){function castPath(value){return isArray(value)?value:stringToPath(value)}var isArray=__webpack_require__(188),stringToPath=__webpack_require__(210);module.exports=castPath},function(module,exports,__webpack_require__){var memoize=__webpack_require__(211),toString=__webpack_require__(212),rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(\.|\[\])(?:\4|$))/g,reEscapeChar=/\\(\\)?/g,stringToPath=memoize(function(string){var result=[];return toString(string).replace(rePropName,function(match,number,quote,string){result.push(quote?string.replace(reEscapeChar,"$1"):number||match)}),result});module.exports=stringToPath},function(module,exports,__webpack_require__){function memoize(func,resolver){if("function"!=typeof func||resolver&&"function"!=typeof resolver)throw new TypeError(FUNC_ERROR_TEXT);var memoized=function(){var args=arguments,key=resolver?resolver.apply(this,args):args[0],cache=memoized.cache;if(cache.has(key))return cache.get(key);var result=func.apply(this,args);return memoized.cache=cache.set(key,result),result};return memoized.cache=new(memoize.Cache||MapCache),memoized}var MapCache=__webpack_require__(146),FUNC_ERROR_TEXT="Expected a function";memoize.Cache=MapCache,module.exports=memoize},function(module,exports,__webpack_require__){function toString(value){return null==value?"":baseToString(value)}var baseToString=__webpack_require__(213);module.exports=toString},function(module,exports,__webpack_require__){function baseToString(value){if("string"==typeof value)return value;if(isSymbol(value))return symbolToString?symbolToString.call(value):"";var result=value+"";return"0"==result&&1/value==-INFINITY?"-0":result}var Symbol=__webpack_require__(169),isSymbol=__webpack_require__(214),INFINITY=1/0,symbolProto=Symbol?Symbol.prototype:void 0,symbolToString=symbolProto?symbolProto.toString:void 0;module.exports=baseToString},function(module,exports,__webpack_require__){function isSymbol(value){return"symbol"==typeof value||isObjectLike(value)&&objectToString.call(value)==symbolTag}var isObjectLike=__webpack_require__(187),symbolTag="[object Symbol]",objectProto=Object.prototype,objectToString=objectProto.toString;module.exports=isSymbol},function(module,exports,__webpack_require__){function isKey(value,object){if(isArray(value))return!1;var type=typeof value;return!("number"!=type&&"symbol"!=type&&"boolean"!=type&&null!=value&&!isSymbol(value))||(reIsPlainProp.test(value)||!reIsDeepProp.test(value)||null!=object&&value in Object(object))}var isArray=__webpack_require__(188),isSymbol=__webpack_require__(214),reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/;module.exports=isKey},function(module,exports,__webpack_require__){function toKey(value){if("string"==typeof value||isSymbol(value))return value;var result=value+"";return"0"==result&&1/value==-INFINITY?"-0":result}var isSymbol=__webpack_require__(214),INFINITY=1/0;module.exports=toKey},function(module,exports,__webpack_require__){function hasIn(object,path){return null!=object&&hasPath(object,path,baseHasIn)}var baseHasIn=__webpack_require__(218),hasPath=__webpack_require__(219);module.exports=hasIn},function(module,exports){function baseHasIn(object,key){return null!=object&&key in Object(object)}module.exports=baseHasIn},function(module,exports,__webpack_require__){function hasPath(object,path,hasFunc){path=isKey(path,object)?[path]:castPath(path);for(var result,index=-1,length=path.length;++index<length;){var key=toKey(path[index]);if(!(result=null!=object&&hasFunc(object,key)))break;object=object[key]}if(result)return result;var length=object?object.length:0;return!!length&&isLength(length)&&isIndex(key,length)&&(isArray(object)||isString(object)||isArguments(object))}var castPath=__webpack_require__(209),isArguments=__webpack_require__(181),isArray=__webpack_require__(188),isIndex=__webpack_require__(190),isKey=__webpack_require__(215),isLength=__webpack_require__(186),isString=__webpack_require__(189),toKey=__webpack_require__(216);
module.exports=hasPath},function(module,exports){function identity(value){return value}module.exports=identity},function(module,exports,__webpack_require__){function property(path){return isKey(path)?baseProperty(toKey(path)):basePropertyDeep(path)}var baseProperty=__webpack_require__(185),basePropertyDeep=__webpack_require__(222),isKey=__webpack_require__(215),toKey=__webpack_require__(216);module.exports=property},function(module,exports,__webpack_require__){function basePropertyDeep(path){return function(object){return baseGet(object,path)}}var baseGet=__webpack_require__(208);module.exports=basePropertyDeep},function(module,exports,__webpack_require__){function findIndex(array,predicate,fromIndex){var length=array?array.length:0;if(!length)return-1;var index=null==fromIndex?0:toInteger(fromIndex);return index<0&&(index=nativeMax(length+index,0)),baseFindIndex(array,baseIteratee(predicate,3),index)}var baseFindIndex=__webpack_require__(224),baseIteratee=__webpack_require__(117),toInteger=__webpack_require__(225),nativeMax=Math.max;module.exports=findIndex},function(module,exports){function baseFindIndex(array,predicate,fromIndex,fromRight){for(var length=array.length,index=fromIndex+(fromRight?1:-1);fromRight?index--:++index<length;)if(predicate(array[index],index,array))return index;return-1}module.exports=baseFindIndex},function(module,exports,__webpack_require__){function toInteger(value){var result=toFinite(value),remainder=result%1;return result===result?remainder?result-remainder:result:0}var toFinite=__webpack_require__(226);module.exports=toInteger},function(module,exports,__webpack_require__){function toFinite(value){if(!value)return 0===value?value:0;if(value=toNumber(value),value===INFINITY||value===-INFINITY){var sign=value<0?-1:1;return sign*MAX_INTEGER}return value===value?value:0}var toNumber=__webpack_require__(227),INFINITY=1/0,MAX_INTEGER=1.7976931348623157e308;module.exports=toFinite},function(module,exports,__webpack_require__){function toNumber(value){if("number"==typeof value)return value;if(isSymbol(value))return NAN;if(isObject(value)){var other=isFunction(value.valueOf)?value.valueOf():value;value=isObject(other)?other+"":other}if("string"!=typeof value)return 0===value?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 isFunction=__webpack_require__(137),isObject=__webpack_require__(138),isSymbol=__webpack_require__(214),NAN=NaN,reTrim=/^\s+|\s+$/g,reIsBadHex=/^[-+]0x[0-9a-f]+$/i,reIsBinary=/^0b[01]+$/i,reIsOctal=/^0o[0-7]+$/i,freeParseInt=parseInt;module.exports=toNumber},function(module,exports,__webpack_require__){var baseFlatten=__webpack_require__(229),baseOrderBy=__webpack_require__(232),baseRest=__webpack_require__(243),isIterateeCall=__webpack_require__(245),sortBy=baseRest(function(collection,iteratees){if(null==collection)return[];var length=iteratees.length;return length>1&&isIterateeCall(collection,iteratees[0],iteratees[1])?iteratees=[]:length>2&&isIterateeCall(iteratees[0],iteratees[1],iteratees[2])&&(iteratees=[iteratees[0]]),baseOrderBy(collection,baseFlatten(iteratees,1),[])});module.exports=sortBy},function(module,exports,__webpack_require__){function baseFlatten(array,depth,predicate,isStrict,result){var index=-1,length=array.length;for(predicate||(predicate=isFlattenable),result||(result=[]);++index<length;){var value=array[index];depth>0&&predicate(value)?depth>1?baseFlatten(value,depth-1,predicate,isStrict,result):arrayPush(result,value):isStrict||(result[result.length]=value)}return result}var arrayPush=__webpack_require__(230),isFlattenable=__webpack_require__(231);module.exports=baseFlatten},function(module,exports){function arrayPush(array,values){for(var index=-1,length=values.length,offset=array.length;++index<length;)array[offset+index]=values[index];return array}module.exports=arrayPush},function(module,exports,__webpack_require__){function isFlattenable(value){return isArray(value)||isArguments(value)||!!(spreadableSymbol&&value&&value[spreadableSymbol])}var Symbol=__webpack_require__(169),isArguments=__webpack_require__(181),isArray=__webpack_require__(188),spreadableSymbol=Symbol?Symbol.isConcatSpreadable:void 0;module.exports=isFlattenable},function(module,exports,__webpack_require__){function baseOrderBy(collection,iteratees,orders){var index=-1;iteratees=arrayMap(iteratees.length?iteratees:[identity],baseUnary(baseIteratee));var result=baseMap(collection,function(value,key,collection){var criteria=arrayMap(iteratees,function(iteratee){return iteratee(value)});return{criteria:criteria,index:++index,value:value}});return baseSortBy(result,function(object,other){return compareMultiple(object,other,orders)})}var arrayMap=__webpack_require__(233),baseIteratee=__webpack_require__(117),baseMap=__webpack_require__(234),baseSortBy=__webpack_require__(240),baseUnary=__webpack_require__(200),compareMultiple=__webpack_require__(241),identity=__webpack_require__(220);module.exports=baseOrderBy},function(module,exports){function arrayMap(array,iteratee){for(var index=-1,length=array?array.length:0,result=Array(length);++index<length;)result[index]=iteratee(array[index],index,array);return result}module.exports=arrayMap},function(module,exports,__webpack_require__){function baseMap(collection,iteratee){var index=-1,result=isArrayLike(collection)?Array(collection.length):[];return baseEach(collection,function(value,key,collection){result[++index]=iteratee(value,key,collection)}),result}var baseEach=__webpack_require__(235),isArrayLike=__webpack_require__(183);module.exports=baseMap},function(module,exports,__webpack_require__){var baseForOwn=__webpack_require__(236),createBaseEach=__webpack_require__(239),baseEach=createBaseEach(baseForOwn);module.exports=baseEach},function(module,exports,__webpack_require__){function baseForOwn(object,iteratee){return object&&baseFor(object,iteratee,keys)}var baseFor=__webpack_require__(237),keys=__webpack_require__(177);module.exports=baseForOwn},function(module,exports,__webpack_require__){var createBaseFor=__webpack_require__(238),baseFor=createBaseFor();module.exports=baseFor},function(module,exports){function createBaseFor(fromRight){return function(object,iteratee,keysFunc){for(var index=-1,iterable=Object(object),props=keysFunc(object),length=props.length;length--;){var key=props[fromRight?length:++index];if(iteratee(iterable[key],key,iterable)===!1)break}return object}}module.exports=createBaseFor},function(module,exports,__webpack_require__){function createBaseEach(eachFunc,fromRight){return function(collection,iteratee){if(null==collection)return collection;if(!isArrayLike(collection))return eachFunc(collection,iteratee);for(var length=collection.length,index=fromRight?length:-1,iterable=Object(collection);(fromRight?index--:++index<length)&&iteratee(iterable[index],index,iterable)!==!1;);return collection}}var isArrayLike=__webpack_require__(183);module.exports=createBaseEach},function(module,exports){function baseSortBy(array,comparer){var length=array.length;for(array.sort(comparer);length--;)array[length]=array[length].value;return array}module.exports=baseSortBy},function(module,exports,__webpack_require__){function compareMultiple(object,other,orders){for(var index=-1,objCriteria=object.criteria,othCriteria=other.criteria,length=objCriteria.length,ordersLength=orders.length;++index<length;){var result=compareAscending(objCriteria[index],othCriteria[index]);if(result){if(index>=ordersLength)return result;var order=orders[index];return result*("desc"==order?-1:1)}}return object.index-other.index}var compareAscending=__webpack_require__(242);module.exports=compareMultiple},function(module,exports,__webpack_require__){function compareAscending(value,other){if(value!==other){var valIsDefined=void 0!==value,valIsNull=null===value,valIsReflexive=value===value,valIsSymbol=isSymbol(value),othIsDefined=void 0!==other,othIsNull=null===other,othIsReflexive=other===other,othIsSymbol=isSymbol(other);if(!othIsNull&&!othIsSymbol&&!valIsSymbol&&value>other||valIsSymbol&&othIsDefined&&othIsReflexive&&!othIsNull&&!othIsSymbol||valIsNull&&othIsDefined&&othIsReflexive||!valIsDefined&&othIsReflexive||!valIsReflexive)return 1;if(!valIsNull&&!valIsSymbol&&!othIsSymbol&&value<other||othIsSymbol&&valIsDefined&&valIsReflexive&&!valIsNull&&!valIsSymbol||othIsNull&&valIsDefined&&valIsReflexive||!othIsDefined&&valIsReflexive||!othIsReflexive)return-1}return 0}var isSymbol=__webpack_require__(214);module.exports=compareAscending},function(module,exports,__webpack_require__){function baseRest(func,start){return start=nativeMax(void 0===start?func.length-1:start,0),function(){for(var args=arguments,index=-1,length=nativeMax(args.length-start,0),array=Array(length);++index<length;)array[index]=args[start+index];index=-1;for(var otherArgs=Array(start+1);++index<start;)otherArgs[index]=args[index];return otherArgs[start]=array,apply(func,this,otherArgs)}}var apply=__webpack_require__(244),nativeMax=Math.max;module.exports=baseRest},function(module,exports){function apply(func,thisArg,args){switch(args.length){case 0:return func.call(thisArg);case 1:return func.call(thisArg,args[0]);case 2:return func.call(thisArg,args[0],args[1]);case 3:return func.call(thisArg,args[0],args[1],args[2])}return func.apply(thisArg,args)}module.exports=apply},function(module,exports,__webpack_require__){function isIterateeCall(value,index,object){if(!isObject(object))return!1;var type=typeof index;return!!("number"==type?isArrayLike(object)&&isIndex(index,object.length):"string"==type&&index in object)&&eq(object[index],value)}var eq=__webpack_require__(125),isArrayLike=__webpack_require__(183),isIndex=__webpack_require__(190),isObject=__webpack_require__(138);module.exports=isIterateeCall},function(module,exports,__webpack_require__){(function(process){"use strict";var invariant=function(condition,format,a,b,c,d,e,f){if("production"!==process.env.NODE_ENV&&void 0===format)throw new Error("invariant requires an error message argument");if(!condition){var error;if(void 0===format)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],argIndex=0;error=new Error(format.replace(/%s/g,function(){return args[argIndex++]})),error.name="Invariant Violation"}throw error.framesToPop=1,error}};module.exports=invariant}).call(exports,__webpack_require__(247))},function(module,exports){function cleanUpNextTick(){draining&¤tQueue&&(draining=!1,currentQueue.length?queue=currentQueue.concat(queue):queueIndex=-1,queue.length&&drainQueue())}function drainQueue(){if(!draining){var timeout=setTimeout(cleanUpNextTick);draining=!0;for(var len=queue.length;len;){for(currentQueue=queue,queue=[];++queueIndex<len;)currentQueue&¤tQueue[queueIndex].run();queueIndex=-1,len=queue.length}currentQueue=null,draining=!1,clearTimeout(timeout)}}function Item(fun,array){this.fun=fun,this.array=array}function noop(){}var currentQueue,process=module.exports={},queue=[],draining=!1,queueIndex=-1;process.nextTick=function(fun){var args=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)args[i-1]=arguments[i];queue.push(new Item(fun,args)),1!==queue.length||draining||setTimeout(drainQueue,0)},Item.prototype.run=function(){this.fun.apply(null,this.array)},process.title="browser",process.browser=!0,process.env={},process.argv=[],process.version="",process.versions={},process.on=noop,process.addListener=noop,process.once=noop,process.off=noop,process.removeListener=noop,process.removeAllListeners=noop,process.emit=noop,process.binding=function(name){throw new Error("process.binding is not supported")},process.cwd=function(){return"/"},process.chdir=function(dir){throw new Error("process.chdir is not supported")},process.umask=function(){return 0}},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}function SortableElement(WrappedComponent){var _class,_temp,config=arguments.length<=1||void 0===arguments[1]?{withRef:!1}:arguments[1];return _temp=_class=function(_Component){function _class(){return(0,_classCallCheck3["default"])(this,_class),(0,_possibleConstructorReturn3["default"])(this,(0,_getPrototypeOf2["default"])(_class).apply(this,arguments))}return(0,_inherits3["default"])(_class,_Component),(0,_createClass3["default"])(_class,[{key:"componentDidMount",value:function(){var _props=this.props,collection=_props.collection,disabled=_props.disabled,index=_props.index;disabled||this.setDraggable(collection,index)}},{key:"componentWillReceiveProps",value:function(nextProps){if(this.props.index!==nextProps.index&&this.node&&(this.node.sortableInfo.index=nextProps.index),this.props.disabled!==nextProps.disabled){var collection=nextProps.collection,disabled=nextProps.disabled,index=nextProps.index;disabled?this.removeDraggable(collection):this.setDraggable(collection,index)}else this.props.collection!==nextProps.collection&&(this.removeDraggable(this.props.collection),this.setDraggable(nextProps.collection,nextProps.index))}},{key:"componentWillUnmount",value:function(){var _props2=this.props,collection=_props2.collection,disabled=_props2.disabled;disabled||this.removeDraggable(collection)}},{key:"setDraggable",value:function(collection,index){var node=this.node=(0,_reactDom.findDOMNode)(this);node.sortableInfo={index:index,collection:collection},this.ref={node:node},this.context.manager.add(collection,this.ref)}},{key:"removeDraggable",value:function(collection){this.context.manager.remove(collection,this.ref)}},{key:"getWrappedInstance",value:function(){return(0,_invariant2["default"])(config.withRef,"To access the wrapped instance, you need to pass in {withRef: true} as the second argument of the SortableElement() call"),this.refs.wrappedInstance}},{key:"render",value:function(){var ref=config.withRef?"wrappedInstance":null;return _react2["default"].createElement(WrappedComponent,(0,_extends3["default"])({ref:ref},this.props))}}]),_class}(_react.Component),_class.displayName=WrappedComponent.displayName?"SortableElement("+WrappedComponent.displayName+")":"SortableElement",_class.WrappedComponent=WrappedComponent,_class.contextTypes={manager:_react.PropTypes.object.isRequired},_class.propTypes={index:_react.PropTypes.number.isRequired,collection:_react.PropTypes.oneOfType([_react.PropTypes.number,_react.PropTypes.string]),disabled:_react.PropTypes.bool},_class.defaultProps={collection:0},_temp}Object.defineProperty(exports,"__esModule",{value:!0});var _extends2=__webpack_require__(4),_extends3=_interopRequireDefault(_extends2),_getPrototypeOf=__webpack_require__(76),_getPrototypeOf2=_interopRequireDefault(_getPrototypeOf),_classCallCheck2=__webpack_require__(80),_classCallCheck3=_interopRequireDefault(_classCallCheck2),_createClass2=__webpack_require__(81),_createClass3=_interopRequireDefault(_createClass2),_possibleConstructorReturn2=__webpack_require__(85),_possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2),_inherits2=__webpack_require__(104),_inherits3=_interopRequireDefault(_inherits2);exports["default"]=SortableElement;var _react=__webpack_require__(112),_react2=_interopRequireDefault(_react),_reactDom=__webpack_require__(113),_invariant=__webpack_require__(246),_invariant2=_interopRequireDefault(_invariant)},function(module,exports,__webpack_require__){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}function SortableHandle(WrappedComponent){var _class,_temp,config=arguments.length<=1||void 0===arguments[1]?{withRef:!1}:arguments[1];return _temp=_class=function(_Component){function _class(){return(0,_classCallCheck3["default"])(this,_class),(0,_possibleConstructorReturn3["default"])(this,(0,_getPrototypeOf2["default"])(_class).apply(this,arguments))}return(0,_inherits3["default"])(_class,_Component),(0,_createClass3["default"])(_class,[{key:"componentDidMount",value:function(){var node=(0,_reactDom.findDOMNode)(this);node.sortableHandle=!0}},{key:"getWrappedInstance",value:function(){return(0,_invariant2["default"])(config.withRef,"To access the wrapped instance, you need to pass in {withRef: true} as the second argument of the SortableHandle() call"),this.refs.wrappedInstance}},{key:"render",value:function(){var ref=config.withRef?"wrappedInstance":null;return _react2["default"].createElement(WrappedComponent,(0,_extends3["default"])({ref:ref},this.props))}}]),_class}(_react.Component),_class.displayName=WrappedComponent.displayName?"SortableHandle("+WrappedComponent.displayName+")":"SortableHandle",_class.WrappedComponent=WrappedComponent,_temp}Object.defineProperty(exports,"__esModule",{value:!0});var _extends2=__webpack_require__(4),_extends3=_interopRequireDefault(_extends2),_getPrototypeOf=__webpack_require__(76),_getPrototypeOf2=_interopRequireDefault(_getPrototypeOf),_classCallCheck2=__webpack_require__(80),_classCallCheck3=_interopRequireDefault(_classCallCheck2),_createClass2=__webpack_require__(81),_createClass3=_interopRequireDefault(_createClass2),_possibleConstructorReturn2=__webpack_require__(85),_possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2),_inherits2=__webpack_require__(104),_inherits3=_interopRequireDefault(_inherits2);exports["default"]=SortableHandle;var _react=__webpack_require__(112),_react2=_interopRequireDefault(_react),_reactDom=__webpack_require__(113),_invariant=__webpack_require__(246),_invariant2=_interopRequireDefault(_invariant)}])});
//# sourceMappingURL=react-sortable-hoc.min.js.map
|
app/components/H3/index.js
|
sulthan16/awesome-jr-frontend-sulthan
|
import React from 'react';
function H3(props) {
return (
<h3 {...props} />
);
}
export default H3;
|
ajax/libs/yui/3.7.0/datatable-core/datatable-core.js
|
mikesir87/cdnjs
|
YUI.add('datatable-core', function (Y, NAME) {
/**
The core implementation of the `DataTable` and `DataTable.Base` Widgets.
@module datatable
@submodule datatable-core
@since 3.5.0
**/
var INVALID = Y.Attribute.INVALID_VALUE,
Lang = Y.Lang,
isFunction = Lang.isFunction,
isObject = Lang.isObject,
isArray = Lang.isArray,
isString = Lang.isString,
isNumber = Lang.isNumber,
toArray = Y.Array,
keys = Y.Object.keys,
Table;
/**
_API docs for this extension are included in the DataTable class._
Class extension providing the core API and structure for the DataTable Widget.
Use this class extension with Widget or another Base-based superclass to create
the basic DataTable model API and composing class structure.
@class DataTable.Core
@for DataTable
@since 3.5.0
**/
Table = Y.namespace('DataTable').Core = function () {};
Table.ATTRS = {
/**
Columns to include in the rendered table.
If omitted, the attributes on the configured `recordType` or the first item
in the `data` collection will be used as a source.
This attribute takes an array of strings or objects (mixing the two is
fine). Each string or object is considered a column to be rendered.
Strings are converted to objects, so `columns: ['first', 'last']` becomes
`columns: [{ key: 'first' }, { key: 'last' }]`.
DataTable.Core only concerns itself with a few properties of columns.
These properties are:
* `key` - Used to identify the record field/attribute containing content for
this column. Also used to create a default Model if no `recordType` or
`data` are provided during construction. If `name` is not specified, this
is assigned to the `_id` property (with added incrementer if the key is
used by multiple columns).
* `children` - Traversed to initialize nested column objects
* `name` - Used in place of, or in addition to, the `key`. Useful for
columns that aren't bound to a field/attribute in the record data. This
is assigned to the `_id` property.
* `id` - For backward compatibility. Implementers can specify the id of
the header cell. This should be avoided, if possible, to avoid the
potential for creating DOM elements with duplicate IDs.
* `field` - For backward compatibility. Implementers should use `name`.
* `_id` - Assigned unique-within-this-instance id for a column. By order
of preference, assumes the value of `name`, `key`, `id`, or `_yuid`.
This is used by the rendering views as well as feature module
as a means to identify a specific column without ambiguity (such as
multiple columns using the same `key`.
* `_yuid` - Guid stamp assigned to the column object.
* `_parent` - Assigned to all child columns, referencing their parent
column.
@attribute columns
@type {Object[]|String[]}
@default (from `recordType` ATTRS or first item in the `data`)
@since 3.5.0
**/
columns: {
// TODO: change to setter to clone input array/objects
validator: isArray,
setter: '_setColumns',
getter: '_getColumns'
},
/**
Model subclass to use as the `model` for the ModelList stored in the `data`
attribute.
If not provided, it will try really hard to figure out what to use. The
following attempts will be made to set a default value:
1. If the `data` attribute is set with a ModelList instance and its `model`
property is set, that will be used.
2. If the `data` attribute is set with a ModelList instance, and its
`model` property is unset, but it is populated, the `ATTRS` of the
`constructor of the first item will be used.
3. If the `data` attribute is set with a non-empty array, a Model subclass
will be generated using the keys of the first item as its `ATTRS` (see
the `_createRecordClass` method).
4. If the `columns` attribute is set, a Model subclass will be generated
using the columns defined with a `key`. This is least desirable because
columns can be duplicated or nested in a way that's not parsable.
5. If neither `data` nor `columns` is set or populated, a change event
subscriber will listen for the first to be changed and try all over
again.
@attribute recordType
@type {Function}
@default (see description)
@since 3.5.0
**/
recordType: {
getter: '_getRecordType',
setter: '_setRecordType'
},
/**
The collection of data records to display. This attribute is a pass
through to a `data` property, which is a ModelList instance.
If this attribute is passed a ModelList or subclass, it will be assigned to
the property directly. If an array of objects is passed, a new ModelList
will be created using the configured `recordType` as its `model` property
and seeded with the array.
Retrieving this attribute will return the ModelList stored in the `data`
property.
@attribute data
@type {ModelList|Object[]}
@default `new ModelList()`
@since 3.5.0
**/
data: {
valueFn: '_initData',
setter : '_setData',
lazyAdd: false
},
/**
Content for the `<table summary="ATTRIBUTE VALUE HERE">`. Values assigned
to this attribute will be HTML escaped for security.
@attribute summary
@type {String}
@default '' (empty string)
@since 3.5.0
**/
//summary: {},
/**
HTML content of an optional `<caption>` element to appear above the table.
Leave this config unset or set to a falsy value to remove the caption.
@attribute caption
@type HTML
@default '' (empty string)
@since 3.5.0
**/
//caption: {},
/**
Deprecated as of 3.5.0. Passes through to the `data` attribute.
WARNING: `get('recordset')` will NOT return a Recordset instance as of
3.5.0. This is a break in backward compatibility.
@attribute recordset
@type {Object[]|Recordset}
@deprecated Use the `data` attribute
@since 3.5.0
**/
recordset: {
setter: '_setRecordset',
getter: '_getRecordset',
lazyAdd: false
},
/**
Deprecated as of 3.5.0. Passes through to the `columns` attribute.
WARNING: `get('columnset')` will NOT return a Columnset instance as of
3.5.0. This is a break in backward compatibility.
@attribute columnset
@type {Object[]}
@deprecated Use the `columns` attribute
@since 3.5.0
**/
columnset: {
setter: '_setColumnset',
getter: '_getColumnset',
lazyAdd: false
}
};
Y.mix(Table.prototype, {
// -- Instance properties -------------------------------------------------
/**
The ModelList that manages the table's data.
@property data
@type {ModelList}
@default undefined (initially unset)
@since 3.5.0
**/
//data: null,
// -- Public methods ------------------------------------------------------
/**
Gets the column configuration object for the given key, name, or index. For
nested columns, `name` can be an array of indexes, each identifying the index
of that column in the respective parent's "children" array.
If you pass a column object, it will be returned.
For columns with keys, you can also fetch the column with
`instance.get('columns.foo')`.
@method getColumn
@param {String|Number|Number[]} name Key, "name", index, or index array to
identify the column
@return {Object} the column configuration object
@since 3.5.0
**/
getColumn: function (name) {
var col, columns, i, len, cols;
if (isObject(name) && !isArray(name)) {
// TODO: support getting a column from a DOM node - this will cross
// the line into the View logic, so it should be relayed
// Assume an object passed in is already a column def
col = name;
} else {
col = this.get('columns.' + name);
}
if (col) {
return col;
}
columns = this.get('columns');
if (isNumber(name) || isArray(name)) {
name = toArray(name);
cols = columns;
for (i = 0, len = name.length - 1; cols && i < len; ++i) {
cols = cols[name[i]] && cols[name[i]].children;
}
return (cols && cols[name[i]]) || null;
}
return null;
},
/**
Returns the Model associated to the record `id`, `clientId`, or index (not
row index). If none of those yield a Model from the `data` ModelList, the
arguments will be passed to the `view` instance's `getRecord` method
if it has one.
If no Model can be found, `null` is returned.
@method getRecord
@param {Number|String|Node} seed Record `id`, `clientId`, index, Node, or
identifier for a row or child element
@return {Model}
@since 3.5.0
**/
getRecord: function (seed) {
var record = this.data.getById(seed) || this.data.getByClientId(seed);
if (!record) {
if (isNumber(seed)) {
record = this.data.item(seed);
}
// TODO: this should be split out to base somehow
if (!record && this.view && this.view.getRecord) {
record = this.view.getRecord.apply(this.view, arguments);
}
}
return record || null;
},
// -- Protected and private properties and methods ------------------------
/**
This tells `Y.Base` that it should create ad-hoc attributes for config
properties passed to DataTable's constructor. This is useful for setting
configurations on the DataTable that are intended for the rendering View(s).
@property _allowAdHocAttrs
@type Boolean
@default true
@protected
@since 3.6.0
**/
_allowAdHocAttrs: true,
/**
A map of column key to column configuration objects parsed from the
`columns` attribute.
@property _columnMap
@type {Object}
@default undefined (initially unset)
@protected
@since 3.5.0
**/
//_columnMap: null,
/**
The Node instance of the table containing the data rows. This is set when
the table is rendered. It may also be set by progressive enhancement,
though this extension does not provide the logic to parse from source.
@property _tableNode
@type {Node}
@default undefined (initially unset)
@protected
@since 3.5.0
**/
//_tableNode: null,
/**
Updates the `_columnMap` property in response to changes in the `columns`
attribute.
@method _afterColumnsChange
@param {EventFacade} e The `columnsChange` event object
@protected
@since 3.5.0
**/
_afterColumnsChange: function (e) {
this._setColumnMap(e.newVal);
},
/**
Updates the `modelList` attributes of the rendered views in response to the
`data` attribute being assigned a new ModelList.
@method _afterDataChange
@param {EventFacade} e the `dataChange` event
@protected
@since 3.5.0
**/
_afterDataChange: function (e) {
var modelList = e.newVal;
this.data = e.newVal;
if (!this.get('columns') && modelList.size()) {
// TODO: this will cause a re-render twice because the Views are
// subscribed to columnsChange
this._initColumns();
}
},
/**
Assigns to the new recordType as the model for the data ModelList
@method _afterRecordTypeChange
@param {EventFacade} e recordTypeChange event
@protected
@since 3.6.0
**/
_afterRecordTypeChange: function (e) {
var data = this.data.toJSON();
this.data.model = e.newVal;
this.data.reset(data);
if (!this.get('columns') && data) {
if (data.length) {
this._initColumns();
} else {
this.set('columns', keys(e.newVal.ATTRS));
}
}
},
/**
Creates a Model subclass from an array of attribute names or an object of
attribute definitions. This is used to generate a class suitable to
represent the data passed to the `data` attribute if no `recordType` is
set.
@method _createRecordClass
@param {String[]|Object} attrs Names assigned to the Model subclass's
`ATTRS` or its entire `ATTRS` definition object
@return {Model}
@protected
@since 3.5.0
**/
_createRecordClass: function (attrs) {
var ATTRS, i, len;
if (isArray(attrs)) {
ATTRS = {};
for (i = 0, len = attrs.length; i < len; ++i) {
ATTRS[attrs[i]] = {};
}
} else if (isObject(attrs)) {
ATTRS = attrs;
}
return Y.Base.create('record', Y.Model, [], null, { ATTRS: ATTRS });
},
/**
Tears down the instance.
@method destructor
@protected
@since 3.6.0
**/
destructor: function () {
new Y.EventHandle(Y.Object.values(this._eventHandles)).detach();
},
/**
The getter for the `columns` attribute. Returns the array of column
configuration objects if `instance.get('columns')` is called, or the
specific column object if `instance.get('columns.columnKey')` is called.
@method _getColumns
@param {Object[]} columns The full array of column objects
@param {String} name The attribute name requested
(e.g. 'columns' or 'columns.foo');
@protected
@since 3.5.0
**/
_getColumns: function (columns, name) {
// Workaround for an attribute oddity (ticket #2529254)
// getter is expected to return an object if get('columns.foo') is called.
// Note 'columns.' is 8 characters
return name.length > 8 ? this._columnMap : columns;
},
/**
Relays the `get()` request for the deprecated `columnset` attribute to the
`columns` attribute.
THIS BREAKS BACKWARD COMPATIBILITY. 3.4.1 and prior implementations will
expect a Columnset instance returned from `get('columnset')`.
@method _getColumnset
@param {Object} ignored The current value stored in the `columnset` state
@param {String} name The attribute name requested
(e.g. 'columnset' or 'columnset.foo');
@deprecated This will be removed with the `columnset` attribute in a future
version.
@protected
@since 3.5.0
**/
_getColumnset: function (_, name) {
return this.get(name.replace(/^columnset/, 'columns'));
},
/**
Returns the Model class of the instance's `data` attribute ModelList. If
not set, returns the explicitly configured value.
@method _getRecordType
@param {Model} val The currently configured value
@return {Model}
**/
_getRecordType: function (val) {
// Prefer the value stored in the attribute because the attribute
// change event defaultFn sets e.newVal = this.get('recordType')
// before notifying the after() subs. But if this getter returns
// this.data.model, then after() subs would get e.newVal === previous
// model before _afterRecordTypeChange can set
// this.data.model = e.newVal
return val || (this.data && this.data.model);
},
/**
Initializes the `_columnMap` property from the configured `columns`
attribute. If `columns` is not set, but there are records in the `data`
ModelList, use
`ATTRS` of that class.
@method _initColumns
@protected
@since 3.5.0
**/
_initColumns: function () {
var columns = this.get('columns') || [],
item;
// Default column definition from the configured recordType
if (!columns.length && this.data.size()) {
// TODO: merge superclass attributes up to Model?
item = this.data.item(0);
if (item.toJSON) {
item = item.toJSON();
}
this.set('columns', keys(item));
}
this._setColumnMap(columns);
},
/**
Sets up the change event subscriptions to maintain internal state.
@method _initCoreEvents
@protected
@since 3.6.0
**/
_initCoreEvents: function () {
this._eventHandles.coreAttrChanges = this.after({
columnsChange : Y.bind('_afterColumnsChange', this),
recordTypeChange: Y.bind('_afterRecordTypeChange', this),
dataChange : Y.bind('_afterDataChange', this)
});
},
/**
Defaults the `data` attribute to an empty ModelList if not set during
construction. Uses the configured `recordType` for the ModelList's `model`
proeprty if set.
@method _initData
@protected
@return {ModelList}
@since 3.6.0
**/
_initData: function () {
var recordType = this.get('recordType'),
// TODO: LazyModelList if recordType doesn't have complex ATTRS
modelList = new Y.ModelList();
if (recordType) {
modelList.model = recordType;
}
return modelList;
},
/**
Initializes the instance's `data` property from the value of the `data`
attribute. If the attribute value is a ModelList, it is assigned directly
to `this.data`. If it is an array, a ModelList is created, its `model`
property is set to the configured `recordType` class, and it is seeded with
the array data. This ModelList is then assigned to `this.data`.
@method _initDataProperty
@param {Array|ModelList|ArrayList} data Collection of data to populate the
DataTable
@protected
@since 3.6.0
**/
_initDataProperty: function (data) {
var recordType;
if (!this.data) {
recordType = this.get('recordType');
if (data && data.each && data.toJSON) {
this.data = data;
if (recordType) {
this.data.model = recordType;
}
} else {
// TODO: customize the ModelList or read the ModelList class
// from a configuration option?
this.data = new Y.ModelList();
if (recordType) {
this.data.model = recordType;
}
}
// TODO: Replace this with an event relay for specific events.
// Using bubbling causes subscription conflicts with the models'
// aggregated change event and 'change' events from DOM elements
// inside the table (via Widget UI event).
this.data.addTarget(this);
}
},
/**
Initializes the columns, `recordType` and data ModelList.
@method initializer
@param {Object} config Configuration object passed to constructor
@protected
@since 3.5.0
**/
initializer: function (config) {
var data = config.data,
columns = config.columns,
recordType;
// Referencing config.data to allow _setData to be more stringent
// about its behavior
this._initDataProperty(data);
// Default columns from recordType ATTRS if recordType is supplied at
// construction. If no recordType is supplied, but the data is
// supplied as a non-empty array, use the keys of the first item
// as the columns.
if (!columns) {
recordType = (config.recordType || config.data === this.data) &&
this.get('recordType');
if (recordType) {
columns = keys(recordType.ATTRS);
} else if (isArray(data) && data.length) {
columns = keys(data[0]);
}
if (columns) {
this.set('columns', columns);
}
}
this._initColumns();
this._eventHandles = {};
this._initCoreEvents();
},
/**
Iterates the array of column configurations to capture all columns with a
`key` property. An map is built with column keys as the property name and
the corresponding column object as the associated value. This map is then
assigned to the instance's `_columnMap` property.
@method _setColumnMap
@param {Object[]|String[]} columns The array of column config objects
@protected
@since 3.6.0
**/
_setColumnMap: function (columns) {
var map = {};
function process(cols) {
var i, len, col, key;
for (i = 0, len = cols.length; i < len; ++i) {
col = cols[i];
key = col.key;
// First in wins for multiple columns with the same key
// because the first call to genId (in _setColumns) will
// return the same key, which will then be overwritten by the
// subsequent same-keyed column. So table.getColumn(key) would
// return the last same-keyed column.
if (key && !map[key]) {
map[key] = col;
}
//TODO: named columns can conflict with keyed columns
map[col._id] = col;
if (col.children) {
process(col.children);
}
}
}
process(columns);
this._columnMap = map;
},
/**
Translates string columns into objects with that string as the value of its
`key` property.
All columns are assigned a `_yuid` stamp and `_id` property corresponding
to the column's configured `name` or `key` property with any spaces
replaced with dashes. If the same `name` or `key` appears in multiple
columns, subsequent appearances will have their `_id` appended with an
incrementing number (e.g. if column "foo" is included in the `columns`
attribute twice, the first will get `_id` of "foo", and the second an `_id`
of "foo1"). Columns that are children of other columns will have the
`_parent` property added, assigned the column object to which they belong.
@method _setColumns
@param {null|Object[]|String[]} val Array of config objects or strings
@return {null|Object[]}
@protected
**/
_setColumns: function (val) {
var keys = {},
known = [],
knownCopies = [],
arrayIndex = Y.Array.indexOf;
function copyObj(o) {
var copy = {},
key, val, i;
known.push(o);
knownCopies.push(copy);
for (key in o) {
if (o.hasOwnProperty(key)) {
val = o[key];
if (isArray(val)) {
copy[key] = val.slice();
} else if (isObject(val, true)) {
i = arrayIndex(val, known);
copy[key] = i === -1 ? copyObj(val) : knownCopies[i];
} else {
copy[key] = o[key];
}
}
}
return copy;
}
function genId(name) {
// Sanitize the name for use in generated CSS classes.
// TODO: is there more to do for other uses of _id?
name = name.replace(/\s+/, '-');
if (keys[name]) {
name += (keys[name]++);
} else {
keys[name] = 1;
}
return name;
}
function process(cols, parent) {
var columns = [],
i, len, col, yuid;
for (i = 0, len = cols.length; i < len; ++i) {
columns[i] = // chained assignment
col = isString(cols[i]) ? { key: cols[i] } : copyObj(cols[i]);
yuid = Y.stamp(col);
// For backward compatibility
if (!col.id) {
// Implementers can shoot themselves in the foot by setting
// this config property to a non-unique value
col.id = yuid;
}
if (col.field) {
// Field is now known as "name" to avoid confusion with data
// fields or schema.resultFields
col.name = col.field;
}
if (parent) {
col._parent = parent;
} else {
delete col._parent;
}
// Unique id based on the column's configured name or key,
// falling back to the yuid. Duplicates will have a counter
// added to the end.
col._id = genId(col.name || col.key || col.id);
if (isArray(col.children)) {
col.children = process(col.children, col);
}
}
return columns;
}
return val && process(val);
},
/**
Relays attribute assignments of the deprecated `columnset` attribute to the
`columns` attribute. If a Columnset is object is passed, its basic object
structure is mined.
@method _setColumnset
@param {Array|Columnset} val The columnset value to relay
@deprecated This will be removed with the deprecated `columnset` attribute
in a later version.
@protected
@since 3.5.0
**/
_setColumnset: function (val) {
this.set('columns', val);
return isArray(val) ? val : INVALID;
},
/**
Accepts an object with `each` and `getAttrs` (preferably a ModelList or
subclass) or an array of data objects. If an array is passes, it will
create a ModelList to wrap the data. In doing so, it will set the created
ModelList's `model` property to the class in the `recordType` attribute,
which will be defaulted if not yet set.
If the `data` property is already set with a ModelList, passing an array as
the value will call the ModelList's `reset()` method with that array rather
than replacing the stored ModelList wholesale.
Any non-ModelList-ish and non-array value is invalid.
@method _setData
@protected
@since 3.5.0
**/
_setData: function (val) {
if (val === null) {
val = [];
}
if (isArray(val)) {
this._initDataProperty();
// silent to prevent subscribers to both reset and dataChange
// from reacting to the change twice.
// TODO: would it be better to return INVALID to silence the
// dataChange event, or even allow both events?
this.data.reset(val, { silent: true });
// Return the instance ModelList to avoid storing unprocessed
// data in the state and their vivified Model representations in
// the instance's data property. Decreases memory consumption.
val = this.data;
} else if (!val || !val.each || !val.toJSON) {
// ModelList/ArrayList duck typing
val = INVALID;
}
return val;
},
/**
Relays the value assigned to the deprecated `recordset` attribute to the
`data` attribute. If a Recordset instance is passed, the raw object data
will be culled from it.
@method _setRecordset
@param {Object[]|Recordset} val The recordset value to relay
@deprecated This will be removed with the deprecated `recordset` attribute
in a later version.
@protected
@since 3.5.0
**/
_setRecordset: function (val) {
var data;
if (val && Y.Recordset && val instanceof Y.Recordset) {
data = [];
val.each(function (record) {
data.push(record.get('data'));
});
val = data;
}
this.set('data', val);
return val;
},
/**
Accepts a Base subclass (preferably a Model subclass). Alternately, it will
generate a custom Model subclass from an array of attribute names or an
object defining attributes and their respective configurations (it is
assigned as the `ATTRS` of the new class).
Any other value is invalid.
@method _setRecordType
@param {Function|String[]|Object} val The Model subclass, array of
attribute names, or the `ATTRS` definition for a custom model
subclass
@return {Function} A Base/Model subclass
@protected
@since 3.5.0
**/
_setRecordType: function (val) {
var modelClass;
// Duck type based on known/likely consumed APIs
if (isFunction(val) && val.prototype.toJSON && val.prototype.setAttrs) {
modelClass = val;
} else if (isObject(val)) {
modelClass = this._createRecordClass(val);
}
return modelClass || INVALID;
}
});
}, '@VERSION@', {"requires": ["escape", "model-list", "node-event-delegate"]});
|
src/client/handlers/AppHandler.js
|
janicduplessis/imessage-client
|
import React from 'react';
import StyleSheet from 'react-style';
import TransitionGroup from 'react/lib/ReactCSSTransitionGroup';
import ThemeManager from 'material-ui/lib/styles/theme-manager';
import {branch} from 'baobab-react/decorators';
import {RouteHandler} from 'react-router';
import NavBar from '../components/NavBar';
import MessageActions from '../actions/MessageActions';
import colors from '../utils/colors';
import '../styles/app.scss';
@branch({
cursors: {
user: ['user'],
},
})
export default class AppHandler extends React.Component {
static childContextTypes = {
muiTheme: React.PropTypes.object,
}
static contextTypes = {
router: React.PropTypes.func,
};
constructor(props) {
super(props);
this.themeManager = new ThemeManager();
}
getChildContext() {
return {
muiTheme: this.themeManager.getCurrentTheme(),
};
}
componentWillMount() {
this.themeManager.setPalette({
primary1Color: colors.primary,
accent1Color: colors.accent,
});
}
componentDidMount() {
if(this.props.user) {
MessageActions.connect();
}
}
componentWillReceiveProps(props) {
let {router} = this.context;
let {user} = this.props;
if(props.user !== user) {
if(user) {
MessageActions.connect();
router.replaceWith('/chat');
} else {
router.replaceWith('/login');
}
}
}
render() {
let name = this.context.router.getCurrentPath();
return (
<div className="app vbox">
<NavBar />
<div className="vbox" style={styles.content}>
<TransitionGroup
transitionName="content-fade"
component="div"
className={'content vbox ' + this._curRouteClassName()}>
<RouteHandler {...this.props} key={name} />
</TransitionGroup>
</div>
</div>
);
}
_curRouteClassName() {
return 'page-' + this.context.router.getRouteAtDepth(1).name;
}
}
const styles = StyleSheet.create({
content: {
},
});
|
src/svg-icons/av/music-video.js
|
pomerantsev/material-ui
|
import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let AvMusicVideo = (props) => (
<SvgIcon {...props}>
<path d="M21 3H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H3V5h18v14zM8 15c0-1.66 1.34-3 3-3 .35 0 .69.07 1 .18V6h5v2h-3v7.03c-.02 1.64-1.35 2.97-3 2.97-1.66 0-3-1.34-3-3z"/>
</SvgIcon>
);
AvMusicVideo = pure(AvMusicVideo);
AvMusicVideo.displayName = 'AvMusicVideo';
AvMusicVideo.muiName = 'SvgIcon';
export default AvMusicVideo;
|
ajax/libs/raven.js/3.24.1/raven.js
|
sashberd/cdnjs
|
/*! Raven.js 3.24.1 (f3b3500) | github.com/getsentry/raven-js */
/*
* Includes TraceKit
* https://github.com/getsentry/TraceKit
*
* Copyright 2018 Matt Robenolt and other contributors
* Released under the BSD license
* https://github.com/getsentry/raven-js/blob/master/LICENSE
*
*/
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Raven = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
function RavenConfigError(message) {
this.name = 'RavenConfigError';
this.message = message;
}
RavenConfigError.prototype = new Error();
RavenConfigError.prototype.constructor = RavenConfigError;
module.exports = RavenConfigError;
},{}],2:[function(_dereq_,module,exports){
var utils = _dereq_(5);
var wrapMethod = function(console, level, callback) {
var originalConsoleLevel = console[level];
var originalConsole = console;
if (!(level in console)) {
return;
}
var sentryLevel = level === 'warn' ? 'warning' : level;
console[level] = function() {
var args = [].slice.call(arguments);
var msg = utils.safeJoin(args, ' ');
var data = {level: sentryLevel, logger: 'console', extra: {arguments: args}};
if (level === 'assert') {
if (args[0] === false) {
// Default browsers message
msg =
'Assertion failed: ' + (utils.safeJoin(args.slice(1), ' ') || 'console.assert');
data.extra.arguments = args.slice(1);
callback && callback(msg, data);
}
} else {
callback && callback(msg, data);
}
// this fails for some browsers. :(
if (originalConsoleLevel) {
// IE9 doesn't allow calling apply on console functions directly
// See: https://stackoverflow.com/questions/5472938/does-ie9-support-console-log-and-is-it-a-real-function#answer-5473193
Function.prototype.apply.call(originalConsoleLevel, originalConsole, args);
}
};
};
module.exports = {
wrapMethod: wrapMethod
};
},{"5":5}],3:[function(_dereq_,module,exports){
(function (global){
/*global XDomainRequest:false */
var TraceKit = _dereq_(6);
var stringify = _dereq_(7);
var md5 = _dereq_(8);
var RavenConfigError = _dereq_(1);
var utils = _dereq_(5);
var isError = utils.isError;
var isObject = utils.isObject;
var isPlainObject = utils.isPlainObject;
var isErrorEvent = utils.isErrorEvent;
var isUndefined = utils.isUndefined;
var isFunction = utils.isFunction;
var isString = utils.isString;
var isArray = utils.isArray;
var isEmptyObject = utils.isEmptyObject;
var each = utils.each;
var objectMerge = utils.objectMerge;
var truncate = utils.truncate;
var objectFrozen = utils.objectFrozen;
var hasKey = utils.hasKey;
var joinRegExp = utils.joinRegExp;
var urlencode = utils.urlencode;
var uuid4 = utils.uuid4;
var htmlTreeAsString = utils.htmlTreeAsString;
var isSameException = utils.isSameException;
var isSameStacktrace = utils.isSameStacktrace;
var parseUrl = utils.parseUrl;
var fill = utils.fill;
var supportsFetch = utils.supportsFetch;
var supportsReferrerPolicy = utils.supportsReferrerPolicy;
var serializeKeysForMessage = utils.serializeKeysForMessage;
var serializeException = utils.serializeException;
var sanitize = utils.sanitize;
var wrapConsoleMethod = _dereq_(2).wrapMethod;
var dsnKeys = 'source protocol user pass host port path'.split(' '),
dsnPattern = /^(?:(\w+):)?\/\/(?:(\w+)(:\w+)?@)?([\w\.-]+)(?::(\d+))?(\/.*)/;
function now() {
return +new Date();
}
// This is to be defensive in environments where window does not exist (see https://github.com/getsentry/raven-js/pull/785)
var _window =
typeof window !== 'undefined'
? window
: typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
var _document = _window.document;
var _navigator = _window.navigator;
function keepOriginalCallback(original, callback) {
return isFunction(callback)
? function(data) {
return callback(data, original);
}
: callback;
}
// First, check for JSON support
// If there is no JSON, we no-op the core features of Raven
// since JSON is required to encode the payload
function Raven() {
this._hasJSON = !!(typeof JSON === 'object' && JSON.stringify);
// Raven can run in contexts where there's no document (react-native)
this._hasDocument = !isUndefined(_document);
this._hasNavigator = !isUndefined(_navigator);
this._lastCapturedException = null;
this._lastData = null;
this._lastEventId = null;
this._globalServer = null;
this._globalKey = null;
this._globalProject = null;
this._globalContext = {};
this._globalOptions = {
// SENTRY_RELEASE can be injected by https://github.com/getsentry/sentry-webpack-plugin
release: _window.SENTRY_RELEASE && _window.SENTRY_RELEASE.id,
logger: 'javascript',
ignoreErrors: [],
ignoreUrls: [],
whitelistUrls: [],
includePaths: [],
headers: null,
collectWindowErrors: true,
captureUnhandledRejections: true,
maxMessageLength: 0,
// By default, truncates URL values to 250 chars
maxUrlLength: 250,
stackTraceLimit: 50,
autoBreadcrumbs: true,
instrument: true,
sampleRate: 1,
sanitizeKeys: []
};
this._fetchDefaults = {
method: 'POST',
keepalive: true,
// Despite all stars in the sky saying that Edge supports old draft syntax, aka 'never', 'always', 'origin' and 'default
// https://caniuse.com/#feat=referrer-policy
// It doesn't. And it throw exception instead of ignoring this parameter...
// REF: https://github.com/getsentry/raven-js/issues/1233
referrerPolicy: supportsReferrerPolicy() ? 'origin' : ''
};
this._ignoreOnError = 0;
this._isRavenInstalled = false;
this._originalErrorStackTraceLimit = Error.stackTraceLimit;
// capture references to window.console *and* all its methods first
// before the console plugin has a chance to monkey patch
this._originalConsole = _window.console || {};
this._originalConsoleMethods = {};
this._plugins = [];
this._startTime = now();
this._wrappedBuiltIns = [];
this._breadcrumbs = [];
this._lastCapturedEvent = null;
this._keypressTimeout;
this._location = _window.location;
this._lastHref = this._location && this._location.href;
this._resetBackoff();
// eslint-disable-next-line guard-for-in
for (var method in this._originalConsole) {
this._originalConsoleMethods[method] = this._originalConsole[method];
}
}
/*
* The core Raven singleton
*
* @this {Raven}
*/
Raven.prototype = {
// Hardcode version string so that raven source can be loaded directly via
// webpack (using a build step causes webpack #1617). Grunt verifies that
// this value matches package.json during build.
// See: https://github.com/getsentry/raven-js/issues/465
VERSION: '3.24.1',
debug: false,
TraceKit: TraceKit, // alias to TraceKit
/*
* Configure Raven with a DSN and extra options
*
* @param {string} dsn The public Sentry DSN
* @param {object} options Set of global options [optional]
* @return {Raven}
*/
config: function(dsn, options) {
var self = this;
if (self._globalServer) {
this._logDebug('error', 'Error: Raven has already been configured');
return self;
}
if (!dsn) return self;
var globalOptions = self._globalOptions;
// merge in options
if (options) {
each(options, function(key, value) {
// tags and extra are special and need to be put into context
if (key === 'tags' || key === 'extra' || key === 'user') {
self._globalContext[key] = value;
} else {
globalOptions[key] = value;
}
});
}
self.setDSN(dsn);
// "Script error." is hard coded into browsers for errors that it can't read.
// this is the result of a script being pulled in from an external domain and CORS.
globalOptions.ignoreErrors.push(/^Script error\.?$/);
globalOptions.ignoreErrors.push(/^Javascript error: Script error\.? on line 0$/);
// join regexp rules into one big rule
globalOptions.ignoreErrors = joinRegExp(globalOptions.ignoreErrors);
globalOptions.ignoreUrls = globalOptions.ignoreUrls.length
? joinRegExp(globalOptions.ignoreUrls)
: false;
globalOptions.whitelistUrls = globalOptions.whitelistUrls.length
? joinRegExp(globalOptions.whitelistUrls)
: false;
globalOptions.includePaths = joinRegExp(globalOptions.includePaths);
globalOptions.maxBreadcrumbs = Math.max(
0,
Math.min(globalOptions.maxBreadcrumbs || 100, 100)
); // default and hard limit is 100
var autoBreadcrumbDefaults = {
xhr: true,
console: true,
dom: true,
location: true,
sentry: true
};
var autoBreadcrumbs = globalOptions.autoBreadcrumbs;
if ({}.toString.call(autoBreadcrumbs) === '[object Object]') {
autoBreadcrumbs = objectMerge(autoBreadcrumbDefaults, autoBreadcrumbs);
} else if (autoBreadcrumbs !== false) {
autoBreadcrumbs = autoBreadcrumbDefaults;
}
globalOptions.autoBreadcrumbs = autoBreadcrumbs;
var instrumentDefaults = {
tryCatch: true
};
var instrument = globalOptions.instrument;
if ({}.toString.call(instrument) === '[object Object]') {
instrument = objectMerge(instrumentDefaults, instrument);
} else if (instrument !== false) {
instrument = instrumentDefaults;
}
globalOptions.instrument = instrument;
TraceKit.collectWindowErrors = !!globalOptions.collectWindowErrors;
// return for chaining
return self;
},
/*
* Installs a global window.onerror error handler
* to capture and report uncaught exceptions.
* At this point, install() is required to be called due
* to the way TraceKit is set up.
*
* @return {Raven}
*/
install: function() {
var self = this;
if (self.isSetup() && !self._isRavenInstalled) {
TraceKit.report.subscribe(function() {
self._handleOnErrorStackInfo.apply(self, arguments);
});
if (self._globalOptions.captureUnhandledRejections) {
self._attachPromiseRejectionHandler();
}
self._patchFunctionToString();
if (self._globalOptions.instrument && self._globalOptions.instrument.tryCatch) {
self._instrumentTryCatch();
}
if (self._globalOptions.autoBreadcrumbs) self._instrumentBreadcrumbs();
// Install all of the plugins
self._drainPlugins();
self._isRavenInstalled = true;
}
Error.stackTraceLimit = self._globalOptions.stackTraceLimit;
return this;
},
/*
* Set the DSN (can be called multiple time unlike config)
*
* @param {string} dsn The public Sentry DSN
*/
setDSN: function(dsn) {
var self = this,
uri = self._parseDSN(dsn),
lastSlash = uri.path.lastIndexOf('/'),
path = uri.path.substr(1, lastSlash);
self._dsn = dsn;
self._globalKey = uri.user;
self._globalSecret = uri.pass && uri.pass.substr(1);
self._globalProject = uri.path.substr(lastSlash + 1);
self._globalServer = self._getGlobalServer(uri);
self._globalEndpoint =
self._globalServer + '/' + path + 'api/' + self._globalProject + '/store/';
// Reset backoff state since we may be pointing at a
// new project/server
this._resetBackoff();
},
/*
* Wrap code within a context so Raven can capture errors
* reliably across domains that is executed immediately.
*
* @param {object} options A specific set of options for this context [optional]
* @param {function} func The callback to be immediately executed within the context
* @param {array} args An array of arguments to be called with the callback [optional]
*/
context: function(options, func, args) {
if (isFunction(options)) {
args = func || [];
func = options;
options = undefined;
}
return this.wrap(options, func).apply(this, args);
},
/*
* Wrap code within a context and returns back a new function to be executed
*
* @param {object} options A specific set of options for this context [optional]
* @param {function} func The function to be wrapped in a new context
* @param {function} func A function to call before the try/catch wrapper [optional, private]
* @return {function} The newly wrapped functions with a context
*/
wrap: function(options, func, _before) {
var self = this;
// 1 argument has been passed, and it's not a function
// so just return it
if (isUndefined(func) && !isFunction(options)) {
return options;
}
// options is optional
if (isFunction(options)) {
func = options;
options = undefined;
}
// At this point, we've passed along 2 arguments, and the second one
// is not a function either, so we'll just return the second argument.
if (!isFunction(func)) {
return func;
}
// We don't wanna wrap it twice!
try {
if (func.__raven__) {
return func;
}
// If this has already been wrapped in the past, return that
if (func.__raven_wrapper__) {
return func.__raven_wrapper__;
}
} catch (e) {
// Just accessing custom props in some Selenium environments
// can cause a "Permission denied" exception (see raven-js#495).
// Bail on wrapping and return the function as-is (defers to window.onerror).
return func;
}
function wrapped() {
var args = [],
i = arguments.length,
deep = !options || (options && options.deep !== false);
if (_before && isFunction(_before)) {
_before.apply(this, arguments);
}
// Recursively wrap all of a function's arguments that are
// functions themselves.
while (i--) args[i] = deep ? self.wrap(options, arguments[i]) : arguments[i];
try {
// Attempt to invoke user-land function
// NOTE: If you are a Sentry user, and you are seeing this stack frame, it
// means Raven caught an error invoking your application code. This is
// expected behavior and NOT indicative of a bug with Raven.js.
return func.apply(this, args);
} catch (e) {
self._ignoreNextOnError();
self.captureException(e, options);
throw e;
}
}
// copy over properties of the old function
for (var property in func) {
if (hasKey(func, property)) {
wrapped[property] = func[property];
}
}
wrapped.prototype = func.prototype;
func.__raven_wrapper__ = wrapped;
// Signal that this function has been wrapped/filled already
// for both debugging and to prevent it to being wrapped/filled twice
wrapped.__raven__ = true;
wrapped.__orig__ = func;
return wrapped;
},
/**
* Uninstalls the global error handler.
*
* @return {Raven}
*/
uninstall: function() {
TraceKit.report.uninstall();
this._detachPromiseRejectionHandler();
this._unpatchFunctionToString();
this._restoreBuiltIns();
this._restoreConsole();
Error.stackTraceLimit = this._originalErrorStackTraceLimit;
this._isRavenInstalled = false;
return this;
},
/**
* Callback used for `unhandledrejection` event
*
* @param {PromiseRejectionEvent} event An object containing
* promise: the Promise that was rejected
* reason: the value with which the Promise was rejected
* @return void
*/
_promiseRejectionHandler: function(event) {
this._logDebug('debug', 'Raven caught unhandled promise rejection:', event);
this.captureException(event.reason, {
extra: {
unhandledPromiseRejection: true
}
});
},
/**
* Installs the global promise rejection handler.
*
* @return {raven}
*/
_attachPromiseRejectionHandler: function() {
this._promiseRejectionHandler = this._promiseRejectionHandler.bind(this);
_window.addEventListener &&
_window.addEventListener('unhandledrejection', this._promiseRejectionHandler);
return this;
},
/**
* Uninstalls the global promise rejection handler.
*
* @return {raven}
*/
_detachPromiseRejectionHandler: function() {
_window.removeEventListener &&
_window.removeEventListener('unhandledrejection', this._promiseRejectionHandler);
return this;
},
/**
* Manually capture an exception and send it over to Sentry
*
* @param {error} ex An exception to be logged
* @param {object} options A specific set of options for this error [optional]
* @return {Raven}
*/
captureException: function(ex, options) {
options = objectMerge({trimHeadFrames: 0}, options ? options : {});
if (isErrorEvent(ex) && ex.error) {
// If it is an ErrorEvent with `error` property, extract it to get actual Error
ex = ex.error;
} else if (isError(ex)) {
// we have a real Error object
ex = ex;
} else if (isPlainObject(ex)) {
// If it is plain Object, serialize it manually and extract options
// This will allow us to group events based on top-level keys
// which is much better than creating new group when any key/value change
options = this._getCaptureExceptionOptionsFromPlainObject(options, ex);
ex = new Error(options.message);
} else {
// If none of previous checks were valid, then it means that
// it's not a plain Object
// it's not a valid ErrorEvent (one with an error property)
// it's not an Error
// So bail out and capture it as a simple message:
return this.captureMessage(
ex,
objectMerge(options, {
stacktrace: true, // if we fall back to captureMessage, default to attempting a new trace
trimHeadFrames: options.trimHeadFrames + 1
})
);
}
// Store the raw exception object for potential debugging and introspection
this._lastCapturedException = ex;
// TraceKit.report will re-raise any exception passed to it,
// which means you have to wrap it in try/catch. Instead, we
// can wrap it here and only re-raise if TraceKit.report
// raises an exception different from the one we asked to
// report on.
try {
var stack = TraceKit.computeStackTrace(ex);
this._handleStackInfo(stack, options);
} catch (ex1) {
if (ex !== ex1) {
throw ex1;
}
}
return this;
},
_getCaptureExceptionOptionsFromPlainObject: function(currentOptions, ex) {
var exKeys = Object.keys(ex).sort();
var options = objectMerge(currentOptions, {
message:
'Non-Error exception captured with keys: ' + serializeKeysForMessage(exKeys),
fingerprint: [md5(exKeys)],
extra: currentOptions.extra || {}
});
options.extra.__serialized__ = serializeException(ex);
return options;
},
/*
* Manually send a message to Sentry
*
* @param {string} msg A plain message to be captured in Sentry
* @param {object} options A specific set of options for this message [optional]
* @return {Raven}
*/
captureMessage: function(msg, options) {
// config() automagically converts ignoreErrors from a list to a RegExp so we need to test for an
// early call; we'll error on the side of logging anything called before configuration since it's
// probably something you should see:
if (
!!this._globalOptions.ignoreErrors.test &&
this._globalOptions.ignoreErrors.test(msg)
) {
return;
}
options = options || {};
msg = msg + ''; // Make sure it's actually a string
var data = objectMerge(
{
message: msg
},
options
);
var ex;
// Generate a "synthetic" stack trace from this point.
// NOTE: If you are a Sentry user, and you are seeing this stack frame, it is NOT indicative
// of a bug with Raven.js. Sentry generates synthetic traces either by configuration,
// or if it catches a thrown object without a "stack" property.
try {
throw new Error(msg);
} catch (ex1) {
ex = ex1;
}
// null exception name so `Error` isn't prefixed to msg
ex.name = null;
var stack = TraceKit.computeStackTrace(ex);
// stack[0] is `throw new Error(msg)` call itself, we are interested in the frame that was just before that, stack[1]
var initialCall = isArray(stack.stack) && stack.stack[1];
var fileurl = (initialCall && initialCall.url) || '';
if (
!!this._globalOptions.ignoreUrls.test &&
this._globalOptions.ignoreUrls.test(fileurl)
) {
return;
}
if (
!!this._globalOptions.whitelistUrls.test &&
!this._globalOptions.whitelistUrls.test(fileurl)
) {
return;
}
if (this._globalOptions.stacktrace || (options && options.stacktrace)) {
// fingerprint on msg, not stack trace (legacy behavior, could be revisited)
data.fingerprint = data.fingerprint == null ? msg : data.fingerprint;
options = objectMerge(
{
trimHeadFrames: 0
},
options
);
// Since we know this is a synthetic trace, the top frame (this function call)
// MUST be from Raven.js, so mark it for trimming
// We add to the trim counter so that callers can choose to trim extra frames, such
// as utility functions.
options.trimHeadFrames += 1;
var frames = this._prepareFrames(stack, options);
data.stacktrace = {
// Sentry expects frames oldest to newest
frames: frames.reverse()
};
}
// Make sure that fingerprint is always wrapped in an array
if (data.fingerprint) {
data.fingerprint = isArray(data.fingerprint)
? data.fingerprint
: [data.fingerprint];
}
// Fire away!
this._send(data);
return this;
},
captureBreadcrumb: function(obj) {
var crumb = objectMerge(
{
timestamp: now() / 1000
},
obj
);
if (isFunction(this._globalOptions.breadcrumbCallback)) {
var result = this._globalOptions.breadcrumbCallback(crumb);
if (isObject(result) && !isEmptyObject(result)) {
crumb = result;
} else if (result === false) {
return this;
}
}
this._breadcrumbs.push(crumb);
if (this._breadcrumbs.length > this._globalOptions.maxBreadcrumbs) {
this._breadcrumbs.shift();
}
return this;
},
addPlugin: function(plugin /*arg1, arg2, ... argN*/) {
var pluginArgs = [].slice.call(arguments, 1);
this._plugins.push([plugin, pluginArgs]);
if (this._isRavenInstalled) {
this._drainPlugins();
}
return this;
},
/*
* Set/clear a user to be sent along with the payload.
*
* @param {object} user An object representing user data [optional]
* @return {Raven}
*/
setUserContext: function(user) {
// Intentionally do not merge here since that's an unexpected behavior.
this._globalContext.user = user;
return this;
},
/*
* Merge extra attributes to be sent along with the payload.
*
* @param {object} extra An object representing extra data [optional]
* @return {Raven}
*/
setExtraContext: function(extra) {
this._mergeContext('extra', extra);
return this;
},
/*
* Merge tags to be sent along with the payload.
*
* @param {object} tags An object representing tags [optional]
* @return {Raven}
*/
setTagsContext: function(tags) {
this._mergeContext('tags', tags);
return this;
},
/*
* Clear all of the context.
*
* @return {Raven}
*/
clearContext: function() {
this._globalContext = {};
return this;
},
/*
* Get a copy of the current context. This cannot be mutated.
*
* @return {object} copy of context
*/
getContext: function() {
// lol javascript
return JSON.parse(stringify(this._globalContext));
},
/*
* Set environment of application
*
* @param {string} environment Typically something like 'production'.
* @return {Raven}
*/
setEnvironment: function(environment) {
this._globalOptions.environment = environment;
return this;
},
/*
* Set release version of application
*
* @param {string} release Typically something like a git SHA to identify version
* @return {Raven}
*/
setRelease: function(release) {
this._globalOptions.release = release;
return this;
},
/*
* Set the dataCallback option
*
* @param {function} callback The callback to run which allows the
* data blob to be mutated before sending
* @return {Raven}
*/
setDataCallback: function(callback) {
var original = this._globalOptions.dataCallback;
this._globalOptions.dataCallback = keepOriginalCallback(original, callback);
return this;
},
/*
* Set the breadcrumbCallback option
*
* @param {function} callback The callback to run which allows filtering
* or mutating breadcrumbs
* @return {Raven}
*/
setBreadcrumbCallback: function(callback) {
var original = this._globalOptions.breadcrumbCallback;
this._globalOptions.breadcrumbCallback = keepOriginalCallback(original, callback);
return this;
},
/*
* Set the shouldSendCallback option
*
* @param {function} callback The callback to run which allows
* introspecting the blob before sending
* @return {Raven}
*/
setShouldSendCallback: function(callback) {
var original = this._globalOptions.shouldSendCallback;
this._globalOptions.shouldSendCallback = keepOriginalCallback(original, callback);
return this;
},
/**
* Override the default HTTP transport mechanism that transmits data
* to the Sentry server.
*
* @param {function} transport Function invoked instead of the default
* `makeRequest` handler.
*
* @return {Raven}
*/
setTransport: function(transport) {
this._globalOptions.transport = transport;
return this;
},
/*
* Get the latest raw exception that was captured by Raven.
*
* @return {error}
*/
lastException: function() {
return this._lastCapturedException;
},
/*
* Get the last event id
*
* @return {string}
*/
lastEventId: function() {
return this._lastEventId;
},
/*
* Determine if Raven is setup and ready to go.
*
* @return {boolean}
*/
isSetup: function() {
if (!this._hasJSON) return false; // needs JSON support
if (!this._globalServer) {
if (!this.ravenNotConfiguredError) {
this.ravenNotConfiguredError = true;
this._logDebug('error', 'Error: Raven has not been configured.');
}
return false;
}
return true;
},
afterLoad: function() {
// TODO: remove window dependence?
// Attempt to initialize Raven on load
var RavenConfig = _window.RavenConfig;
if (RavenConfig) {
this.config(RavenConfig.dsn, RavenConfig.config).install();
}
},
showReportDialog: function(options) {
if (
!_document // doesn't work without a document (React native)
)
return;
options = options || {};
var lastEventId = options.eventId || this.lastEventId();
if (!lastEventId) {
throw new RavenConfigError('Missing eventId');
}
var dsn = options.dsn || this._dsn;
if (!dsn) {
throw new RavenConfigError('Missing DSN');
}
var encode = encodeURIComponent;
var qs = '';
qs += '?eventId=' + encode(lastEventId);
qs += '&dsn=' + encode(dsn);
var user = options.user || this._globalContext.user;
if (user) {
if (user.name) qs += '&name=' + encode(user.name);
if (user.email) qs += '&email=' + encode(user.email);
}
var globalServer = this._getGlobalServer(this._parseDSN(dsn));
var script = _document.createElement('script');
script.async = true;
script.src = globalServer + '/api/embed/error-page/' + qs;
(_document.head || _document.body).appendChild(script);
},
/**** Private functions ****/
_ignoreNextOnError: function() {
var self = this;
this._ignoreOnError += 1;
setTimeout(function() {
// onerror should trigger before setTimeout
self._ignoreOnError -= 1;
});
},
_triggerEvent: function(eventType, options) {
// NOTE: `event` is a native browser thing, so let's avoid conflicting wiht it
var evt, key;
if (!this._hasDocument) return;
options = options || {};
eventType = 'raven' + eventType.substr(0, 1).toUpperCase() + eventType.substr(1);
if (_document.createEvent) {
evt = _document.createEvent('HTMLEvents');
evt.initEvent(eventType, true, true);
} else {
evt = _document.createEventObject();
evt.eventType = eventType;
}
for (key in options)
if (hasKey(options, key)) {
evt[key] = options[key];
}
if (_document.createEvent) {
// IE9 if standards
_document.dispatchEvent(evt);
} else {
// IE8 regardless of Quirks or Standards
// IE9 if quirks
try {
_document.fireEvent('on' + evt.eventType.toLowerCase(), evt);
} catch (e) {
// Do nothing
}
}
},
/**
* Wraps addEventListener to capture UI breadcrumbs
* @param evtName the event name (e.g. "click")
* @returns {Function}
* @private
*/
_breadcrumbEventHandler: function(evtName) {
var self = this;
return function(evt) {
// reset keypress timeout; e.g. triggering a 'click' after
// a 'keypress' will reset the keypress debounce so that a new
// set of keypresses can be recorded
self._keypressTimeout = null;
// It's possible this handler might trigger multiple times for the same
// event (e.g. event propagation through node ancestors). Ignore if we've
// already captured the event.
if (self._lastCapturedEvent === evt) return;
self._lastCapturedEvent = evt;
// try/catch both:
// - accessing evt.target (see getsentry/raven-js#838, #768)
// - `htmlTreeAsString` because it's complex, and just accessing the DOM incorrectly
// can throw an exception in some circumstances.
var target;
try {
target = htmlTreeAsString(evt.target);
} catch (e) {
target = '<unknown>';
}
self.captureBreadcrumb({
category: 'ui.' + evtName, // e.g. ui.click, ui.input
message: target
});
};
},
/**
* Wraps addEventListener to capture keypress UI events
* @returns {Function}
* @private
*/
_keypressEventHandler: function() {
var self = this,
debounceDuration = 1000; // milliseconds
// TODO: if somehow user switches keypress target before
// debounce timeout is triggered, we will only capture
// a single breadcrumb from the FIRST target (acceptable?)
return function(evt) {
var target;
try {
target = evt.target;
} catch (e) {
// just accessing event properties can throw an exception in some rare circumstances
// see: https://github.com/getsentry/raven-js/issues/838
return;
}
var tagName = target && target.tagName;
// only consider keypress events on actual input elements
// this will disregard keypresses targeting body (e.g. tabbing
// through elements, hotkeys, etc)
if (
!tagName ||
(tagName !== 'INPUT' && tagName !== 'TEXTAREA' && !target.isContentEditable)
)
return;
// record first keypress in a series, but ignore subsequent
// keypresses until debounce clears
var timeout = self._keypressTimeout;
if (!timeout) {
self._breadcrumbEventHandler('input')(evt);
}
clearTimeout(timeout);
self._keypressTimeout = setTimeout(function() {
self._keypressTimeout = null;
}, debounceDuration);
};
},
/**
* Captures a breadcrumb of type "navigation", normalizing input URLs
* @param to the originating URL
* @param from the target URL
* @private
*/
_captureUrlChange: function(from, to) {
var parsedLoc = parseUrl(this._location.href);
var parsedTo = parseUrl(to);
var parsedFrom = parseUrl(from);
// because onpopstate only tells you the "new" (to) value of location.href, and
// not the previous (from) value, we need to track the value of the current URL
// state ourselves
this._lastHref = to;
// Use only the path component of the URL if the URL matches the current
// document (almost all the time when using pushState)
if (parsedLoc.protocol === parsedTo.protocol && parsedLoc.host === parsedTo.host)
to = parsedTo.relative;
if (parsedLoc.protocol === parsedFrom.protocol && parsedLoc.host === parsedFrom.host)
from = parsedFrom.relative;
this.captureBreadcrumb({
category: 'navigation',
data: {
to: to,
from: from
}
});
},
_patchFunctionToString: function() {
var self = this;
self._originalFunctionToString = Function.prototype.toString;
// eslint-disable-next-line no-extend-native
Function.prototype.toString = function() {
if (typeof this === 'function' && this.__raven__) {
return self._originalFunctionToString.apply(this.__orig__, arguments);
}
return self._originalFunctionToString.apply(this, arguments);
};
},
_unpatchFunctionToString: function() {
if (this._originalFunctionToString) {
// eslint-disable-next-line no-extend-native
Function.prototype.toString = this._originalFunctionToString;
}
},
/**
* Wrap timer functions and event targets to catch errors and provide
* better metadata.
*/
_instrumentTryCatch: function() {
var self = this;
var wrappedBuiltIns = self._wrappedBuiltIns;
function wrapTimeFn(orig) {
return function(fn, t) {
// preserve arity
// Make a copy of the arguments to prevent deoptimization
// https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments
var args = new Array(arguments.length);
for (var i = 0; i < args.length; ++i) {
args[i] = arguments[i];
}
var originalCallback = args[0];
if (isFunction(originalCallback)) {
args[0] = self.wrap(originalCallback);
}
// IE < 9 doesn't support .call/.apply on setInterval/setTimeout, but it
// also supports only two arguments and doesn't care what this is, so we
// can just call the original function directly.
if (orig.apply) {
return orig.apply(this, args);
} else {
return orig(args[0], args[1]);
}
};
}
var autoBreadcrumbs = this._globalOptions.autoBreadcrumbs;
function wrapEventTarget(global) {
var proto = _window[global] && _window[global].prototype;
if (proto && proto.hasOwnProperty && proto.hasOwnProperty('addEventListener')) {
fill(
proto,
'addEventListener',
function(orig) {
return function(evtName, fn, capture, secure) {
// preserve arity
try {
if (fn && fn.handleEvent) {
fn.handleEvent = self.wrap(fn.handleEvent);
}
} catch (err) {
// can sometimes get 'Permission denied to access property "handle Event'
}
// More breadcrumb DOM capture ... done here and not in `_instrumentBreadcrumbs`
// so that we don't have more than one wrapper function
var before, clickHandler, keypressHandler;
if (
autoBreadcrumbs &&
autoBreadcrumbs.dom &&
(global === 'EventTarget' || global === 'Node')
) {
// NOTE: generating multiple handlers per addEventListener invocation, should
// revisit and verify we can just use one (almost certainly)
clickHandler = self._breadcrumbEventHandler('click');
keypressHandler = self._keypressEventHandler();
before = function(evt) {
// need to intercept every DOM event in `before` argument, in case that
// same wrapped method is re-used for different events (e.g. mousemove THEN click)
// see #724
if (!evt) return;
var eventType;
try {
eventType = evt.type;
} catch (e) {
// just accessing event properties can throw an exception in some rare circumstances
// see: https://github.com/getsentry/raven-js/issues/838
return;
}
if (eventType === 'click') return clickHandler(evt);
else if (eventType === 'keypress') return keypressHandler(evt);
};
}
return orig.call(
this,
evtName,
self.wrap(fn, undefined, before),
capture,
secure
);
};
},
wrappedBuiltIns
);
fill(
proto,
'removeEventListener',
function(orig) {
return function(evt, fn, capture, secure) {
try {
fn = fn && (fn.__raven_wrapper__ ? fn.__raven_wrapper__ : fn);
} catch (e) {
// ignore, accessing __raven_wrapper__ will throw in some Selenium environments
}
return orig.call(this, evt, fn, capture, secure);
};
},
wrappedBuiltIns
);
}
}
fill(_window, 'setTimeout', wrapTimeFn, wrappedBuiltIns);
fill(_window, 'setInterval', wrapTimeFn, wrappedBuiltIns);
if (_window.requestAnimationFrame) {
fill(
_window,
'requestAnimationFrame',
function(orig) {
return function(cb) {
return orig(self.wrap(cb));
};
},
wrappedBuiltIns
);
}
// event targets borrowed from bugsnag-js:
// https://github.com/bugsnag/bugsnag-js/blob/master/src/bugsnag.js#L666
var eventTargets = [
'EventTarget',
'Window',
'Node',
'ApplicationCache',
'AudioTrackList',
'ChannelMergerNode',
'CryptoOperation',
'EventSource',
'FileReader',
'HTMLUnknownElement',
'IDBDatabase',
'IDBRequest',
'IDBTransaction',
'KeyOperation',
'MediaController',
'MessagePort',
'ModalWindow',
'Notification',
'SVGElementInstance',
'Screen',
'TextTrack',
'TextTrackCue',
'TextTrackList',
'WebSocket',
'WebSocketWorker',
'Worker',
'XMLHttpRequest',
'XMLHttpRequestEventTarget',
'XMLHttpRequestUpload'
];
for (var i = 0; i < eventTargets.length; i++) {
wrapEventTarget(eventTargets[i]);
}
},
/**
* Instrument browser built-ins w/ breadcrumb capturing
* - XMLHttpRequests
* - DOM interactions (click/typing)
* - window.location changes
* - console
*
* Can be disabled or individually configured via the `autoBreadcrumbs` config option
*/
_instrumentBreadcrumbs: function() {
var self = this;
var autoBreadcrumbs = this._globalOptions.autoBreadcrumbs;
var wrappedBuiltIns = self._wrappedBuiltIns;
function wrapProp(prop, xhr) {
if (prop in xhr && isFunction(xhr[prop])) {
fill(xhr, prop, function(orig) {
return self.wrap(orig);
}); // intentionally don't track filled methods on XHR instances
}
}
if (autoBreadcrumbs.xhr && 'XMLHttpRequest' in _window) {
var xhrproto = _window.XMLHttpRequest && _window.XMLHttpRequest.prototype;
fill(
xhrproto,
'open',
function(origOpen) {
return function(method, url) {
// preserve arity
// if Sentry key appears in URL, don't capture
if (isString(url) && url.indexOf(self._globalKey) === -1) {
this.__raven_xhr = {
method: method,
url: url,
status_code: null
};
}
return origOpen.apply(this, arguments);
};
},
wrappedBuiltIns
);
fill(
xhrproto,
'send',
function(origSend) {
return function() {
// preserve arity
var xhr = this;
function onreadystatechangeHandler() {
if (xhr.__raven_xhr && xhr.readyState === 4) {
try {
// touching statusCode in some platforms throws
// an exception
xhr.__raven_xhr.status_code = xhr.status;
} catch (e) {
/* do nothing */
}
self.captureBreadcrumb({
type: 'http',
category: 'xhr',
data: xhr.__raven_xhr
});
}
}
var props = ['onload', 'onerror', 'onprogress'];
for (var j = 0; j < props.length; j++) {
wrapProp(props[j], xhr);
}
if ('onreadystatechange' in xhr && isFunction(xhr.onreadystatechange)) {
fill(
xhr,
'onreadystatechange',
function(orig) {
return self.wrap(orig, undefined, onreadystatechangeHandler);
} /* intentionally don't track this instrumentation */
);
} else {
// if onreadystatechange wasn't actually set by the page on this xhr, we
// are free to set our own and capture the breadcrumb
xhr.onreadystatechange = onreadystatechangeHandler;
}
return origSend.apply(this, arguments);
};
},
wrappedBuiltIns
);
}
if (autoBreadcrumbs.xhr && supportsFetch()) {
fill(
_window,
'fetch',
function(origFetch) {
return function() {
// preserve arity
// Make a copy of the arguments to prevent deoptimization
// https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments
var args = new Array(arguments.length);
for (var i = 0; i < args.length; ++i) {
args[i] = arguments[i];
}
var fetchInput = args[0];
var method = 'GET';
var url;
if (typeof fetchInput === 'string') {
url = fetchInput;
} else if ('Request' in _window && fetchInput instanceof _window.Request) {
url = fetchInput.url;
if (fetchInput.method) {
method = fetchInput.method;
}
} else {
url = '' + fetchInput;
}
// if Sentry key appears in URL, don't capture, as it's our own request
if (url.indexOf(self._globalKey) !== -1) {
return origFetch.apply(this, args);
}
if (args[1] && args[1].method) {
method = args[1].method;
}
var fetchData = {
method: method,
url: url,
status_code: null
};
return origFetch.apply(this, args).then(function(response) {
fetchData.status_code = response.status;
self.captureBreadcrumb({
type: 'http',
category: 'fetch',
data: fetchData
});
return response;
});
};
},
wrappedBuiltIns
);
}
// Capture breadcrumbs from any click that is unhandled / bubbled up all the way
// to the document. Do this before we instrument addEventListener.
if (autoBreadcrumbs.dom && this._hasDocument) {
if (_document.addEventListener) {
_document.addEventListener('click', self._breadcrumbEventHandler('click'), false);
_document.addEventListener('keypress', self._keypressEventHandler(), false);
} else if(_document.attachEvent){
// IE8 Compatibility
_document.attachEvent('onclick', self._breadcrumbEventHandler('click'));
_document.attachEvent('onkeypress', self._keypressEventHandler());
}
}
// record navigation (URL) changes
// NOTE: in Chrome App environment, touching history.pushState, *even inside
// a try/catch block*, will cause Chrome to output an error to console.error
// borrowed from: https://github.com/angular/angular.js/pull/13945/files
var chrome = _window.chrome;
var isChromePackagedApp = chrome && chrome.app && chrome.app.runtime;
var hasPushAndReplaceState =
!isChromePackagedApp &&
_window.history &&
history.pushState &&
history.replaceState;
if (autoBreadcrumbs.location && hasPushAndReplaceState) {
// TODO: remove onpopstate handler on uninstall()
var oldOnPopState = _window.onpopstate;
_window.onpopstate = function() {
var currentHref = self._location.href;
self._captureUrlChange(self._lastHref, currentHref);
if (oldOnPopState) {
return oldOnPopState.apply(this, arguments);
}
};
var historyReplacementFunction = function(origHistFunction) {
// note history.pushState.length is 0; intentionally not declaring
// params to preserve 0 arity
return function(/* state, title, url */) {
var url = arguments.length > 2 ? arguments[2] : undefined;
// url argument is optional
if (url) {
// coerce to string (this is what pushState does)
self._captureUrlChange(self._lastHref, url + '');
}
return origHistFunction.apply(this, arguments);
};
};
fill(history, 'pushState', historyReplacementFunction, wrappedBuiltIns);
fill(history, 'replaceState', historyReplacementFunction, wrappedBuiltIns);
}
if (autoBreadcrumbs.console && 'console' in _window && console.log) {
// console
var consoleMethodCallback = function(msg, data) {
self.captureBreadcrumb({
message: msg,
level: data.level,
category: 'console'
});
};
each(['debug', 'info', 'warn', 'error', 'log'], function(_, level) {
wrapConsoleMethod(console, level, consoleMethodCallback);
});
}
},
_restoreBuiltIns: function() {
// restore any wrapped builtins
var builtin;
while (this._wrappedBuiltIns.length) {
builtin = this._wrappedBuiltIns.shift();
var obj = builtin[0],
name = builtin[1],
orig = builtin[2];
obj[name] = orig;
}
},
_restoreConsole: function() {
// eslint-disable-next-line guard-for-in
for (var method in this._originalConsoleMethods) {
this._originalConsole[method] = this._originalConsoleMethods[method];
}
},
_drainPlugins: function() {
var self = this;
// FIX ME TODO
each(this._plugins, function(_, plugin) {
var installer = plugin[0];
var args = plugin[1];
installer.apply(self, [self].concat(args));
});
},
_parseDSN: function(str) {
var m = dsnPattern.exec(str),
dsn = {},
i = 7;
try {
while (i--) dsn[dsnKeys[i]] = m[i] || '';
} catch (e) {
throw new RavenConfigError('Invalid DSN: ' + str);
}
if (dsn.pass && !this._globalOptions.allowSecretKey) {
throw new RavenConfigError(
'Do not specify your secret key in the DSN. See: http://bit.ly/raven-secret-key'
);
}
return dsn;
},
_getGlobalServer: function(uri) {
// assemble the endpoint from the uri pieces
var globalServer = '//' + uri.host + (uri.port ? ':' + uri.port : '');
if (uri.protocol) {
globalServer = uri.protocol + ':' + globalServer;
}
return globalServer;
},
_handleOnErrorStackInfo: function() {
// if we are intentionally ignoring errors via onerror, bail out
if (!this._ignoreOnError) {
this._handleStackInfo.apply(this, arguments);
}
},
_handleStackInfo: function(stackInfo, options) {
var frames = this._prepareFrames(stackInfo, options);
this._triggerEvent('handle', {
stackInfo: stackInfo,
options: options
});
this._processException(
stackInfo.name,
stackInfo.message,
stackInfo.url,
stackInfo.lineno,
frames,
options
);
},
_prepareFrames: function(stackInfo, options) {
var self = this;
var frames = [];
if (stackInfo.stack && stackInfo.stack.length) {
each(stackInfo.stack, function(i, stack) {
var frame = self._normalizeFrame(stack, stackInfo.url);
if (frame) {
frames.push(frame);
}
});
// e.g. frames captured via captureMessage throw
if (options && options.trimHeadFrames) {
for (var j = 0; j < options.trimHeadFrames && j < frames.length; j++) {
frames[j].in_app = false;
}
}
}
frames = frames.slice(0, this._globalOptions.stackTraceLimit);
return frames;
},
_normalizeFrame: function(frame, stackInfoUrl) {
// normalize the frames data
var normalized = {
filename: frame.url,
lineno: frame.line,
colno: frame.column,
function: frame.func || '?'
};
// Case when we don't have any information about the error
// E.g. throwing a string or raw object, instead of an `Error` in Firefox
// Generating synthetic error doesn't add any value here
//
// We should probably somehow let a user know that they should fix their code
if (!frame.url) {
normalized.filename = stackInfoUrl; // fallback to whole stacks url from onerror handler
}
normalized.in_app = !// determine if an exception came from outside of our app
// first we check the global includePaths list.
(
(!!this._globalOptions.includePaths.test &&
!this._globalOptions.includePaths.test(normalized.filename)) ||
// Now we check for fun, if the function name is Raven or TraceKit
/(Raven|TraceKit)\./.test(normalized['function']) ||
// finally, we do a last ditch effort and check for raven.min.js
/raven\.(min\.)?js$/.test(normalized.filename)
);
return normalized;
},
_processException: function(type, message, fileurl, lineno, frames, options) {
var prefixedMessage = (type ? type + ': ' : '') + (message || '');
if (
!!this._globalOptions.ignoreErrors.test &&
(this._globalOptions.ignoreErrors.test(message) ||
this._globalOptions.ignoreErrors.test(prefixedMessage))
) {
return;
}
var stacktrace;
if (frames && frames.length) {
fileurl = frames[0].filename || fileurl;
// Sentry expects frames oldest to newest
// and JS sends them as newest to oldest
frames.reverse();
stacktrace = {frames: frames};
} else if (fileurl) {
stacktrace = {
frames: [
{
filename: fileurl,
lineno: lineno,
in_app: true
}
]
};
}
if (
!!this._globalOptions.ignoreUrls.test &&
this._globalOptions.ignoreUrls.test(fileurl)
) {
return;
}
if (
!!this._globalOptions.whitelistUrls.test &&
!this._globalOptions.whitelistUrls.test(fileurl)
) {
return;
}
var data = objectMerge(
{
// sentry.interfaces.Exception
exception: {
values: [
{
type: type,
value: message,
stacktrace: stacktrace
}
]
},
culprit: fileurl
},
options
);
// Fire away!
this._send(data);
},
_trimPacket: function(data) {
// For now, we only want to truncate the two different messages
// but this could/should be expanded to just trim everything
var max = this._globalOptions.maxMessageLength;
if (data.message) {
data.message = truncate(data.message, max);
}
if (data.exception) {
var exception = data.exception.values[0];
exception.value = truncate(exception.value, max);
}
var request = data.request;
if (request) {
if (request.url) {
request.url = truncate(request.url, this._globalOptions.maxUrlLength);
}
if (request.Referer) {
request.Referer = truncate(request.Referer, this._globalOptions.maxUrlLength);
}
}
if (data.breadcrumbs && data.breadcrumbs.values)
this._trimBreadcrumbs(data.breadcrumbs);
return data;
},
/**
* Truncate breadcrumb values (right now just URLs)
*/
_trimBreadcrumbs: function(breadcrumbs) {
// known breadcrumb properties with urls
// TODO: also consider arbitrary prop values that start with (https?)?://
var urlProps = ['to', 'from', 'url'],
urlProp,
crumb,
data;
for (var i = 0; i < breadcrumbs.values.length; ++i) {
crumb = breadcrumbs.values[i];
if (
!crumb.hasOwnProperty('data') ||
!isObject(crumb.data) ||
objectFrozen(crumb.data)
)
continue;
data = objectMerge({}, crumb.data);
for (var j = 0; j < urlProps.length; ++j) {
urlProp = urlProps[j];
if (data.hasOwnProperty(urlProp) && data[urlProp]) {
data[urlProp] = truncate(data[urlProp], this._globalOptions.maxUrlLength);
}
}
breadcrumbs.values[i].data = data;
}
},
_getHttpData: function() {
if (!this._hasNavigator && !this._hasDocument) return;
var httpData = {};
if (this._hasNavigator && _navigator.userAgent) {
httpData.headers = {
'User-Agent': navigator.userAgent
};
}
// Check in `window` instead of `document`, as we may be in ServiceWorker environment
if (_window.location && _window.location.href) {
httpData.url = _window.location.href;
}
if (this._hasDocument && _document.referrer) {
if (!httpData.headers) httpData.headers = {};
httpData.headers.Referer = _document.referrer;
}
return httpData;
},
_resetBackoff: function() {
this._backoffDuration = 0;
this._backoffStart = null;
},
_shouldBackoff: function() {
return this._backoffDuration && now() - this._backoffStart < this._backoffDuration;
},
/**
* Returns true if the in-process data payload matches the signature
* of the previously-sent data
*
* NOTE: This has to be done at this level because TraceKit can generate
* data from window.onerror WITHOUT an exception object (IE8, IE9,
* other old browsers). This can take the form of an "exception"
* data object with a single frame (derived from the onerror args).
*/
_isRepeatData: function(current) {
var last = this._lastData;
if (
!last ||
current.message !== last.message || // defined for captureMessage
current.culprit !== last.culprit // defined for captureException/onerror
)
return false;
// Stacktrace interface (i.e. from captureMessage)
if (current.stacktrace || last.stacktrace) {
return isSameStacktrace(current.stacktrace, last.stacktrace);
} else if (current.exception || last.exception) {
// Exception interface (i.e. from captureException/onerror)
return isSameException(current.exception, last.exception);
}
return true;
},
_setBackoffState: function(request) {
// If we are already in a backoff state, don't change anything
if (this._shouldBackoff()) {
return;
}
var status = request.status;
// 400 - project_id doesn't exist or some other fatal
// 401 - invalid/revoked dsn
// 429 - too many requests
if (!(status === 400 || status === 401 || status === 429)) return;
var retry;
try {
// If Retry-After is not in Access-Control-Expose-Headers, most
// browsers will throw an exception trying to access it
if (supportsFetch()) {
retry = request.headers.get('Retry-After');
} else {
retry = request.getResponseHeader('Retry-After');
}
// Retry-After is returned in seconds
retry = parseInt(retry, 10) * 1000;
} catch (e) {
/* eslint no-empty:0 */
}
this._backoffDuration = retry
? // If Sentry server returned a Retry-After value, use it
retry
: // Otherwise, double the last backoff duration (starts at 1 sec)
this._backoffDuration * 2 || 1000;
this._backoffStart = now();
},
_send: function(data) {
var globalOptions = this._globalOptions;
var baseData = {
project: this._globalProject,
logger: globalOptions.logger,
platform: 'javascript'
},
httpData = this._getHttpData();
if (httpData) {
baseData.request = httpData;
}
// HACK: delete `trimHeadFrames` to prevent from appearing in outbound payload
if (data.trimHeadFrames) delete data.trimHeadFrames;
data = objectMerge(baseData, data);
// Merge in the tags and extra separately since objectMerge doesn't handle a deep merge
data.tags = objectMerge(objectMerge({}, this._globalContext.tags), data.tags);
data.extra = objectMerge(objectMerge({}, this._globalContext.extra), data.extra);
// Send along our own collected metadata with extra
data.extra['session:duration'] = now() - this._startTime;
if (this._breadcrumbs && this._breadcrumbs.length > 0) {
// intentionally make shallow copy so that additions
// to breadcrumbs aren't accidentally sent in this request
data.breadcrumbs = {
values: [].slice.call(this._breadcrumbs, 0)
};
}
if (this._globalContext.user) {
// sentry.interfaces.User
data.user = this._globalContext.user;
}
// Include the environment if it's defined in globalOptions
if (globalOptions.environment) data.environment = globalOptions.environment;
// Include the release if it's defined in globalOptions
if (globalOptions.release) data.release = globalOptions.release;
// Include server_name if it's defined in globalOptions
if (globalOptions.serverName) data.server_name = globalOptions.serverName;
data = this._sanitizeData(data);
// Cleanup empty properties before sending them to the server
Object.keys(data).forEach(function(key) {
if (data[key] == null || data[key] === '' || isEmptyObject(data[key])) {
delete data[key];
}
});
if (isFunction(globalOptions.dataCallback)) {
data = globalOptions.dataCallback(data) || data;
}
// Why??????????
if (!data || isEmptyObject(data)) {
return;
}
// Check if the request should be filtered or not
if (
isFunction(globalOptions.shouldSendCallback) &&
!globalOptions.shouldSendCallback(data)
) {
return;
}
// Backoff state: Sentry server previously responded w/ an error (e.g. 429 - too many requests),
// so drop requests until "cool-off" period has elapsed.
if (this._shouldBackoff()) {
this._logDebug('warn', 'Raven dropped error due to backoff: ', data);
return;
}
if (typeof globalOptions.sampleRate === 'number') {
if (Math.random() < globalOptions.sampleRate) {
this._sendProcessedPayload(data);
}
} else {
this._sendProcessedPayload(data);
}
},
_sanitizeData: function(data) {
return sanitize(data, this._globalOptions.sanitizeKeys);
},
_getUuid: function() {
return uuid4();
},
_sendProcessedPayload: function(data, callback) {
var self = this;
var globalOptions = this._globalOptions;
if (!this.isSetup()) return;
// Try and clean up the packet before sending by truncating long values
data = this._trimPacket(data);
// ideally duplicate error testing should occur *before* dataCallback/shouldSendCallback,
// but this would require copying an un-truncated copy of the data packet, which can be
// arbitrarily deep (extra_data) -- could be worthwhile? will revisit
if (!this._globalOptions.allowDuplicates && this._isRepeatData(data)) {
this._logDebug('warn', 'Raven dropped repeat event: ', data);
return;
}
// Send along an event_id if not explicitly passed.
// This event_id can be used to reference the error within Sentry itself.
// Set lastEventId after we know the error should actually be sent
this._lastEventId = data.event_id || (data.event_id = this._getUuid());
// Store outbound payload after trim
this._lastData = data;
this._logDebug('debug', 'Raven about to send:', data);
var auth = {
sentry_version: '7',
sentry_client: 'raven-js/' + this.VERSION,
sentry_key: this._globalKey
};
if (this._globalSecret) {
auth.sentry_secret = this._globalSecret;
}
var exception = data.exception && data.exception.values[0];
// only capture 'sentry' breadcrumb is autoBreadcrumbs is truthy
if (
this._globalOptions.autoBreadcrumbs &&
this._globalOptions.autoBreadcrumbs.sentry
) {
this.captureBreadcrumb({
category: 'sentry',
message: exception
? (exception.type ? exception.type + ': ' : '') + exception.value
: data.message,
event_id: data.event_id,
level: data.level || 'error' // presume error unless specified
});
}
var url = this._globalEndpoint;
(globalOptions.transport || this._makeRequest).call(this, {
url: url,
auth: auth,
data: data,
options: globalOptions,
onSuccess: function success() {
self._resetBackoff();
self._triggerEvent('success', {
data: data,
src: url
});
callback && callback();
},
onError: function failure(error) {
self._logDebug('error', 'Raven transport failed to send: ', error);
if (error.request) {
self._setBackoffState(error.request);
}
self._triggerEvent('failure', {
data: data,
src: url
});
error = error || new Error('Raven send failed (no additional details provided)');
callback && callback(error);
}
});
},
_makeRequest: function(opts) {
// Auth is intentionally sent as part of query string (NOT as custom HTTP header) to avoid preflight CORS requests
var url = opts.url + '?' + urlencode(opts.auth);
var evaluatedHeaders = null;
var evaluatedFetchParameters = {};
if (opts.options.headers) {
evaluatedHeaders = this._evaluateHash(opts.options.headers);
}
if (opts.options.fetchParameters) {
evaluatedFetchParameters = this._evaluateHash(opts.options.fetchParameters);
}
if (supportsFetch()) {
evaluatedFetchParameters.body = stringify(opts.data);
var defaultFetchOptions = objectMerge({}, this._fetchDefaults);
var fetchOptions = objectMerge(defaultFetchOptions, evaluatedFetchParameters);
if (evaluatedHeaders) {
fetchOptions.headers = evaluatedHeaders;
}
return _window
.fetch(url, fetchOptions)
.then(function(response) {
if (response.ok) {
opts.onSuccess && opts.onSuccess();
} else {
var error = new Error('Sentry error code: ' + response.status);
// It's called request only to keep compatibility with XHR interface
// and not add more redundant checks in setBackoffState method
error.request = response;
opts.onError && opts.onError(error);
}
})
['catch'](function() {
opts.onError &&
opts.onError(new Error('Sentry error code: network unavailable'));
});
}
var request = _window.XMLHttpRequest && new _window.XMLHttpRequest();
if (!request) return;
// if browser doesn't support CORS (e.g. IE7), we are out of luck
var hasCORS = 'withCredentials' in request || typeof XDomainRequest !== 'undefined';
if (!hasCORS) return;
if ('withCredentials' in request) {
request.onreadystatechange = function() {
if (request.readyState !== 4) {
return;
} else if (request.status === 200) {
opts.onSuccess && opts.onSuccess();
} else if (opts.onError) {
var err = new Error('Sentry error code: ' + request.status);
err.request = request;
opts.onError(err);
}
};
} else {
request = new XDomainRequest();
// xdomainrequest cannot go http -> https (or vice versa),
// so always use protocol relative
url = url.replace(/^https?:/, '');
// onreadystatechange not supported by XDomainRequest
if (opts.onSuccess) {
request.onload = opts.onSuccess;
}
if (opts.onError) {
request.onerror = function() {
var err = new Error('Sentry error code: XDomainRequest');
err.request = request;
opts.onError(err);
};
}
}
request.open('POST', url);
if (evaluatedHeaders) {
each(evaluatedHeaders, function(key, value) {
request.setRequestHeader(key, value);
});
}
request.send(stringify(opts.data));
},
_evaluateHash: function(hash) {
var evaluated = {};
for (var key in hash) {
if (hash.hasOwnProperty(key)) {
var value = hash[key];
evaluated[key] = typeof value === 'function' ? value() : value;
}
}
return evaluated;
},
_logDebug: function(level) {
if (this._originalConsoleMethods[level] && this.debug) {
// In IE<10 console methods do not have their own 'apply' method
Function.prototype.apply.call(
this._originalConsoleMethods[level],
this._originalConsole,
[].slice.call(arguments, 1)
);
}
},
_mergeContext: function(key, context) {
if (isUndefined(context)) {
delete this._globalContext[key];
} else {
this._globalContext[key] = objectMerge(this._globalContext[key] || {}, context);
}
}
};
// Deprecations
Raven.prototype.setUser = Raven.prototype.setUserContext;
Raven.prototype.setReleaseContext = Raven.prototype.setRelease;
module.exports = Raven;
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"1":1,"2":2,"5":5,"6":6,"7":7,"8":8}],4:[function(_dereq_,module,exports){
(function (global){
/**
* Enforces a single instance of the Raven client, and the
* main entry point for Raven. If you are a consumer of the
* Raven library, you SHOULD load this file (vs raven.js).
**/
var RavenConstructor = _dereq_(3);
// This is to be defensive in environments where window does not exist (see https://github.com/getsentry/raven-js/pull/785)
var _window =
typeof window !== 'undefined'
? window
: typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
var _Raven = _window.Raven;
var Raven = new RavenConstructor();
/*
* Allow multiple versions of Raven to be installed.
* Strip Raven from the global context and returns the instance.
*
* @return {Raven}
*/
Raven.noConflict = function() {
_window.Raven = _Raven;
return Raven;
};
Raven.afterLoad();
module.exports = Raven;
/**
* DISCLAIMER:
*
* Expose `Client` constructor for cases where user want to track multiple "sub-applications" in one larger app.
* It's not meant to be used by a wide audience, so pleaaase make sure that you know what you're doing before using it.
* Accidentally calling `install` multiple times, may result in an unexpected behavior that's very hard to debug.
*
* It's called `Client' to be in-line with Raven Node implementation.
*
* HOWTO:
*
* import Raven from 'raven-js';
*
* const someAppReporter = new Raven.Client();
* const someOtherAppReporter = new Raven.Client();
*
* someAppReporter.config('__DSN__', {
* ...config goes here
* });
*
* someOtherAppReporter.config('__OTHER_DSN__', {
* ...config goes here
* });
*
* someAppReporter.captureMessage(...);
* someAppReporter.captureException(...);
* someAppReporter.captureBreadcrumb(...);
*
* someOtherAppReporter.captureMessage(...);
* someOtherAppReporter.captureException(...);
* someOtherAppReporter.captureBreadcrumb(...);
*
* It should "just work".
*/
module.exports.Client = RavenConstructor;
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"3":3}],5:[function(_dereq_,module,exports){
(function (global){
var stringify = _dereq_(7);
var _window =
typeof window !== 'undefined'
? window
: typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
function isObject(what) {
return typeof what === 'object' && what !== null;
}
// Yanked from https://git.io/vS8DV re-used under CC0
// with some tiny modifications
function isError(value) {
switch ({}.toString.call(value)) {
case '[object Error]':
return true;
case '[object Exception]':
return true;
case '[object DOMException]':
return true;
default:
return value instanceof Error;
}
}
function isErrorEvent(value) {
return supportsErrorEvent() && {}.toString.call(value) === '[object ErrorEvent]';
}
function isUndefined(what) {
return what === void 0;
}
function isFunction(what) {
return typeof what === 'function';
}
function isPlainObject(what) {
return Object.prototype.toString.call(what) === '[object Object]';
}
function isString(what) {
return Object.prototype.toString.call(what) === '[object String]';
}
function isArray(what) {
return Object.prototype.toString.call(what) === '[object Array]';
}
function isEmptyObject(what) {
if (!isPlainObject(what)) return false;
for (var _ in what) {
if (what.hasOwnProperty(_)) {
return false;
}
}
return true;
}
function supportsErrorEvent() {
try {
new ErrorEvent(''); // eslint-disable-line no-new
return true;
} catch (e) {
return false;
}
}
function supportsFetch() {
if (!('fetch' in _window)) return false;
try {
new Headers(); // eslint-disable-line no-new
new Request(''); // eslint-disable-line no-new
new Response(); // eslint-disable-line no-new
return true;
} catch (e) {
return false;
}
}
// Despite all stars in the sky saying that Edge supports old draft syntax, aka 'never', 'always', 'origin' and 'default
// https://caniuse.com/#feat=referrer-policy
// It doesn't. And it throw exception instead of ignoring this parameter...
// REF: https://github.com/getsentry/raven-js/issues/1233
function supportsReferrerPolicy() {
if (!supportsFetch()) return false;
try {
// eslint-disable-next-line no-new
new Request('pickleRick', {
referrerPolicy: 'origin'
});
return true;
} catch (e) {
return false;
}
}
function supportsPromiseRejectionEvent() {
return typeof PromiseRejectionEvent === 'function';
}
function wrappedCallback(callback) {
function dataCallback(data, original) {
var normalizedData = callback(data) || data;
if (original) {
return original(normalizedData) || normalizedData;
}
return normalizedData;
}
return dataCallback;
}
function each(obj, callback) {
var i, j;
if (isUndefined(obj.length)) {
for (i in obj) {
if (hasKey(obj, i)) {
callback.call(null, i, obj[i]);
}
}
} else {
j = obj.length;
if (j) {
for (i = 0; i < j; i++) {
callback.call(null, i, obj[i]);
}
}
}
}
function objectMerge(obj1, obj2) {
if (!obj2) {
return obj1;
}
each(obj2, function(key, value) {
obj1[key] = value;
});
return obj1;
}
/**
* This function is only used for react-native.
* react-native freezes object that have already been sent over the
* js bridge. We need this function in order to check if the object is frozen.
* So it's ok that objectFrozen returns false if Object.isFrozen is not
* supported because it's not relevant for other "platforms". See related issue:
* https://github.com/getsentry/react-native-sentry/issues/57
*/
function objectFrozen(obj) {
if (!Object.isFrozen) {
return false;
}
return Object.isFrozen(obj);
}
function truncate(str, max) {
return !max || str.length <= max ? str : str.substr(0, max) + '\u2026';
}
/**
* hasKey, a better form of hasOwnProperty
* Example: hasKey(MainHostObject, property) === true/false
*
* @param {Object} host object to check property
* @param {string} key to check
*/
function hasKey(object, key) {
return Object.prototype.hasOwnProperty.call(object, key);
}
function joinRegExp(patterns) {
// Combine an array of regular expressions and strings into one large regexp
// Be mad.
var sources = [],
i = 0,
len = patterns.length,
pattern;
for (; i < len; i++) {
pattern = patterns[i];
if (isString(pattern)) {
// If it's a string, we need to escape it
// Taken from: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
sources.push(pattern.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, '\\$1'));
} else if (pattern && pattern.source) {
// If it's a regexp already, we want to extract the source
sources.push(pattern.source);
}
// Intentionally skip other cases
}
return new RegExp(sources.join('|'), 'i');
}
function urlencode(o) {
var pairs = [];
each(o, function(key, value) {
pairs.push(encodeURIComponent(key) + '=' + encodeURIComponent(value));
});
return pairs.join('&');
}
// borrowed from https://tools.ietf.org/html/rfc3986#appendix-B
// intentionally using regex and not <a/> href parsing trick because React Native and other
// environments where DOM might not be available
function parseUrl(url) {
if (typeof url !== 'string') return {};
var match = url.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);
// coerce to undefined values to empty string so we don't get 'undefined'
var query = match[6] || '';
var fragment = match[8] || '';
return {
protocol: match[2],
host: match[4],
path: match[5],
relative: match[5] + query + fragment // everything minus origin
};
}
function uuid4() {
var crypto = _window.crypto || _window.msCrypto;
if (!isUndefined(crypto) && crypto.getRandomValues) {
// Use window.crypto API if available
// eslint-disable-next-line no-undef
var arr = new Uint16Array(8);
crypto.getRandomValues(arr);
// set 4 in byte 7
arr[3] = (arr[3] & 0xfff) | 0x4000;
// set 2 most significant bits of byte 9 to '10'
arr[4] = (arr[4] & 0x3fff) | 0x8000;
var pad = function(num) {
var v = num.toString(16);
while (v.length < 4) {
v = '0' + v;
}
return v;
};
return (
pad(arr[0]) +
pad(arr[1]) +
pad(arr[2]) +
pad(arr[3]) +
pad(arr[4]) +
pad(arr[5]) +
pad(arr[6]) +
pad(arr[7])
);
} else {
// http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#2117523
return 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = (Math.random() * 16) | 0,
v = c === 'x' ? r : (r & 0x3) | 0x8;
return v.toString(16);
});
}
}
/**
* Given a child DOM element, returns a query-selector statement describing that
* and its ancestors
* e.g. [HTMLElement] => body > div > input#foo.btn[name=baz]
* @param elem
* @returns {string}
*/
function htmlTreeAsString(elem) {
/* eslint no-extra-parens:0*/
var MAX_TRAVERSE_HEIGHT = 5,
MAX_OUTPUT_LEN = 80,
out = [],
height = 0,
len = 0,
separator = ' > ',
sepLength = separator.length,
nextStr;
while (elem && height++ < MAX_TRAVERSE_HEIGHT) {
nextStr = htmlElementAsString(elem);
// bail out if
// - nextStr is the 'html' element
// - the length of the string that would be created exceeds MAX_OUTPUT_LEN
// (ignore this limit if we are on the first iteration)
if (
nextStr === 'html' ||
(height > 1 && len + out.length * sepLength + nextStr.length >= MAX_OUTPUT_LEN)
) {
break;
}
out.push(nextStr);
len += nextStr.length;
elem = elem.parentNode;
}
return out.reverse().join(separator);
}
/**
* Returns a simple, query-selector representation of a DOM element
* e.g. [HTMLElement] => input#foo.btn[name=baz]
* @param HTMLElement
* @returns {string}
*/
function htmlElementAsString(elem) {
var out = [],
className,
classes,
key,
attr,
i;
if (!elem || !elem.tagName) {
return '';
}
out.push(elem.tagName.toLowerCase());
if (elem.id) {
out.push('#' + elem.id);
}
className = elem.className;
if (className && isString(className)) {
classes = className.split(/\s+/);
for (i = 0; i < classes.length; i++) {
out.push('.' + classes[i]);
}
}
var attrWhitelist = ['type', 'name', 'title', 'alt'];
for (i = 0; i < attrWhitelist.length; i++) {
key = attrWhitelist[i];
attr = elem.getAttribute(key);
if (attr) {
out.push('[' + key + '="' + attr + '"]');
}
}
return out.join('');
}
/**
* Returns true if either a OR b is truthy, but not both
*/
function isOnlyOneTruthy(a, b) {
return !!(!!a ^ !!b);
}
/**
* Returns true if both parameters are undefined
*/
function isBothUndefined(a, b) {
return isUndefined(a) && isUndefined(b);
}
/**
* Returns true if the two input exception interfaces have the same content
*/
function isSameException(ex1, ex2) {
if (isOnlyOneTruthy(ex1, ex2)) return false;
ex1 = ex1.values[0];
ex2 = ex2.values[0];
if (ex1.type !== ex2.type || ex1.value !== ex2.value) return false;
// in case both stacktraces are undefined, we can't decide so default to false
if (isBothUndefined(ex1.stacktrace, ex2.stacktrace)) return false;
return isSameStacktrace(ex1.stacktrace, ex2.stacktrace);
}
/**
* Returns true if the two input stack trace interfaces have the same content
*/
function isSameStacktrace(stack1, stack2) {
if (isOnlyOneTruthy(stack1, stack2)) return false;
var frames1 = stack1.frames;
var frames2 = stack2.frames;
// Exit early if frame count differs
if (frames1.length !== frames2.length) return false;
// Iterate through every frame; bail out if anything differs
var a, b;
for (var i = 0; i < frames1.length; i++) {
a = frames1[i];
b = frames2[i];
if (
a.filename !== b.filename ||
a.lineno !== b.lineno ||
a.colno !== b.colno ||
a['function'] !== b['function']
)
return false;
}
return true;
}
/**
* Polyfill a method
* @param obj object e.g. `document`
* @param name method name present on object e.g. `addEventListener`
* @param replacement replacement function
* @param track {optional} record instrumentation to an array
*/
function fill(obj, name, replacement, track) {
if (obj == null) return;
var orig = obj[name];
obj[name] = replacement(orig);
obj[name].__raven__ = true;
obj[name].__orig__ = orig;
if (track) {
track.push([obj, name, orig]);
}
}
/**
* Join values in array
* @param input array of values to be joined together
* @param delimiter string to be placed in-between values
* @returns {string}
*/
function safeJoin(input, delimiter) {
if (!isArray(input)) return '';
var output = [];
for (var i = 0; i < input.length; i++) {
try {
output.push(String(input[i]));
} catch (e) {
output.push('[value cannot be serialized]');
}
}
return output.join(delimiter);
}
// Default Node.js REPL depth
var MAX_SERIALIZE_EXCEPTION_DEPTH = 3;
// 50kB, as 100kB is max payload size, so half sounds reasonable
var MAX_SERIALIZE_EXCEPTION_SIZE = 50 * 1024;
var MAX_SERIALIZE_KEYS_LENGTH = 40;
function utf8Length(value) {
return ~-encodeURI(value).split(/%..|./).length;
}
function jsonSize(value) {
return utf8Length(JSON.stringify(value));
}
function serializeValue(value) {
var maxLength = 40;
if (typeof value === 'string') {
return value.length <= maxLength ? value : value.substr(0, maxLength - 1) + '\u2026';
} else if (
typeof value === 'number' ||
typeof value === 'boolean' ||
typeof value === 'undefined'
) {
return value;
}
var type = Object.prototype.toString.call(value);
// Node.js REPL notation
if (type === '[object Object]') return '[Object]';
if (type === '[object Array]') return '[Array]';
if (type === '[object Function]')
return value.name ? '[Function: ' + value.name + ']' : '[Function]';
return value;
}
function serializeObject(value, depth) {
if (depth === 0) return serializeValue(value);
if (isPlainObject(value)) {
return Object.keys(value).reduce(function(acc, key) {
acc[key] = serializeObject(value[key], depth - 1);
return acc;
}, {});
} else if (Array.isArray(value)) {
return value.map(function(val) {
return serializeObject(val, depth - 1);
});
}
return serializeValue(value);
}
function serializeException(ex, depth, maxSize) {
if (!isPlainObject(ex)) return ex;
depth = typeof depth !== 'number' ? MAX_SERIALIZE_EXCEPTION_DEPTH : depth;
maxSize = typeof depth !== 'number' ? MAX_SERIALIZE_EXCEPTION_SIZE : maxSize;
var serialized = serializeObject(ex, depth);
if (jsonSize(stringify(serialized)) > maxSize) {
return serializeException(ex, depth - 1);
}
return serialized;
}
function serializeKeysForMessage(keys, maxLength) {
if (typeof keys === 'number' || typeof keys === 'string') return keys.toString();
if (!Array.isArray(keys)) return '';
keys = keys.filter(function(key) {
return typeof key === 'string';
});
if (keys.length === 0) return '[object has no keys]';
maxLength = typeof maxLength !== 'number' ? MAX_SERIALIZE_KEYS_LENGTH : maxLength;
if (keys[0].length >= maxLength) return keys[0];
for (var usedKeys = keys.length; usedKeys > 0; usedKeys--) {
var serialized = keys.slice(0, usedKeys).join(', ');
if (serialized.length > maxLength) continue;
if (usedKeys === keys.length) return serialized;
return serialized + '\u2026';
}
return '';
}
function sanitize(input, sanitizeKeys) {
if (!isArray(sanitizeKeys) || (isArray(sanitizeKeys) && sanitizeKeys.length === 0))
return input;
var sanitizeRegExp = joinRegExp(sanitizeKeys);
var sanitizeMask = '********';
var safeInput;
try {
safeInput = JSON.parse(stringify(input));
} catch (o_O) {
return input;
}
function sanitizeWorker(workerInput) {
if (isArray(workerInput)) {
return workerInput.map(function(val) {
return sanitizeWorker(val);
});
}
if (isPlainObject(workerInput)) {
return Object.keys(workerInput).reduce(function(acc, k) {
if (sanitizeRegExp.test(k)) {
acc[k] = sanitizeMask;
} else {
acc[k] = sanitizeWorker(workerInput[k]);
}
return acc;
}, {});
}
return workerInput;
}
return sanitizeWorker(safeInput);
}
module.exports = {
isObject: isObject,
isError: isError,
isErrorEvent: isErrorEvent,
isUndefined: isUndefined,
isFunction: isFunction,
isPlainObject: isPlainObject,
isString: isString,
isArray: isArray,
isEmptyObject: isEmptyObject,
supportsErrorEvent: supportsErrorEvent,
supportsFetch: supportsFetch,
supportsReferrerPolicy: supportsReferrerPolicy,
supportsPromiseRejectionEvent: supportsPromiseRejectionEvent,
wrappedCallback: wrappedCallback,
each: each,
objectMerge: objectMerge,
truncate: truncate,
objectFrozen: objectFrozen,
hasKey: hasKey,
joinRegExp: joinRegExp,
urlencode: urlencode,
uuid4: uuid4,
htmlTreeAsString: htmlTreeAsString,
htmlElementAsString: htmlElementAsString,
isSameException: isSameException,
isSameStacktrace: isSameStacktrace,
parseUrl: parseUrl,
fill: fill,
safeJoin: safeJoin,
serializeException: serializeException,
serializeKeysForMessage: serializeKeysForMessage,
sanitize: sanitize
};
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"7":7}],6:[function(_dereq_,module,exports){
(function (global){
var utils = _dereq_(5);
/*
TraceKit - Cross brower stack traces
This was originally forked from github.com/occ/TraceKit, but has since been
largely re-written and is now maintained as part of raven-js. Tests for
this are in test/vendor.
MIT license
*/
var TraceKit = {
collectWindowErrors: true,
debug: false
};
// This is to be defensive in environments where window does not exist (see https://github.com/getsentry/raven-js/pull/785)
var _window =
typeof window !== 'undefined'
? window
: typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
// global reference to slice
var _slice = [].slice;
var UNKNOWN_FUNCTION = '?';
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Error_types
var ERROR_TYPES_RE = /^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/;
function getLocationHref() {
if (typeof document === 'undefined' || document.location == null) return '';
return document.location.href;
}
/**
* TraceKit.report: cross-browser processing of unhandled exceptions
*
* Syntax:
* TraceKit.report.subscribe(function(stackInfo) { ... })
* TraceKit.report.unsubscribe(function(stackInfo) { ... })
* TraceKit.report(exception)
* try { ...code... } catch(ex) { TraceKit.report(ex); }
*
* Supports:
* - Firefox: full stack trace with line numbers, plus column number
* on top frame; column number is not guaranteed
* - Opera: full stack trace with line and column numbers
* - Chrome: full stack trace with line and column numbers
* - Safari: line and column number for the top frame only; some frames
* may be missing, and column number is not guaranteed
* - IE: line and column number for the top frame only; some frames
* may be missing, and column number is not guaranteed
*
* In theory, TraceKit should work on all of the following versions:
* - IE5.5+ (only 8.0 tested)
* - Firefox 0.9+ (only 3.5+ tested)
* - Opera 7+ (only 10.50 tested; versions 9 and earlier may require
* Exceptions Have Stacktrace to be enabled in opera:config)
* - Safari 3+ (only 4+ tested)
* - Chrome 1+ (only 5+ tested)
* - Konqueror 3.5+ (untested)
*
* Requires TraceKit.computeStackTrace.
*
* Tries to catch all unhandled exceptions and report them to the
* subscribed handlers. Please note that TraceKit.report will rethrow the
* exception. This is REQUIRED in order to get a useful stack trace in IE.
* If the exception does not reach the top of the browser, you will only
* get a stack trace from the point where TraceKit.report was called.
*
* Handlers receive a stackInfo object as described in the
* TraceKit.computeStackTrace docs.
*/
TraceKit.report = (function reportModuleWrapper() {
var handlers = [],
lastArgs = null,
lastException = null,
lastExceptionStack = null;
/**
* Add a crash handler.
* @param {Function} handler
*/
function subscribe(handler) {
installGlobalHandler();
handlers.push(handler);
}
/**
* Remove a crash handler.
* @param {Function} handler
*/
function unsubscribe(handler) {
for (var i = handlers.length - 1; i >= 0; --i) {
if (handlers[i] === handler) {
handlers.splice(i, 1);
}
}
}
/**
* Remove all crash handlers.
*/
function unsubscribeAll() {
uninstallGlobalHandler();
handlers = [];
}
/**
* Dispatch stack information to all handlers.
* @param {Object.<string, *>} stack
*/
function notifyHandlers(stack, isWindowError) {
var exception = null;
if (isWindowError && !TraceKit.collectWindowErrors) {
return;
}
for (var i in handlers) {
if (handlers.hasOwnProperty(i)) {
try {
handlers[i].apply(null, [stack].concat(_slice.call(arguments, 2)));
} catch (inner) {
exception = inner;
}
}
}
if (exception) {
throw exception;
}
}
var _oldOnerrorHandler, _onErrorHandlerInstalled;
/**
* Ensures all global unhandled exceptions are recorded.
* Supported by Gecko and IE.
* @param {string} msg Error message.
* @param {string} url URL of script that generated the exception.
* @param {(number|string)} lineNo The line number at which the error
* occurred.
* @param {?(number|string)} colNo The column number at which the error
* occurred.
* @param {?Error} ex The actual Error object.
*/
function traceKitWindowOnError(msg, url, lineNo, colNo, ex) {
var stack = null;
// If 'ex' is ErrorEvent, get real Error from inside
var exception = utils.isErrorEvent(ex) ? ex.error : ex;
// If 'msg' is ErrorEvent, get real message from inside
var message = utils.isErrorEvent(msg) ? msg.message : msg;
if (lastExceptionStack) {
TraceKit.computeStackTrace.augmentStackTraceWithInitialElement(
lastExceptionStack,
url,
lineNo,
message
);
processLastException();
} else if (exception && utils.isError(exception)) {
// non-string `exception` arg; attempt to extract stack trace
// New chrome and blink send along a real error object
// Let's just report that like a normal error.
// See: https://mikewest.org/2013/08/debugging-runtime-errors-with-window-onerror
stack = TraceKit.computeStackTrace(exception);
notifyHandlers(stack, true);
} else {
var location = {
url: url,
line: lineNo,
column: colNo
};
var name = undefined;
var groups;
if ({}.toString.call(message) === '[object String]') {
var groups = message.match(ERROR_TYPES_RE);
if (groups) {
name = groups[1];
message = groups[2];
}
}
location.func = UNKNOWN_FUNCTION;
stack = {
name: name,
message: message,
url: getLocationHref(),
stack: [location]
};
notifyHandlers(stack, true);
}
if (_oldOnerrorHandler) {
return _oldOnerrorHandler.apply(this, arguments);
}
return false;
}
function installGlobalHandler() {
if (_onErrorHandlerInstalled) {
return;
}
_oldOnerrorHandler = _window.onerror;
_window.onerror = traceKitWindowOnError;
_onErrorHandlerInstalled = true;
}
function uninstallGlobalHandler() {
if (!_onErrorHandlerInstalled) {
return;
}
_window.onerror = _oldOnerrorHandler;
_onErrorHandlerInstalled = false;
_oldOnerrorHandler = undefined;
}
function processLastException() {
var _lastExceptionStack = lastExceptionStack,
_lastArgs = lastArgs;
lastArgs = null;
lastExceptionStack = null;
lastException = null;
notifyHandlers.apply(null, [_lastExceptionStack, false].concat(_lastArgs));
}
/**
* Reports an unhandled Error to TraceKit.
* @param {Error} ex
* @param {?boolean} rethrow If false, do not re-throw the exception.
* Only used for window.onerror to not cause an infinite loop of
* rethrowing.
*/
function report(ex, rethrow) {
var args = _slice.call(arguments, 1);
if (lastExceptionStack) {
if (lastException === ex) {
return; // already caught by an inner catch block, ignore
} else {
processLastException();
}
}
var stack = TraceKit.computeStackTrace(ex);
lastExceptionStack = stack;
lastException = ex;
lastArgs = args;
// If the stack trace is incomplete, wait for 2 seconds for
// slow slow IE to see if onerror occurs or not before reporting
// this exception; otherwise, we will end up with an incomplete
// stack trace
setTimeout(function() {
if (lastException === ex) {
processLastException();
}
}, stack.incomplete ? 2000 : 0);
if (rethrow !== false) {
throw ex; // re-throw to propagate to the top level (and cause window.onerror)
}
}
report.subscribe = subscribe;
report.unsubscribe = unsubscribe;
report.uninstall = unsubscribeAll;
return report;
})();
/**
* TraceKit.computeStackTrace: cross-browser stack traces in JavaScript
*
* Syntax:
* s = TraceKit.computeStackTrace(exception) // consider using TraceKit.report instead (see below)
* Returns:
* s.name - exception name
* s.message - exception message
* s.stack[i].url - JavaScript or HTML file URL
* s.stack[i].func - function name, or empty for anonymous functions (if guessing did not work)
* s.stack[i].args - arguments passed to the function, if known
* s.stack[i].line - line number, if known
* s.stack[i].column - column number, if known
*
* Supports:
* - Firefox: full stack trace with line numbers and unreliable column
* number on top frame
* - Opera 10: full stack trace with line and column numbers
* - Opera 9-: full stack trace with line numbers
* - Chrome: full stack trace with line and column numbers
* - Safari: line and column number for the topmost stacktrace element
* only
* - IE: no line numbers whatsoever
*
* Tries to guess names of anonymous functions by looking for assignments
* in the source code. In IE and Safari, we have to guess source file names
* by searching for function bodies inside all page scripts. This will not
* work for scripts that are loaded cross-domain.
* Here be dragons: some function names may be guessed incorrectly, and
* duplicate functions may be mismatched.
*
* TraceKit.computeStackTrace should only be used for tracing purposes.
* Logging of unhandled exceptions should be done with TraceKit.report,
* which builds on top of TraceKit.computeStackTrace and provides better
* IE support by utilizing the window.onerror event to retrieve information
* about the top of the stack.
*
* Note: In IE and Safari, no stack trace is recorded on the Error object,
* so computeStackTrace instead walks its *own* chain of callers.
* This means that:
* * in Safari, some methods may be missing from the stack trace;
* * in IE, the topmost function in the stack trace will always be the
* caller of computeStackTrace.
*
* This is okay for tracing (because you are likely to be calling
* computeStackTrace from the function you want to be the topmost element
* of the stack trace anyway), but not okay for logging unhandled
* exceptions (because your catch block will likely be far away from the
* inner function that actually caused the exception).
*
*/
TraceKit.computeStackTrace = (function computeStackTraceWrapper() {
// Contents of Exception in various browsers.
//
// SAFARI:
// ex.message = Can't find variable: qq
// ex.line = 59
// ex.sourceId = 580238192
// ex.sourceURL = http://...
// ex.expressionBeginOffset = 96
// ex.expressionCaretOffset = 98
// ex.expressionEndOffset = 98
// ex.name = ReferenceError
//
// FIREFOX:
// ex.message = qq is not defined
// ex.fileName = http://...
// ex.lineNumber = 59
// ex.columnNumber = 69
// ex.stack = ...stack trace... (see the example below)
// ex.name = ReferenceError
//
// CHROME:
// ex.message = qq is not defined
// ex.name = ReferenceError
// ex.type = not_defined
// ex.arguments = ['aa']
// ex.stack = ...stack trace...
//
// INTERNET EXPLORER:
// ex.message = ...
// ex.name = ReferenceError
//
// OPERA:
// ex.message = ...message... (see the example below)
// ex.name = ReferenceError
// ex.opera#sourceloc = 11 (pretty much useless, duplicates the info in ex.message)
// ex.stacktrace = n/a; see 'opera:config#UserPrefs|Exceptions Have Stacktrace'
/**
* Computes stack trace information from the stack property.
* Chrome and Gecko use this property.
* @param {Error} ex
* @return {?Object.<string, *>} Stack trace information.
*/
function computeStackTraceFromStackProp(ex) {
if (typeof ex.stack === 'undefined' || !ex.stack) return;
var chrome = /^\s*at (?:(.*?) ?\()?((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|[a-z]:|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i;
var winjs = /^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx(?:-web)|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;
// NOTE: blob urls are now supposed to always have an origin, therefore it's format
// which is `blob:http://url/path/with-some-uuid`, is matched by `blob.*?:\/` as well
var gecko = /^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|moz-extension).*?:\/.*?|\[native code\]|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i;
// Used to additionally parse URL/line/column from eval frames
var geckoEval = /(\S+) line (\d+)(?: > eval line \d+)* > eval/i;
var chromeEval = /\((\S*)(?::(\d+))(?::(\d+))\)/;
var lines = ex.stack.split('\n');
var stack = [];
var submatch;
var parts;
var element;
var reference = /^(.*) is undefined$/.exec(ex.message);
for (var i = 0, j = lines.length; i < j; ++i) {
if ((parts = chrome.exec(lines[i]))) {
var isNative = parts[2] && parts[2].indexOf('native') === 0; // start of line
var isEval = parts[2] && parts[2].indexOf('eval') === 0; // start of line
if (isEval && (submatch = chromeEval.exec(parts[2]))) {
// throw out eval line/column and use top-most line/column number
parts[2] = submatch[1]; // url
parts[3] = submatch[2]; // line
parts[4] = submatch[3]; // column
}
element = {
url: !isNative ? parts[2] : null,
func: parts[1] || UNKNOWN_FUNCTION,
args: isNative ? [parts[2]] : [],
line: parts[3] ? +parts[3] : null,
column: parts[4] ? +parts[4] : null
};
} else if ((parts = winjs.exec(lines[i]))) {
element = {
url: parts[2],
func: parts[1] || UNKNOWN_FUNCTION,
args: [],
line: +parts[3],
column: parts[4] ? +parts[4] : null
};
} else if ((parts = gecko.exec(lines[i]))) {
var isEval = parts[3] && parts[3].indexOf(' > eval') > -1;
if (isEval && (submatch = geckoEval.exec(parts[3]))) {
// throw out eval line/column and use top-most line number
parts[3] = submatch[1];
parts[4] = submatch[2];
parts[5] = null; // no column when eval
} else if (i === 0 && !parts[5] && typeof ex.columnNumber !== 'undefined') {
// FireFox uses this awesome columnNumber property for its top frame
// Also note, Firefox's column number is 0-based and everything else expects 1-based,
// so adding 1
// NOTE: this hack doesn't work if top-most frame is eval
stack[0].column = ex.columnNumber + 1;
}
element = {
url: parts[3],
func: parts[1] || UNKNOWN_FUNCTION,
args: parts[2] ? parts[2].split(',') : [],
line: parts[4] ? +parts[4] : null,
column: parts[5] ? +parts[5] : null
};
} else {
continue;
}
if (!element.func && element.line) {
element.func = UNKNOWN_FUNCTION;
}
stack.push(element);
}
if (!stack.length) {
return null;
}
return {
name: ex.name,
message: ex.message,
url: getLocationHref(),
stack: stack
};
}
/**
* Adds information about the first frame to incomplete stack traces.
* Safari and IE require this to get complete data on the first frame.
* @param {Object.<string, *>} stackInfo Stack trace information from
* one of the compute* methods.
* @param {string} url The URL of the script that caused an error.
* @param {(number|string)} lineNo The line number of the script that
* caused an error.
* @param {string=} message The error generated by the browser, which
* hopefully contains the name of the object that caused the error.
* @return {boolean} Whether or not the stack information was
* augmented.
*/
function augmentStackTraceWithInitialElement(stackInfo, url, lineNo, message) {
var initial = {
url: url,
line: lineNo
};
if (initial.url && initial.line) {
stackInfo.incomplete = false;
if (!initial.func) {
initial.func = UNKNOWN_FUNCTION;
}
if (stackInfo.stack.length > 0) {
if (stackInfo.stack[0].url === initial.url) {
if (stackInfo.stack[0].line === initial.line) {
return false; // already in stack trace
} else if (
!stackInfo.stack[0].line &&
stackInfo.stack[0].func === initial.func
) {
stackInfo.stack[0].line = initial.line;
return false;
}
}
}
stackInfo.stack.unshift(initial);
stackInfo.partial = true;
return true;
} else {
stackInfo.incomplete = true;
}
return false;
}
/**
* Computes stack trace information by walking the arguments.caller
* chain at the time the exception occurred. This will cause earlier
* frames to be missed but is the only way to get any stack trace in
* Safari and IE. The top frame is restored by
* {@link augmentStackTraceWithInitialElement}.
* @param {Error} ex
* @return {?Object.<string, *>} Stack trace information.
*/
function computeStackTraceByWalkingCallerChain(ex, depth) {
var functionName = /function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,
stack = [],
funcs = {},
recursion = false,
parts,
item,
source;
for (
var curr = computeStackTraceByWalkingCallerChain.caller;
curr && !recursion;
curr = curr.caller
) {
if (curr === computeStackTrace || curr === TraceKit.report) {
// console.log('skipping internal function');
continue;
}
item = {
url: null,
func: UNKNOWN_FUNCTION,
line: null,
column: null
};
if (curr.name) {
item.func = curr.name;
} else if ((parts = functionName.exec(curr.toString()))) {
item.func = parts[1];
}
if (typeof item.func === 'undefined') {
try {
item.func = parts.input.substring(0, parts.input.indexOf('{'));
} catch (e) {}
}
if (funcs['' + curr]) {
recursion = true;
} else {
funcs['' + curr] = true;
}
stack.push(item);
}
if (depth) {
// console.log('depth is ' + depth);
// console.log('stack is ' + stack.length);
stack.splice(0, depth);
}
var result = {
name: ex.name,
message: ex.message,
url: getLocationHref(),
stack: stack
};
augmentStackTraceWithInitialElement(
result,
ex.sourceURL || ex.fileName,
ex.line || ex.lineNumber,
ex.message || ex.description
);
return result;
}
/**
* Computes a stack trace for an exception.
* @param {Error} ex
* @param {(string|number)=} depth
*/
function computeStackTrace(ex, depth) {
var stack = null;
depth = depth == null ? 0 : +depth;
try {
stack = computeStackTraceFromStackProp(ex);
if (stack) {
return stack;
}
} catch (e) {
if (TraceKit.debug) {
throw e;
}
}
try {
stack = computeStackTraceByWalkingCallerChain(ex, depth + 1);
if (stack) {
return stack;
}
} catch (e) {
if (TraceKit.debug) {
throw e;
}
}
return {
name: ex.name,
message: ex.message,
url: getLocationHref()
};
}
computeStackTrace.augmentStackTraceWithInitialElement = augmentStackTraceWithInitialElement;
computeStackTrace.computeStackTraceFromStackProp = computeStackTraceFromStackProp;
return computeStackTrace;
})();
module.exports = TraceKit;
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
},{"5":5}],7:[function(_dereq_,module,exports){
/*
json-stringify-safe
Like JSON.stringify, but doesn't throw on circular references.
Originally forked from https://github.com/isaacs/json-stringify-safe
version 5.0.1 on 3/8/2017 and modified to handle Errors serialization
and IE8 compatibility. Tests for this are in test/vendor.
ISC license: https://github.com/isaacs/json-stringify-safe/blob/master/LICENSE
*/
exports = module.exports = stringify;
exports.getSerialize = serializer;
function indexOf(haystack, needle) {
for (var i = 0; i < haystack.length; ++i) {
if (haystack[i] === needle) return i;
}
return -1;
}
function stringify(obj, replacer, spaces, cycleReplacer) {
return JSON.stringify(obj, serializer(replacer, cycleReplacer), spaces);
}
// https://github.com/ftlabs/js-abbreviate/blob/fa709e5f139e7770a71827b1893f22418097fbda/index.js#L95-L106
function stringifyError(value) {
var err = {
// These properties are implemented as magical getters and don't show up in for in
stack: value.stack,
message: value.message,
name: value.name
};
for (var i in value) {
if (Object.prototype.hasOwnProperty.call(value, i)) {
err[i] = value[i];
}
}
return err;
}
function serializer(replacer, cycleReplacer) {
var stack = [];
var keys = [];
if (cycleReplacer == null) {
cycleReplacer = function(key, value) {
if (stack[0] === value) {
return '[Circular ~]';
}
return '[Circular ~.' + keys.slice(0, indexOf(stack, value)).join('.') + ']';
};
}
return function(key, value) {
if (stack.length > 0) {
var thisPos = indexOf(stack, this);
~thisPos ? stack.splice(thisPos + 1) : stack.push(this);
~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key);
if (~indexOf(stack, value)) {
value = cycleReplacer.call(this, key, value);
}
} else {
stack.push(value);
}
return replacer == null
? value instanceof Error ? stringifyError(value) : value
: replacer.call(this, key, value);
};
}
},{}],8:[function(_dereq_,module,exports){
/*
* JavaScript MD5
* https://github.com/blueimp/JavaScript-MD5
*
* Copyright 2011, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* https://opensource.org/licenses/MIT
*
* Based on
* A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
* Digest Algorithm, as defined in RFC 1321.
* Version 2.2 Copyright (C) Paul Johnston 1999 - 2009
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
* Distributed under the BSD License
* See http://pajhome.org.uk/crypt/md5 for more info.
*/
/*
* Add integers, wrapping at 2^32. This uses 16-bit operations internally
* to work around bugs in some JS interpreters.
*/
function safeAdd(x, y) {
var lsw = (x & 0xffff) + (y & 0xffff);
var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
return (msw << 16) | (lsw & 0xffff);
}
/*
* Bitwise rotate a 32-bit number to the left.
*/
function bitRotateLeft(num, cnt) {
return (num << cnt) | (num >>> (32 - cnt));
}
/*
* These functions implement the four basic operations the algorithm uses.
*/
function md5cmn(q, a, b, x, s, t) {
return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b);
}
function md5ff(a, b, c, d, x, s, t) {
return md5cmn((b & c) | (~b & d), a, b, x, s, t);
}
function md5gg(a, b, c, d, x, s, t) {
return md5cmn((b & d) | (c & ~d), a, b, x, s, t);
}
function md5hh(a, b, c, d, x, s, t) {
return md5cmn(b ^ c ^ d, a, b, x, s, t);
}
function md5ii(a, b, c, d, x, s, t) {
return md5cmn(c ^ (b | ~d), a, b, x, s, t);
}
/*
* Calculate the MD5 of an array of little-endian words, and a bit length.
*/
function binlMD5(x, len) {
/* append padding */
x[len >> 5] |= 0x80 << (len % 32);
x[(((len + 64) >>> 9) << 4) + 14] = len;
var i;
var olda;
var oldb;
var oldc;
var oldd;
var a = 1732584193;
var b = -271733879;
var c = -1732584194;
var d = 271733878;
for (i = 0; i < x.length; i += 16) {
olda = a;
oldb = b;
oldc = c;
oldd = d;
a = md5ff(a, b, c, d, x[i], 7, -680876936);
d = md5ff(d, a, b, c, x[i + 1], 12, -389564586);
c = md5ff(c, d, a, b, x[i + 2], 17, 606105819);
b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330);
a = md5ff(a, b, c, d, x[i + 4], 7, -176418897);
d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426);
c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341);
b = md5ff(b, c, d, a, x[i + 7], 22, -45705983);
a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416);
d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417);
c = md5ff(c, d, a, b, x[i + 10], 17, -42063);
b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162);
a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682);
d = md5ff(d, a, b, c, x[i + 13], 12, -40341101);
c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290);
b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329);
a = md5gg(a, b, c, d, x[i + 1], 5, -165796510);
d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632);
c = md5gg(c, d, a, b, x[i + 11], 14, 643717713);
b = md5gg(b, c, d, a, x[i], 20, -373897302);
a = md5gg(a, b, c, d, x[i + 5], 5, -701558691);
d = md5gg(d, a, b, c, x[i + 10], 9, 38016083);
c = md5gg(c, d, a, b, x[i + 15], 14, -660478335);
b = md5gg(b, c, d, a, x[i + 4], 20, -405537848);
a = md5gg(a, b, c, d, x[i + 9], 5, 568446438);
d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690);
c = md5gg(c, d, a, b, x[i + 3], 14, -187363961);
b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501);
a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467);
d = md5gg(d, a, b, c, x[i + 2], 9, -51403784);
c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473);
b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734);
a = md5hh(a, b, c, d, x[i + 5], 4, -378558);
d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463);
c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562);
b = md5hh(b, c, d, a, x[i + 14], 23, -35309556);
a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060);
d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353);
c = md5hh(c, d, a, b, x[i + 7], 16, -155497632);
b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640);
a = md5hh(a, b, c, d, x[i + 13], 4, 681279174);
d = md5hh(d, a, b, c, x[i], 11, -358537222);
c = md5hh(c, d, a, b, x[i + 3], 16, -722521979);
b = md5hh(b, c, d, a, x[i + 6], 23, 76029189);
a = md5hh(a, b, c, d, x[i + 9], 4, -640364487);
d = md5hh(d, a, b, c, x[i + 12], 11, -421815835);
c = md5hh(c, d, a, b, x[i + 15], 16, 530742520);
b = md5hh(b, c, d, a, x[i + 2], 23, -995338651);
a = md5ii(a, b, c, d, x[i], 6, -198630844);
d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415);
c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905);
b = md5ii(b, c, d, a, x[i + 5], 21, -57434055);
a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571);
d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606);
c = md5ii(c, d, a, b, x[i + 10], 15, -1051523);
b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799);
a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359);
d = md5ii(d, a, b, c, x[i + 15], 10, -30611744);
c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380);
b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649);
a = md5ii(a, b, c, d, x[i + 4], 6, -145523070);
d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379);
c = md5ii(c, d, a, b, x[i + 2], 15, 718787259);
b = md5ii(b, c, d, a, x[i + 9], 21, -343485551);
a = safeAdd(a, olda);
b = safeAdd(b, oldb);
c = safeAdd(c, oldc);
d = safeAdd(d, oldd);
}
return [a, b, c, d];
}
/*
* Convert an array of little-endian words to a string
*/
function binl2rstr(input) {
var i;
var output = '';
var length32 = input.length * 32;
for (i = 0; i < length32; i += 8) {
output += String.fromCharCode((input[i >> 5] >>> (i % 32)) & 0xff);
}
return output;
}
/*
* Convert a raw string to an array of little-endian words
* Characters >255 have their high-byte silently ignored.
*/
function rstr2binl(input) {
var i;
var output = [];
output[(input.length >> 2) - 1] = undefined;
for (i = 0; i < output.length; i += 1) {
output[i] = 0;
}
var length8 = input.length * 8;
for (i = 0; i < length8; i += 8) {
output[i >> 5] |= (input.charCodeAt(i / 8) & 0xff) << (i % 32);
}
return output;
}
/*
* Calculate the MD5 of a raw string
*/
function rstrMD5(s) {
return binl2rstr(binlMD5(rstr2binl(s), s.length * 8));
}
/*
* Calculate the HMAC-MD5, of a key and some data (raw strings)
*/
function rstrHMACMD5(key, data) {
var i;
var bkey = rstr2binl(key);
var ipad = [];
var opad = [];
var hash;
ipad[15] = opad[15] = undefined;
if (bkey.length > 16) {
bkey = binlMD5(bkey, key.length * 8);
}
for (i = 0; i < 16; i += 1) {
ipad[i] = bkey[i] ^ 0x36363636;
opad[i] = bkey[i] ^ 0x5c5c5c5c;
}
hash = binlMD5(ipad.concat(rstr2binl(data)), 512 + data.length * 8);
return binl2rstr(binlMD5(opad.concat(hash), 512 + 128));
}
/*
* Convert a raw string to a hex string
*/
function rstr2hex(input) {
var hexTab = '0123456789abcdef';
var output = '';
var x;
var i;
for (i = 0; i < input.length; i += 1) {
x = input.charCodeAt(i);
output += hexTab.charAt((x >>> 4) & 0x0f) + hexTab.charAt(x & 0x0f);
}
return output;
}
/*
* Encode a string as utf-8
*/
function str2rstrUTF8(input) {
return unescape(encodeURIComponent(input));
}
/*
* Take string arguments and return either raw or hex encoded strings
*/
function rawMD5(s) {
return rstrMD5(str2rstrUTF8(s));
}
function hexMD5(s) {
return rstr2hex(rawMD5(s));
}
function rawHMACMD5(k, d) {
return rstrHMACMD5(str2rstrUTF8(k), str2rstrUTF8(d));
}
function hexHMACMD5(k, d) {
return rstr2hex(rawHMACMD5(k, d));
}
function md5(string, key, raw) {
if (!key) {
if (!raw) {
return hexMD5(string);
}
return rawMD5(string);
}
if (!raw) {
return hexHMACMD5(key, string);
}
return rawHMACMD5(key, string);
}
module.exports = md5;
},{}]},{},[4])(4)
});
|
test/containers/CounterPage.spec.js
|
SixSecondMonks/sos-electron
|
import { expect } from 'chai';
import React from 'react';
import {
renderIntoDocument,
scryRenderedDOMComponentsWithTag,
findRenderedDOMComponentWithClass,
Simulate
} from 'react-addons-test-utils';
import { Provider } from 'react-redux';
import CounterPage from '../../app/containers/CounterPage';
import configureStore from '../../app/store/configureStore';
function setup(initialState) {
const store = configureStore(initialState);
const app = renderIntoDocument(
<Provider store={store}>
<CounterPage />
</Provider>
);
return {
app,
buttons: scryRenderedDOMComponentsWithTag(app, 'button').map(button => button),
p: findRenderedDOMComponentWithClass(app, 'counter')
};
}
describe('containers', () => {
describe('App', () => {
it('should display initial count', () => {
const { p } = setup();
expect(p.textContent).to.match(/^0$/);
});
it('should display updated count after increment button click', () => {
const { buttons, p } = setup();
Simulate.click(buttons[0]);
expect(p.textContent).to.match(/^1$/);
});
it('should display updated count after descrement button click', () => {
const { buttons, p } = setup();
Simulate.click(buttons[1]);
expect(p.textContent).to.match(/^-1$/);
});
it('shouldnt change if even and if odd button clicked', () => {
const { buttons, p } = setup();
Simulate.click(buttons[2]);
expect(p.textContent).to.match(/^0$/);
});
it('should change if odd and if odd button clicked', () => {
const { buttons, p } = setup({ counter: 1 });
Simulate.click(buttons[2]);
expect(p.textContent).to.match(/^2$/);
});
});
});
|
src/SplitToggle.js
|
mxc/react-bootstrap
|
import React from 'react';
import DropdownToggle from './DropdownToggle';
export default class SplitToggle extends React.Component {
render() {
return (
<DropdownToggle
{...this.props}
useAnchor={false}
noCaret={false}
/>
);
}
}
SplitToggle.defaultProps = DropdownToggle.defaultProps;
|
app/javascript/mastodon/features/compose/index.js
|
pfm-eyesightjp/mastodon
|
import React from 'react';
import ComposeFormContainer from './containers/compose_form_container';
import NavigationContainer from './containers/navigation_container';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { connect } from 'react-redux';
import { mountCompose, unmountCompose } from '../../actions/compose';
import Link from 'react-router-dom/Link';
import { injectIntl, defineMessages } from 'react-intl';
import SearchContainer from './containers/search_container';
import Motion from 'react-motion/lib/Motion';
import spring from 'react-motion/lib/spring';
import SearchResultsContainer from './containers/search_results_container';
import { changeComposing } from '../../actions/compose';
const messages = defineMessages({
start: { id: 'getting_started.heading', defaultMessage: 'Getting started' },
home_timeline: { id: 'tabs_bar.home', defaultMessage: 'Home' },
notifications: { id: 'tabs_bar.notifications', defaultMessage: 'Notifications' },
public: { id: 'navigation_bar.public_timeline', defaultMessage: 'Federated timeline' },
community: { id: 'navigation_bar.community_timeline', defaultMessage: 'Local timeline' },
preferences: { id: 'navigation_bar.preferences', defaultMessage: 'Preferences' },
logout: { id: 'navigation_bar.logout', defaultMessage: 'Logout' },
});
const mapStateToProps = state => ({
columns: state.getIn(['settings', 'columns']),
showSearch: state.getIn(['search', 'submitted']) && !state.getIn(['search', 'hidden']),
});
@connect(mapStateToProps)
@injectIntl
export default class Compose extends React.PureComponent {
static propTypes = {
dispatch: PropTypes.func.isRequired,
columns: ImmutablePropTypes.list.isRequired,
multiColumn: PropTypes.bool,
showSearch: PropTypes.bool,
intl: PropTypes.object.isRequired,
};
componentDidMount () {
this.props.dispatch(mountCompose());
}
componentWillUnmount () {
this.props.dispatch(unmountCompose());
}
onFocus = () => {
this.props.dispatch(changeComposing(true));
}
onBlur = () => {
this.props.dispatch(changeComposing(false));
}
render () {
const { multiColumn, showSearch, intl } = this.props;
let header = '';
if (multiColumn) {
const { columns } = this.props;
header = (
<nav className='drawer__header'>
<Link to='/getting-started' className='drawer__tab' title={intl.formatMessage(messages.start)} aria-label={intl.formatMessage(messages.start)}><i role='img' className='fa fa-fw fa-asterisk' /></Link>
{!columns.some(column => column.get('id') === 'HOME') && (
<Link to='/timelines/home' className='drawer__tab' title={intl.formatMessage(messages.home_timeline)} aria-label={intl.formatMessage(messages.home_timeline)}><i role='img' className='fa fa-fw fa-home' /></Link>
)}
{!columns.some(column => column.get('id') === 'NOTIFICATIONS') && (
<Link to='/notifications' className='drawer__tab' title={intl.formatMessage(messages.notifications)} aria-label={intl.formatMessage(messages.notifications)}><i role='img' className='fa fa-fw fa-bell' /></Link>
)}
{!columns.some(column => column.get('id') === 'COMMUNITY') && (
<Link to='/timelines/public/local' className='drawer__tab' title={intl.formatMessage(messages.community)} aria-label={intl.formatMessage(messages.community)}><i role='img' className='fa fa-fw fa-users' /></Link>
)}
{!columns.some(column => column.get('id') === 'PUBLIC') && (
<Link to='/timelines/public' className='drawer__tab' title={intl.formatMessage(messages.public)} aria-label={intl.formatMessage(messages.public)}><i role='img' className='fa fa-fw fa-globe' /></Link>
)}
<a href='/settings/preferences' className='drawer__tab' title={intl.formatMessage(messages.preferences)} aria-label={intl.formatMessage(messages.preferences)}><i role='img' className='fa fa-fw fa-cog' /></a>
<a href='/auth/sign_out' className='drawer__tab' data-method='delete' title={intl.formatMessage(messages.logout)} aria-label={intl.formatMessage(messages.logout)}><i role='img' className='fa fa-fw fa-sign-out' /></a>
</nav>
);
}
return (
<div className='drawer'>
{header}
<SearchContainer />
<div className='drawer__pager'>
<div className='drawer__inner' onFocus={this.onFocus}>
<NavigationContainer onClose={this.onBlur} />
<ComposeFormContainer />
</div>
<Motion defaultStyle={{ x: -100 }} style={{ x: spring(showSearch ? 0 : -100, { stiffness: 210, damping: 20 }) }}>
{({ x }) =>
<div className='drawer__inner darker' style={{ transform: `translateX(${x}%)`, visibility: x === -100 ? 'hidden' : 'visible' }}>
<SearchResultsContainer />
</div>
}
</Motion>
</div>
</div>
);
}
}
|
ajax/libs/glamorous/4.1.2/glamorous.umd.tiny.js
|
froala/cdnjs
|
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react'), require('glamor')) :
typeof define === 'function' && define.amd ? define(['react', 'glamor'], factory) :
(global.glamorous = factory(global.React,global.Glamor));
}(this, (function (React,glamor) { 'use strict';
var React__default = 'default' in React ? React['default'] : React;
var PropTypes = void 0;
/* istanbul ignore next */
if (parseFloat(React__default.version.slice(0, 4)) >= 15.5) {
/* istanbul ignore next */
try {
PropTypes = require('prop-types');
/* istanbul ignore next */
} catch (error) {
// ignore
}
}
/* istanbul ignore next */
PropTypes = PropTypes || React__default.PropTypes;
/*
eslint
import/no-mutable-exports:0,
import/prefer-default-export:0,
react/no-deprecated:0
*/
var CHANNEL = '__glamorous__';
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 toConsumableArray = function (arr) {
if (Array.isArray(arr)) {
for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
return arr2;
} else {
return Array.from(arr);
}
};
function generateWarningMessage(Comp) {
var componentName = Comp.displayName || Comp.name || 'FunctionComponent';
// eslint-disable-next-line max-len
return 'glamorous warning: Expected component called "' + componentName + '" which uses withTheme to be within a ThemeProvider but none was found.';
}
function withTheme(ComponentToTheme) {
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
_ref$noWarn = _ref.noWarn,
noWarn = _ref$noWarn === undefined ? false : _ref$noWarn,
_ref$createElement = _ref.createElement,
createElement = _ref$createElement === undefined ? true : _ref$createElement;
var ThemedComponent = function (_Component) {
inherits(ThemedComponent, _Component);
function ThemedComponent() {
var _ref2;
var _temp, _this, _ret;
classCallCheck(this, ThemedComponent);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = possibleConstructorReturn(this, (_ref2 = ThemedComponent.__proto__ || Object.getPrototypeOf(ThemedComponent)).call.apply(_ref2, [this].concat(args))), _this), _this.warned = noWarn, _this.state = { theme: {} }, _this.setTheme = function (theme) {
return _this.setState({ theme: theme });
}, _temp), possibleConstructorReturn(_this, _ret);
}
createClass(ThemedComponent, [{
key: 'componentWillMount',
// eslint-disable-next-line complexity
value: function componentWillMount() {
if (!this.context[CHANNEL]) {
if ("development" !== 'production' && !this.warned) {
this.warned = true;
// eslint-disable-next-line no-console
console.warn(generateWarningMessage(ComponentToTheme));
}
}
var theme = this.props.theme;
if (this.context[CHANNEL]) {
// if a theme is provided via props,
// it takes precedence over context
this.setTheme(theme ? theme : this.context[CHANNEL].getState());
} else {
this.setTheme(theme || {});
}
}
}, {
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(nextProps) {
if (this.props.theme !== nextProps.theme) {
this.setTheme(nextProps.theme);
}
}
}, {
key: 'componentDidMount',
value: function componentDidMount() {
if (this.context[CHANNEL] && !this.props.theme) {
// subscribe to future theme changes
this.subscriptionId = this.context[CHANNEL].subscribe(this.setTheme);
}
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
// cleanup subscription
this.subscriptionId && this.context[CHANNEL].unsubscribe(this.subscriptionId);
}
}, {
key: 'render',
value: function render() {
if (createElement) {
return React__default.createElement(ComponentToTheme, _extends({}, this.props, this.state));
} else {
// this allows us to effectively use the GlamorousComponent
// as our `render` method without going through lifecycle hooks.
// Also allows us to forward the context in the scenario where
// a user wants to add more context.
// eslint-disable-next-line babel/new-cap
return ComponentToTheme.call(this, _extends({}, this.props, this.state), this.context);
}
}
}]);
return ThemedComponent;
}(React.Component);
ThemedComponent.propTypes = {
theme: PropTypes.object
};
var defaultContextTypes = defineProperty({}, CHANNEL, PropTypes.object);
var userDefinedContextTypes = null;
// configure the contextTypes to be settable by the user,
// however also retaining the glamorous channel.
Object.defineProperty(ThemedComponent, 'contextTypes', {
enumerable: true,
configurable: true,
set: function set$$1(value) {
userDefinedContextTypes = value;
},
get: function get$$1() {
// if the user has provided a contextTypes definition,
// merge the default context types with the provided ones.
if (userDefinedContextTypes) {
return _extends({}, defaultContextTypes, userDefinedContextTypes);
}
return defaultContextTypes;
}
});
return ThemedComponent;
}
/**
* This function takes a className string and gets all the
* associated glamor styles. It's used to merge glamor styles
* from a className to make sure that specificity is not
* a problem when passing a className to a component.
* @param {String} [className=''] the className string
* @return {Object} { glamorStyles, glamorlessClassName }
* - glamorStyles is an array of all the glamor styles objects
* - glamorlessClassName is the rest of the className string
* without the glamor classNames
*/
function extractGlamorStyles(className) {
var glamorlessClassName = [];
var glamorStyles = [];
className.toString().split(' ').forEach(function (name) {
if (name.indexOf('css-') === 0) {
var style = buildGlamorSrcFromClassName(name);
glamorStyles.push(style);
} else {
glamorlessClassName.push(name);
}
});
return { glamorlessClassName: glamorlessClassName, glamorStyles: glamorStyles };
}
/** Glamor's css function returns an object with the shape
*
* {
* [`data-css-${hash}`]: '',
* toString() { return `css-${hash}` }
* }
*
* Whenever glamor's build function encounters an object with
* this shape it just pulls the resulting styles from the cache.
*
* note: the toString method is not needed to qualify the shape
**/
function buildGlamorSrcFromClassName(className) {
return defineProperty({}, 'data-' + className, '');
}
function getGlamorClassName$1(_ref2) {
var styles = _ref2.styles,
props = _ref2.props,
cssOverrides = _ref2.cssOverrides,
cssProp = _ref2.cssProp,
context = _ref2.context,
displayName = _ref2.displayName;
var _handleStyles = handleStyles([].concat(toConsumableArray(styles), [props.className, cssOverrides, cssProp]), props, context),
mappedArgs = _handleStyles.mappedArgs,
nonGlamorClassNames = _handleStyles.nonGlamorClassNames;
// eslint-disable-next-line max-len
var isDev = "development" === 'development' || !"development";
var devRules = isDev ? { label: displayName } : null;
var glamorClassName = glamor.css.apply(undefined, [devRules].concat(toConsumableArray(mappedArgs))).toString();
var extras = nonGlamorClassNames.join(' ').trim();
return (glamorClassName + ' ' + extras).trim();
}
// this next function is on a "hot" code-path
// so it's pretty complex to make sure it's fast.
// eslint-disable-next-line complexity
function handleStyles(styles, props, context) {
var current = void 0;
var mappedArgs = [];
var nonGlamorClassNames = [];
for (var i = 0; i < styles.length; i++) {
current = styles[i];
if (typeof current === 'function') {
var result = current(props, context);
if (typeof result === 'string') {
var _extractGlamorStyles = extractGlamorStyles(result),
glamorStyles = _extractGlamorStyles.glamorStyles,
glamorlessClassName = _extractGlamorStyles.glamorlessClassName;
mappedArgs.push.apply(mappedArgs, toConsumableArray(glamorStyles));
nonGlamorClassNames.push.apply(nonGlamorClassNames, toConsumableArray(glamorlessClassName));
} else {
mappedArgs.push(result);
}
} else if (typeof current === 'string') {
var _extractGlamorStyles2 = extractGlamorStyles(current),
_glamorStyles = _extractGlamorStyles2.glamorStyles,
_glamorlessClassName = _extractGlamorStyles2.glamorlessClassName;
mappedArgs.push.apply(mappedArgs, toConsumableArray(_glamorStyles));
nonGlamorClassNames.push.apply(nonGlamorClassNames, toConsumableArray(_glamorlessClassName));
} else if (Array.isArray(current)) {
var recursed = handleStyles(current, props, context);
mappedArgs.push.apply(mappedArgs, toConsumableArray(recursed.mappedArgs));
nonGlamorClassNames.push.apply(nonGlamorClassNames, toConsumableArray(recursed.nonGlamorClassNames));
} else {
mappedArgs.push(current);
}
}
return { mappedArgs: mappedArgs, nonGlamorClassNames: nonGlamorClassNames };
}
/*
* This is a relatively small abstraction that's ripe for open sourcing.
* Documentation is in the README.md
*/
function createGlamorous$1(splitProps) {
return glamorous;
/**
* This is the main export and the function that people
* interact with most directly.
*
* It accepts a component which can be a string or
* a React Component and returns
* a "glamorousComponentFactory"
* @param {String|ReactComponent} comp the component to render
* @param {Object} options helpful info for the GlamorousComponents
* @return {Function} the glamorousComponentFactory
*/
function glamorous(comp) {
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
rootEl = _ref.rootEl,
displayName = _ref.displayName,
shouldClassNameUpdate = _ref.shouldClassNameUpdate,
_ref$forwardProps = _ref.forwardProps,
forwardProps = _ref$forwardProps === undefined ? [] : _ref$forwardProps,
_ref$propsAreCssOverr = _ref.propsAreCssOverrides,
propsAreCssOverrides = _ref$propsAreCssOverr === undefined ? comp.propsAreCssOverrides : _ref$propsAreCssOverr,
basePropsToApply = _ref.withProps;
return glamorousComponentFactory;
/**
* This returns a React Component that renders the comp (closure)
* with a className based on the given glamor styles object(s)
* @param {...Object|Function} styles the styles to create with glamor.
* If any of these are functions, they are invoked with the component
* props and the return value is used.
* @return {ReactComponent} the ReactComponent function
*/
function glamorousComponentFactory() {
for (var _len = arguments.length, styles = Array(_len), _key = 0; _key < _len; _key++) {
styles[_key] = arguments[_key];
}
/**
* This is a component which will render the comp (closure)
* with the glamorous styles (closure). Forwards any valid
* props to the underlying component.
*/
var GlamorousComponent = withTheme(function GlamorousInnerComponent(props, context) {
props = getPropsToApply(GlamorousComponent.propsToApply, {}, props, context);
var updateClassName = shouldUpdate(props, context, this.previous);
if (shouldClassNameUpdate) {
this.previous = { props: props, context: context };
}
var _splitProps = splitProps(props, GlamorousComponent),
toForward = _splitProps.toForward,
cssOverrides = _splitProps.cssOverrides,
cssProp = _splitProps.cssProp;
// create className to apply
this.className = updateClassName ? getGlamorClassName$1({
styles: GlamorousComponent.styles,
props: props,
cssOverrides: cssOverrides,
cssProp: cssProp,
context: context,
displayName: GlamorousComponent.displayName
}) : this.className;
return React__default.createElement(GlamorousComponent.comp, _extends({
ref: props.innerRef
}, toForward, {
className: this.className
}));
}, { noWarn: true, createElement: false });
GlamorousComponent.propTypes = {
className: PropTypes.string,
cssOverrides: PropTypes.object,
innerRef: PropTypes.func,
glam: PropTypes.object
};
function withComponent(newComp) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var fp = GlamorousComponent.forwardProps,
componentProperties = objectWithoutProperties(GlamorousComponent, ['forwardProps']);
return glamorous(_extends({}, componentProperties, {
comp: newComp
}), _extends({
// allows the forwardProps to be overridden
forwardProps: fp
}, options))(GlamorousComponent.styles);
}
function withProps() {
for (var _len2 = arguments.length, propsToApply = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
propsToApply[_key2] = arguments[_key2];
}
return glamorous(GlamorousComponent, { withProps: propsToApply })();
}
function shouldUpdate(props, context, previous) {
// exiting early so components which do not use this
// optimization are not penalized by hanging onto
// references to previous props and context
if (!shouldClassNameUpdate) {
return true;
}
var update = true;
if (previous) {
if (!shouldClassNameUpdate(previous.props, props, previous.context, context)) {
update = false;
}
}
return update;
}
Object.assign(GlamorousComponent, getGlamorousComponentMetadata({
comp: comp,
styles: styles,
rootEl: rootEl,
forwardProps: forwardProps,
displayName: displayName,
propsToApply: basePropsToApply
}), {
withComponent: withComponent,
isGlamorousComponent: true,
propsAreCssOverrides: propsAreCssOverrides,
withProps: withProps
});
return GlamorousComponent;
}
}
function getGlamorousComponentMetadata(_ref2) {
var comp = _ref2.comp,
styles = _ref2.styles,
rootEl = _ref2.rootEl,
forwardProps = _ref2.forwardProps,
displayName = _ref2.displayName,
basePropsToApply = _ref2.propsToApply;
var componentsComp = comp.comp ? comp.comp : comp;
var propsToApply = comp.propsToApply ? [].concat(toConsumableArray(comp.propsToApply), toConsumableArray(arrayify(basePropsToApply))) : arrayify(basePropsToApply);
return {
// join styles together (for anyone doing: glamorous(glamorous.a({}), {}))
styles: when(comp.styles, styles),
// keep track of the ultimate rootEl to render (we never
// actually render anything but
// the base component, even when people wrap a glamorous
// component in glamorous
comp: componentsComp,
rootEl: rootEl || componentsComp,
// join forwardProps (for anyone doing: glamorous(glamorous.a({}), {}))
forwardProps: when(comp.forwardProps, forwardProps),
// set the displayName to something that's slightly more
// helpful than `GlamorousComponent` :)
displayName: displayName || 'glamorous(' + getDisplayName(comp) + ')',
// these are props that should be applied to the component at render time
propsToApply: propsToApply
};
}
}
/**
* reduces the propsToApply given to a single props object
* @param {Array} propsToApply an array of propsToApply objects:
* - object
* - array of propsToApply items
* - function that accepts the accumulated props and the context
* @param {Object} accumulator an object to apply props onto
* @param {Object} props the props that should ultimately take precedence
* @param {*} context the context object
* @return {Object} the reduced props
*/
function getPropsToApply(propsToApply, accumulator, props, context) {
// using forEach rather than reduce here because the reduce solution
// effectively did the same thing because we manipulate the `accumulator`
propsToApply.forEach(function (propsToApplyItem) {
if (typeof propsToApplyItem === 'function') {
return Object.assign(accumulator, propsToApplyItem(Object.assign({}, accumulator, props), context));
} else if (Array.isArray(propsToApplyItem)) {
return Object.assign(accumulator, getPropsToApply(propsToApplyItem, accumulator, props, context));
}
return Object.assign(accumulator, propsToApplyItem);
});
// props wins
return Object.assign(accumulator, props);
}
function arrayify() {
var x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
return Array.isArray(x) ? x : [x];
}
function when(comp, prop) {
return comp ? comp.concat(prop) : prop;
}
function getDisplayName(comp) {
return typeof comp === 'string' ? comp : comp.displayName || comp.name || 'unknown';
}
/* eslint no-unused-vars:0 */
function splitProps(_ref) {
var cssProp = _ref.css,
theme = _ref.theme,
className = _ref.className,
innerRef = _ref.innerRef,
glam = _ref.glam,
rest = objectWithoutProperties(_ref, ['css', 'theme', 'className', 'innerRef', 'glam']);
return { toForward: rest, cssProp: cssProp };
}
var glamorous = createGlamorous$1(splitProps);
return glamorous;
})));
//# sourceMappingURL=glamorous.umd.tiny.js.map
|
example/examples/PolylineCreator.js
|
carleryd/react-native-maps
|
import React from 'react';
import {
StyleSheet,
View,
Text,
Dimensions,
TouchableOpacity,
} from 'react-native';
import MapView from 'react-native-maps';
const { width, height } = Dimensions.get('window');
const ASPECT_RATIO = width / height;
const LATITUDE = 37.78825;
const LONGITUDE = -122.4324;
const LATITUDE_DELTA = 0.0922;
const LONGITUDE_DELTA = LATITUDE_DELTA * ASPECT_RATIO;
let id = 0;
class PolylineCreator extends React.Component {
constructor(props) {
super(props);
this.state = {
region: {
latitude: LATITUDE,
longitude: LONGITUDE,
latitudeDelta: LATITUDE_DELTA,
longitudeDelta: LONGITUDE_DELTA,
},
polylines: [],
editing: null,
};
}
finish() {
const { polylines, editing } = this.state;
this.setState({
polylines: [...polylines, editing],
editing: null,
});
}
onPanDrag(e) {
const { editing } = this.state;
if (!editing) {
this.setState({
editing: {
id: id++,
coordinates: [e.nativeEvent.coordinate],
},
});
} else {
this.setState({
editing: {
...editing,
coordinates: [
...editing.coordinates,
e.nativeEvent.coordinate,
],
},
});
}
}
render() {
return (
<View style={styles.container}>
<MapView
provider={this.props.provider}
style={styles.map}
initialRegion={this.state.region}
scrollEnabled={false}
onPanDrag={e => this.onPanDrag(e)}
>
{this.state.polylines.map(polyline => (
<MapView.Polyline
key={polyline.id}
coordinates={polyline.coordinates}
strokeColor="#000"
fillColor="rgba(255,0,0,0.5)"
strokeWidth={1}
/>
))}
{this.state.editing &&
<MapView.Polyline
key="editingPolyline"
coordinates={this.state.editing.coordinates}
strokeColor="#F00"
fillColor="rgba(255,0,0,0.5)"
strokeWidth={1}
/>
}
</MapView>
<View style={styles.buttonContainer}>
{this.state.editing && (
<TouchableOpacity
onPress={() => this.finish()}
style={[styles.bubble, styles.button]}
>
<Text>Finish</Text>
</TouchableOpacity>
)}
</View>
</View>
);
}
}
PolylineCreator.propTypes = {
provider: MapView.ProviderPropType,
};
const styles = StyleSheet.create({
container: {
...StyleSheet.absoluteFillObject,
justifyContent: 'flex-end',
alignItems: 'center',
},
map: {
...StyleSheet.absoluteFillObject,
},
bubble: {
backgroundColor: 'rgba(255,255,255,0.7)',
paddingHorizontal: 18,
paddingVertical: 12,
borderRadius: 20,
},
latlng: {
width: 200,
alignItems: 'stretch',
},
button: {
width: 80,
paddingHorizontal: 12,
alignItems: 'center',
marginHorizontal: 10,
},
buttonContainer: {
flexDirection: 'row',
marginVertical: 20,
backgroundColor: 'transparent',
},
});
module.exports = PolylineCreator;
|
packages/material-ui-icons/src/LeakRemove.js
|
AndriusBil/material-ui
|
import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from 'material-ui/SvgIcon';
let LeakRemove = props =>
<SvgIcon {...props}>
<path d="M10 3H8c0 .37-.04.72-.12 1.06l1.59 1.59C9.81 4.84 10 3.94 10 3zM3 4.27l2.84 2.84C5.03 7.67 4.06 8 3 8v2c1.61 0 3.09-.55 4.27-1.46L8.7 9.97C7.14 11.24 5.16 12 3 12v2c2.71 0 5.19-.99 7.11-2.62l2.5 2.5C10.99 15.81 10 18.29 10 21h2c0-2.16.76-4.14 2.03-5.69l1.43 1.43C14.55 17.91 14 19.39 14 21h2c0-1.06.33-2.03.89-2.84L19.73 21 21 19.73 4.27 3 3 4.27zM14 3h-2c0 1.5-.37 2.91-1.02 4.16l1.46 1.46C13.42 6.98 14 5.06 14 3zm5.94 13.12c.34-.08.69-.12 1.06-.12v-2c-.94 0-1.84.19-2.66.52l1.6 1.6zm-4.56-4.56l1.46 1.46C18.09 12.37 19.5 12 21 12v-2c-2.06 0-3.98.58-5.62 1.56z" />
</SvgIcon>;
LeakRemove = pure(LeakRemove);
LeakRemove.muiName = 'SvgIcon';
export default LeakRemove;
|
src/06-components/ResultsItem.js
|
benmvp/react-workshop
|
import React from 'react'
const ResultsItem = ({ id, title, url, rating, previewUrl }) => {
return (
<section
key={id}
className="card"
style={{
width: '300px',
display: 'inline-block',
marginRight: '16px',
}}
>
<video src={previewUrl} alt={title} loop autoPlay />
<section className="card-section">
<h5>
<a href={url} target="_blank" rel="noopener noreferrer">
{title}
</a>{' '}
({rating})
</h5>
</section>
</section>
)
}
export default ResultsItem
|
public/assets/js/node_modules/react-select/examples/src/components/CustomSingleValue.js
|
ngocson8b/6jar
|
import React from 'react';
import Gravatar from 'react-gravatar';
var SingleValue = React.createClass({
propTypes: {
placeholder: React.PropTypes.string,
value: React.PropTypes.object
},
render () {
var obj = this.props.value;
var size = 15;
var gravatarStyle = {
borderRadius: 3,
display: 'inline-block',
marginRight: 10,
position: 'relative',
top: -2,
verticalAlign: 'middle',
};
return (
<div className="Select-placeholder">
{obj ? (
<div>
<Gravatar email={obj.email} size={size} style={gravatarStyle} />
{obj.value}
</div>
) : (
this.props.placeholder
)
}
</div>
);
}
});
module.exports = SingleValue;
|
js/jqwidgets/demos/react/app/datatable/pinnedfrozencolumn/app.js
|
luissancheza/sice
|
import React from 'react';
import ReactDOM from 'react-dom';
import JqxDataTable from '../../../jqwidgets-react/react_jqxdatatable.js';
class App extends React.Component {
render() {
let source =
{
dataType: "xml",
dataFields: [
{ name: 'ShippedDate', map: 'm\\:properties>d\\:ShippedDate', type: 'date' },
{ name: 'Freight', map: 'm\\:properties>d\\:Freight', type: 'float' },
{ name: 'ShipName', map: 'm\\:properties>d\\:ShipName' },
{ name: 'ShipAddress', map: 'm\\:properties>d\\:ShipAddress' },
{ name: 'ShipCity', map: 'm\\:properties>d\\:ShipCity' },
{ name: 'ShipCountry', map: 'm\\:properties>d\\:ShipCountry' }
],
root: "entry",
record: "content",
id: 'm\\:properties>d\\:OrderID',
url: "../../sampledata/orders.xml",
pager: (pagenum, pagesize, oldpagenum) => {
// callback called when a page or page size is changed.
}
};
let dataAdapter = new $.jqx.dataAdapter(source);
let columns =
[
{ text: 'Ship Name', dataField: 'ShipName', pinned: true, width: 300 },
{ text: 'Ship City', dataField: 'ShipCity', width: 250 },
{ text: 'Ship Address', dataField: 'ShipAddress', width: 350 },
{ text: 'Ship Country', dataField: 'ShipCountry', width: 150 },
{ text: 'Shipped Date', dataField: 'ShippedDate', width: 250, cellsFormat: 'D' },
{ text: 'Freight', dataField: 'Freight', width: 100, cellsFormat: 'f2', cellsalign: 'right' }
];
return (
<JqxDataTable
width={850} source={dataAdapter} pagerButtonsCount={10}
pageable={true} sortable={true} columnsResize={true} columns={columns}
/>
)
}
}
ReactDOM.render(<App />, document.getElementById('app'));
|
entry.js
|
change-soft8/cs-project
|
import React from 'react'
import ReactDOM from "react-dom";
import { Router, Link, browserHistory, Route, IndexRoute } from 'react-router'
import App from './src/router/App'
import About from './src/router/About'
import Home from './src/router/Home'
import Landing from './src/router/Landing'
import Logout from './src/router/Logout'
import "./src/style/global.css"
const e = document.createElement('div');
e.id = 'app';
document.body.appendChild(e);
ReactDOM.render((
<Router history={browserHistory}>
<Route path="/" component={App}>
<IndexRoute component={Home}/>
<Route path="/about" component={About}/>
<Route path="/landing" component={Landing}/>
<Route path="/logout" component={Logout}/>
</Route>
</Router>
), e);
|
templates/jsme/8816D61E367E34DBCFA53666849E21D8.cache.js
|
kyro46/ILIAS_4.4_JSME_Question
|
jsme.onScriptDownloaded(['var $wnd = $wnd || window.parent;var __gwtModuleFunction = $wnd.jsme;var $sendStats = __gwtModuleFunction.__sendStats;$sendStats(\'moduleStartup\', \'moduleEvalStart\');var $gwt_version = "2.5.1";var $strongName = \'8816D61E367E34DBCFA53666849E21D8\';var $doc = $wnd.document;function __gwtStartLoadingFragment(frag) {var fragFile = \'deferredjs/\' + $strongName + \'/\' + frag + \'.cache.js\';return __gwtModuleFunction.__startLoadingFragment(fragFile);}function __gwtInstallCode(code) {return __gwtModuleFunction.__installRunAsyncCode(code);}var $stats = $wnd.__gwtStatsEvent ? function(a) {return $wnd.__gwtStatsEvent(a);} : null;var $sessionId = $wnd.__gwtStatsSessionId ? $wnd.__gwtStatsSessionId : null;var n="",ea="\\n",ga=" ",ha=" \\t\\n\\r\\u000c",ia=" ",ja=" 0 0",ka=" 0 0 0",ma=" is not supported",na=\'"\',oa=\'" \',qa=\'" cy="\',ra=\'" height="\',ua=\'" stroke="\',va=\'" x2="\',wa=\'" y1="\',xa=\'" y2="\',za=\'" y="\',Aa=\'"/>\',Ca=\'">\',Fa="#",Ha="$",Ia="$$$$",Ja="$MOL\\n",La="$RXN",Oa="$RXN\\n\\n\\nJME Molecular Editor\\n",Pa="%",Qa="&",Ua="&",Ya=">",ab="<",bb="\'",cb="(",hb=")",ib="*",jb="+",kb=",",nb=", ",qb=",modifiers=",rb="-",sb="-C#C-Me",vb="-C#CH",wb="-C#N",zb="-C(=O)N",Ab="-C(=O)OH",Hb="-C(=O)OMe",\nLb="-CCl3",Mb="-CF3",Nb="-CMe3",Pb="-NC=O",Vb="-NH-SO2-Me",Yb="-NMe2",Zb="-NO2",$b="-OC(=O)Me",ac="-SO2-NH2",bc="-SO3H",dc="-disabled",hc="-selected",lc=".",mc="...",tc="/",yc="//",zc="/>",Fc="0",Gc="0.0px",Hc="0px",Ic="1",Kc="100%",Nc="2",Oc="3",Pc="4",Uc="5",Vc="6",Wc="7",Xc="8",ad="9",bd=":",gd=": ",hd=";",id="<",td="<\/g>",ud="<\/svg>",vd="<\/text>",zd=\'<line x1="\',Ad=\'<text x="\',Ed="=",Fd=">",Gd="?",Nd="@",Od="A",Pd="API",Qd="AfterStructureModified",Rd="Ag",Ud="Al",Vd="AtomClicked",Wd="AtomHighlight",\nXd="Au",be="Auto atom map molecule",ce="B",de="Ba",ee="BeforePaste",fe="BondClicked",ke="BondHighlight",le="Br",me="C",ne="CSS1Compat",re="Ca",se="Cd",te="Center",ue="Change atom map",ve="Cl",we="Class$",xe="Color parameter outside of expected range",ye="Copy as ",ze="Cs",Ee="Cu",Fe="DOMMouseScroll",Ge="Delete all atom map molecule",He="Delete hydrogens",Ie="Dialog",Je="ERROR - ",Ke="F",Le=\'For input string: "\',Me="Fr",Ne="GUI",Oe="Ga",Pe="H",Ue="Helvetica",Xe="I",Ye="InchiKeySearch",Ze="Incorrect URL: ",\n$e="Internal index set to null.",af="JSME",bf="JavaScript",cf="K",df="Li",ef="M CHG",ff="M END",gf="M END\\n",kf="M ISO",nf="M V30 ",of="MDLV30/STEABS",pf="MDLV30/STERAC",qf="MDLV30/STEREL",rf="Mg",sf="N",tf="NA",uf="Na",vf="Ni",wf="Null widget handle. If you are creating a composite, ensure that initWidget() has been called.",xf="O",yf="P",zf="Q",Ef="R",Ff="RXN",Gf="Rb",Hf="S",If="SMILES",Jf="Se",Kf="Set molecule Chiral flag",Lf="Si",Mf="Sr",Nf="Style names cannot be empty",Of="TBODY",Pf="TR",\nQf="Unset molecule chiral flag",Rf="V2000",Sf="V3000",Tf="WebkitUserSelect",Uf="X",Vf="Zn",Wf="[",Xf="[object Array]",Yf="\\\\",Zf="\\\\.",$f="\\\\\\\\",ag="\\\\\\\\n",bg="\\\\b",cg="]",dg="__gwtex_wrap",eg="a",fg="abs",gg="absolute",hg="addBond",ig="addGroup",jg="addRing",kg="addRingBond",ng="addTemplate",rg="alert",sg="alertdialog",tg="align",ug="antialias",vg="application",wg="article",xg="auto",yg="autonumber",zg="banner",Ag="begin",Bg="black",Cg="blue",Dg="blur",Eg="bolder",Fg="boolean",Gg="border",Ig="bottom",\nKg="button",Mg="c",Ng="cellPadding",Og="cellSpacing",Pg="center",Qg="change",Rg="chargeAtom0",Sg="checkbox",Tg="className",Ug="click",Vg="click marked atom to delete mark",Wg="clip",Yg="code",Zg="colSpan",$g="columnheader",eh="combobox",fh="complementary",gh="contentinfo",hh="contextmenu",ih="cursor",jh="dblclick",kh="definition",lh="depict",mh="dialog",nh="directory",oh="display",ph="div",qh="document",rh="download",sh="dragend",th="dragenter",uh="dragover",vh="dragstart",wh="drop",xh="end_gesture",\nyh="error",zh="false",Ah="focus",Bh="fontFamily",Ch="fontSize",Dh="fontStyle",Eh="fontWeight",Fh="form",Gh="function",Hh="g",Ih="gesturechange",Jh="gestureend",Lh="gesturestart",Mh="google",Nh="grid",Oh="gridcell",Ph="group",Qh="gwt-MenuBar",Rh="gwt-MenuBarPopup",Sh="head",Th="heading",Uh="height",Vh="hidden",Wh="i",Xh="id",Yh="img",Zh="is_touch_supported",$h="italic",ai="java.vm.name",bi="jsa-resetDiv",ci="keydown",di="keypress",ei="keyup",fi="left",gi="leftoversDownload",hi="link",ii="list",ji=\n"listbox",ki="listitem",li="load",mi="log",ni="m",oi="main",pi="margin",qi="marginBottom",ri="marquee",si="math",vi="menu",wi="menuPopup",xi="menubar",yi="menuitem",zi="menuitemcheckbox",Ai="menuitemradio",Bi="middle",Ci="mol",Di="mousedown",Ei="mousemove",Fi="mouseout",Gi="mouseover",Hi="mouseup",Ii="mousewheel",Ji="move",Ki="msie",Li="multipart",Mi="n",Ni="name",Oi="navigation",Pi="nodepict",Qi="none",Ri="note",Si="nowrap",Ti="null",Ui="number",Vi="object",Wi="offsetHeight",Xi="offsetWidth",Yi=\n"ontouchstart",Zi="opera",$i="option",aj="or",bj="outline",cj="overflow",hj="p",ij="padding",jj="paste",kj="popupContent",lj="position",mj="presentation",nj="progressbar",oj="px",pj="px ",qj="px, ",rj="px;",sj="radio",tj="radiogroup",uj="readMolFile",vj="rect(0px, 0px, 0px, 0px)",wj="redo",xj="region",yj="rgb(",zj="right",Aj="rotation",Bj="row",Cj="rowgroup",Dj="rowheader",Ej="runAsyncCallback",Fj="s",Gj="scale100",Hj="scrollbar",Ij="se",Jj="search",Kj="separator",Lj="serif",Mj="setAtom",Nj="setBondDouble",\nOj="setBondSingle",Pj="setBondTriple",Qj=\'shape-rendering="crispEdges"\',Rj="slider",Sj="span",Tj="spinbutton",Uj="status",Vj="string",Wj="subMenuIcon-selected",Xj="tab",Yj="table",Zj="tablist",$j="tabpanel",ak="tbody",bk="td",gk="text",hk="textAlign",ik="textbox",jk="timer",kk="title",lk="toolbar",mk="tooltip",nk="top",ok="touchcancel",pk="touchend",qk="touchmove",rk="touchstart",sk="tr",uk="tree",vk="treegrid",wk="treeitem",xk="true",yk="undo",zk="unknown type",Ak="value",Bk="verticalAlign",Ck="visibility",\nDk="visible",Ek="whiteSpace",Fk="width",Gk="x",Hk="zIndex",Ik="{",Jk="|",_,Kk={l:4194303,m:4194303,h:1048575},Lk={l:0,m:0,h:0},Mk={l:1,m:0,h:0},Nk={l:2,m:0,h:0},Ok={l:3,m:0,h:0},Pk={l:4,m:0,h:0},Qk={l:8,m:0,h:0},Rk={l:10,m:0,h:0},Sk={l:16,m:0,h:0},Tk={l:32,m:0,h:0},Uk={l:64,m:0,h:0},Vk={l:128,m:0,h:0},Wk={l:256,m:0,h:0},Xk={l:512,m:0,h:0},Yk={l:1024,m:0,h:0},Zk={l:2048,m:0,h:0},$k={l:8192,m:0,h:0},al={l:16384,m:0,h:0},bl={l:32768,m:0,h:0},cl={l:65536,m:0,h:0},dl={l:131072,m:0,h:0},fl={l:262144,m:0,\nh:0},gl={l:524288,m:0,h:0},hl={},il={89:1,93:1,109:1},jl={22:1,25:1,89:1,94:1,96:1},kl={89:1,93:1,108:1},ll={27:1,29:1,37:1,42:1,43:1,45:1,49:1,51:1},ml={2:1,89:1,93:1},q={87:1,89:1,93:1},nl={54:1,89:1,93:1},ol={27:1,29:1,37:1,41:1,42:1,43:1,45:1,49:1,51:1},pl={27:1,29:1,37:1,42:1,45:1,49:1,51:1},ql={108:1},rl={3:1,89:1,93:1},sl={89:1,93:1},tl={53:1,89:1,97:1,105:1,106:1},ul={60:1,67:1,81:1,89:1},zl={20:1,22:1,89:1,94:1,96:1},Al={42:1,49:1},Bl={92:1},Cl={26:1},Dl={36:1},El={60:1,61:1,67:1,81:1,89:1},\nFl={21:1,22:1,89:1,94:1,96:1},Gl={110:1},Hl={28:1,52:1},Il={112:1},Jl={89:1,97:1,106:1},Kl={133:1},Ll={22:1,23:1,89:1,94:1,96:1},Ml={80:1,93:1},Nl={109:1},Pl={50:1,89:1,94:1,96:1},Ql={89:1},Rl={33:1,89:1},Sl={67:1,89:1},Tl={35:1},Ul={17:1},Vl={},Wl={75:1,84:1},u={89:1,93:1,104:1},Xl={29:1},Yl={55:1,60:1,61:1,67:1,75:1,76:1,81:1,84:1,89:1},Zl={18:1},$l={89:1,108:1},am={88:1,89:1,93:1,104:1},bm={64:1,89:1},cm={24:1,89:1,94:1,96:1},dm={89:1,97:1,105:1,106:1};\nfunction w(a,b,c){var d=hl[a];d&&!d.cZ?_=d.prototype:(!d&&(d=hl[a]=function(){}),_=d.prototype=0>b?{}:new hl[b],_.cM=c);for(var e=3;e<arguments.length;++e)arguments[e].prototype=_;d.cZ&&(_.cZ=d.cZ,d.cZ=null)}function x(){}w(1,-1,Vl);_.eQ=em;_.hC=fm;_.tS=function(){return this.cZ.d+Nd+gm(this.hC())};_.toString=function(){return this.tS()};_.tM=x;\nfunction hm(){hm=x;im=z(B,q,-1,[0,16777215,14286847,13402367,12779264,16758197,9474192,3166456,16715021,9494608,11789301,11230450,9109248,12560038,1578E4,16744448,16777008,2093087,8442339,9388244,4062976,15132390,12567239,10921643,9083335,10255047,14706227,15765664,5296208,13140019,8224944,12750735,6721423,12419299,16752896,10889513,6076625,7351984,65280,9764863,9756896,7586505,5551541,3907230,2396047,687500,27013,12632256,16767375,10909043,6717568,10380213,13924864,9699476,4366E3,5707663,51456,7394559,\n16777159,14286791,13107143,10747847,9437127,6422471,4587463,3211207,2097095,65436,58997,54354,48952,43812,5096191,5089023,2200790,2522539,2516630,1528967,13684960,16765219,12105936,10900557,5724513,10375093,11230208,7688005,4358806,4325478,32E3,7384058,47871,41471,36863,33023,27647,5528818,7888099,9064419,10565332,11739092,11739066,11734438,12389767,13041766,13369433,13697103,14221381,14680120,15073326,15400998,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,\n0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13158600,1334015,56540,15075850,15132160,56540,15075850,15461355,8553170,1016335,1016335,1334015,15132160,3289770,14456450,16422400,16422400,11819700,3289770,1016335]);jm=new km(255,128,0);lm=new km(92,160,255);mm=new km(160,0,64);nm=new km(255,160,255);om=new km(32,96,255);pm=new km(255,0,0);qm=new km(0,255,0);rm=new km(192,0,255);sm=new km(255,160,0);tm=new km(0,128,0);um=new km(160,0,0)}var im,nm,lm,jm,om,tm,um,qm,rm,sm,pm,mm;\nfunction vm(a){if(a.o){a.u=a.p;a.o=!1;a.p=!1;if(a.q){var b=a.q,c=b.b;wm(c.a,b);0==c.a.c&&xm(c.b);a.q=null}a.qd()}}function ym(a,b){var c=zm();vm(a);a.o=!0;a.p=!1;a.n=b;a.t=c;++a.r;Am(a.k,zm())}function Bm(a,b){var c,d;c=a.r;d=b>=a.t+a.n;if(a.p&&!d)return d=(b-a.t)/a.n,a.td((1+Math.cos(3.141592653589793+3.141592653589793*d))/2),a.o&&a.r==c;if(!a.p&&b>=a.t&&(a.p=!0,a.sd(),!(a.o&&a.r==c)))return!1;return d?(a.o=!1,a.p=!1,a.rd(),!1):!0}w(58,1,{});_.qd=function(){this.u&&this.rd()};\n_.rd=function(){this.td((1+Math.cos(6.283185307179586))/2)};_.sd=function(){this.td((1+Math.cos(3.141592653589793))/2)};_.n=-1;_.o=!1;_.p=!1;_.q=null;_.r=-1;_.s=null;_.t=-1;_.u=!1;function Am(a,b){if(Bm(a.a,b)){var c=a.a,d=a.a.s,e;e=new Cm(d,a.a.k);Dm(d.a,e);1==d.a.c&&Em(d.b,16);c.q=e}else a.a.q=null}function Fm(a){this.a=a}w(59,1,{},Fm);_.a=null;w(60,1,{});w(61,1,{13:1});function Gm(){Gm=x;Hm=new Im}w(62,60,{});var Hm=null;function Im(){this.a=new Jm;this.b=new Km(this)}w(63,62,{},Im);\nfunction Lm(){Lm=x;Mm=new Jm;var a=new Nm;Om();Pm(Qm?Qm:Qm=new Rm,a)}function xm(a){a.b?$wnd.clearInterval(a.c):$wnd.clearTimeout(a.c);wm(Mm,a)}function Em(a,b){if(0>b)throw new Sm("must be non-negative");a.b?$wnd.clearInterval(a.c):$wnd.clearTimeout(a.c);wm(Mm,a);a.b=!1;a.c=Tm(a,b);Dm(Mm,a)}function Tm(a,b){return $wnd.setTimeout(C(function(){a.ud()}),b)}w(65,1,{});_.ud=function(){this.b||wm(Mm,this);this.vd()};_.b=!1;_.c=0;var Mm;function Km(a){Lm();this.a=a}w(64,65,{},Km);\n_.vd=function(){var a=this.a,b,c,d,e,f;b=D(Um,u,14,a.a.c,0);b=Vm(a.a,b);c=new Wm;for(e=0,f=b.length;e<f;++e)d=b[e],wm(a.a,d),Am(d.a,c.a);0<a.a.c&&Em(a.b,Xm(5,16-(zm()-c.a)))};_.a=null;function Cm(a,b){this.b=a;this.a=b}w(66,61,{13:1,14:1},Cm);_.a=null;_.b=null;w(68,1,{});_.a=null;function Ym(){this.a=rg}w(67,68,{},Ym);function Zm(){this.a=sg}w(69,68,{},Zm);function $m(){this.a=vg}w(70,68,{},$m);w(72,1,{});_.a=null;function an(a){this.a=a}w(71,72,{},an);function bn(){this.a=wg}w(73,68,{},bn);\nfunction cn(){this.a=zg}w(74,68,{},cn);function dn(){this.a=Kg}w(75,68,{},dn);function en(){this.a=Sg}w(76,68,{},en);function fn(){this.a=$g}w(77,68,{},fn);function gn(){this.a=eh}w(78,68,{},gn);function hn(){this.a=fh}w(79,68,{},hn);function jn(){this.a=gh}w(80,68,{},jn);function kn(){this.a=kh}w(81,68,{},kn);function ln(){this.a=mh}w(82,68,{},ln);function mn(){this.a=nh}w(83,68,{},mn);function nn(){this.a=qh}w(84,68,{},nn);function on(){this.a=Fh}w(85,68,{},on);function pn(){this.a=Nh}\nw(86,68,{},pn);function qn(){this.a=Oh}w(87,68,{},qn);function rn(){this.a=Ph}w(88,68,{},rn);function sn(){this.a=Th}w(89,68,{},sn);function tn(a){this.a=a.id}w(90,1,{15:1,16:1},tn);_.a=null;function un(){this.a=Yh}w(91,68,{},un);function vn(){this.a=hi}w(92,68,{},vn);function wn(){this.a=ii}w(93,68,{},wn);function xn(){this.a=ji}w(94,68,{},xn);function yn(){this.a=ki}w(95,68,{},yn);function zn(){this.a=mi}w(96,68,{},zn);function An(){this.a=oi}w(97,68,{},An);function Bn(){this.a=ri}w(98,68,{},Bn);\nfunction Cn(){this.a=si}w(99,68,{},Cn);function Dn(){this.a=vi}w(100,68,{},Dn);function En(){this.a=xi}w(101,68,{},En);function Fn(){this.a=yi}w(102,68,{},Fn);function Gn(){this.a=zi}w(103,68,{},Gn);function Hn(){this.a=Ai}w(104,68,{},Hn);function In(){this.a=Oi}w(105,68,{},In);function Jn(){this.a=Ri}w(106,68,{},Jn);function Kn(){this.a=$i}w(107,68,{},Kn);function Ln(){this.a=mj}w(108,68,{},Ln);w(109,72,{},function(a){this.a=a});function On(){this.a=nj}w(110,68,{},On);\nfunction Pn(){Pn=x;Qn=new an("aria-activedescendant")}var Qn;function Rn(){this.a=sj}w(112,68,{},Rn);function Sn(){this.a=tj}w(113,68,{},Sn);function Tn(){this.a=xj}w(114,68,{},Tn);\nfunction Un(){Un=x;Vn=new Zm;Wn=new Ym;Xn=new $m;Yn=new bn;Zn=new cn;$n=new dn;ao=new en;bo=new fn;co=new gn;eo=new hn;fo=new jn;go=new kn;ho=new ln;io=new mn;jo=new nn;ko=new on;lo=new qn;mo=new pn;no=new rn;oo=new sn;po=new un;qo=new vn;ro=new xn;so=new yn;to=new wn;uo=new zn;vo=new An;wo=new Bn;xo=new Cn;yo=new En;zo=new Gn;Ao=new Hn;Bo=new Fn;Co=new Dn;Do=new In;Eo=new Jn;Fo=new Kn;Go=new Ln;Ho=new On;Io=new Sn;Jo=new Rn;Ko=new Tn;Lo=new Mo;No=new Oo;Po=new Qo;Ro=new So;To=new Uo;Vo=new Wo;Xo=\nnew Yo;Zo=new $o;ap=new bp;cp=new dp;ep=new fp;gp=new hp;ip=new jp;kp=new lp;mp=new np;op=new pp;qp=new rp;sp=new tp;up=new vp;wp=new xp;E(wp,xj,Ko);E(wp,rg,Wn);E(wp,mh,ho);E(wp,sg,Vn);E(wp,vg,Xn);E(wp,qh,jo);E(wp,wg,Yn);E(wp,zg,Zn);E(wp,Kg,$n);E(wp,Sg,ao);E(wp,Oh,lo);E(wp,$g,bo);E(wp,Ph,no);E(wp,eh,co);E(wp,fh,eo);E(wp,gh,fo);E(wp,kh,go);E(wp,ii,to);E(wp,nh,io);E(wp,Fh,ko);E(wp,Nh,mo);E(wp,Th,oo);E(wp,Yh,po);E(wp,hi,qo);E(wp,ji,ro);E(wp,ki,so);E(wp,mi,uo);E(wp,oi,vo);E(wp,ri,wo);E(wp,si,xo);E(wp,\nvi,Co);E(wp,xi,yo);E(wp,yi,Bo);E(wp,zi,zo);E(wp,$i,Fo);E(wp,sj,Jo);E(wp,Ai,Ao);E(wp,Oi,Do);E(wp,Ri,Eo);E(wp,mj,Go);E(wp,nj,Ho);E(wp,tj,Io);E(wp,Bj,Po);E(wp,Cj,Lo);E(wp,Dj,No);E(wp,Jj,To);E(wp,Kj,Vo);E(wp,Hj,Ro);E(wp,Rj,Xo);E(wp,Tj,Zo);E(wp,Uj,ap);E(wp,Xj,gp);E(wp,Zj,cp);E(wp,$j,ep);E(wp,ik,ip);E(wp,jk,kp);E(wp,lk,mp);E(wp,mk,op);E(wp,uk,up);E(wp,vk,qp);E(wp,wk,sp)}\nvar Wn,Vn,Xn,Yn,Zn,$n,ao,bo,co,eo,fo,go,ho,io,jo,ko,mo,lo,no,oo,po,qo,to,ro,so,uo,vo,wo,xo,Co,yo,Bo,zo,Ao,Do,Eo,Fo,Go,Ho,Jo,Io,Ko,wp,Po,Lo,No,Ro,To,Vo,Xo,Zo,ap,gp,cp,ep,ip,kp,mp,op,up,qp,sp;function Qo(){this.a=Bj}w(116,68,{},Qo);function Mo(){this.a=Cj}w(117,68,{},Mo);function Oo(){this.a=Dj}w(118,68,{},Oo);function So(){this.a=Hj}w(119,68,{},So);function Uo(){this.a=Jj}w(120,68,{},Uo);function Wo(){this.a=Kj}w(121,68,{},Wo);function Yo(){this.a=Rj}w(122,68,{},Yo);function $o(){this.a=Tj}\nw(123,68,{},$o);function bp(){this.a=Uj}w(124,68,{},bp);function hp(){this.a=Xj}w(125,68,{},hp);function dp(){this.a=Zj}w(126,68,{},dp);function fp(){this.a=$j}w(127,68,{},fp);function jp(){this.a=ik}w(128,68,{},jp);function lp(){this.a=jk}w(129,68,{},lp);function np(){this.a=lk}w(130,68,{},np);function pp(){this.a=mk}w(131,68,{},pp);function vp(){this.a=uk}w(132,68,{},vp);function rp(){this.a=vk}w(133,68,{},rp);function tp(){this.a=wk}w(134,68,{},tp);\nfunction yp(a){var b,c,d;d=new zp;for(c=a;c;)b=c.yd(),c!=a&&(d.a.a+="Caused by: "),Ap(d,c.cZ.d),d.a.a+=gd,Bp(d.a,null==b?"(No exception detail)":b),d.a.a+=ea,c=c.e}function Cp(a){var b;b=a.cZ.d;a=a.yd();return null!=a?b+gd+a:b}w(138,1,{89:1,106:1});_.yd=function(){return this.f};_.tS=function(){return Cp(this)};_.e=null;_.f=null;function Dp(a){this.f=a}w(137,138,Jl,Dp);function Ep(a){this.f=a}function Fp(a,b){this.e=b;this.f=a}w(136,137,dm,Ep,Fp);function Gp(a){this.f=a}w(135,136,dm,Gp);\nfunction Wm(){this.a=zm()}function zm(){return(new Date).getTime()}w(139,1,{},Wm);function Hp(a){this.b=a;this.a=n}w(141,136,dm,Hp);_.yd=function(){if(null==this.c){this.d=null==this.b?Ti:Ip(this.b)?null==this.b?null:this.b.name:G(this.b,1)?"String":Jp(this.b).d;this.a=this.a+gd+(Ip(this.b)?null==this.b?null:this.b.message:this.b+n);var a;if(Ip(this.b)){a=this.b;var b=n,c;for(c in a)if(c!=Ni&&"message"!=c&&"toString"!=c)try{b+="\\n "+c+gd+a[c]}catch(d){}a=b}else a=n;this.c=cb+this.d+") "+a+this.a}return this.c};\n_.a=n;_.b=null;_.c=null;_.d=null;function Kp(a,b){return Lp(a)?a.eQ(b):a===b}function Jp(a){return Lp(a)?a.cZ:Mp}function Np(a){return Lp(a)?a.hC():Op(a)}function Pp(a){return a.toString?a.toString():"[JavaScriptObject]"}\nfunction Qp(){var a;Qp=x;Rp=(a=["\\\\u0000","\\\\u0001","\\\\u0002","\\\\u0003","\\\\u0004","\\\\u0005","\\\\u0006","\\\\u0007",bg,"\\\\t","\\\\n","\\\\u000B","\\\\f","\\\\r","\\\\u000E","\\\\u000F","\\\\u0010","\\\\u0011","\\\\u0012","\\\\u0013","\\\\u0014","\\\\u0015","\\\\u0016","\\\\u0017","\\\\u0018","\\\\u0019","\\\\u001A","\\\\u001B","\\\\u001C","\\\\u001D","\\\\u001E","\\\\u001F"],a[34]=\'\\\\"\',a[92]=$f,a[173]="\\\\u00ad",a[1536]="\\\\u0600",a[1537]="\\\\u0601",a[1538]="\\\\u0602",a[1539]="\\\\u0603",a[1757]="\\\\u06dd",a[1807]="\\\\u070f",a[6068]="\\\\u17b4",a[6069]=\n"\\\\u17b5",a[8203]="\\\\u200b",a[8204]="\\\\u200c",a[8205]="\\\\u200d",a[8206]="\\\\u200e",a[8207]="\\\\u200f",a[8232]="\\\\u2028",a[8233]="\\\\u2029",a[8234]="\\\\u202a",a[8235]="\\\\u202b",a[8236]="\\\\u202c",a[8237]="\\\\u202d",a[8238]="\\\\u202e",a[8288]="\\\\u2060",a[8289]="\\\\u2061",a[8290]="\\\\u2062",a[8291]="\\\\u2063",a[8292]="\\\\u2064",a[8298]="\\\\u206a",a[8299]="\\\\u206b",a[8300]="\\\\u206c",a[8301]="\\\\u206d",a[8302]="\\\\u206e",a[8303]="\\\\u206f",a[65279]="\\\\ufeff",a[65529]="\\\\ufff9",a[65530]="\\\\ufffa",a[65531]="\\\\ufffb",a)}\nfunction Sp(a){Qp();a=a.replace(/[\\x00-\\x1f\\xad\\u0600-\\u0603\\u06dd\\u070f\\u17b4\\u17b5\\u200b-\\u200f\\u2028-\\u202e\\u2060-\\u2064\\u206a-\\u206f\\ufeff\\ufff9-\\ufffb"\\\\]/g,function(a){var c;return c=Rp[a.charCodeAt(0)],null==c?a:c});return na+a+na}var Rp;w(148,1,{});function Tp(){Tp=x;Up=$wnd}\nfunction Vp(a,b,c){function d(){a.onerror=a.onreadystatechange=a.onload=function(){};c&&a.parentNode.removeChild(a)}Tp();a.onload=C(function(){d();b&&b.xd(null)});a.onerror=C(function(){d();b&&b.wd(new Gp("onerror() called."))});a.onreadystatechange=C(function(){("complete"==a.readyState||"loaded"==a.readyState)&&a.onload()})}var Up;\nfunction Wp(a){var b,c,d;b=!a.d?(Tp(),window):a.d;b=(Tp(),b.document);c=(d=b.createElement("script"),d.type="text/javascript",d);(a.a||a.b)&&Vp(c,a.a,a.b);a=a.c;Tp();c.src=a;b.getElementsByTagName(Sh)[0].appendChild(c)}function Xp(a,b){a.a=b;return a}function Yp(a){a.b=!0;return a}function Zp(a){this.c=a}w(150,1,{},Zp);_.a=null;_.b=!1;_.c=null;_.d=null;function $p(){$p=x;aq=new bq(9,z(B,q,-1,[]),new cq)}\nfunction dq(a,b){var c,d,e,f;if(b==a.f)return!0;for(d=a.c,e=0,f=d.length;e<f;++e)if(c=d[e],c==b)return!0;return!1}function eq(a,b){a.b=b;if($stats){var c=fq(b==a.f?gi:rh+b,Ag,b);$stats(c)}var d=a.e,c=new gq(a,b),e,f;f=hq(b,c);null!=f&&(d=(e=d.a[b]?d.a[b]:0,d.a[b]=e+1,e),0<d&&(e=-1!=f.indexOf(Gd)?38:63,f+=String.fromCharCode(e)+"manualRetry="+d),c=new iq(f,c,b),jq(c.b,c),Wp(Xp(Yp((Tp(),new Zp(c.f))),new kq(c))))}\nfunction lq(a){if(!(0<=a.b)){var b,c,d,e;if(!a.j){a.j=new mq(a.c.length+1);for(c=a.c,d=0,e=c.length;d<e;++d){b=c[d];var f=a.j;f.a[f.c++]=b}c=a.j;d=a.f;c.a[c.c++]=d}for(;0<a.k.c-a.k.b&&a.d[a.k.a[a.k.b]];)c=a.k.a[a.k.b++],c<a.i.length&&nq(a.i,c,null);a:{c=a.i;for(d=0;d<c.length;++d)if(c[d]){c=!1;break a}c=!0}c||(0<a.j.c-a.j.b?eq(a,a.j.a[a.j.b]):0<a.k.c-a.k.b&&eq(a,a.k.a[a.k.b++]))}}\nfunction bq(a,b,c){this.f=a;this.c=b;this.e=c;a+=1;this.a=D(oq,u,104,a,0);this.k=new mq(a);this.d=D(pq,ml,-1,a,2);this.i=D(qq,u,18,a,0)}function rq(a,b){$p();var c=aq,d;c.d[a]?b.Ad():(d=c.a[a],null==d&&(d=nq(c.a,a,D(sq,u,17,0,0))),nq(d,d.length,b),c.i[a]||(nq(c.i,a,new tq(c,a)),dq(c,a)||(d=c.k,d.a[d.c++]=a),lq(c)))}w(151,1,{},bq);_.a=null;_.b=-1;_.c=null;_.d=null;_.e=null;_.f=0;_.i=null;_.j=null;_.k=null;var aq;function tq(a,b){this.a=a;this.b=b}w(152,1,Zl,tq);\n_.Cd=function(a){var b,c,d,e;e=this.a.a[this.b];if(null!=e){nq(this.a.a,this.b,null);for(c=0,d=e.length;c<d;++c)b=e[c],b.zd(a)}};_.a=null;_.b=0;function mq(a){this.a=D(B,q,-1,a,1)}w(153,1,{},mq);_.a=null;_.b=0;_.c=0;function uq(a){this.f="Download of "+a+" failed with status 404(Script Tag Failure - no status available)"}w(154,136,dm,uq);function vq(a,b,c){this.e=c;this.f="Install of "+a+" failed with text "+b}w(155,136,dm,vq);\nfunction wq(a,b){var c,d,e,f,g;if(a.b.b==a.a){f=a.b.i;a.b.i=D(qq,u,18,a.b.f+1,0);d=a.b.k;d.b=0;d.c=0;a.b.b=-1;g=null;for(d=0,e=f.length;d<e;++d)if(c=f[d])try{c.Cd(b)}catch(h){if(h=yq(h),G(h,105))g=c=h;else throw h;}if(g)throw g;}}function gq(a,b){this.b=a;this.a=b}w(156,1,Zl,gq);_.Cd=function(a){wq(this,a)};_.a=0;_.b=null;function fq(a,b,c){a={moduleName:$moduleName,sessionId:$sessionId,subSystem:"runAsync",evtGroup:a,millis:(new Date).getTime(),type:b};0<=c&&(a.fragment=c);return a}\nfunction Op(a){return a.$H||(a.$H=++zq)}function Aq(){return($wnd||self)["__gwtDevModeHook:"+$moduleName+":moduleBase"]||$moduleBase}function Bq(){return $wnd.setTimeout(function(){0!=Cq&&(Cq=0);Dq=-1},10)}var Cq=0,zq=0,Eq=0,Dq=-1;function hq(a,b){return __gwtStartLoadingFragment(a,C(function(a){b.Cd(a)}))}w(159,1,{});\nfunction Fq(a,b,c){if(c&&(++a.e,a.e<=a.c)){b=-1!=a.d.indexOf(Gd)?38:63;a.f=a.d+String.fromCharCode(b)+"autoRetry="+a.e;jq(a.b,a);Wp(Xp(Yp((Tp(),new Zp(a.f))),new kq(a)));return}wq(a.a,b)}function iq(a,b,c){this.d=this.f=a;this.a=b;this.c=3;this.e=0;this.b=c}w(161,1,{},iq);_.a=null;_.b=0;_.c=0;_.d=null;_.e=0;_.f=null;function Gq(){Gq=x;Hq=new Iq}function Jq(a,b){a.a=Kq(a.a,[b,!1]);a.j||(a.j=!0,!a.e&&(a.e=new Lq(a)),Mq(a.e,1),!a.i&&(a.i=new Nq(a)),Mq(a.i,50))}function Iq(){}\nfunction Oq(a){return a.Bd()}function Kq(a,b){!a&&(a=[]);a[a.length]=b;return a}function Pq(a,b){var c,d,e;for(c=0,d=a.length;c<d;++c){e=a[c];try{e[1]?e[0].Bd()&&(b=Kq(b,e)):e[0].pd()}catch(f){if(f=yq(f),!G(f,106))throw f;}}return b}function Mq(a,b){Gq();$wnd.setTimeout(function(){C(Oq)(a)&&$wnd.setTimeout(arguments.callee,b)},b)}w(162,148,{},Iq);_.a=null;_.b=null;_.c=null;_.d=!1;_.e=null;_.f=null;_.i=null;_.j=!1;var Hq;function Lq(a){this.a=a}w(163,1,{},Lq);\n_.Bd=function(){this.a.d=!0;var a=this.a,b;a.a&&(b=a.a,a.a=null,!a.f&&(a.f=[]),Pq(b,a.f));if(a.f){b=a.f;var c,d,e,f,g,h;g=b.length;if(0==g)b=null;else{c=!1;for(d=new Wm;100>zm()-d.a;){e=!1;for(f=0;f<g;++f)if(h=b[f])e=!0,h[0].Bd()||(b[f]=null,c=!0);if(!e)break}if(c){c=[];for(f=0;f<g;++f)b[f]&&(c[c.length]=b[f]);b=0==c.length?null:c}}a.f=b}this.a.d=!1;return this.a.j=!!this.a.a||!!this.a.f};_.a=null;function Nq(a){this.a=a}w(164,1,{},Nq);_.Bd=function(){this.a.d&&Mq(this.a.e,1);return this.a.j};\n_.a=null;function cq(){this.a=[]}function Qq(a){Rq(a.b)&&Fq(a,new uq(a.f),!0)}function Rq(a){if(!__gwtModuleFunction[Ej+a])return!1;delete __gwtModuleFunction[Ej+a];return!0}function jq(a,b){__gwtModuleFunction[Ej+a]=C(function(a){if(Rq(b.b)){var d,e;try{__gwtInstallCode(a)}catch(f){if(f=yq(f),G(f,105))d=f,e=a,null!=a&&200<a.length&&(e=a.substr(0,200)+mc),Fq(b,new vq(b.f,e,d),!1);else throw f;}}})}w(166,159,{},cq);function kq(a){this.a=a}w(167,1,{},kq);_.wd=function(){Qq(this.a)};_.xd=function(){Qq(this.a)};\n_.a=null;w(169,1,{});function Bp(a,b){a.a+=b}function Sq(){}w(170,169,{},Sq);_.a=n;function Tq(a,b){return parseInt(a[b])||0}function Uq(a,b){return null==a[b]?null:""+a[b]}function Vq(a,b){var c,d,e;for(c=a.indexOf(b);-1!=c;){if(0==c||32==a.charCodeAt(c-1))if(d=c+b.length,e=a.length,d==e||d<e&&32==a.charCodeAt(d))break;c=a.indexOf(b,c+1)}return c}function Wq(a){var b=$doc.createElement("INPUT");b.type=a;return b}function Xq(a){for(a=a.firstChild;a&&1!=a.nodeType;)a=a.nextSibling;return a}\nfunction Yq(a){a=a.parentNode;(!a||1!=a.nodeType)&&(a=null);return a}function Zq(a,b){var c=$doc.createEvent("HTMLEvents");c.initEvent(a,!1,b);return c}function $q(a){a=a.button;return 1==a?4:2==a?2:1}function ar(a){for(var b=0,c=a.parentNode;c&&c.offsetParent;)c.tagName!=Pf&&c.tagName!=Of&&(b-=c.scrollLeft),c=c.parentNode;for(;a;)b+=a.offsetLeft,a=a.offsetParent;return b}\nfunction br(a){for(var b=0,c=a.parentNode;c&&c.offsetParent;)c.tagName!=Pf&&c.tagName!=Of&&(b-=c.scrollTop),c=c.parentNode;for(;a;)b+=a.offsetTop,a=a.offsetParent;return b}function cr(){var a=$doc;!a.gwt_uid&&(a.gwt_uid=1);return"gwt-uid-"+a.gwt_uid++}function dr(){var a=$doc;return(H(a.compatMode,ne)?a.documentElement:a.body).clientHeight}function er(){var a=$doc;return(H(a.compatMode,ne)?a.documentElement:a.body).clientWidth}\nfunction fr(a){return(H(a.compatMode,ne)?a.documentElement:a.body).scrollLeft||0}function gr(a){return(H(a.compatMode,ne)?a.documentElement:a.body).scrollTop||0}w(193,1,{89:1,94:1,96:1});_.eQ=em;_.hC=fm;_.tS=function(){return n+this.b};_.b=0;\nfunction hr(){hr=x;ir=new jr;kr=new lr;mr=new nr;or=new pr;qr=new rr;sr=new tr;ur=new vr;wr=new xr;yr=new zr;Ar=new Br;Cr=new Dr;Er=new Fr;Gr=new Hr;Ir=new Jr;Kr=new Lr;Mr=new Nr;Or=new Pr;Qr=new Rr;Sr=z(Tr,u,20,[ir,kr,mr,or,qr,sr,ur,wr,yr,Ar,Cr,Er,Gr,Ir,Kr,Mr,Or,Qr])}w(199,193,zl);var Sr,kr,Or,mr,ir,sr,Mr,qr,ur,wr,yr,or,Qr,Ar,Cr,Er,Ir,Kr,Gr;function jr(){this.b=0}w(200,199,zl,jr);function Br(){this.b=9}w(201,199,zl,Br);function Dr(){this.b=10}w(202,199,zl,Dr);function Fr(){this.b=11}\nw(203,199,zl,Fr);function Hr(){this.b=12}w(204,199,zl,Hr);function Jr(){this.b=13}w(205,199,zl,Jr);function Lr(){this.b=14}w(206,199,zl,Lr);function Nr(){this.b=15}w(207,199,zl,Nr);function Pr(){this.b=16}w(208,199,zl,Pr);function Rr(){this.b=17}w(209,199,zl,Rr);function lr(){this.b=1}w(210,199,zl,lr);function nr(){this.b=2}w(211,199,zl,nr);function pr(){this.b=3}w(212,199,zl,pr);function rr(){this.b=4}w(213,199,zl,rr);function tr(){this.b=5}w(214,199,zl,tr);function vr(){this.b=6}w(215,199,zl,vr);\nfunction xr(){this.b=7}w(216,199,zl,xr);function zr(){this.b=8}w(217,199,zl,zr);function Ur(){Ur=x;Vr=new Wr;Xr=new Yr;Zr=new $r;as=new bs;cs=z(ds,u,21,[Vr,Xr,Zr,as])}w(218,193,Fl);var cs,Xr,Zr,as,Vr;function Wr(){this.b=0}w(219,218,Fl,Wr);function Yr(){this.b=1}w(220,218,Fl,Yr);function $r(){this.b=2}w(221,218,Fl,$r);function bs(){this.b=3}w(222,218,Fl,bs);function es(){es=x;fs=new gs;hs=new is;js=new ks;ls=new ms;ns=z(os,u,23,[fs,hs,js,ls])}w(223,193,Ll);var ns,fs,hs,js,ls;\nfunction gs(){this.b=0}w(224,223,Ll,gs);function is(){this.b=1}w(225,223,Ll,is);function ks(){this.b=2}w(226,223,Ll,ks);function ms(){this.b=3}w(227,223,Ll,ms);function ps(){ps=x;qs=new rs;ss=new ts;us=new vs;ws=new xs;ys=new zs;As=new Bs;Cs=new Ds;Es=new Fs;Gs=new Hs;Is=z(Js,u,24,[qs,ss,us,ws,ys,As,Cs,Es,Gs])}w(228,193,cm);var Is,Es,us,ws,Cs,Gs,As,ss,ys,qs;function rs(){this.b=0}w(229,228,cm,rs);function ts(){this.b=1}w(230,228,cm,ts);function vs(){this.b=2}w(231,228,cm,vs);\nfunction xs(){this.b=3}w(232,228,cm,xs);function zs(){this.b=4}w(233,228,cm,zs);function Bs(){this.b=5}w(234,228,cm,Bs);function Ds(){this.b=6}w(235,228,cm,Ds);function Fs(){this.b=7}w(236,228,cm,Fs);function Hs(){this.b=8}w(237,228,cm,Hs);function Ks(){Ks=x;Ls=new Ms;Ns=new Os;Ps=new Qs;Rs=new Ss;Ts=new Us;Vs=new Ws;Xs=new Ys;Zs=new $s;at=z(bt,u,25,[Ls,Ns,Ps,Rs,Ts,Vs,Xs,Zs])}w(238,193,jl);var at,Ls,Xs,Vs,Ns,Ps,Zs,Ts,Rs;function Ms(){this.b=0}w(239,238,jl,Ms);function Os(){this.b=1}w(240,238,jl,Os);\nfunction Qs(){this.b=2}w(241,238,jl,Qs);function Ss(){this.b=3}w(242,238,jl,Ss);function Us(){this.b=4}w(243,238,jl,Us);function Ws(){this.b=5}w(244,238,jl,Ws);function Ys(){this.b=6}w(245,238,jl,Ys);function $s(){this.b=7}w(246,238,jl,$s);function ct(){ct=x;dt=[];et=[];ft=[]}var dt,et,ft;function gt(){gt=x;ht=new it}function jt(a){var b;b=$doc.createElement("style");b.language="text/css";b.textContent=a||n;return b}function kt(a){var b;a.a||(b=$doc.getElementsByTagName(Sh)[0],a.a=b);return a.a}\nfunction it(){}w(249,1,{},it);_.a=null;var ht;w(261,1,{});_.tS=function(){return"An event type"};_.f=null;w(260,261,{});_.Fd=function(){this.e=!1;this.f=null};_.e=!1;w(259,260,{});_.Ed=function(){return this.Gd()};_.a=null;var lt=_.b=null;function mt(){mt=x;nt=new ot(Dg,new pt)}function pt(){}w(258,259,{},pt);_.Dd=function(a){a.Hd(this)};_.Gd=function(){return nt};var nt;w(265,259,Cl);function qt(a,b){return(a.a.clientX||0)-ar(b)+(b.scrollLeft||0)+fr(b.ownerDocument)}\nfunction rt(a,b){return(a.a.clientY||0)-br(b)+(b.scrollTop||0)+gr(b.ownerDocument)}function st(a){var b;return(b=a.b)?qt(a,b):a.a.clientX||0}function tt(a){var b;return(b=a.b)?rt(a,b):a.a.clientY||0}w(264,265,Cl);function ut(){ut=x;vt=new ot(Ug,new wt)}function wt(){}w(263,264,Cl,wt);_.Dd=function(a){a.Jd(this)};_.Gd=function(){return vt};var vt;function xt(){xt=x;yt=new ot(hh,new zt)}function zt(){}w(266,259,{},zt);_.Dd=function(){this.a.preventDefault();this.a.stopPropagation()};_.Gd=function(){return yt};\nvar yt;w(269,1,{52:1});_.hC=At;_.tS=function(){return"Event type"};var Bt=_.c=0;function Rm(){this.c=++Bt}w(268,269,Hl,Rm);function ot(a,b){this.c=++Bt;this.a=b;!lt&&(lt=new Ct);lt.a[a]=this;this.b=a}w(267,268,Hl,ot);_.a=null;_.b=null;w(271,259,{});function Dt(){Dt=x;Et=new ot(sh,new Ft)}function Gt(a){a.a.stopPropagation();a.a.preventDefault()}function Ft(){}w(272,271,{},Ft);_.Dd=function(){Gt(this)};_.Gd=function(){return Et};var Et;function Ht(){Ht=x;It=new ot(th,new Jt)}function Jt(){}\nw(273,271,{},Jt);_.Dd=function(){Gt(this)};_.Gd=function(){return It};var It;function Kt(){Kt=x;Lt=new ot(uh,new Mt)}function Mt(){}w(274,271,{},Mt);_.Dd=function(){Gt(this)};_.Gd=function(){return Lt};var Lt;function Nt(){Nt=x;Ot=new ot(vh,new Pt)}function Pt(){}w(275,271,{},Pt);_.Dd=function(a){a=Qt(a.a,!0,!1);(this.a.dataTransfer||null).setData(gk,a)};_.Gd=function(){return Ot};var Ot;function Rt(){Rt=x;St=new ot(wh,new Tt)}function Tt(){}w(276,271,{},Tt);\n_.Dd=function(a){var b,c,d,e;this.a.stopPropagation();this.a.preventDefault();d=(this.a.dataTransfer||null).files;e=0;a:for(;e<d.length;++e){if(0<a.a.d&&e>=a.a.d)break a;b=d[e];c=new FileReader;Ut(c,a.a.b);1==a.a.c&&c.readAsText(b)}0==d.length&&(b=(this.a.dataTransfer||null).getData(gk),a.a.b.Xf(b))};_.Gd=function(){return St};var St;function Vt(){Vt=x;Wt=new ot(Ih,new Xt)}function Xt(){}w(278,259,{},Xt);\n_.Dd=function(a){var b,c;b=this.a.rotation;c=this.a.scale;a.a.e&&(0!=b&&a.a.b.b!=b&&(a.a.b.b=b,a.a.b.a=null,Yt(a.a.e,a.a.b)&&this.a.preventDefault()),a.a.d=!0);a.a.f&&(1!=c&&a.a.b.c!=c&&(a.a.b.a=null,a.a.b.c=c,Zt(a.a.f,a.a.b)&&this.a.preventDefault()),a.a.d=!0)};_.Gd=function(){return Wt};var Wt;function $t(){$t=x;au=new ot(Jh,new bu)}function bu(){}w(279,259,{},bu);_.Dd=function(a){a.a.a&&(a.a.b.a=null,cu(a.a.a,a.a.b))};_.Gd=function(){return au};var au;function du(){du=x;eu=new ot(Lh,new fu)}\nfunction fu(){}w(280,259,{},fu);_.Dd=function(){this.a.preventDefault()};_.Gd=function(){return eu};var eu;w(282,259,{});w(281,282,{});function gu(){gu=x;hu=new ot(ci,new iu)}function iu(){}w(283,281,{},iu);\n_.Dd=function(a){var b,c;c=this.a.keyCode||0;0<=c&&c<(ju(),ku).length&&-999!=(ju(),ku)[c]&&(c=(ju(),ku)[c]);b=new lu(null,c,null);if(this.a.ctrlKey||this.a.shiftKey||this.a.metaKey||this.a.altKey)this.a.ctrlKey&&(b.e|=2),this.a.altKey&&(b.e|=8),this.a.metaKey&&(b.e|=4),this.a.shiftKey&&(b.e|=1);a:{var a=a.a.c,d=c,e;a.Gb=!1;if(!a.J||a.K){mu(a,n);c=0;e=8==b.e;b=0!=(b.e&2);switch(d){case 99:case 67:b?nu(Qt(a,!0,!1)):c=301;break;case 118:case 86:b&&a.Tb&&(b=a.r,null==b.i&&(b.i="PASTE"),ou(a.E,(!a.Ub&&\n(a.Ub=new pu(a)),a.Ub)));break;case 110:case 78:c=401;break;case 111:case 79:c=501;break;case 115:case 83:c=601;break;case 112:case 80:c=1101;break;case 102:case 70:c=701;break;case 108:case 76:c=801;break;case 98:case 66:c=901;break;case 105:case 73:c=1001;break;case 120:case 88:a.Bc&&(mu(a,Uq((qu(),ru).Tc.a.pb,Ak)),c=1201,a.n=32);break;case 104:case 72:mu(a,Pe);c=1300;break;case 114:case 82:mu(a,"-R");c=1301;break;case 116:case 84:701==a.k?(c=236,mu(a,Mb)):801==a.k?(c=237,mu(a,Lb)):(c=233,mu(a,\n"-tBu"));break;case 121:case 89:b?c=111:(c=234,mu(a,Zb));break;case 122:case 90:b?c=110:(c=239,mu(a,bc));break;case 97:case 65:c=235;mu(a,"-COOH");break;case 101:case 69:c=238;mu(a,vb);break;case 117:case 85:c=110;break;case 113:case 81:c=242;mu(a,wb);break;case 103:a=!0;break a;case 27:c=202;break;case 45:701==a.k?(c=254,mu(a,"-F")):801==a.k?(c=255,mu(a,"-Cl")):901==a.k?(c=256,mu(a,"-Br")):1001==a.k?(c=257,mu(a,"-I")):501==a.k?(c=259,mu(a,"-OH")):401==a.k?(c=258,mu(a,"-NH2")):c=202;break;case 43:c=\n108;break;case 35:c=204;break;case 48:105==a.k?su(a,0):e?(c=223,mu(a,"-3-Furyl")):(c=221,mu(a,"-Furyl"));break;case 49:105==a.k?su(a,1):c=209;break;case 50:case 61:50==d&&105==a.k?su(a,2):501==a.k?(c=250,mu(a,"=O")):c=203;break;case 51:105==a.k?su(a,3):c=206;break;case 52:105==a.k?su(a,4):c=207;break;case 53:105==a.k?su(a,5):c=208;break;case 54:105==a.k?su(a,6):c=210;break;case 55:105==a.k?su(a,7):c=211;break;case 56:105==a.k?su(a,8):c=212;break;case 57:105==a.k?su(a,9):(mu(a,"9 ring"),c=229);break;\ncase 100:case 68:case 8:case 127:c=104;break;case 32:c=205;break;case 109:case 77:case 1002:c=151;break;case 119:case 87:case 1003:c=152;break;case 1E3:c=153;break;case 1001:c=154}d=d+1-49;0<=d&&9>=d&&0<a.ob.v&&(b=a.ob.b[a.ob.v].a,33<=b&&42>=b&&(c=1301+d));tu(a,c)}a=!0}a&&this.a.preventDefault()};_.Gd=function(){return hu};var hu;function uu(){uu=x;vu=new ot(Di,new wu)}function wu(){}w(284,264,Cl,wu);_.Dd=function(a){a.ld(this)};_.Gd=function(){return vu};var vu;\nfunction xu(){xu=x;yu=new ot(Ei,new zu)}function zu(){}w(285,264,Cl,zu);_.Dd=function(a){a.md(this)};_.Gd=function(){return yu};var yu;function Au(){Au=x;Bu=new ot(Fi,new Cu)}function Cu(){}w(286,264,Cl,Cu);_.Dd=function(a){a.nd(this)};_.Gd=function(){return Bu};var Bu;function Du(){Du=x;Eu=new ot(Gi,new Fu)}function Fu(){}w(287,264,Cl,Fu);_.Dd=function(a){var b;b=this.a;Jq((Gq(),Hq),new Gu(a,a.b,b))};_.Gd=function(){return Eu};var Eu;function Hu(){Hu=x;Iu=new ot(Hi,new Ju)}function Ju(){}\nw(288,264,Cl,Ju);_.Dd=function(a){a.od(this)};_.Gd=function(){return Iu};var Iu;function Ku(){Ku=x;Lu=new ot(Ii,new Mu);new ot(Fe,new Mu)}function Mu(){}w(289,264,Cl,Mu);_.Dd=function(a){var b,c,d,e,f;b=new Nu(a.a.i,st(this),tt(this),4*this.a.detail||0);f=0;for(c=Ou(a.a.i.Pc,D(Pu,u,76,0,0)),d=0,e=c.length;d<e;++d)a=c[d],++f,a.Af(b);0<f&&this.a.preventDefault()};_.Gd=function(){return Lu};var Lu;function Ct(){this.a={}}w(290,1,{},Ct);_.a=null;w(293,265,Cl);var Qu=null;\nfunction Ru(){Ru=x;Su=new ot(ok,new Tu)}function Tu(){}w(292,293,Cl,Tu);_.Dd=Uu;_.Gd=function(){return Su};var Su;function Vu(){Vu=x;Wu=new ot(pk,new Xu)}function Xu(){}w(294,293,Cl,Xu);_.Dd=Uu;_.Gd=function(){return Wu};var Wu;function Yu(){var a;this.a=(a=document.createElement(ph),a.setAttribute(Yi,"return;"),typeof a.ontouchstart==Gh)}w(295,1,{},Yu);function Zu(){Zu=x;$u=new ot(qk,new av)}function av(){}w(296,293,Cl,av);_.Dd=function(a){var b=a.a;if(a=a.a.n)bv(b,this),a.Lh(b.b);b.d=!0};_.Gd=function(){return $u};\nvar $u;function cv(){cv=x;dv=new ot(rk,new ev)}function ev(){}w(297,293,Cl,ev);_.Dd=function(a){bv(a.a,this)&&(a.a.j&&fv(a.a.j,a.a.b)?a.a.d=!0:(this.a.preventDefault(),Em(a.a.c,750),a.a.d=!1))};_.Gd=function(){return dv};var dv;function gv(a,b){this.a=b;this.b=a}function hv(a,b,c){Qm&&(b=new gv(b,c),a.Wd(b))}w(298,260,{},gv);_.Dd=function(a){a.Sd(this)};_.Ed=function(){return Qm};_.a=!1;var Qm=_.b=null;function iv(){}function jv(a){var b;kv&&(b=new iv,a.Wd(b))}w(300,260,{},iv);_.Dd=function(a){a.Ud(this)};\n_.Ed=function(){return kv};var kv=null;function lv(){}w(302,260,{},lv);_.Dd=function(a){a.a.W&&a.a.Fe()};_.Ed=function(){return mv};var mv=null;function nv(a,b,c){a=a.a;if(!b)throw new ov("Cannot add a handler with a null type");if(!c)throw new ov("Cannot add a null handler");0<a.b?pv(a,new qv(a,b,c)):rv(a,b,null,c);return new sv(new tv(a,b,c))}\nfunction uv(a,b){var c;!b.e||b.Fd();c=b.f;b.f=a.b;try{var d=a.a,e,f,g,h,j;if(!b)throw new ov("Cannot fire null event");try{++d.b;h=vv(d,b.Ed(),null);e=null;for(j=d.c?h.Dh(h.Tf()):h.Ch();d.c?j.Fh():j.Zd();){g=d.c?j.Gh():j.$d();try{b.Dd(g)}catch(l){if(l=yq(l),G(l,106))f=l,!e&&(e=new wv),xv(e,f);else throw l;}}if(e)throw new yv(e);}finally{if(--d.b,0==d.b){var o,m;if(d.a)try{for(m=new zv(d.a);m.b<m.d.Tf();)o=Av(m),o.pd()}finally{d.a=null}}}}catch(r){r=yq(r);if(G(r,53))throw new Bv(r.a);throw r;}finally{null==\nc?(b.e=!0,b.f=null):b.f=c}}function Cv(a){Dv.call(this,a,!1)}function Dv(a,b){this.a=new Ev(b);this.b=a}w(303,1,Xl,Cv,Dv);_.Wd=function(a){uv(this,a)};_.a=null;_.b=null;w(306,1,{});function pv(a,b){!a.a&&(a.a=new Jm);Dm(a.a,b)}function rv(a,b,c,d){var e;e=Fv(a.d,b);e||(e=new xp,E(a.d,b,e));a=e.Pf(c);a||(a=new Jm,e.Rf(c,a));a.uh(d)}function Gv(a,b,c,d){var e,f;e=vv(a,b,c);e.wh(d)&&e.Qf()&&(f=Fv(a.d,b),f.Sf(c),f.Qf()&&Hv(a.d,b))}\nfunction vv(a,b,c){a=Fv(a.d,b);if(!a)return Iv(),Iv(),Ov;c=a.Pf(c);return!c?(Iv(),Iv(),Ov):c}w(305,306,{});_.a=null;_.b=0;_.c=!1;function Ev(a){this.d=new xp;this.c=a}w(304,305,{},Ev);function sv(a){this.a=a}w(307,1,{},sv);_.a=null;function yv(a){Fp.call(this,Pv(a),Qv(a));this.a=a}function Qv(a){a=a.ye();return!a.Zd()?null:a.$d()}\nfunction Pv(a){var b,c,d;b=a.Tf();if(0==b)return null;b=new Rv(1==b?"Exception caught: ":b+" exceptions caught: ");c=!0;for(d=a.ye();d.Zd();)a=d.$d(),c?c=!1:b.a.a+="; ",Ap(b,a.yd());return b.a.a}w(309,136,tl,yv);_.a=null;function Bv(a){yv.call(this,a)}w(308,309,tl,Bv);w(310,1,{},function(){});function Sv(){Sv=x;Tv=new Uv}function Uv(){}w(315,1,{},Uv);_.a=null;var Tv;function Vv(){}function Wv(a,b){var c;c=a.slice(0,b);z(a.cZ,a.cM,a.qI,c);return c}\nfunction Xv(a,b){var c=Array(b);if(3==a)for(var d=0;d<b;++d){var e={};e.l=e.m=e.h=0;c[d]=e}else if(0<a){e=[null,0,!1][a];for(d=0;d<b;++d)c[d]=e}return c}function D(a,b,c,d,e){d=Xv(e,d);z(a,b,c,d);return d}function Yv(a,b,c,d,e,f,g){var h,j,l;j=d[e];h=e==f-1;l=Xv(h?g:0,j);z(a[e],b[e],c[e],l);if(!h){++e;for(h=0;h<j;++h)l[h]=Yv(a,b,c,d,e,f,g)}return l}function z(a,b,c,d){Zv();var e=$v,f=aw;Zv();for(var g=0,h=e.length;g<h;++g)d[e[g]]=f[g];d.cZ=a;d.cM=b;d.qI=c;return d}\nfunction nq(a,b,c){if(null!=c){if(0<a.qI&&(!c.cM||!c.cM[a.qI]))throw new bw;if(-1==a.qI&&(c.tM==x||c.cM&&c.cM[1]))throw new bw;if(-1>a.qI&&(c.tM==x||c.cM&&c.cM[1])&&(!c.cM||!c.cM[-a.qI]))throw new bw;}return a[b]=c}w(319,1,{},Vv);_.qI=0;function Zv(){Zv=x;$v=[];aw=[];var a=new Vv,b=$v,c=aw,d=0,e,f;for(f in a)if(e=a[f])b[d]=f,c[d]=e,++d}var $v,aw;function G(a,b){return null!=a&&a.cM&&!!a.cM[b]}function Ip(a){return null!=a&&a.tM!=x&&!(a.cM&&a.cM[1])}function Lp(a){return a.tM==x||a.cM&&!!a.cM[1]}\nfunction cw(a){return null==a?null:a}function dw(a){return~~Math.max(Math.min(a,2147483647),-2147483648)}var ew=-1;\nfunction fw(){var a;$stats&&gw("com.google.gwt.useragent.client.UserAgentAsserter");a=navigator.userAgent.toLowerCase();if(-1!=a.indexOf(Zi))a=Zi;else if(-1!=a.indexOf("webkit"))a="safari";else if(-1!=a.indexOf(Ki)&&9<=$doc.documentMode)a="ie9";else if(-1!=a.indexOf(Ki)&&8<=$doc.documentMode)a="ie8";else{var b;var c=/msie ([0-9]+)\\.([0-9]+)/.exec(a);c&&3==c.length&&(b=6E3<=1E3*parseInt(c[1])+parseInt(c[2]));a=b?"ie6":-1!=a.indexOf("gecko")?"gecko1_8":"unknown"}H(Zi,a)||$wnd.alert("ERROR: Possible problem with your *.gwt.xml module file.\\nThe compile time user.agent value (opera) does not match the runtime user.agent value ("+\na+"). Expect more errors.\\n");$stats&&gw("com.google.gwt.user.client.DocumentModeAsserter");b=$doc.compatMode;a=z(hw,u,1,[ne]);for(c=0;c<a.length&&!H(a[c],b);++c);$stats&&gw("com.allen_sauer.gwt.dnd.client.util.DragEntryPoint");$wnd.$GWT_DND_VERSION="3.0.0";ct();ft.unshift("HTML{margin:0 !important;border:none !important;}.dragdrop-handle{cursor:move;user-select:none;-khtml-user-select:none;-moz-user-select:none;}.GBVTBU-BB{zoom:1;}.dragdrop-dragging{zoom:normal;}.GBVTBU-BI{border:1px dashed #1e90ff;margin:0 !important;zoom:1;z-index:100;}.dragdrop-flow-panel-positioner{color:#1e90ff;display:inline;text-align:center;vertical-align:middle;}.dragdrop-proxy{background-color:#7af;}.dragdrop-selected,.dragdrop-dragging,.dragdrop-proxy{filter:alpha(opacity \\\\= 30);opacity:0.3;}.dragdrop-movable-panel{z-index:200;margin:0 !important;border:none !important;}");\nct();0!=ft.length&&(a=ft.join(n),b=(gt(),ht),a=jt(a),kt(b).insertBefore(a,b.a.firstChild),ft.length=0);0!=dt.length&&(a=dt.join(n),b=(gt(),ht),a=jt(a),kt(b).appendChild(a),dt.length=0);0!=et.length&&(a=et.join(n),b=(gt(),ht),a=jt(a),kt(b).appendChild(a),et.length=0);$stats&&gw("export.client.JSME_export");new iw;new jw;0<kw(null)?Jq((Gq(),Hq),new lw):mw()}function yq(a){return G(a,106)?a:new Hp(a)}function nw(a){return ow(a&4194303,a>>22&4194303,0>a?1048575:0)}\nfunction pw(a){return ow(a.l,a.m,a.h)}function ow(a,b,c){return _=new qw,_.l=a,_.m=b,_.h=c,_}\nfunction rw(a,b){var c,d,e,f,g;if(0==b.l&&0==b.m&&0==b.h)throw new sw;if(0==a.l&&0==a.m&&0==a.h)return tw=ow(0,0,0),ow(0,0,0);if(524288==b.h&&0==b.m&&0==b.l)return c=a,524288==c.h&&0==c.m&&0==c.l?(tw=ow(0,0,0),c=pw((uw(),vw))):(tw=ow(c.l,c.m,c.h),c=ow(0,0,0)),c;g=!1;0!=b.h>>19&&(b=ww(b),g=!0);e=b.l;0!=(e&e-1)?f=-1:(d=b.m,0!=(d&d-1)?f=-1:(c=b.h,f=0!=(c&c-1)||0==c&&0==d&&0==e?-1:0==c&&0==d&&0!=e?xw(e):0==c&&0!=d&&0==e?xw(d)+22:0!=c&&0==d&&0==e?xw(c)+44:-1));c=d=e=!1;if(524288==a.h&&0==a.m&&0==a.l)if(e=\nd=!0,-1==f)a=pw((uw(),yw)),c=!0,g=!g;else return c=zw(a,f),g&&Aw(c),tw=ow(0,0,0),c;else 0!=a.h>>19&&(e=!0,a=ww(a),c=!0,g=!g);if(-1!=f){c=a;d=f;f=g;g=e;e=zw(c,d);f&&Aw(e);var h;22>=d?(f=c.l&(1<<d)-1,h=c=0):44>=d?(f=c.l,h=c.m&(1<<d-22)-1,c=0):(f=c.l,h=c.m,c=c.h&(1<<d-44)-1);c=ow(f,h,c);g?tw=ww(c):tw=ow(c.l,c.m,c.h);return e}if(!Bw(a,b))return e?tw=ww(a):tw=ow(a.l,a.m,a.h),ow(0,0,0);c=c?a:ow(a.l,a.m,a.h);var j,l,o,m;l=Cw(b)-Cw(c);f=Dw(b,l);for(h=ow(0,0,0);0<=l;){j=c;var r=m=o=void 0,r=j.h-f.h;0>r?j=\n!1:(o=j.l-f.l,m=j.m-f.m+(o>>22),r+=m>>22,0>r?j=!1:(j.l=o&4194303,j.m=m&4194303,j.h=r&1048575,j=!0));if(j&&(22>l?h.l|=1<<l:44>l?h.m|=1<<l-22:h.h|=1<<l-44,0==c.l&&0==c.m&&0==c.h))break;j=f.m;o=f.h;m=f.l;f.h=o>>>1;f.m=j>>>1|(o&1)<<21;f.l=m>>>1|(j&1)<<21;--l}g&&Aw(h);e?(tw=ww(c),d&&(tw=Ew(tw,(uw(),vw)))):tw=ow(c.l,c.m,c.h);return h}function Aw(a){var b,c,d;b=~a.l+1&4194303;c=~a.m+(0==b?1:0)&4194303;d=~a.h+(0==b&&0==c?1:0)&1048575;a.l=b;a.m=c;a.h=d}\nfunction Cw(a){var b;b=Fw(a.h);return 32==b?(b=Fw(a.m),32==b?Fw(a.l)+32:b+20-10):b-12}var tw=null;function Gw(a,b){return a.l==b.l&&a.m==b.m&&a.h==b.h}function J(a){var b,c,d;if(isNaN(a))return uw(),Hw;if(-9223372036854775E3>a)return uw(),Iw;if(9223372036854775E3<=a)return uw(),yw;d=!1;0>a&&(d=!0,a=-a);c=0;17592186044416<=a&&(c=dw(a/17592186044416),a-=17592186044416*c);b=0;4194304<=a&&(b=dw(a/4194304),a-=4194304*b);a=dw(a);b=ow(a,b,c);d&&Aw(b);return b}\nfunction Jw(a){var b,c;return-129<a&&128>a?(b=a+128,null==Kw&&(Kw=D(Lw,u,31,256,0)),c=Kw[b],!c&&(c=Kw[b]=nw(a)),c):nw(a)}function Mw(a){var b=Lk,c,d;c=a.h>>19;d=b.h>>19;return 0==c?0!=d||a.h>b.h||a.h==b.h&&a.m>b.m||a.h==b.h&&a.m==b.m&&a.l>b.l:!(0==d||a.h<b.h||a.h==b.h&&a.m<b.m||a.h==b.h&&a.m==b.m&&a.l<=b.l)}function Bw(a,b){var c,d;c=a.h>>19;d=b.h>>19;return 0==c?0!=d||a.h>b.h||a.h==b.h&&a.m>b.m||a.h==b.h&&a.m==b.m&&a.l>=b.l:!(0==d||a.h<b.h||a.h==b.h&&a.m<b.m||a.h==b.h&&a.m==b.m&&a.l<b.l)}\nfunction Nw(a,b){var c,d,e,f,g,h,j,l,o,m,r,t,y,v;c=a.l&8191;d=a.l>>13|(a.m&15)<<9;e=a.m>>4&8191;f=a.m>>17|(a.h&255)<<5;g=(a.h&1048320)>>8;h=b.l&8191;j=b.l>>13|(b.m&15)<<9;l=b.m>>4&8191;o=b.m>>17|(b.h&255)<<5;m=(b.h&1048320)>>8;r=c*h;y=d*h;t=e*h;v=f*h;g*=h;0!=j&&(y+=c*j,t+=d*j,v+=e*j,g+=f*j);0!=l&&(t+=c*l,v+=d*l,g+=e*l);0!=o&&(v+=c*o,g+=d*o);0!=m&&(g+=c*m);c=(r&4194303)+((y&511)<<13);r=(r>>22)+(y>>9)+((t&262143)<<4)+((v&31)<<17)+(c>>22);t=(t>>18)+(v>>5)+((g&4095)<<8)+(r>>22);return ow(c&4194303,r&\n4194303,t&1048575)}function ww(a){var b,c;b=~a.l+1&4194303;c=~a.m+(0==b?1:0)&4194303;return ow(b,c,~a.h+(0==b&&0==c?1:0)&1048575)}function Dw(a,b){var c,d,e,b=b&63;22>b?(c=a.l<<b,d=a.m<<b|a.l>>22-b,e=a.h<<b|a.m>>22-b):44>b?(c=0,d=a.l<<b-22,e=a.m<<b-22|a.l>>44-b):(d=c=0,e=a.l<<b-44);return ow(c&4194303,d&4194303,e&1048575)}\nfunction zw(a,b){var c,d,e,b=b&63;c=a.h;(d=0!=(c&524288))&&(c|=-1048576);22>b?(e=c>>b,d=a.m>>b|c<<22-b,c=a.l>>b|a.m<<22-b):44>b?(e=d?1048575:0,d=c>>b-22,c=a.m>>b-22|c<<44-b):(e=d?1048575:0,d=d?4194303:0,c>>=b-44);return ow(c&4194303,d&4194303,e&1048575)}function Ew(a,b){var c,d;c=a.l-b.l;d=a.m-b.m+(c>>22);return ow(c&4194303,d&4194303,a.h-b.h+(d>>22)&1048575)}function P(a){return a.l|a.m<<22}\nfunction Ow(a){var b,c,d;if(0==a.l&&0==a.m&&0==a.h)return Fc;if(524288==a.h&&0==a.m&&0==a.l)return"-9223372036854775808";if(0!=a.h>>19)return rb+Ow(ww(a));for(c=n;!(0==a.l&&0==a.m&&0==a.h);){b=Jw(1E9);a=rw(a,b);b=n+P(tw);if(!(0==a.l&&0==a.m&&0==a.h))for(d=9-b.length;0<d;--d)b=Fc+b;c=b+c}return c}var Kw=null;function uw(){uw=x;yw=ow(4194303,4194303,524287);Iw=ow(0,0,524288);vw=Jw(1);Jw(2);Hw=Jw(0)}var yw,Iw,vw,Hw;function qw(){}w(329,1,{31:1},qw);\nfunction gw(a){$stats({moduleName:$moduleName,sessionId:$sessionId,subSystem:"startup",evtGroup:"moduleStartup",millis:(new Date).getTime(),type:"onModuleLoadStart",className:a})}function Pw(a){this.a=a}w(335,1,{},Pw);_.a=null;function Qw(a,b,c){this.c=this.b=0;this.a=c;this.e=b;this.d=a}w(336,1,{},Qw);_.a=0;_.b=0;_.c=0;_.d=null;_.e=0;function Rw(a,b){Ap(a.a,b.a);return a}function Sw(){this.a=new Tw}w(337,1,{},Sw);function Uw(a){if(null==a)throw new ov("css is null");this.a=a}\nw(338,1,{32:1,89:1},Uw);_.eQ=function(a){return!G(a,32)?!1:H(this.a,a.a)};_.hC=Vw;_.a=null;function Ww(a){if(null==a)throw new ov("html is null");this.a=a}w(340,1,Rl,Ww);_.Xd=Xw;_.eQ=Yw;_.hC=Vw;_.a=null;w(341,1,Rl,function(){this.a=n});_.Xd=Xw;_.eQ=Yw;_.hC=Vw;_.a=null;function Zw(){Zw=x;$w=RegExp(Qa,Hh);ax=RegExp(Fd,Hh);bx=RegExp(id,Hh);cx=RegExp(bb,Hh);dx=RegExp(na,Hh)}\nfunction ex(a){Zw();-1!=a.indexOf(Qa)&&(a=a.replace($w,Ua));-1!=a.indexOf(id)&&(a=a.replace(bx,ab));-1!=a.indexOf(Fd)&&(a=a.replace(ax,Ya));-1!=a.indexOf(na)&&(a=a.replace(dx,"""));-1!=a.indexOf(bb)&&(a=a.replace(cx,"'"));return a}var $w,ax,bx,dx,cx;function fx(a){if(null==a)throw new ov("uri is null");this.a=a}w(343,1,{34:1},fx);_.eQ=function(a){return!G(a,34)?!1:H(this.a,a.a)};_.hC=Vw;_.a=null;function gx(){gx=x}w(345,1,{});function hx(){}w(346,1,{},hx);var ix=null;function jx(){}\nw(347,345,{},jx);var kx=null;w(348,1,Tl);_.a=null;function lx(a,b){var c=(mx(),nx(b));a.appendChild(c)}function ox(a,b,c){var d;d=px;px=a;b==qx&&8192==rx(a.type)&&(qx=null);c.ae(a);px=d}var px=null,qx=null;function sx(a){tx();!ux&&(ux=new Rm);vx||(vx=new Dv(null,!0),wx=new xx);return nv(vx,ux,a)}var vx=null;function yx(a){a.e=!1;a.f=null;a.a=!1;a.b=!1;a.c=!0;a.d=null}function xx(){}w(361,260,{},xx);_.Dd=function(a){a.Yd(this);wx.c=!1};_.Ed=function(){return ux};_.Fd=function(){yx(this)};_.a=!1;\n_.b=!1;_.c=!1;var ux=_.d=null,wx=null;function zx(){zx=x;Ax=new Bx;Cx()||(Ax=null)}var Ax=null;function Nm(){}w(363,1,{},Nm);_.Sd=function(){for(;0<(Lm(),Mm).c;)xm(Dx(Mm,0))};function Pm(a,b){return nv((!Ex&&(Ex=new Fx),Ex),a,b)}function Gx(a){Om();Hx||(Ix(),Hx=!0);return Pm((!kv&&(kv=new Rm),kv),a)}function Om(){Jx||(Kx(),Jx=!0)}function Lx(){var a;Jx&&(a=new Mx,Ex&&uv(Ex,a));return null}var Jx=!1,Ex=null,Nx=0,Ox=0,Hx=!1;function Px(){Px=x;Qx=new Rm}function Mx(){Px()}w(365,260,{},Mx);_.Dd=function(){null.ei()};\n_.Ed=function(){return Qx};var Qx;function Fx(){Cv.call(this,null)}w(367,303,Xl,Fx);\nfunction rx(a){switch(a){case Dg:return 4096;case Qg:return 1024;case Ug:return 1;case jh:return 2;case Ah:return 2048;case ci:return 128;case di:return 256;case ei:return 512;case li:return 32768;case "losecapture":return 8192;case Di:return 4;case Ei:return 64;case Fi:return 32;case Gi:return 16;case Hi:return 8;case "scroll":return 16384;case yh:return 65536;case Fe:case Ii:return 131072;case hh:return 262144;case jj:return 524288;case rk:return 1048576;case qk:return 2097152;case pk:return 4194304;\ncase ok:return 8388608;case Lh:return 16777216;case Ih:return 33554432;case Jh:return 67108864;default:return-1}}function tx(){Rx||(Sx(),Rx=!0)}var Rx=!1;function Tx(a,b){for(var c=0,d=a.firstChild;d;){if(1==d.nodeType){if(b==c)return d;++c}d=d.nextSibling}return null}function Ux(a){for(var b=0,a=a.firstChild;a;)1==a.nodeType&&++b,a=a.nextSibling;return b}\nfunction Sx(){Vx=C(function(a){var b;var c=vx,d,e,f;ux&&c&&Wx(c.a.d,ux)?(b=wx.a,d=wx.b,e=wx.c,f=wx.d,yx(wx),wx.d=a,uv(c,wx),c=!(wx.a&&!wx.b),wx.a=b,wx.b=d,wx.c=e,wx.d=f,b=c):b=!0;!b&&a&&(a.cancelBubble=!0,a.preventDefault());return!b?(a.stopPropagation(),a.preventDefault(),!1):!0});Xx=C(function(a){for(var b,c=this;c&&!(b=c.__listener);)c=c.parentNode;c&&1!=c.nodeType&&(c=null);b&&!Ip(b)&&G(b,37)&&ox(a,c,b)});Yx=C(function(a){a.preventDefault();Xx.call(this,a)});Zx=C(function(a){this.__gwtLastUnhandledEvent=\na.type;Xx.call(this,a)});$x=C(function(a){if(Vx(a)){var b=ay;b&&b.__listener&&!Ip(b.__listener)&&G(b.__listener,37)&&(ox(a,b,b.__listener),a.stopPropagation())}});$wnd.addEventListener(Ug,$x,!0);$wnd.addEventListener(jh,$x,!0);$wnd.addEventListener(Di,$x,!0);$wnd.addEventListener(Hi,$x,!0);$wnd.addEventListener(Ei,$x,!0);$wnd.addEventListener(Gi,$x,!0);$wnd.addEventListener(Fi,$x,!0);$wnd.addEventListener(Ii,$x,!0);$wnd.addEventListener(ci,Vx,!0);$wnd.addEventListener(ei,Vx,!0);$wnd.addEventListener(di,\nVx,!0);$wnd.addEventListener(rk,$x,!0);$wnd.addEventListener(qk,$x,!0);$wnd.addEventListener(pk,$x,!0);$wnd.addEventListener(ok,$x,!0);$wnd.addEventListener(Lh,$x,!0);$wnd.addEventListener(Ih,$x,!0);$wnd.addEventListener(Jh,$x,!0)}function by(a,b,c){for(var d=0,e=a.firstChild,f=null;e;){if(1==e.nodeType){if(d==c){f=e;break}++d}e=e.nextSibling}a.insertBefore(b,f)}\nfunction cy(a,b){tx();switch(b){case "drag":a.ondrag=Xx;break;case sh:a.ondragend=Xx;break;case th:a.ondragenter=Yx;break;case "dragleave":a.ondragleave=Xx;break;case uh:a.ondragover=Yx;break;case vh:a.ondragstart=Xx;break;case wh:a.ondrop=Xx;break;case "canplaythrough":case "ended":case "progress":a.removeEventListener(b,Xx,!1);a.addEventListener(b,Xx,!1);break;default:throw"Trying to sink unknown event type "+b;}}var ay=null,Vx=null,$x=null,Yx=null,Xx=null,Zx=null;\nfunction dy(a,b){a.__eventBits=b;a.onclick=b&1?Xx:null;a.ondblclick=b&2?Xx:null;a.onmousedown=b&4?Xx:null;a.onmouseup=b&8?Xx:null;a.onmouseover=b&16?Xx:null;a.onmouseout=b&32?Xx:null;a.onmousemove=b&64?Xx:null;a.onkeydown=b&128?Xx:null;a.onkeypress=b&256?Xx:null;a.onkeyup=b&512?Xx:null;a.onchange=b&1024?Xx:null;a.onfocus=b&2048?Xx:null;a.onblur=b&4096?Xx:null;a.onlosecapture=b&8192?Xx:null;a.onscroll=b&16384?Xx:null;a.onload=b&32768?Zx:null;a.onerror=b&65536?Xx:null;a.onmousewheel=b&131072?Xx:null;\na.oncontextmenu=b&262144?Xx:null;a.onpaste=b&524288?Xx:null}w(374,1,Xl);_.ce=function(a){return decodeURI(a.replace("%23",Fa))};_.Wd=function(a){uv(this.a,a)};_.de=function(a){a=null==a?n:a;if(!H(a,null==ey?n:ey))ey=a,mv&&(a=new lv,uv(this.a,a))};var ey=n;function Cx(){function a(){$wnd.setTimeout(a,250);e()}var b=Ax,c=n,d=$wnd.location.hash;0<d.length&&(c=b.ce(d.substring(1)));ey=c;var e=C(function(){var a=n,c=$wnd.location.hash;0<c.length&&(a=b.ce(c.substring(1)));b.de(a)});a();return!0}\nfunction Bx(){this.a=new Cv(null)}w(375,374,Xl,Bx);function Kx(){var a=$wnd.onbeforeunload,b=$wnd.onunload;$wnd.onbeforeunload=function(b){var d;try{d=C(Lx)()}finally{b=a&&a(b)}if(null!=d)return d;if(null!=b)return b};$wnd.onunload=C(function(a){try{Jx&&hv((!Ex&&(Ex=new Fx),Ex),null,!1)}finally{b&&b(a),$wnd.onresize=null,$wnd.onscroll=null,$wnd.onbeforeunload=null,$wnd.onunload=null}})}\nfunction Ix(){var a=$wnd.onresize;$wnd.onresize=C(function(b){try{var c,d;if(Hx&&(d=er(),c=dr(),Ox!=d||Nx!=c))Ox=d,Nx=c,jv((!Ex&&(Ex=new Fx),Ex))}finally{a&&a(b)}})}function fy(a,b){gy(a.ie(),b,!0)}function hy(a,b){a.pb.style[Uh]=b}function iy(a,b,c){0<=b&&a.ne(b+oj);0<=c&&a.le(c+oj)}function jy(a,b,c){a.ne(b);a.le(c)}function ky(a,b){null==b||0==b.length?a.pb.removeAttribute(kk):a.pb.setAttribute(kk,b)}function ly(a){var b,a=Uq(a,Tg);b=my(a,ny(32));return 0<=b?a.substr(0,b-0):a}\nfunction gy(a,b,c){if(!a)throw new Ep(wf);b=oy(b);if(0==b.length)throw new Sm(Nf);if(c){var d;d=oy(b);b=a.className;-1==Vq(b,d)&&(0<b.length?a.className=b+ga+d:a.className=d)}else{var e,f,c=oy(b);f=a.className;e=Vq(f,c);-1!=e&&(b=oy(f.substr(0,e-0)),c=oy(py(f,e+c.length)),0==b.length?d=c:0==c.length?d=b:d=b+ga+c,a.className=d)}}function qy(a,b){a.style.display=b?n:Qi;a.setAttribute("aria-hidden",""+!b)}w(381,1,Al);_.ge=ry;_.he=sy;_.ie=ty;_.le=function(a){hy(this,a)};\n_.ne=function(a){this.pb.style[Fk]=a};_.tS=function(){return!this.pb?"(null handle)":this.pb.outerHTML};_.pb=null;function uy(a,b,c){cy(a.pb,c.b);return nv(!a.mb?a.mb=new Cv(a):a.mb,c,b)}function vy(a,b,c){var d;d=rx(c.b);if(-1==d)cy(a.pb,c.b);else if(-1==a.lb){var e=a.pb;d|=a.pb.__eventBits||0;tx();dy(e,d)}else a.lb|=d;return nv(!a.mb?a.mb=new Cv(a):a.mb,c,b)}function wy(a,b,c){return nv(!a.mb?a.mb=new Cv(a):a.mb,c,b)}\nfunction xy(a){var b;if(a.qe())throw new yy("Should only call onAttach when the widget is detached from the browser\'s document");a.kb=!0;a.pb.__listener=a;b=a.lb;a.lb=-1;if(0<b)if(-1==a.lb){var c=a.pb;b|=a.pb.__eventBits||0;tx();dy(c,b)}else a.lb|=b;a.oe();a.te()}function zy(a,b){var c;switch(rx(b.type)){case 16:case 32:if((c=b.relatedTarget)&&a.pb.contains(c))return}c=a.pb;var d,e,f;if(lt&&(f=lt.a[b.type]))d=f.a.a,e=f.a.b,f.a.a=b,f.a.b=c,a.mb&&uv(a.mb,f.a),f.a.a=d,f.a.b=e}\nfunction Ay(a){if(!a.qe())throw new yy("Should only call onDetach when the widget is attached to the browser\'s document");try{a.ue()}finally{try{a.pe()}finally{a.pb.__listener=null,a.kb=!1}}}function By(a){if(a.ob)if(G(a.ob,43))a.ob.ve(a);else{if(a.ob)throw new yy("This widget\'s parent does not implement HasWidgets");}else if(Cy(),Wx(Dy.a,a)){Cy();try{a.se()}finally{Hv(Dy.a,a)}}}\nfunction Ey(a,b){var c;c=a.ob;if(b){if(c)throw new yy("Cannot set a new parent without first clearing the old parent");a.ob=b;b.qe()&&a.re()}else try{c&&c.qe()&&a.se()}finally{a.ob=null}}w(380,381,pl);_.oe=Fy;_.pe=Fy;_.Wd=function(a){this.mb&&uv(this.mb,a)};_.qe=function(){return this.kb};_.re=function(){xy(this)};_.ae=function(a){zy(this,a)};_.se=Gy;_.te=Fy;_.ue=Fy;_.kb=!1;_.lb=0;_.mb=null;_.nb=null;_.ob=null;w(379,380,ll);_.oe=function(){Hy(this,(Iy(),Jy))};_.pe=function(){Hy(this,(Iy(),Ky))};\nfunction Ly(a,b,c){By(b);var d=a.p;My(d,b,d.c);d=(mx(),nx(b.pb));c.appendChild(d);Ey(b,a)}function Ny(a,b,c,d,e){var f;if(0>d||d>a.p.c)throw new Oy;b.ob==a&&(f=a.we(b),f<d&&--d);By(b);My(a.p,b,d);e?(e=b.pb,by(c,(mx(),nx(e)),d)):(e=(mx(),nx(b.pb)),c.appendChild(e));Ey(b,a)}\nfunction Py(a,b){var c;if(b.ob!=a)return!1;try{Ey(b,null)}finally{c=b.pb;Yq(c).removeChild(c);c=a.p;var d;d=Qy(c,b);if(-1==d)throw new Ry;if(0>d||d>=c.c)throw new Oy;for(--c.c;d<c.c;++d)nq(c.a,d,c.a[d+1]);nq(c.a,c.c,null)}return!0}w(378,379,ll);_.we=function(a){return Qy(this.p,a)};_.xe=function(a,b,c,d){Ny(this,a,b,c,d)};_.ye=function(){return new Sy(this.p)};_.ve=function(a){return Py(this,a)};function Ty(a,b,c,d){var e;By(b);e=a.p.c;a.Be(b,c,d);a.xe(b,a.pb,e,!0)}\nfunction Uy(a,b){var c;(c=Py(a,b))&&Vy(b.pb);return c}function Wy(a,b,c,d){if(b.ob!=a)throw new Sm("Widget must be a child of this panel.");a.Be(b,c,d)}function Xy(a,b,c){a=a.pb;-1==b&&-1==c?Vy(a):(a.style[lj]=gg,a.style[fi]=b+oj,a.style[nk]=c+oj)}function Yy(){var a=$doc.createElement(ph);this.p=new Zy(this);this.pb=a;this.pb.style[lj]="relative";this.pb.style[cj]=Vh}function Vy(a){a.style[fi]=n;a.style[nk]=n;a.style[lj]=n}w(377,378,ll,Yy);_.ve=function(a){return Uy(this,a)};\n_.Be=function(a,b,c){Xy(a,b,c)};function $y(a,b){if(a.De())throw new yy("SimplePanel can only contain one child widget");a.Ee(b)}function az(a,b){if(a.jb!=b)return!1;try{Ey(b,null)}finally{a.Ce().removeChild(b.pb),a.jb=null}return!0}function bz(a,b){if(b!=a.jb&&(b&&By(b),a.jb&&a.ve(a.jb),a.jb=b)){var c=a.Ce(),d=(mx(),nx(a.jb.pb));c.appendChild(d);Ey(b,a)}}function cz(){this.pb=$doc.createElement(ph)}w(385,379,ll,cz);_.Ce=ty;_.De=function(){return this.jb};_.ye=function(){return new dz(this)};\n_.ve=function(a){return az(this,a)};_.Ee=function(a){bz(this,a)};_.jb=null;function ez(a,b){a.hb&&(fz(a.gb,!1,!1),hv(a,a,b))}function gz(a){var b;if(b=a.jb)null!=a.X&&b.le(a.X),null!=a.Y&&b.ne(a.Y)}function hz(a,b,c){a.cb=b;a.ib=c;c-=0;a=a.pb;a.style[fi]=b-0+(ps(),oj);a.style[nk]=c+oj}function iz(a){a.hb||(a.kb&&By(a),fz(a.gb,!0,!1))}w(384,385,ll);_.Ce=function(){return Xq(this.pb)};_.ge=ry;_.he=sy;_.ie=function(){return Yq(Xq(this.pb))};_.Fe=function(){this.Ge(!1)};_.Ge=function(a){ez(this,a)};\n_.Yd=function(){};_.ue=function(){this.hb&&fz(this.gb,!1,!0)};_.le=function(a){this.X=a;gz(this);0==a.length&&(this.X=null)};_.He=function(a,b){hz(this,a,b)};_.Ee=function(a){bz(this,a);gz(this)};_.ne=function(a){this.Y=a;gz(this);0==a.length&&(this.Y=null)};_.V=!1;_.W=!1;_.X=null;_.Y=null;_.Z=null;_._=null;_.ab=!1;_.bb=!1;_.cb=-1;_.db=!1;_.eb=null;_.fb=!1;_.hb=!1;_.ib=-1;\nfunction jz(a,b){var c;cz.call(this);this.$=new kz;this.U=(lz(),mz);this.gb=new nz(this);this.pb.appendChild($doc.createElement(ph));this.He(0,0);Yq(Xq(this.pb))[Tg]="gwt-PopupPanel";Xq(this.pb)[Tg]=kj;this.W=this.V=a;this.db=!1;c=z(hw,u,1,[b+"Top",b+"Middle",b+"Bottom"]);this.T=new oz(c);c=n;this.T.ie()[Tg]=c;c=Yq(Xq(this.pb));var d;if(!c)throw new Ep(wf);d=oy("gwt-DecoratedPopupPanel");if(0==d.length)throw new Sm(Nf);var e=c.className.split(/\\s+/);if(e){var f=e[0],g=f.length;e[0]=d;for(var h=1,\nj=e.length;h<j;h++){var l=e[h];l.length>g&&l.charAt(g)==rb&&0==l.indexOf(f)&&(e[h]=d+l.substring(g))}c.className=e.join(ga)}bz(this,this.T);gz(this);gy(Xq(this.pb),kj,!1);gy(this.T.b,b+"Content",!0)}w(383,384,ll);_.oe=function(){xy(this.T)};_.pe=function(){Ay(this.T)};_.De=function(){return this.T.jb};_.ye=function(){return new dz(this.T)};_.ve=function(a){return this.T.ve(a)};_.Ee=function(a){bz(this.T,a);gz(this)};_.T=null;w(382,383,ll);_.se=Gy;\nfunction pz(){pz=x;qz=new rz(0,(lz(),mz));sz=new rz(1,tz);uz=new rz(2,vz);wz=z(xz,u,38,[qz,sz,uz])}function rz(a,b){this.b=a;this.a=b}w(386,193,{38:1,89:1,94:1,96:1},rz);_.a=null;var wz,qz,sz,uz;function yz(){yz=x;zz=z(hw,u,1,[nk,Bi,Ig])}\nfunction oz(a){var b;yz();var c,d;c=this.pb=$doc.createElement(Yj);this.c=$doc.createElement(ak);lx(c,this.c);c[Og]=0;for(c=c[Ng]=0;c<a.length;++c)d=(b=$doc.createElement(sk),b[Tg]=a[c],Sv(),lx(b,Az(a[c]+"Left")),lx(b,Az(a[c]+te)),lx(b,Az(a[c]+"Right")),b),lx(this.c,d),1==c&&(this.b=Xq(Tx(d,1)));this.pb[Tg]="gwt-DecoratorPanel"}function Az(a){var b,c;c=$doc.createElement(bk);b=$doc.createElement(ph);var d=(mx(),nx(b));c.appendChild(d);c[Tg]=a;b[Tg]=a+"Inner";return c}w(388,385,ol,oz);_.Ce=Bz;\n_.b=null;_.c=null;var zz;w(389,1,{});function Iy(){Iy=x;Jy=new Cz;Ky=new Dz}function Ez(a){yv.call(this,a)}function Hy(a,b){Iy();var c,d,e;c=null;for(e=a.ye();e.Zd();){d=e.$d();try{b.Je(d)}catch(f){if(f=yq(f),G(f,106))d=f,!c&&(c=new wv),xv(c,d);else throw f;}}if(c)throw new Ez(c);}w(390,308,tl,Ez);var Jy,Ky;function Cz(){}w(391,1,{},Cz);_.Je=function(a){a.re()};function Dz(){}w(392,1,{},Dz);_.Je=function(a){a.se()};w(395,380,pl);_.Kd=Fz;_.Ld=Gz;_.Md=Hz;_.Nd=Iz;\n_.re=function(){xy(this);-1==this.pb.tabIndex&&(this.pb.tabIndex=0)};function Jz(){this.p=new Zy(this);this.e=$doc.createElement(Yj);this.d=$doc.createElement(ak);lx(this.e,this.d);this.pb=this.e}w(396,378,ll);_.d=null;_.e=null;function Kz(){this.pb=Lz()}w(402,385,ll,Kz);_.Kd=Fz;_.Ld=Gz;_.Md=Hz;_.Nd=Iz;function Mz(){Mz=x;Nz=new Oz((es(),Pg));Pz=new Oz(fi);Qz=new Oz(zj);Rz=(Sv(),Pz);Sz=Qz;Tz=Rz}var Nz,Tz,Pz,Sz,Rz,Qz;w(412,1,{});function Oz(a){this.a=a}w(413,412,{},Oz);_.a=null;\nfunction Uz(){Uz=x;Vz=new Wz(Bi);Xz=new Wz(nk)}var Vz,Xz;function Wz(a){this.a=a}w(414,1,{},Wz);_.a=null;function Yz(a,b){var c;c=Zz(a);lx(a.b,c);Ly(a,b,c)}function Zz(a){var b;b=$doc.createElement(bk);b[tg]=a.a.a;b.style[Bk]=a.c.a;return b}function $z(a,b){var c,d;d=Yq(b.pb);(c=Py(a,b))&&a.b.removeChild(d);return c}function aA(){Jz.call(this);this.a=(Mz(),Tz);this.c=(Uz(),Xz);this.b=$doc.createElement(sk);lx(this.d,this.b);this.e[Og]=Fc;this.e[Ng]=Fc}w(415,396,ll,aA);\n_.ve=function(a){return $z(this,a)};_.b=null;function bA(){bA=x;new xp}function cA(a){bA();dA.call(this,a.d.a,a.b,a.c,a.e,a.a)}function eA(a,b,c,d,e){bA();this.a=new fA(this,a,b,c,d,e);this.pb[Tg]="gwt-Image"}function dA(a,b,c,d,e){bA();eA.call(this,(gx(),new fx(a)),b,c,d,e)}w(416,380,pl,cA,eA,dA);_.Kd=Fz;_.Ld=Gz;_.Md=Hz;_.Nd=Iz;_.ae=function(a){32768==rx(a.type)&&this.a&&(this.pb.__gwtLastUnhandledEvent=n);zy(this,a)};\n_.te=function(){var a=this.a;H(li,Uq(this.pb,"__gwtLastUnhandledEvent"))&&(a.f=new gA(a,this),Jq((Gq(),Hq),a.f))};_.a=null;w(418,1,{});_.f=null;function hA(){hA=x;iA()}\nfunction fA(a,b,c,d,e,f){var g,h;hA();this.b=c;this.c=d;this.e=e;this.a=f;this.d=b;g=$doc.createElement(Sj);h=new Sw;Rw(Rw(Rw(h,new Uw("width:"+e+(ps(),oj)+hd)),new Uw("height:"+f+rj)),new Uw("background:url("+b.a+") no-repeat "+-c+pj+-d+rj));!jA&&(jA=new kA);b=lA;h=new Uw((new Uw(h.a.a.a)).a);c=new Tw;c.a.a+="<img onload=\'this.__gwtLastUnhandledEvent=\\"load\\";\' src=\'";Ap(c,ex(b.a));c.a.a+="\' style=\'";Ap(c,ex(h.a));c.a.a+="\' border=\'0\'>";h=new Ww(c.a.a);g.innerHTML=h.a||n;g=Xq(g);a.kb&&(a.pb.__listener=\nnull);if(a.pb&&(h=a.pb,b=h.parentNode))b.insertBefore(g,h),b.removeChild(h);a.pb=g;a.kb&&(a.pb.__listener=a);-1==a.lb?(g=a.pb,a=133333119|(a.pb.__eventBits||0),tx(),dy(g,a)):a.lb|=133333119}w(417,418,{},fA);_.a=0;_.b=0;_.c=0;_.d=null;_.e=0;function gA(a,b){this.a=a;this.b=b}w(419,1,{},gA);_.pd=function(){var a;this.b.a!=this.a||this!=this.a.f||(this.a.f=null,this.b.kb?(a=Zq(li,!1),this.b.pb.dispatchEvent(a)):this.b.pb.__gwtLastUnhandledEvent=li)};_.a=null;_.b=null;w(421,348,Tl);\nfunction mA(a){this.a=a}w(423,421,Tl,mA);_.Sd=function(a){this.a.Ke(a.f,a.a)};function nA(a,b,c){var d;if(a.o){var e=d=$doc.createElement(sk);by(a.e,(mx(),nx(e)),b);a=(mx(),nx(c));d.appendChild(a)}else d=Tx(a.e,0),by(d,(mx(),nx(c)),b)}\nfunction oA(a,b,c){var d;b.b&&(pA(a,b),c&&b.a?(pA(a,null),a=b.a,b=(Gq(),Hq),b.c=Kq(b.c,[new qA(a),!1])):null!=b.d&&(a.j=new rA(a,b),c=(lz(),tz),a.j.U=c,a.j.ab=a.f,c=Rh,a.j.ie()[Tg]=c,d=ly(a.pb),H(Qh,d)||fy(a.j,d+"Popup"),wy(a.j,new mA(a),Qm?Qm:Qm=new Rm),a.n=b.d,d=a.j,a=new sA(a,b),d.pb.style[Ck]=Vh,iz(d),Sv(),a.a.o?hz(a.a.j,ar(a.a.pb)+Tq(a.a.pb,Xi)-1,br(a.b.pb)):hz(a.a.j,ar(a.b.pb),br(a.a.pb)+Tq(a.a.pb,Wi)-1),d.pb.style[Ck]=Dk))}\nfunction tA(a,b){!b&&a.k&&a.n==a.k.d||b&&!b.b||(pA(a,b),a.pb.focus(),b&&a.d&&oA(a,b,!1))}\nfunction uA(a,b){var c;a:{c=b.target;var d,e;for(e=new zv(a.i);e.b<e.d.Tf();)if(d=Av(e),d.pb.contains(c)){c=d;break a}c=null}switch(rx(b.type)){case 1:a.pb.focus();c&&oA(a,c,!0);break;case 16:c&&tA(a,c);break;case 32:c&&tA(a,null);break;case 2048:vA(a);break;case 128:switch(c=b.keyCode||0,c){case 37:Sv();vA(a)||a.o||wA(a);b.cancelBubble=!0;b.preventDefault();break;case 39:Sv();vA(a)||(a.o?null!=a.k.d&&!a.k.d.ei().ei()&&(oA(a,a.k,!1),a.k.d.ei()):xA(a));b.cancelBubble=!0;b.preventDefault();break;case 38:vA(a)||\na.o&&wA(a);b.cancelBubble=!0;b.preventDefault();break;case 40:vA(a)||(a.o?xA(a):null!=a.k.d&&!a.k.d.ei().ei()&&(oA(a,a.k,!1),a.k.d.ei()));b.cancelBubble=!0;b.preventDefault();break;case 27:pA(a,null);a.j&&ez(a.j,!1);b.cancelBubble=!0;b.preventDefault();break;case 9:pA(a,null);a.j&&ez(a.j,!1);break;case 13:vA(a)||(oA(a,a.k,!0),b.cancelBubble=!0,b.preventDefault())}}zy(a,b)}function yA(a,b,c){c&&pA(a,null);hv(a,b,!1);a.n=null;a.j=null}\nfunction vA(a){var b,c;if(!a.k){for(c=new zv(a.i);c.b<c.d.Tf();)if(b=Av(c),b.b){pA(a,b);break}return!0}return!1}\nfunction pA(a,b){var c;if(b!=a.k){if(a.k){c=a.k;var d=ly(c.pb)+hc;gy(c.ie(),d,!1);a.o&&(c=Yq(a.k.pb),2==Ux(c)&&(c=Tx(c,1),gy(c,Wj,!1)))}if(b){c=ly(b.pb)+hc;gy(b.ie(),c,!0);a.o&&(c=Yq(b.pb),2==Ux(c)&&(c=Tx(c,1),gy(c,Wj,!0)));Un();c=a.pb;var e=new tn(b.pb),d=(Pn(),Qn),e=z(zA,u,16,[e]),f,g,h,j;f=new zp;for(h=0,j=e.length;h<j;++h)g=e[h],Ap(Ap(f,g.a),ga);e=oy(f.a.a);c.setAttribute(d.a,e)}a.k=b}}\nfunction xA(a){var b,c,d;if(a.k){for(b=c=AA(a.i,a.k);;)if(c+=1,c==a.i.c&&(c=0),c==b){d=Dx(a.i,b);break}else if(d=Dx(a.i,c),d.b)break;pA(a,d)}}function wA(a){var b,c,d;if(a.k){for(b=c=AA(a.i,a.k);;)if(c-=1,0>c&&(c=a.i.c-1),c==b){d=Dx(a.i,b);break}else if(d=Dx(a.i,c),d.b)break;pA(a,d)}}w(424,380,pl);_.ae=function(a){uA(this,a)};_.se=function(){this.j&&ez(this.j,!1);Ay(this)};_.Ke=function(a,b){yA(this,a,b)};_.d=!1;_.e=null;_.f=!1;_.j=null;_.k=null;_.n=null;_.o=!1;function qA(a){this.a=a}\nw(425,1,{},qA);_.pd=function(){BA(this.a)};_.a=null;function CA(a){this.a=a}w(426,1,{},CA);_.Hd=function(){pA(this.a,null)};_.a=null;function rA(a,b){this.a=a;this.b=b;jz.call(this,!0,wi);bz(this.T,this.b.d);gz(this);this.fb=!0;this.b.d.ei()}w(427,383,ll,rA);_.Yd=function(a){var b,c;if(!a.a)switch(rx(a.d.type)){case 4:c=a.d.target;b=this.b.c.pb;if(b.contains(c)){a.a=!0;break}a.a&&pA(this.a,null)}};_.a=null;_.b=null;function sA(a,b){this.a=a;this.b=b}w(428,1,{},sA);_.a=null;var DA=_.b=null;\nfunction EA(){EA=x;DA=new Qw((gx(),new fx((Sv(),"data:image/gif;base64,R0lGODlhBQAJAIAAAAAAAAAAACH5BAEAAAEALAAAAAAFAAkAAAIMRB5gp9v2YlJsJRQKADs="))),5,9)}function FA(a,b){if(b){var c=ly(a.pb)+dc;gy(a.ie(),c,!1)}else c=ly(a.pb)+dc,gy(a.ie(),c,!0);a.b=b}function GA(a,b){this.pb=$doc.createElement(bk);var c=ly(this.pb)+hc;gy(this.ie(),c,!1);this.pb.textContent=a||n;this.pb[Tg]="gwt-MenuItem";c=cr();this.pb.setAttribute(Xh,c);Un();this.pb.setAttribute("role",Bo.a);this.a=b}w(431,381,{42:1,46:1,49:1},GA);\n_.a=null;_.b=!0;_.c=null;_.d=null;function HA(){var a;this.pb=$doc.createElement(bk);this.pb[Tg]="gwt-MenuItemSeparator";a=$doc.createElement(ph);lx(this.pb,a);a[Tg]="menuSeparatorInner"}w(432,381,Al,HA);function IA(){var a,b,c,d,e;b=null.ei();e=er();d=dr();b[oh]=(Ur(),Qi);b[Fk]=0+(ps(),oj);b[Uh]=Hc;c=$doc;c=(H(c.compatMode,ne)?c.documentElement:c.body).scrollWidth||0;a=$doc;a=(H(a.compatMode,ne)?a.documentElement:a.body).scrollHeight||0;b[Fk]=(c>e?c:e)+oj;b[Uh]=(a>d?a:d)+oj;b[oh]="block"}\nfunction kz(){}w(433,1,{},kz);_.Ud=function(){IA()};function JA(a){this.a=a}w(434,1,{},JA);\n_.Yd=function(a){var b=this.a,c,d;if(a.a||!b.fb&&a.b)b.db&&(a.a=!0);else if(b.Yd(a),!a.a){d=a.d;c=d.target;var e;try{e=!!c&&!!c.nodeType}catch(f){e=!1}(c=e&&c&&1==c.nodeType?b.pb.contains(c):!1)&&(a.b=!0);b.db&&(a.a=!0);switch(rx(d.type)){case 4:case 1048576:if(qx){a.b=!0;break}if(!c&&b.V){b.Ge(!0);break}break;case 8:case 64:case 1:case 2:case 4194304:if(qx){a.b=!0;break}break;case 2048:d=d.target,b.db&&!c&&d&&(d.blur&&d!=$doc.body&&d.blur(),a.a=!0)}}};_.a=null;function KA(a){this.a=a}\nw(435,1,{},KA);_.a=null;function lz(){lz=x;mz=new LA(0);tz=new LA(1);vz=new LA(2);MA=z(NA,u,47,[mz,tz,vz])}function LA(a){this.b=a}w(436,193,{47:1,89:1,94:1,96:1},LA);var MA,mz,tz,vz;function OA(a){a.j?a.a.bb&&($doc.body.appendChild(a.a.Z),a.f=Gx(a.a.$),IA(),a.b=!0):a.b&&($doc.body.removeChild(a.a.Z),PA(a.f.a),a.f=null,a.b=!1)}function QA(a){a.j||(OA(a),a.c||(Cy(),Uy(RA(null),a.a)));a.a.pb.style[Wg]="rect(auto, auto, auto, auto)";a.a.pb.style[cj]=Dk}\nfunction SA(a,b){var c,d,e,f,g,h;a.j||(b=1-b);c=f=e=g=0;d=dw(b*a.d);h=dw(b*a.e);switch(a.a.U.b){case 2:f=a.e;c=d;break;case 0:g=a.d-d>>1;e=a.e-h>>1;f=e+h;c=g+d;break;case 1:Sv(),f=h,c=d}a.a.pb.style[Wg]="rect("+g+qj+f+qj+c+qj+e+"px)"}\nfunction fz(a,b,c){a.c=c;vm(a);a.i&&(xm(a.i),a.i=null,QA(a));a.a.hb=b;var d=a.a;d.eb&&(PA(d.eb.a),d.eb=null);d._&&(PA(d._.a),d._=null);if(d.hb){d.eb=sx(new JA(d));var e;e=new KA(d);zx();e=Ax?nv(Ax.a,(!mv&&(mv=new Rm),mv),e):null;d._=e}c=!c&&a.a.ab;a.a.U!=(lz(),mz)&&!b&&(c=!1);a.j=b;c?b?(OA(a),a.a.pb.style[lj]=gg,-1!=a.a.ib&&a.a.He(a.a.cb,a.a.ib),a.a.pb.style[Wg]=vj,Cy(),b=RA(null),Ly(b,a.a,b.pb),a.i=new TA(a),Em(a.i,1)):ym(a,200):(OA(a),a.j?(a.a.pb.style[lj]=gg,-1!=a.a.ib&&a.a.He(a.a.cb,a.a.ib),Cy(),\nb=RA(null),Ly(b,a.a,b.pb)):a.c||(Cy(),Uy(RA(null),a.a)),a.a.pb.style[cj]=Dk)}function nz(a){var b=(Gm(),Hm);this.k=new Fm(this);this.s=b;this.a=a}w(437,58,{},nz);_.rd=function(){QA(this)};_.sd=function(){this.d=Tq(this.a.pb,Wi);this.e=Tq(this.a.pb,Xi);this.a.pb.style[cj]=Vh;SA(this,(1+Math.cos(3.141592653589793))/2)};_.td=function(a){SA(this,a)};_.a=null;_.b=!1;_.c=!1;_.d=0;_.e=-1;_.f=null;_.i=null;_.j=!1;function TA(a){Lm();this.a=a}w(438,65,{},TA);_.vd=function(){this.a.i=null;ym(this.a,200)};\n_.a=null;function mx(){mx=x;UA()}function nx(a){return a.__gwt_resolve?a.__gwt_resolve():a}function UA(){function a(){}a.prototype={className:n,clientHeight:0,clientWidth:0,dir:n,getAttribute:function(a){return this[a]},href:n,id:n,lang:n,nodeType:1,removeAttribute:function(a){this[a]=void 0},setAttribute:function(a,c){this[a]=c},src:n,style:{},title:n};$wnd.GwtPotentialElementShim=a}function Cy(){Cy=x;VA=new WA;XA=new xp;Dy=new wv}function YA(a){this.p=new Zy(this);this.pb=a;xy(this)}\nfunction RA(a){Cy();var b,c;c=Fv(XA,a);b=null;if(null!=a&&!(b=$doc.getElementById(a)))return null;if(c&&(!b||c.pb==b))return c;if(0==XA.d){var d=new ZA;Om();Pm(Qm?Qm:Qm=new Rm,d);Sv()}!b?c=new $A:c=new YA(b);E(XA,a,c);xv(Dy,c);return c}w(440,377,ll,YA);var VA,XA,Dy;function WA(){}w(441,1,{},WA);_.Je=function(a){a.qe()&&a.se()};function ZA(){}w(442,1,{},ZA);_.Sd=function(){Cy();try{Hy(Dy,VA)}finally{aB(Dy.a),aB(XA)}};function $A(){YA.call(this,$doc.body)}w(443,440,ll,$A);\n_.Be=function(a,b,c){Xy(a,b-0,c-0)};function dz(a){this.c=a;this.a=!!this.c.jb}w(444,1,{},dz);_.Zd=Xw;_.$d=function(){if(!this.a||!this.c.jb)throw new Ry;this.a=!1;return this.b=this.c.jb};_._d=function(){this.b&&this.c.ve(this.b)};_.b=null;_.c=null;function bB(a,b){a.pb[Ak]=null!=b?b:n}w(447,395,pl);_.ae=function(a){0!=(rx(a.type)&896)?zy(this,a):zy(this,a)};_.te=Fy;function cB(){cB=x;dB()}w(446,447,pl);\nfunction eB(){cB();var a=Wq(gk);!kx&&(kx=new jx);!ix&&(ix=new hx);this.pb=a;Sv();this.pb[Tg]="gwt-TextBox"}w(448,446,pl,eB);function dB(){dB=x;fB=new gB;hB=new iB;jB=new kB;lB=new mB;nB=z(oB,u,50,[fB,hB,jB,lB])}w(449,193,Pl);var nB,fB,hB,jB,lB;function gB(){this.b=0}w(450,449,Pl,gB);function iB(){this.b=1}w(451,449,Pl,iB);function kB(){this.b=2}w(452,449,Pl,kB);function mB(){this.b=3}w(453,449,Pl,mB);function Qy(a,b){var c;for(c=0;c<a.c;++c)if(a.a[c]==b)return c;return-1}\nfunction My(a,b,c){var d,e;if(0>c||c>a.c)throw new Oy;if(a.c==a.a.length){e=D(pB,u,51,2*a.a.length,0);for(d=0;d<a.a.length;++d)nq(e,d,a.a[d]);a.a=e}++a.c;for(d=a.c-1;d>c;--d)nq(a.a,d,a.a[d-1]);nq(a.a,c,b)}function Zy(a){this.b=a;this.a=D(pB,u,51,4,0)}w(455,1,{},Zy);_.ye=function(){return new Sy(this)};_.a=null;_.b=null;_.c=0;function qB(a){if(a.a>=a.b.c)throw new Ry;return a.b.a[++a.a]}function rB(a){if(0>a.a||a.a>=a.b.c)throw new sB;a.b.b.ve(a.b.a[a.a--])}function Sy(a){this.b=a}w(456,1,{},Sy);\n_.Zd=function(){return this.a<this.b.c-1};_.$d=function(){return qB(this)};_._d=function(){rB(this)};_.a=-1;_.b=null;function iA(){iA=x;lA=(gx(),new fx(Aq()+"clear.cache.gif"))}var lA,jA=null;function kA(){}w(458,1,{},kA);function tB(){tB=x;iA()}function uB(a,b,c,d,e){tB();this.d=a;this.b=b;this.c=c;this.e=d;this.a=e}w(459,389,{},uB);_.a=0;_.b=0;_.c=0;_.d=null;_.e=0;function Lz(){var a;a=$doc.createElement(ph);a.tabIndex=0;return a}\nfunction PA(a){var b=a.a,c=a.d,d=a.c,a=a.b;0<b.b?pv(b,new vB(b,c,d,a)):Gv(b,c,d,a)}function tv(a,b,c){this.a=a;this.d=b;this.c=null;this.b=c}w(465,1,{},tv);_.a=null;_.b=null;_.c=null;_.d=null;function qv(a,b,c){this.a=a;this.d=b;this.c=null;this.b=c}w(466,1,{},qv);_.pd=function(){rv(this.a,this.d,this.c,this.b)};_.a=null;_.b=null;_.c=null;_.d=null;function vB(a,b,c,d){this.a=a;this.d=b;this.c=c;this.b=d}w(467,1,{},vB);_.pd=function(){Gv(this.a,this.d,this.c,this.b)};_.a=null;_.b=null;_.c=null;\n_.d=null;function wB(a,b){var c;this.a=(c=n,0!=(b&1)&&(c+=ni),0!=(b&2)&&(c+=Wh),RegExp(a,c))}w(468,1,{});_.tS=function(){return Pp(this.a)};_.a=null;function xB(a,b){b.k!=a&&(!a.Uc&&(a.Uc=new Jm),b.k=a,Dm(a.Uc,b))}function yB(a){var b;b=a.cZ.d;if(-1!=my(b,ny(36)))return null;a=a.Vc.b.b++;return b=py(b,zB(b,ny(46))+1)+n+a}function AB(a){return!a.Mc&&a.Sc?AB(a.Sc):a.Mc}function BB(a){return ju(),new CB(a)}\nfunction DB(a){var b;b=new EB;if(a.$e()){for(;a&&!G(a,72);a=a.Sc){var c=b,d=a.Xe();c.a+=a.We();c.b+=d}G(a,72)&&(c=a.Xe(),b.a+=a.We(),b.b+=c);return b}throw new FB;}function GB(a){a.Wc=!1;a.hf();HB(a)}function HB(a){if((a=G(a,72)?null:a.Sc)&&a.Wc)GB(a),a.Gc&&G(a.Gc,66)&&(a.Gc.n=!1)}function IB(a){return(a=a.Pe())?a:new JB(1,1)}function KB(a){var b;return(b=a.Qe())?new LB(b):new LB(a.Se())}\nfunction MB(a,b,c,d,e){var f,g,h,j;h=a._c;j=a.ad;g=a.Yc;f=a.Nc;a._c=b;a.ad=c;a.Yc=d;a.Nc=e;if(h!=a._c||j!=a.ad)HB(a),new NB(a,100);if(g!=a.Yc||f!=a.Nc)a.Ze(),new NB(a,101)}function OB(){this.Vc=(PB(),PB(),QB);this.Pc=new RB;new xp;this.Ye();this.Rc=(SB(),TB)}w(472,1,ul);_.Ne=function(){return yB(this)};_.Pe=function(){return UB(this.Tc,this)};_.Qe=function(){return this.Pe()};_.Re=function(){return this.Nc};_.Se=function(){return this.af()};_.Te=function(){return new VB(0,0,0,0)};_.Ue=function(){return this.df()};\n_.Ve=function(){return this.Yc};_.We=function(){return this._c};_.Xe=function(){return this.ad};_.Ye=Fy;_.Ze=function(){GB(this)};_.$e=function(){return this.Xc&&!!this.Sc&&this.Sc.$e()};_.af=WB;_.bf=XB;_.cf=function(){return(null==this.Qc&&(this.Qc=this.Ne()),this.Qc)+kb+this.We()+kb+this.Xe()+kb+this.Ve()+Gk+this.Re()+(this.Xc?n:",hidden")};_.df=YB;_.hf=function(){var a=this.Tc;a.e.a=-1;a.e.b=-1};_.kf=function(a,b,c,d){this.lf(a,b,c,d,this.Lc,!0);this.Lc=0};\n_.lf=function(a,b,c,d){MB(this,a,b,c,d)};_.tS=ZB;_.mf=function(){this.Wc=!0};_.Kc=null;_.Lc=0;_.Mc=null;_.Nc=0;_.Oc=0;_.Qc=null;_.Rc=null;_.Sc=null;_.Tc=null;_.Uc=null;_.Wc=!1;_.Xc=!0;_.Yc=0;_.Zc=!1;_.$c=!1;_._c=0;_.ad=0;function $B(a,b){var c;c=a.nf();b.b+=c.b+c.c;b.a+=c.d+c.a;return b}function aC(a){var b;b=a.nf();return new bC(b.b,b.d,a.Yc-b.c-b.b,a.Nc-b.d-b.a)}\nfunction cC(a,b){var c,d;if(a.Gc)for(d=new zv(a.Fc.a);d.b<d.d.Tf();)c=Av(d),a.Gc.sf(c);if(b)for(d=new zv(a.Fc.a);d.b<d.d.Tf();)c=Av(d),b.of(null,c);a.Gc=b;GB(a);a.Gc&&G(a.Gc,66)&&(a.Gc.n=!1)}function dC(a){if(!a.Wc){a.Gc&&a.Gc.pf(a);var b,c;for(c=0;c<a.Fc.a.c;++c)b=Dx(a.Fc.a,c),b.Wc||b.mf();a.Wc=!0}}function eC(){OB.call(this);this.Fc=new fC;this.Jc=(PB(),PB(),QB)}w(471,472,El);_.Pe=function(){if(!this.Gc)return null;!this.Hc&&(this.Hc=this.Gc.qf(this));return this.Hc};\n_.Qe=function(){if(!this.Gc)return null;!this.Ic&&(this.Ic=this.Gc.rf(this));return this.Ic};_.nf=function(){return this.Te()};_.Se=WB;_.Ue=YB;_.Ye=function(){this.Tc=(PB(),new gC)};_.Ze=function(){GB(this);this.Gc&&G(this.Gc,66)&&(this.Gc.n=!1)};_.af=WB;_.df=YB;_.hf=function(){var a,b;this.Ic=this.Hc=null;for(b=0;b<this.Fc.a.c;++b)a=Dx(this.Fc.a,b),a.hf()};_.mf=function(){dC(this)};_.Gc=null;_.Hc=null;_.Ic=null;function hC(){var a=new iC;eC.call(this);cC(this,a)}w(470,471,El,hC);\n_.Ne=function(){return"panel"+this.Jc.b.e++};function jC(a,b,c){a=kC(a.Ec,b,c);a.j=!0;return new lC(a)}function mC(a){a.bf(a.Ec.d)}function nC(a){return new JB(oC(a.Ec),pC(a.Ec))}w(469,470,El);_.Re=function(){return Tq(this.Ec.pb,Wi)};_.Ve=function(){return Tq(this.Ec.pb,Xi)};_.We=function(){return ar(this.Ec.pb)};_.Xe=function(){return br(this.Ec.pb)};_.$e=function(){return this.Ec.pb.style.display!=Qi};_.Ec=null;function qC(a){if(null!=a)this.n=a;else throw new rC;}w(474,1,Ql);\n_.tS=function(){return this.cZ.d+"[source="+this.n+cg};_.n=null;\nfunction sC(){sC=x;tC=new xp;E(tC,new uC(400),new vC(Qk));E(tC,new uC(401),new vC(Qk));E(tC,new uC(402),new vC(Qk));E(tC,new uC(500),new vC(Sk));E(tC,new uC(501),new vC(Sk));E(tC,new uC(502),new vC(Sk));E(tC,new uC(503),new vC(Tk));E(tC,new uC(504),new vC(Sk));E(tC,new uC(505),new vC(Sk));E(tC,new uC(506),new vC(Tk));E(tC,new uC(507),new vC(dl));E(tC,new uC(100),new vC(Mk));E(tC,new uC(101),new vC(Mk));E(tC,new uC(102),new vC(Mk));E(tC,new uC(103),new vC(Mk));E(tC,new uC(1004),new vC(Pk));E(tC,new uC(1005),\nnew vC(Pk));E(tC,new uC(800),new vC($k));E(tC,new uC(801),new vC($k));E(tC,new uC(200),new vC(Uk));E(tC,new uC(201),new vC(Uk));E(tC,new uC(202),new vC(Uk));E(tC,new uC(204),new vC(Uk));E(tC,new uC(203),new vC(Uk));E(tC,new uC(209),new vC(fl));E(tC,new uC(208),new vC(gl));E(tC,new uC(207),new vC(gl));E(tC,new uC(206),new vC(Uk));E(tC,new uC(205),new vC(Uk));E(tC,new uC(1400),new vC(bl));E(tC,new uC(1401),new vC(cl));E(tC,new uC(1402),new vC(cl));E(tC,new uC(300),new vC(Nk));E(tC,new uC(301),new vC(Nk));\nE(tC,new uC(1100),new vC(Zk));E(tC,new uC(1101),new vC(Zk));E(tC,new uC(1200),new vC(al));E(tC,new uC(701),new vC(Xk));E(tC,new uC(900),new vC(Yk));E(tC,new uC(1001),new vC(Vk));E(tC,new uC(601),new vC(Wk))}w(473,474,Ql);_.cf=function(){return n};_.tS=function(){var a;a=n;G(this.n,60)&&null!=this.n&&(a=this.n,a=(null==a.Qc&&(a.Qc=a.Ne()),a.Qc),null==a&&(a=n));return this.cZ.d+Wf+this.cf()+"] on "+(0<a.length?a:this.n)};_.k=0;var tC;function vC(a){this.a=a}w(476,1,{},vC);_.a=Lk;function wC(){}\nw(477,1,{},wC);_.a=null;_.b=null;function xC(a,b){var c;b&&(a.a?(c=new yC(a.a),nq(c.b,c.c++,b),a.a=c):(a.a=new Jm,Dm(a.a,b)))}function Ou(a,b){return a.a?Vm(a.a,b):b}w(479,1,Ql);_.a=null;function zC(){}function RB(){}w(478,479,Ql,zC,RB);function AC(){AC=x;Math.sqrt(2)}function BC(a){AC();if(0>a)throw new Sm("Missing message: awt.133");this.e=a;this.a=2;this.c=0;this.d=10;this.b=0}w(480,1,{56:1},BC);\n_.eQ=function(a){return a===this?!0:G(a,56)?a.e==this.e&&a.a==this.a&&a.c==this.c&&a.d==this.d&&a.b==this.b:!1};_.hC=function(){var a;a=new CC;a.a=31*a.a+dw((new DC(this.e)).a);a.a=31*a.a+this.a;a.a=31*a.a+this.c;a.a=31*a.a+dw((new DC(this.d)).a);return a.a};_.a=0;_.b=0;_.c=0;_.d=0;_.e=0;\nfunction EC(){EC=x;FC=GC=new km(255,255,255);HC=new km(192,192,192);IC=new km(128,128,128);JC=new km(64,64,64);KC=LC=new km(0,0,0);MC=NC=new km(255,0,0);new km(255,175,175);OC=new km(255,200,0);PC=new km(255,255,0);new km(0,255,0);QC=new km(255,0,255);RC=new km(0,255,255);SC=TC=new km(0,0,255)}\nfunction UC(a){var b,c;c=a.d>>16&255;b=a.d&255;a=a.d>>8&255;if(0==c&&0==b&&0==a)return new km(3,3,3);3>c&&0!=c?c=3:(c=dw(c/0.7),c=255<c?255:c);3>b&&0!=b?b=3:(b=dw(b/0.7),b=255<b?255:b);3>a&&0!=a?a=3:(a=dw(a/0.7),a=255<a?255:a);return new km(c,a,b)}function VC(a){return new km(dw(0.7*(a.d>>16&255)),dw(0.7*(a.d>>8&255)),dw(0.7*(a.d&255)))}function WC(a,b){return G(b,59)?b.d==a.d:!1}function km(a,b,c){EC();if((a&255)!=a||(b&255)!=b||(c&255)!=c)throw new Sm(xe);this.d=c|b<<8|a<<16|-16777216}\nw(486,1,{59:1,68:1,71:1},km);_.eQ=function(a){return WC(this,a)};_.hC=XC;_.tS=function(){return YC.d+"[r="+(this.d>>16&255)+",g="+(this.d>>8&255)+",b="+(this.d&255)+cg};_.a=0;_.b=null;_.c=null;_.d=0;var KC,SC,MC,FC,LC,TC,RC,JC,IC,HC,QC,OC,NC,GC,PC;function SB(){SB=x;TB=new ZC(!0);$C=new wv;xv($C,"ar");xv($C,"fa");xv($C,"iw");xv($C,"ur")}function ZC(a){this.a=a}w(487,1,Ql,ZC);_.a=!1;var TB,$C;w(491,1,{77:1,93:1});function aD(){JB.call(this,0,0)}function JB(a,b){this.b=a;this.a=b}\nfunction LB(a){JB.call(this,a.b,a.a)}w(490,491,{62:1,77:1,89:1,93:1},aD,JB,LB);_.eQ=function(a){return a===this?!0:G(a,62)?a.b==this.b&&a.a==this.a:!1};_.hC=function(){var a;a=new CC;a.a=31*a.a+this.b;a.a=31*a.a+this.a;return a.a};_.tS=function(){return bD.d+"[width="+this.b+",height="+this.a+cg};_.a=0;_.b=0;function lu(a,b,c){this.f=a;this.c=b;this.e=this.d=this.j=this.i=0;this.b=c}w(492,1,Ql,lu,function(a,b,c,d){this.f=a;this.c=b;this.j=this.i=0;this.d=c;this.e=d;this.b=null});\n_.tf=function(){return 0!=(this.e&4)};_.uf=function(){return 0!=(this.e&1)};_.tS=function(){var a;return this.cZ.d+"[id="+this.c+",x="+this.i+",y="+this.j+(0!=this.d?",key="+this.d+(a=n,this.uf()&&(a+=",shift"),0!=(this.e&2)&&(a+=",control"),this.tf()&&(a+=",meta"),a):n)+",target="+this.f+(null!=this.b?",arg="+this.b:n)+cg};_.b=null;_.c=0;_.d=0;_.e=0;_.f=null;_.i=0;_.j=0;function cD(a){var b,c;for(c=b=0;c<a.b.length;)a.b[c].Xc&&++b,++c;return b}\nfunction dD(a,b,c,d,e,f,g){var h,j,l,d=d+a.c;switch(a.a){case 0:break;case 2:d+=c;break;case 1:d+=~~(c/2);break;case 4:d+=g?c:0;break;default:d+=g?0:c}l=b.c-1;for(j=0;j<=l;++j)c=(eD(g?j:l-j,b.c),b.b[g?j:l-j]),h=c.Ue(),c.kf(d,e+~~((f-h.a)/2),h.b,h.a),d+=h.b+a.c}function fD(a,b){var c,d,e,f,g,h;h=a.c;g=0;for(d=a.b,e=0,f=d.length;e<f;++e)c=d[e],c.Xc&&(c=b?c.Ue():c.Se(),g=Xm(g,c.a),h+=c.b+a.c);return new JB(h,g+2*a.d)}function iC(){gD.call(this,1,5,5)}\nfunction gD(a,b,c){PB();this.c=b;this.d=c;this.a=a}w(493,1,Ql,iC,gD);_.of=hD;\n_.pf=function(a){this.b=iD(a.Fc);if(0!=cD(this)){var b,c,d,e,f,g,h,j,l,o,m;b=aC(a);g=a.nf();h=a.Rc.a;l=new Jm;o=f=2*this.c;m=g.d+this.d;j=0;e=!0;var r,t,y;r=a.Fc.a.c;d=new jD(r);for(t=0;t<r;++t)nq(d.b,d.c++,null);for(c=this.b,t=0,y=c.length;t<y;++t)r=c[t],r.Sc==a&&kD(d,AA(a.Fc.a,r),r);for(d=new zv(d);d.b<d.d.Tf();)if((c=Av(d))&&c.Xc)a=c.Ue(),!e&&o+a.b>b.b&&(dD(this,l,b.b-(o-this.c),g.b,m,j,h),l.qg(),o=f,m+=j+this.d,j=0),e=!1,nq(l.b,l.c++,c),o+=a.b+this.c,j=Xm(j,a.a);dD(this,l,b.b-(o-this.c),g.b,m,\nj,h)}};_.qf=function(a){this.b=iD(a.Fc);return 0==cD(this)?$B(a,new JB(10,10)):$B(a,fD(this,!1))};_.rf=function(a){this.b=iD(a.Fc);return 0==cD(this)?$B(a,new JB(10,10)):$B(a,fD(this,!0))};_.sf=XB;_.tS=function(){var a;switch(this.a){case 0:a=fi;break;case 2:a=zj;break;case 1:a=Pg;break;case 4:a="trailing";break;default:a="leading"}return lD.d+"[hgap="+this.c+",vgap="+this.d+",align="+a+cg};_.a=0;_.b=null;_.c=0;_.d=0;function mD(){mD=x;nD=new oD(Ie,0,12)}\nfunction oD(a,b,c){mD();this.a=null!=a?a:"Default";this.b=0<=c?c:0;this.c=0==(b&-4)?b:0}w(494,1,{63:1,89:1},oD);_.a=null;_.b=0;_.c=0;var nD;w(495,1,bm);_.tS=function(){return pD.d+"[font="+this.b+"ascent="+qD(this.b).a+", descent="+qD(this.b).b+", height="+qD(this.b).c+cg};_.b=null;w(497,1,{});_.tS=function(){return"Graphics"};w(498,497,{});function sB(){}function yy(a){this.f=a}w(501,136,dm,sB,yy);function FB(){this.f="Missing message: awt.151"}w(500,501,dm,FB);w(502,1,{});\nfunction VB(a,b,c,d){this.d=a;this.b=b;this.a=c;this.c=d}w(503,1,{65:1,89:1,93:1},VB);_.eQ=function(a){return a===this?!0:G(a,65)?a.b==this.b&&a.a==this.a&&a.c==this.c&&a.d==this.d:!1};_.hC=function(){var a;a=31+this.d;a=31*a+this.b;a=31*a+this.a;return a=31*a+this.c};_.tS=function(){return rD.d+"[left="+this.b+",top="+this.d+",right="+this.c+",bottom="+this.a+cg};_.a=0;_.b=0;_.c=0;_.d=0;w(507,1,Ql);_.cf=function(){return this.j};_.tS=ZB;_.j=null;_.k=null;\nfunction sD(a){var b;b=a.j+",label="+a.f;a.e||(b+=",disabled");null!=a.c&&(b+=",command="+a.c);return b}function tD(a,b){a.e=b;FA(a.i.a,b)}function uD(a){this.n=(PB(),PB(),QB);var b;var c;b=this.cZ.d;-1!=my(b,ny(36))?b=null:(c=this.n.b.d++,b=py(b,zB(b,ny(46))+1)+n+c);this.j=b;this.d=new zC;this.f=a;this.e=!0;this.i=new vD(this)}w(506,507,Ql,uD);_.cf=function(){return sD(this)};_.c=null;_.e=!1;_.f=null;_.i=null;w(505,506,Sl);_.cf=function(){return sD(this)+(this.b?",tearOff":n)};_.b=!1;w(509,1,{78:1});\n_.eQ=function(a){return a===this?!0:G(a,78)?this.vf()==a.vf()&&this.wf()==a.wf():!1};_.hC=function(){var a;a=new CC;wD(a,this.vf());wD(a,this.wf());return a.a};function EB(){this.b=this.a=0}function xD(a,b){this.a=a;this.b=b}w(508,509,{69:1,78:1,89:1},EB,xD);_.eQ=function(a){return a===this?!0:G(a,69)?this.a==a.a&&this.b==a.b:!1};_.vf=Xw;_.wf=Bz;_.tS=function(){return yD.d+"[x="+this.a+",y="+this.b+cg};_.a=0;_.b=0;\nfunction zD(a,b){if(!b)throw new ov("Missing message: awt.70");var c=a.a;if(H(b.f,rb)){var c=c.a.a,d=new HA,e=c.c.c;if(0>e||e>c.c.c)throw new Oy;c.o&&(d.pb[Zg]=2);nA(c,e,d.pb);AD(c.c,e,d)}else{var d=c.a.a,c=b.i.a,e=d.c.c,f,g;if(0>e||e>d.c.c)throw new Oy;AD(d.c,e,c);for(f=g=0;f<e;++f)G(Dx(d.c,f),46)&&++g;AD(d.i,g,c);nA(d,e,c.pb);c.c=d;e=ly(c.pb)+hc;gy(c.ie(),e,!1);d.o&&(e=AA(d.c,c),-1!=e&&(d=Tx(d.o?d.e:Tx(d.e,0),e),2==Ux(d)&&d.removeChild(Tx(d,1)),c.pb[Zg]=2))}}\nfunction BD(){uD.call(this,n);new Jm;this.b=!1;this.a=(PB(),new CD)}w(510,505,Sl,BD);_.a=null;w(513,1,{93:1});w(512,513,Ml);_.eQ=function(a){return a===this?!0:G(a,80)?this.vf()==a.vf()&&this.wf()==a.wf()&&this.yf()==a.yf()&&this.xf()==a.xf():!1};_.hC=function(){var a;a=new CC;wD(a,this.vf());wD(a,this.wf());wD(a,this.yf());wD(a,this.xf());return a.a};function bC(a,b,c,d){this.c=a;this.d=b;this.a=d;this.b=c}w(511,512,{70:1,80:1,89:1,93:1},bC);\n_.eQ=function(a){return a===this?!0:G(a,70)?a.c==this.c&&a.d==this.d&&a.b==this.b&&a.a==this.a:!1};_.xf=Xw;_.yf=Bz;_.vf=At;_.wf=XC;_.tS=function(){return DD.d+"[x="+this.c+",y="+this.d+",width="+this.b+",height="+this.a+cg};_.a=0;_.b=0;_.c=0;_.d=0;function ED(){ED=x;FD=new GD;HD=new ID;JD=new ID}var FD,JD,HD;w(515,1,{});_.eQ=em;_.hC=fm;function GD(){}w(516,515,{},GD);function ID(){}w(517,1,{},ID);w(518,472,ul);function KD(a,b){var c;c=BB(AB(a));return!c?null:new JB(LD(c,"_")*b+6,qD(c.b).c+6)}\nfunction MD(a){ND.call(this,a,null!=a?a.length:0)}function ND(a,b){OB.call(this);this.a=0>b?0:b;var c=this.Tc;bB(c.a,a);c.e.a=-1;c.e.b=-1}w(519,518,ul,MD,ND);_.Ne=function(){return"textfield"+this.Vc.b.f++};_.Pe=function(){return KD(this,Uq(this.Tc.a.pb,Ak).length)};_.Qe=function(){return!AB(this)?null:KD(this,Uq(this.Tc.a.pb,Ak).length)};_.Se=OD;_.Ue=PD;_.Ye=function(){this.Tc=(PB(),new QD)};_.af=OD;_.df=PD;_.a=0;function PB(){PB=x;QB=new RD}\nfunction SD(){var a=(PB(),PB(),QB);!a.c&&(a.c=new TD);return a.c}w(520,1,{});_.a=null;_.c=null;var QB;function UD(){}w(521,1,{},UD);_.a=0;_.b=0;_.c=0;_.d=0;_.e=0;_.f=0;w(522,1,{});function VD(){VD=x;WD=new XD;YD=new XD}function ZD(a,b){return b==a?!0:!b?!1:!0}function XD(){}w(523,1,{73:1},XD);_.eQ=function(a){return null==a||!G(a,73)?!1:ZD(this,a)};_.hC=function(){var a;a=null.ei()+";class="+null.ei();a=!null.ei().ei()?a:a+";charset=";return $D(a)};\n_.tS=function(){return aE.d+"[MimeType=(null);humanPresentableName="+this.a+cg};_.a=null;var WD,YD;function bE(){bE=x;z(cE,u,73,[(VD(),YD),WD])}function dE(a){var b=(VD(),YD);if(ZD(b,(VD(),YD)))return a.a;if(ZD(b,WD))return new eE(a.a);throw new fE(b);}function gE(a){bE();this.a=a}w(524,1,{},gE);_.a=null;function fE(a){this.f="flavor = "+a}w(525,137,{74:1,89:1,97:1,106:1},fE);function hE(a,b,c){sC();iE.call(this,a,b,c,Lk)}\nfunction iE(a,b,c,d){sC();qC.call(this,a);this.k=b;this.a=c;this.c=d;this.b=0}w(526,473,Ql,hE,iE);_.cf=function(){var a,b;a=1001==this.k?"ACTION_PERFORMED":zk;b=n;0<(this.b&1)&&(b+="Shift");0<(this.b&2)&&(b+=0==b.length?"Ctrl":"+Ctrl");0<(this.b&4)&&(b+=0==b.length?"Meta":"+Meta");0<(this.b&8)&&(b+=0==b.length?"Alt":"+Alt");return a+",cmd="+this.a+",when="+Ow(this.c)+qb+b};_.a=null;_.b=0;_.c=Lk;function NB(a,b){sC();qC.call(this,a);this.k=b}w(527,473,Ql,NB);\n_.cf=function(){var a,b;a=this.n;switch(this.k){case 100:b="COMPONENT_MOVED";break;case 101:b="COMPONENT_RESIZED";break;case 102:return"COMPONENT_SHOWN";case 103:return"COMPONENT_HIDDEN";default:return zk}return b+" ("+a.We()+kb+a.Xe()+ga+a.Ve()+Gk+a.Re()+hb};w(530,527,Ql);_.j=0;\nfunction jE(a){var b;switch(a.k){case 503:b="MOUSE_MOVED";break;case 500:b="MOUSE_CLICKED";break;case 501:b="MOUSE_PRESSED";break;case 502:b="MOUSE_RELEASED";break;case 506:b="MOUSE_DRAGGED";break;case 504:b="MOUSE_ENTERED";break;case 505:b="MOUSE_EXITED";break;case 507:b="MOUSE_WHEEL";break;default:b=zk}b=b+",("+a.f+kb+a.i+"),button="+a.d;if(0<(a.j&16320)){var c=qb,d;d=a.j;var e;e=new Tw;0!=(d&4)&&Ap(Ap(e,(PB(),null)),jb);0!=(d&1)&&Ap(Ap(e,(PB(),null)),jb);0!=(d&2)&&Ap(Ap(e,(PB(),null)),jb);0!=(d&\n8)&&(0!=(d&2048)?0!=(d&512)&&Ap(Ap(e,(PB(),null)),jb):Ap(Ap(e,(PB(),null)),jb));0!=(d&32)&&Ap(Ap(e,(PB(),null)),jb);0!=(d&16)&&Ap(Ap(e,(PB(),null)),jb);0!=(d&8)&&Ap(Ap(e,(PB(),null)),jb);0!=(d&4)&&Ap(Ap(e,(PB(),null)),jb);d=0==e.a.a.length?e.a.a:mE(e.a.a,0,e.a.a.length-1);c=c+d+",extModifiers=";d=a.j;var f;e=(f=n,0!=(d&256)&&(f+=(PB(),null)),0!=(d&128)&&(f+=(0<f.length?jb:n)+(PB(),null)),0!=(d&512)&&(f+=(0<f.length?jb:n)+(PB(),null)),0!=(d&64)&&(f+=(0<f.length?jb:n)+(PB(),null)),0!=(d&8192)&&(f+=\n(0<f.length?jb:n)+(PB(),null)),f);0!=(d&1024)&&(e+=(0<e.length?jb:n)+(PB(),null));0!=(d&2048)&&(e+=(0<e.length?jb:n)+(PB(),null));0!=(d&4096)&&(e+=(0<e.length?jb:n)+(PB(),null));b+=c+e}return b+=",clickCount="+a.e}w(532,530,Ql);_.cf=function(){return jE(this)};_.d=0;_.e=0;_.f=0;_.i=0;\nfunction Nu(a,b,c,d){sC();NB.call(this,a,507);this.d=this.e=this.j=0;this.f=b;this.i=c;if(0!=(this.j&63))this.j&=-16321,0!=(this.j&1)&&(this.j|=64),0!=(this.j&2)&&(this.j|=128),0!=(this.j&4)&&(this.j|=256),0!=(this.j&8)&&(this.j|=512),0!=(this.j&32)&&(this.j|=8192),500<=this.k&&502>=this.k?0!=(this.j&16)?(this.d=1,501==this.k&&(this.j|=1024)):0!=(this.j&8)?(this.d=2,501==this.k&&(this.j|=2048)):0!=(this.j&4)&&(this.d=3,501==this.k&&(this.j|=4096)):(0!=(this.j&16)&&(this.j|=1024),0!=(this.j&8)&&(this.j|=\n2048),0!=(this.j&4)&&(this.j|=4096));else if(0!=(this.j&16320))if(this.j&=-64,0!=(this.j&64)&&(this.j|=1),0!=(this.j&128)&&(this.j|=2),0!=(this.j&256)&&(this.j|=4),0!=(this.j&512)&&(this.j|=8),0!=(this.j&8192)&&(this.j|=32),500<=this.k&&502>=this.k)switch(this.d){case 1:this.j|=16;break;case 2:this.j|=8;break;case 3:this.j|=4}else 0!=(this.j&1024)&&(this.j|=16),0!=(this.j&2048)&&(this.j|=8),0!=(this.j&4096)&&(this.j|=4);this.b=0;this.a=1;this.c=d}w(533,532,Ql,Nu);\n_.cf=function(){var a,b;a=jE(this);switch(this.b){case 0:b="WHEEL_UNIT_SCROLL";break;case 1:b="WHEEL_BLOCK_SCROLL";break;default:b=zk}return a+=",scrollType="+b+",scrollAmount="+this.a+",wheelRotation="+this.c};_.a=0;_.b=0;_.c=0;w(542,1,{});function eE(a){if(null==a)throw new nE;}w(543,542,{},eE);\nfunction oE(){oE=x;pE={};pE["java.vendor"]=Mh;pE["package.restrict.access.sun"]=xk;pE["sun.java.launcher"]=tf;pE["sun.management.compiler"]=Mh;pE["os.name"]=tf;pE[" sun.boot.class.path"]=tf;pE["path.separator.applet"]=tf;pE["java.vm.specification.vendor"]=Mh;pE["java.runtime.version"]=tf;pE["http.proxyPort"]=tf;pE["user.name"]=tf;pE["user.language"]=tf;pE["os.name.applet"]=tf;pE["browser.version"]=tf;pE["java.version"]=tf;pE["user.timezone"]=tf;pE["java.endorsed.dirs"]=tf;pE["java.specification.name"]=\n"GWT";pE["java.specification.version"]="2.5.0";pE[ai]=bf;!Qu&&(Qu=new Yu);Qu.a?pE[Zh]="yes":pE[Zh]=null}var pE;w(547,137,Jl);function qE(){}function rE(a){this.f=a}w(546,547,{83:1,89:1,97:1,106:1},qE,rE);function sE(){sE=x;tE=new uE}function vE(a){var b;if(a.k){var c;b=new Tw;Ap(b,a.f);b.a.a+=bd;c=a.a;null!=c&&0<c.length&&(b.a.a+=yc,Ap(b,a.a));c=a.b;a=a.j;null!=c&&Bp(b.a,c);null!=a&&(b.a.a+=Fa,Bp(b.a,a));b=b.a.a}else b="unknown protocol("+a.f+")://"+a.c+a.b;return b}\nfunction wE(a){sE();var b,c,d;if(null==a)throw new qE;a=oy(a);try{d=my(a,ny(58))}catch(e){e=yq(e);if(G(e,101))throw new rE(Cp(e));throw e;}c=my(a,ny(91));if(0<=d&&(-1==c||d<c)){this.f=a.substr(0,d-0);b=this.f.charCodeAt(0);b=97<=b&&122>=b||65<=b&&90>=b;for(c=1;b&&c<this.f.length;++c)b=this.f.charCodeAt(c),b=97<=b&&122>=b||65<=b&&90>=b||48<=b&&57>=b||43==b||45==b||46==b;if(b){c=this.f;xE();var f,g,h;h=c.length;b=new yE;for(g=0;g<h;++g)f=c.charCodeAt(g),65<=f&&90>=f?zE(b,f+32&65535):Bp(b.a,String.fromCharCode(f));\nthis.f=b.a.a}else this.f=null,d=-1}if(null==this.f)throw new rE(Ze+a);if(!this.k&&(this.k=Fv(tE,this.f),this.k||(this.k=(PB(),new AE))&&E(tE,this.f,this.k),!this.k))throw new rE(Ze+a);try{c=a;var j=++d,l=a.length,o,m,r,t,y,v,s,A,F,M,N,$,U,V,da,la,sa,cc,K,pa,Ac;if(l<j||0>l){if(-2147483647>=l&&(j>=c.length||0>j)||!(0>j||j>=c.length)&&c.indexOf(yc,j)==j&&-1==BE(c,ny(47),j+2))throw new CE(l);}else{N=c.substr(j,l-j);l-=j;v=0;s=this.c;$=this.e;cc=this.j;t=this.d;da=this.i;o=this.a;Ac=this.n;K=BE(N,ny(35),\n0);if(0==N.indexOf(yc)&&0!=N.indexOf("////")){F=2;$=-1;v=BE(N,ny(47),2);sa=BE(N,ny(63),2);-1!=sa&&(-1==v||v>sa)&&(v=sa);-1==v&&(v=l,t=n);A=v;-1!=K&&K<v&&(A=K);var jd=ny(64);pa=N.lastIndexOf(jd,A);o=N.substr(2,A-2);-1<pa&&(Ac=N.substr(2,pa-2),F=pa+1);U=BE(N,ny(58),-1==pa?F:pa);r=my(N,ny(93));if(-1!=r)try{N.length>r+1?(m=N.charCodeAt(r+1),58==m?U=r+1:U=-1):U=-1}catch(tb){if(tb=yq(tb),!G(tb,97))throw tb;}-1==U||U>v?s=N.substr(F,A-F):(s=N.substr(F,U-F),V=N.substr(U+1,A-(U+1)),0==V.length?$=-1:$=DE(V,\n10))}-1<K&&(cc=N.substr(K+1,l-(K+1)));y=-1==K?l:K;var L=ny(63);la=N.lastIndexOf(L,y);-1<la?(da=N.substr(la+1,y-(la+1)),0==la&&null!=t&&(H(t,n)?t=tc:t.indexOf(tc),M=zB(t,ny(47))+1,t=t.substr(0,M-0)),y=la):0!=K&&(da=null);-1<v&&(v<l&&47==N.charCodeAt(v)?t=N.substr(v,y-v):y>v&&(null==t?t=n:H(t,n)?t=tc:t.indexOf(tc),M=zB(t,ny(47))+1,0==M?t=N.substr(v,y-v):t=t.substr(0,M-0)+N.substr(v,y-v)));null==t&&(t=n);null==s&&(s=n);d=s;var Ga;Ga=t;null!=da&&!H(da,n)&&(null!=t?Ga=t+Gd+da:Ga=Gd+da);null==this.f&&(this.f=\nthis.f);this.c=d;this.b=Ga;this.e=$;this.j=cc;var ub;null!=this.c&&0<this.c.length&&(this.a=this.c,-1!=this.e&&(this.a=this.a+bd+this.e));null!=this.c&&-1<(ub=zB(this.c,ny(64)))?(this.n=mE(this.c,0,ub),this.c=py(this.c,ub+1)):this.n=null;null!=this.b&&-1<(ub=my(this.b,ny(63)))?(this.i=py(this.b,ub+1),this.d=mE(this.b,0,ub)):(this.i=null,this.d=this.b);this.a=o;this.n=Ac;this.d=t;this.i=da}}catch(Jc){Jc=yq(Jc);if(G(Jc,97))throw new rE(Cp(Jc));throw Jc;}if(-1>this.e)throw new rE("incorrect port: "+\nthis.e);}w(548,1,Ql,wE);_.tS=function(){return vE(this)};_.a=null;_.b=null;_.c=null;_.d=null;_.e=-1;_.f=null;_.i=null;_.j=null;_.k=null;_.n=null;var tE;w(549,1,{});function EE(a,b,c){var d,e;for(d=a.Of().ye();d.Zd();)if(a=d.$d(),e=a.xh(),null==b?null==e:Kp(b,e))return c&&(a=new FE(a.xh(),a.yh()),d._d()),a;return null}w(553,1,Nl);_.Nf=function(a){return!!EE(this,a,!1)};\n_.eQ=function(a){var b,c;if(a===this)return!0;if(!G(a,109)||this.Tf()!=a.Tf())return!1;for(a=a.Of().ye();a.Zd();)if(b=a.$d(),c=b.xh(),b=b.yh(),!this.Nf(c)||!GE(b,this.Pf(c)))return!1;return!0};_.Pf=function(a){a=EE(this,a,!1);return!a?null:a.yh()};_.hC=function(){var a,b,c;c=0;for(b=this.Of().ye();b.Zd();)a=b.$d(),c+=a.hC(),c=~~c;return c};_.Qf=HE;_.Rf=function(){throw new IE("Put not supported on this map");};_.Sf=function(a){a=EE(this,a,!0);return!a?null:a.yh()};_.Tf=function(){return this.Of().Tf()};\n_.tS=function(){var a,b,c,d;d=Ik;a=!1;for(c=this.Of().ye();c.Zd();)b=c.$d(),a?d+=nb:a=!0,d+=n+b.xh(),d+=Ed,d+=n+b.yh();return d+"}"};function aB(a){a.a=[];a.e={};a.c=!1;a.b=null;a.d=0}function Wx(a,b){var c;if(null==b)c=a.c;else if(G(b,1))c=bd+b in a.e;else a:{c=a.Wf(b);if(c=a.a[c])for(var d=0,e=c.length;d<e;++d){var f=c[d].xh();if(a.Vf(b,f)){c=!0;break a}}c=!1}return c}function Fv(a,b){return null==b?a.b:G(b,1)?a.e[bd+b]:JE(a,b,a.Wf(b))}\nfunction JE(a,b,c){if(c=a.a[c])for(var d=0,e=c.length;d<e;++d){var f=c[d],g=f.xh();if(a.Vf(b,g))return f.yh()}return null}function E(a,b,c){return null==b?KE(a,c):G(b,1)?LE(a,b,c):ME(a,b,c,a.Wf(b))}function ME(a,b,c,d){var e=a.a[d];if(e)for(var f=0,g=e.length;f<g;++f){var d=e[f],h=d.xh();if(a.Vf(b,h))return a=d.yh(),d.zh(c),a}else e=a.a[d]=[];d=new FE(b,c);e.push(d);++a.d;return null}function KE(a,b){var c;c=a.b;a.b=b;a.c||(a.c=!0,++a.d);return c}\nfunction LE(a,b,c){var d,e=a.e,b=bd+b;b in e?d=e[b]:++a.d;e[b]=c;return d}function Hv(a,b){var c;if(null==b)c=a.b,a.b=null,a.c&&(a.c=!1,--a.d);else if(G(b,1)){var d,e=a.e;c=bd+b;c in e&&(d=e[c],--a.d,delete e[c]);c=d}else a:{c=a.Wf(b);if(d=a.a[c])for(var e=0,f=d.length;e<f;++e){var g=d[e],h=g.xh();if(a.Vf(b,h)){1==d.length?delete a.a[c]:d.splice(e,1);--a.d;c=g.yh();break a}}c=null}return c}w(552,553,Nl);_.Nf=function(a){return Wx(this,a)};_.Of=function(){return new NE(this)};\n_.Vf=function(a,b){return this.Uf(a,b)};_.Pf=function(a){return Fv(this,a)};_.Rf=function(a,b){return E(this,a,b)};_.Sf=function(a){return Hv(this,a)};_.Tf=XC;_.a=null;_.b=null;_.c=!1;_.d=0;_.e=null;function xp(){aB(this)}w(551,552,il,xp);_.Uf=function(a,b){return cw(a)===cw(b)||null!=a&&Kp(a,b)};_.Wf=function(a){return~~Np(a)};function uE(){aB(this)}w(550,551,il,uE);function OE(){}w(554,136,dm,OE);function PE(a){var b,c;b=0;for(c=a.a;c<a.i;){c=QE(a,c);if(c>=a.i)break;c=RE(a,c);++b}return b}\nfunction SE(a,b){var c;for(c=0;c<a.b.length;++c)if(a.b[c]==b)return!0;return!1}function TE(a){var b;a.a=0<=a.j&&!a.d?a.j:QE(a,a.a);a.d=!1;a.j=-1;if(a.a>=a.i)throw new OE;b=a.a;a.a=RE(a,a.a);return mE(a.n,b,a.a)}\nfunction RE(a,b){var c,d;for(d=b;d<a.i;)if(a.e){c=UE(a.n,d,a.n.length);if(c<=a.f&&SE(a,c))break;d+=65536<=c?2:1}else{c=a.n.charCodeAt(d);if(c<=a.f&&0<=my(a.c,ny(c)))break;++d}a.k&&b==d&&(a.e?(c=UE(a.n,d,a.n.length),c<=a.f&&SE(a,c)&&(d+=65536<=c?2:1)):(c=a.n.charCodeAt(d),c<=a.f&&0<=my(a.c,ny(c))&&++d));return d}\nfunction QE(a,b){var c,d;if(null==a.c)throw new nE;for(d=b;!a.k&&d<a.i;)if(a.e){c=UE(a.n,d,a.n.length);if(c>a.f||!SE(a,c))break;d+=65536<=c?2:1}else{c=a.n.charCodeAt(d);if(c>a.f||0>my(a.c,ny(c)))break;++d}return d}function VE(a){WE.call(this,a,ha,!1)}function XE(a){WE.call(this,a,kb,!1)}\nfunction WE(a,b,c){this.a=0;this.j=-1;this.d=!1;this.n=a;this.i=a.length;this.c=b;this.k=c;var d;if(null==this.c)this.f=0;else{for(c=b=d=0;c<this.c.length;c+=65536<=a?2:1)a=this.c.charCodeAt(c),55296<=a&&57343>=a&&(a=UE(this.c,c,this.c.length),this.e=!0),d<a&&(d=a),++b;this.f=d;if(this.e){this.b=D(B,q,-1,b,1);for(c=0,d=0;c<b;++c,d+=65536<=a?2:1)a=UE(this.c,d,this.c.length),this.b[c]=a}}}w(555,1,{},VE,XE,WE);_.a=0;_.b=null;_.c=null;_.d=!1;_.e=!1;_.f=0;_.i=0;_.j=0;_.k=!1;_.n=null;function YE(){}\nw(556,1,{},YE);_.a=null;function ZE(a,b){var c,d;c=a.a.exec(b);d=new YE;d.a=c;return d}function $E(){}function aF(a,b){var c,d;d=n;2==(b|2)&&(d+=Wh);1==(b|1)&&(d+=ni);c=new $E;c.a=RegExp(a,d);return c}w(557,1,{},$E);_.a=null;\nfunction bF(a,b){var c,d,e,f,g;c=n;if(null!=b){d=0;for(f=0,g=b.length;f<g;++f){e=b[f];if(G(e,1)&&(e=Sp(e),!(Qp(),!/[^,:{}\\[\\]0-9.\\-+Eaeflnr-u \\n\\r\\t]/.test(e.replace(/"(\\\\.|[^"\\\\])*"/g,n)))))return;c+=e;d<b.length-1&&(c+=kb);++d}}typeof a==Gh?($wnd.alert("A JavaScript function name is expected, not a the function itself"),c=$wnd.eval(Wf+c+cg),a.apply(c)):(evalString=a+cb+c+");",$wnd.eval(evalString))}\nfunction cF(a){var b;if(null==a||0==a.length)return dF(\'JSME installation warning: invalid size or not specified size of DOM element: "\'+a+\'", Using "100%".\'),Kc;b=a.charCodeAt(a.length-1);return eF(b)||46==b?a+oj:a}function kw(a){var a=new fF(a),b,c,d,e,f;b=$doc.getElementsByTagName(ph);f=b.length;a.c=[];for(d=0;d<f;++d)e=b[d],c=e.getAttribute(Yg)||n,c==a.a&&(c=a.c,c[c.length]=e);for(a.b=0;gF(a););return a.b}w(564,1,{});function hF(a,b){b.Ld(new iF);b.Kd(new jF);b.Md(new kF);b.Nd(new lF(a))}\nw(563,564,{});_.b=null;_.c=1;_.d=-1;function mF(a){this.a=a;this.b=new nF(this.a);this.c=this.d=1}w(562,563,{},mF);_.a=null;function nF(a){this.a=a}w(565,1,{},nF);_.Xf=function(a){var b=this.a;b.Tb&&(null!=a&&0<a.length?(oF(b.r,"DROP"),!b.Ub&&(b.Ub=new pu(b)),pF(b.Ub,a)):(mu(b,"ERROR - empty or null structure"),qF(b)))};_.a=null;function rF(a){this.a=a}w(566,1,{},rF);_.a=null;function sF(a,b,c,d){this.d=a;this.b=b;this.c=c;this.a=d}w(567,1,{},sF);\n_.Yf=function(){Ty(this.d.f,this.b,oC(this.d)-this.c-this.a.a,pC(this.d)-(this.a.d-this.a.a))};_.a=null;_.b=null;_.c=0;var tF=_.d=null;function uF(){uF=x;tF=new Qw((gx(),new fx("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAQCAYAAADqDXTRAAAAF0lEQVR42mNgGAWjYBSMglEwCkYBpQAAB1AAAZMWyVkAAAAASUVORK5CYII=")),29,16)}function vF(a){var b;$wnd.JSApplet.Inchi.__local_ff=function(a){b=a};$wnd.JSApplet.Inchi.computeInchi(a,"JSApplet.Inchi.__local_ff");delete $wnd.JSApplet.Inchi.__local_ff;return b}\nfunction wF(a){var b;xF?a&&yF(a):(b=(zF(),AF).a.a,b=(Tp(),new Zp(b)),b.d=Up,Wp(Xp(b,new BF(a))))}var xF=!1;function BF(a){this.a=a}w(571,1,{},BF);_.wd=function(a){if(this.a){var b=this.a;b.a&&b.a.zd(a)}else $wnd.alert("Loading of InChI-js failed")};_.xd=function(){this.a&&(yF(this.a),xF=!0)};_.a=null;function yF(a){var b;b=vF(a.b);a.a.Zf(b)}function CF(a,b){this.a=a;this.b=b}w(572,1,Ul,CF);_.zd=function(a){this.a&&this.a.zd(a)};_.a=null;var AF=_.b=null;\nfunction zF(){zF=x;AF=new Pw((gx(),new fx($moduleBase+"96E40B969193BD74B8A621486920E79C.cache.js")))}function DF(a){return a.error==n?null:a.error}function EF(a){return a.warning==n?null:a.warning}\nfunction FF(){FF=x;GF=z(hw,u,1,["Copyright (c) 2017, Novartis Institutes for BioMedical Research Inc. and Bruno Bienfait.","All rights reserved."]);HF=(EC(),HC);IF=UC(HF);JF=z(B,q,-1,[301,3,401,4,501,5,701,9,801,10,901,11,1001,12,601,8,1101,7,1300,1,1201,32,1301,33]);KF=D(LF,u,59,43,0);MF=D(hw,u,1,43,0);NF=D(LF,u,59,7,0);OF=null!=(oE(),pE[Zh]);PF=D(QF,u,63,100,0);RF=D(SF,u,64,100,0);var a,b;for(a=1;42>=a;++a)0<TF(a)?KF[a]=(EC(),JC):(KF[a]=(EC(),OC),MF[a]=Uf);MF[1]=Pe;KF[1]=(EC(),JC);MF[2]=ce;KF[2]=\nOC;MF[3]=me;KF[3]=JC;MF[4]=sf;KF[4]=TC;MF[5]=xf;KF[5]=NC;MF[9]=Ke;KF[9]=QC;MF[10]=ve;KF[10]=QC;MF[11]=le;KF[11]=QC;MF[12]=Xe;KF[12]=QC;MF[8]=Hf;KF[8]=VC(PC);MF[7]=yf;KF[7]=OC;MF[6]=Lf;KF[6]=JC;MF[13]=Jf;KF[13]=JC;MF[32]=Uf;KF[32]=JC;MF[14]=cf;MF[16]=df;MF[15]=uf;MF[17]=Gf;MF[18]=ze;MF[19]=Me;MF[20]=Rd;MF[21]=rf;MF[22]=re;MF[24]=Mf;MF[23]=de;MF[25]=Vf;MF[26]=vf;MF[27]=Ee;MF[28]=se;MF[29]=Ud;MF[30]=Oe;MF[31]=Xd;for(a=33;42>=a;++a)b=Ef,33<a&&(b+=a-33),MF[a]=b,KF[a]=JC}\nfunction UF(a){var b;if(a.dc)b=VF(a,1)+Fd+VF(a,2)+Fd+VF(a,3);else if(b=VF(a,0),0<b.length){var c=new WF(a.ob);Dm(a.qb.a,c)}return b}function XF(a){var b,c,d;d=!1;if(0<a.ob.v||0<a.ob.w)if(d=!0,0<a.ob.v?(YF(a.ob,a.ob.v),ZF(a,"delAtom",a.ob.v),a.ob.v=0):($F(a.ob,a.ob.w),ZF(a,"delBond",a.ob.v),a.ob.w=0),aG(a.ob),b=bG(a.ob),1<b.length)for(c=0;c<b.length;++c)0==c?(a.zb[a.o]=b[0],a.ob=a.zb[a.o]):a.zb[++a.Sb]=b[c];return d}\nfunction cG(a,b){var c,d,e,f;dG(a,!1);c=b.a;if(H(c,Fc))nu(UF(a));else if(H(c,Ic))nu(Qt(a,!0,!1));else if(H(c,Nc))nu(Qt(a,!0,!0));else if(H(c,ad))a.Tb&&(c=a.r,null==c.i&&(c.i="PASTE"),ou(a.E,(!a.Ub&&(a.Ub=new pu(a)),a.Ub)));else if(H(c,Oc))a.bg(3);else if(H(c,Pc))a.bg(4);else if(H(c,Uc))a.bg(5);else if(H(c,Vc))rq(6,new eG(a));else if(H(c,Wc))a.kg();else if(H(c,Xc))rq(1,new fG(a));else if(H(c,Aj))7!=a.cb&&(a.db=Lk),d=b.c,d=Nw(d,Kk),c=Ew(d,a.db),e=!Bw(c,Lk)?ww(c):c,!Bw(e,Rk)&&gG(a.ob,P(c)),a.Ib=!0,a.cb=\n7,a.db=d;else if(c==Qf||c==Kf){if(e=hG(a.ob,(iG(),c==Kf?jG:kG)))a.ob.f.a?mu(a,"Chiral flag is set"):mu(a,"No Chiral flag"),lG(a,"changeChiral",a.o,0,0),a.Ib=!0}else if(c==be){f=mG(a);e=!1;for(c=1;c<=a.ob.p;++c)d=a.ob.b[c],-99199==d.f&&(++f,d.f=f,e=!0);e&&(a.Ib=!0,lG(a,"changeManyAtomMap",a.o,0,0))}else if(c==Ge){c=a.ob;e=!1;for(d=1;d<=c.p;++d)e=nG(c.b[d])||e;(a.Ib=e)&&lG(a,"deleteAtomMaps",a.o,0,0)}else c==He?(a.Ib=oG(a.ob),a.Ib&&lG(a,"deleteHydrogens",a.o,0,0)):H(c,Gj)||(H(c,xh)?a.hc=!0:pG(a,c));\n(a.Ib||a.Gb)&&a.bf(a.Ec.d)}\nfunction qG(a,b,c,d,e){var f,g,h,j,l,o,m,r;if(!a.Ob&&(j=c-b+1,!(0>=j||b>a.Sb||c>a.Sb))){l=D(rG,nl,-1,99,1);h=m=o=0;for(g=b;g<=c;++g)f=sG(a.zb[g]),o+=f.c,m+=f.d,f.d>h&&(h=f.d),l[g]=f.c,2==d&&(l[g]=f.d);a.J&&(o+=25*(j+1),m+=25*(j+1),h+=25);j=g=1;a.J?r=tG(a):r=uG(a);f=dw(r.b);r=dw(r.a);1==d||3==d?f=~~((f-48)/2):2==d&&(r=~~(r/2));o>=f&&(g=f/o);h>=r&&(j=r/h);h=0;a.J&&(a.xb=g<j?g:j,a.ig("alignMolecules Depict: molecularAreaScale="+a.xb+" xsize="+f+" ysize="+r+ea),h=25*f/o,2==d&&(h=25*r/m));for(g=b;g<=c;++g)2==\nd?l[g]=l[g]*r/m:l[g]=l[g]*f/o;o=-f/2;m=0;1==d?o=-f-24:3==d?o=24:2==d&&(o=0,m=-r);for(g=b;g<=c;++g){a.J&&vG(a.zb[g]);2==d?m+=l[g]/2+h:o+=l[g]/2+h;if(!e)for(b=1;b<=a.zb[g].p;++b)wG(a.zb[g].b[b],o/a.xb,m/a.xb);2==d?m+=l[g]/2:o+=l[g]/2;a.J||xG(a.zb[g])}}}function yG(a,b){var c;a.k=202;a.Mb=!1;mu(a,n);if(0!=a.Sb){a.Ib=!0;a.q=!0;for(c=a.o;c<a.Sb;++c)a.zb[c]=a.zb[c+1];--a.Sb;a.o=a.Sb;0<a.Sb?a.ob=a.zb[a.o]:(a.ob=new zG(a),a.ob.o=0);b&&(!!a.r&&AG(Xp(a.r,"clear"),0,0,0),a.hc=!0)}}\nfunction BG(a){a.Sb=0;a.o=0;a.ob=new zG(a);a.ob.o=0;a.sb=null;a.Ib=!0}\nfunction CG(a,b){var c,d,e,f,g;g=new BD;e=If;d="MOL";f="MOL or SDF";iG();a:{for(c=1;c<=a.Sb;++c)if(0<a.zb[c].p){c=(iG(),iG(),jG);break a}c=(iG(),iG(),kG)}c=c.a?kG:jG;b&&(e="SMIRKS",f=d=Ff);a.Ac&&(f+=" or "+e,!b&&a.zc&&(f+=" or OCL ID code"));e=new uD(ye+e);e.c=Fc;zD(g,e);tD(e,!c.a);xC(e.d,a);e=new uD(ye+d);e.c=Ic;xC(e.d,a);zD(g,e);b||(e=new uD(ye+d+" V3000"),e.c=Nc,xC(e.d,a),zD(g,e),a.$f()&&(a.N&&(e=new uD("Copy as InChI"),e.c=Oc,xC(e.d,a),tD(e,!c.a),zD(g,e)),a.P&&(e=new uD("Copy as InChI key"),e.c=\nPc,xC(e.d,a),tD(e,!c.a),zD(g,e)),a.kc&&(e=new uD("Search chemical structure (through InChIKey)"),e.c=Wc,xC(e.d,a),tD(e,!c.a),zD(g,e)),a.O&&(e=new uD("Copy as InChI auxinfo"),e.c=Uc,xC(e.d,a),tD(e,!c.a),zD(g,e))));a.Ac&&a.Q&&!b&&(e=new uD("Copy as Scalar Vector Graphics"),e.c=Xc,xC(e.d,a),zD(g,e));a.Ac&&a.zc&&!b&&(e=new uD("Copy as OCL ID code"),e.c=Vc,xC(e.d,a),tD(e,!c.a),zD(g,e));a.Tb&&(zD(g,new uD(rb)),d=a.Wb,null==d&&(d="Paste "+f),e=new uD(d),e.c=ad,xC(e.d,a),zD(g,e));xB(a,g);return g}\nfunction DG(a,b,c,d){return new EG(a.cg(!b?null:b.a,P(J(Math.round(c))),P(J(Math.round(d)))))}\nfunction FG(a,b,c,d){var e,f,g,h,j,l,o;f=100*d+c;j=(c-1)*(a.mb+(a.Lb?1:0));g=(d-1)*(a.mb+(a.Lb?1:0));1==c&&2<d&&(g-=2*a.mb);GG(b,HF);a.Lb?(f==a.k&&GG(b,VC(HF)),HG(b,j,g,a.mb,a.mb),GG(b,(EC(),JC)),IG(b,j,g,a.mb-1,a.mb-1)):f==a.k?JG(b,j+1,g+1,a.mb,a.mb,!1):JG(b,j,g,a.mb,a.mb,!0);if(!(1301==f&&!a.cc||107==f&&!a.ac))if(201!=f||a.tc)if(103!=f||a.Fb)if(!(105==f&&!a.Rb&&!a.A)&&(109!=f||a.dc))if(c=a.mb/4,3>d)switch(GG(b,(EC(),LC)),f){case 101:GG(b,PC);KG(b,j+3,g+3,a.mb-6,a.mb-6);GG(b,LC);e=g+3;h=a.mb-6;c=\na.mb-6;d=b.a;f=P(J(Q((j+3)*R)));e=P(J(Q(e*R)));h=P(J(Q(h*R)));c=P(J(Q(c*R)));d.n&&(LG(d,!1),MG(d,NG(d,f,e,h,c)));OG(b,j+6,g+6,a.mb-12,a.mb-12);PG(b.a,P(J(Q((j+9)*(QG(),R)))),P(J(Q((g+9)*R))),P(J(Q(2*R))),P(J(Q(4*R))));HG(b,j+a.mb-10,g+9,2,4);0.04>Math.random()&&(GG(b,NC),PG(b.a,P(J(Q((j+10)*R))),P(J(Q((g+18)*R))),P(J(Q(4*R))),P(J(Q(4*R)))));0.96<Math.random()&&(GG(b,PC),HG(b,j+a.mb-10,g+8,2,3));break;case 112:f=j+c;e=j+a.mb-c;h=j+a.mb/2;RG(b,f,g+a.mb-c,h,g+a.mb/2);RG(b,j+a.mb/2,g+a.mb/2,e,g+a.mb-\nc);l=g+a.mb-c;d=a.mb/24;SG(b.a,P(J(Q((h-d)*(QG(),R)))),P(J(Q(l*R))),P(J(Q((h-2*d)*R))),P(J(Q(l*R))));SG(b.a,P(J(Q((h+d)*R))),P(J(Q(l*R))),P(J(Q((h+2*d)*R))),P(J(Q(l*R))));GG(b,QC);RG(b,f,g+c,h,g+a.mb/2);RG(b,j+a.mb/2,g+a.mb/2,e,g+c);l=g+c;SG(b.a,P(J(Q((h-d)*R))),P(J(Q(l*R))),P(J(Q((h-2*d)*R))),P(J(Q(l*R))));SG(b.a,P(J(Q((h+d)*R))),P(J(Q(l*R))),P(J(Q((h+2*d)*R))),P(J(Q(l*R))));GG(b,LC);break;case 107:GG(b,OC);HG(b,j+4,g+4,a.mb-8,a.mb-8);GG(b,LC);IG(b,j+4,g+4,a.mb-8,a.mb-8);OG(b,j+6,g+6,a.mb-11,a.mb-\n12);PG(b.a,P(J(Q((j+9)*(QG(),R)))),P(J(Q((g+9)*R))),P(J(Q(2*R))),P(J(Q(4*R))));HG(b,j+a.mb-10,g+9,2,4);break;case 108:d=a.mb/4;RG(b,j+d,g+a.mb-d,j+a.mb-d,g+d);d=a.mb/2-d;f=g+2*a.mb/3;j+=a.mb/2;c=j+d;SG(b.a,P(J(Q(j*(QG(),R)))),P(J(Q(f*R))),P(J(Q(c*R))),P(J(Q(f*R))));g+=a.mb/3;a=j-d;SG(b.a,P(J(Q(a*R))),P(J(Q(g*R))),P(J(Q(j*R))),P(J(Q(g*R))));j=(a+j)/2;g-=d/2;a=g+d;SG(b.a,P(J(Q(j*R))),P(J(Q(g*R))),P(J(Q(j*R))),P(J(Q(a*R))));break;case 113:a.lc&&(d=c/2,f=a.mb-2*c-2*d,c=j+d+c,e=g+(c-j),GG(b,SC),TG(b.a,\nP(J(Q(c*(QG(),R)))),P(J(Q(e*R))),P(J(Q(f*R))),P(J(Q(f*R)))),GG(b,KC),h=j+a.mb/2,a=g+a.mb/2,l=c+f,o=g+d,g=o+d,SG(b.a,P(J(Q(c*R))),P(J(Q(g*R))),P(J(Q(h*R))),P(J(Q(o*R)))),SG(b.a,P(J(Q(h*R))),P(J(Q(o*R))),P(J(Q(l*R))),P(J(Q(g*R)))),g=e+f+d,o=g+d,SG(b.a,P(J(Q(c*R))),P(J(Q(g*R))),P(J(Q(h*R))),P(J(Q(o*R)))),SG(b.a,P(J(Q(h*R))),P(J(Q(o*R))),P(J(Q(l*R))),P(J(Q(g*R)))),j+=d,l=j+d,g=e+f,SG(b.a,P(J(Q(l*R))),P(J(Q(e*R))),P(J(Q(j*R))),P(J(Q(a*R)))),SG(b.a,P(J(Q(j*R))),P(J(Q(a*R))),P(J(Q(l*R))),P(J(Q(g*R)))),j=\nc+f+d,l=j+d,SG(b.a,P(J(Q(j*R))),P(J(Q(e*R))),P(J(Q(l*R))),P(J(Q(a*R)))),SG(b.a,P(J(Q(l*R))),P(J(Q(a*R))),P(J(Q(j*R))),P(J(Q(g*R)))));break;case 110:UG(b,j,g,a.mb,!0);break;case 111:UG(b,j,g,a.mb,!1);break;case 214:d=a.Z;f=3+j;c=f+d/2;e=f+d;h=g+3;l=h+d;GG(b,SC);VG(b,z(rG,nl,-1,[f,c,e]),z(rG,nl,-1,[h,l,h]),3);f=c;l=h+d/2;h=l+d;VG(b,z(rG,nl,-1,[f,c+d/2,f+d]),z(rG,nl,-1,[h,l,h]),3);a.R=new xD(dw(j),dw(g));break;case 109:RG(b,j+c,g+a.mb/2,j+a.mb-c,g+a.mb/2);RG(b,j+a.mb-c,g+a.mb/2,j+a.mb-3*c/2,g+a.mb/2+\nc/2);RG(b,j+a.mb-c,g+a.mb/2,j+a.mb-3*c/2,g+a.mb/2-c/2);break;case 102:GG(b,GC);HG(b,j+3,g+5,a.mb-7,a.mb-11);GG(b,LC);IG(b,j+3,g+5,a.mb-7,a.mb-11);break;case 103:GG(b,HF);a.Mb&&JG(b,j+1,g+1,a.mb,a.mb,!1);GG(b,LC);WG(a,b,j,g,"NEW");break;case 106:GG(b,NC);RG(b,j+7,g+7,j+a.mb-7,g+a.mb-7);RG(b,j+8,g+7,j+a.mb-6,g+a.mb-7);RG(b,j+7,g+a.mb-7,j+a.mb-7,g+7);RG(b,j+8,g+a.mb-7,j+a.mb-6,g+7);GG(b,LC);RG(b,j+c,g+a.mb/2,j+12,g+a.mb/2);WG(a,b,j+6,g,Ef);break;case 104:GG(b,NC);RG(b,j+7,g+7,j+a.mb-7,g+a.mb-7);RG(b,\nj+8,g+7,j+a.mb-6,g+a.mb-7);RG(b,j+7,g+a.mb-7,j+a.mb-7,g+7);RG(b,j+8,g+a.mb-7,j+a.mb-6,g+7);GG(b,LC);break;case 105:a.sc?(GG(b,RC),KG(b,j+3,g+3,a.mb-6,a.mb-6),GG(b,LC)):WG(a,b,j,g,"123");break;case 114:GG(b,TC);d=a.mb-8;f=j+(a.mb-d)/2;c=g+(a.mb-d)/2;PG(b.a,P(J(Q(f*(QG(),R)))),P(J(Q(c*R))),P(J(Q(d*R))),P(J(Q(d*R))));GG(b,LC);XG(a,b,j,g,GC,Wh);break;case 201:RG(b,j+c,g+a.mb/2,j+a.mb-c,g+a.mb/2+2);RG(b,j+c,g+a.mb/2,j+a.mb-c,g+a.mb/2-2);RG(b,j+a.mb-c,g+a.mb/2+2,j+a.mb-c,g+a.mb/2-2);break;case 202:RG(b,\nj+c,g+a.mb/2,j+a.mb-c,g+a.mb/2);break;case 203:RG(b,j+c,g+a.mb/2-2,j+a.mb-c,g+a.mb/2-2);RG(b,j+c,g+a.mb/2+2,j+a.mb-c,g+a.mb/2+2);break;case 204:RG(b,j+c,g+a.mb/2,j+a.mb-c,g+a.mb/2);RG(b,j+c,g+a.mb/2-3,j+a.mb-c,g+a.mb/2-3);RG(b,j+c,g+a.mb/2+3,j+a.mb-c,g+a.mb/2+3);break;case 205:SG(b.a,P(J(Q((j+c/2)*(QG(),R)))),P(J(Q((g+2*c+c/3)*R))),P(J(Q((j+3*(c/2))*R))),P(J(Q((g+2*c-c/3)*R))));SG(b.a,P(J(Q((j+3*(c/2))*R))),P(J(Q((g+2*c-c/3)*R))),P(J(Q((j+5*(c/2))*R))),P(J(Q((g+2*c+c/3)*R))));SG(b.a,P(J(Q((j+5*(c/\n2))*R))),P(J(Q((g+2*c+c/3)*R))),P(J(Q((j+7*(c/2))*R))),P(J(Q((g+2*c-c/3)*R))));break;case 206:YG(a,b,j,g+2,3);break;case 207:YG(a,b,j,g,4);break;case 208:YG(a,b,j,g,5);break;case 209:YG(a,b,j,g,1);break;case 210:YG(a,b,j,g,6);break;case 211:YG(a,b,j,g,7);break;case 212:YG(a,b,j,g,8);break;case 213:WG(a,b,j,g,"FG"),a.T=new xD(dw(j),dw(g))}else d=ZG(a,f),XG(a,b,j,g,KF[d],MF[d])}\nfunction $G(a,b,c){var d,e,f;d=0;b=P(J(Q(b/a.nb)));c=P(J(Q(c/a.nb)));if(b<a.mb+(a.Lb?1:0)||c<2*a.mb+(a.Lb?1:0)){f=0;for(e=1;14>=e;++e)if(b<e*(a.mb+(a.Lb?1:0))){f=e;break}b=0;for(e=1;e<=aH+2;++e)if(c<e*(a.mb+(a.Lb?1:0))){b=e;break}0<f&&0<b&&(d=100*b+f)}109==d&&(a.dc||(d=0));return d}function bH(a){var b;b=9;a.cc&&++b;a.Bc&&++b;return b}\nfunction cH(a,b,c,d,e){var f;f=3*e;e*=a.Z;a.J&&(f=0);f=c-f-e;c=f+e;a.J?(a=d,e=d-e,d=(e+d)/2):(d/=2,a=d+e/2,e=d-e/2);GG(b,(EC(),SC));VG(b,z(rG,nl,-1,[f,c,f]),z(rG,nl,-1,[e,d,a]),3)}\nfunction dH(a){var b,c,d,e,f;a.ig("drawMolecularArea mustReDrawMolecularArea="+a.Ib+ea);if(a.Ib){if(a.r&&null!=a.r.a&&a.r.a!=yk&&a.r.a!=wj)for(b=1;b<=a.Sb;++b)aG(a.zb[b]);eH(a.vb.b.a,a.xb/R);e=a.vb.b;c=a.yb;b=a.ub;a.ig("drawMolecularArea "+c+" : "+b+" scale: "+a.xb+ea);GG(e,a.D);c/=a.xb;b/=a.xb;PG(e.a,P(J(Q(0*(QG(),R)))),P(J(Q(0*R))),P(J(Q(c*R))),P(J(Q(b*R))));d=a.tb?(ED(),HD):(ED(),JD);f=(ED(),FD);var g=e.a;if(f==(ED(),FD))d==HD?g.b=n:g.b=Qj;d=new BC(a.wb);e.d=new BC(R*d.e);fH(e.a,e.d);for(d=1;d<=\na.Sb;++d){f=a.zb[d];var g=e,h=void 0,j=void 0,l=void 0,o=void 0,m=void 0,r=void 0,t=o=o=void 0,y=j=t=void 0,v=y=o=void 0,s=m=v=r=h=v=void 0,A=void 0,F=void 0,M=m=void 0,N=l=m=v=t=h=j=v=j=s=t=h=F=y=h=void 0,l=M=r=M=s=r=t=o=N=l=o=t=t=void 0,y=h=1;g.c=f.k.D;f.k.L&&(GG(g,(EC(),LC)),IG(g,0,0,f.k.M.b-1,f.k.M.a-1));if(0!=f.p){f.y&&(A=g,o=f.y,A.b=o,A.f=A.a.e,gH(A.a,o));f.s&&(vG(f),qG(f.k,1,f.k.Sb,0,!1),f.s=!1);hH(f.k,f.k.x);if(-1==f.i){for(A=1;A<=f.p;++A)o=f.b[A].c,0<o&&7>o&&(GG(g,(FF(),NF)[o]),KG(g,f.b[A].q-\n12,f.b[A].r-12,24,24));for(A=1;A<=f.q;++A)l=f.c[A].i,m=f.c[A].j,0!=f.b[l].c&&f.b[l].c==f.b[m].c&&(GG(g,(FF(),NF)[f.b[l].c]),v=f.b[m].q-f.b[l].q,h=f.b[m].r-f.b[l].r,y=Math.sqrt(v*v+h*h),1>y&&(y=1),h/=y,y=v/y,v=9*h,t=9*y,o=iH(4),r=iH(4),o[0]=f.b[l].q+v,r[0]=f.b[l].r-t,o[1]=f.b[m].q+v,r[1]=f.b[m].r-t,o[2]=f.b[m].q-v,r[2]=f.b[m].r+t,o[3]=f.b[l].q-v,r[3]=f.b[l].r+t,VG(g,o,r,4))}for(A=1;A<=f.q;++A){GG(g,(EC(),KC));t=f.c[A];l=t.i;m=t.j;1==f.i&&0!=f.b[l].c&&f.b[l].c==f.b[m].c&&GG(g,(FF(),NF)[f.b[l].c]);if(3==\nt.f||4==t.f)o=l,l=m,m=o;o=f.b[l].q;r=f.b[l].r;N=f.b[m].q;M=f.b[m].r;if(1!=t.c||0!=t.f)v=N-o,h=M-r,y=Math.sqrt(v*v+h*h),1>y&&(y=1),h/=y,y=v/y;switch(t.c){case 2:10<=t.f&&GG(g,QC);v=2*h;t=2*y;SG(g.a,P(J(Q((o+v)*(QG(),R)))),P(J(Q((r-t)*R))),P(J(Q((N+v)*R))),P(J(Q((M-t)*R))));SG(g.a,P(J(Q((o-v)*R))),P(J(Q((r+t)*R))),P(J(Q((N-v)*R))),P(J(Q((M+t)*R))));GG(g,LC);break;case 3:SG(g.a,P(J(Q(o*(QG(),R)))),P(J(Q(r*R))),P(J(Q(N*R))),P(J(Q(M*R))));l=3*h;m=3*y;SG(g.a,P(J(Q((o+l)*R))),P(J(Q((r-m)*R))),P(J(Q((N+l)*\nR))),P(J(Q((M-m)*R))));SG(g.a,P(J(Q((o-l)*R))),P(J(Q((r+m)*R))),P(J(Q((N-l)*R))),P(J(Q((M+m)*R))));break;case 9:case 0:for(m=0;10>m;++m)l=o-(o-N)/10*m,s=r-(r-M)/10*m,SG(g.a,P(J(Q(l*(QG(),R)))),P(J(Q(s*R))),P(J(Q(l*R))),P(J(Q(s*R))));jH(g,f.k.v);m=kH(f.k.w);t=t.d;l=Gd;null!=t&&(l=t);t=LD(f.k.w,l);t=(o+N)/2-t/2;M=(r+M)/2+~~(m/2)-1;GG(g,QC);lH(g.a,l,P(J(Q(t*(QG(),R)))),P(J(Q(M*R))));GG(g,LC);break;default:if(1==t.f||3==t.f)v=3*h,t=3*y,s=iH(3),j=iH(3),s[0]=N+v,j[0]=M-t,s[1]=o,j[1]=r,s[2]=N-v,j[2]=M+t,\nVG(g,s,j,3);else if(2==t.f||4==t.f){v=3*h;t=3*y;for(m=0;10>m;++m)l=o-(o-N)/10*m,s=r-(r-M)/10*m,j=m/10,SG(g.a,P(J(Q((l+v*j)*(QG(),R)))),P(J(Q((s-t*j)*R))),P(J(Q((l-v*j)*R))),P(J(Q((s+t*j)*R))))}else SG(g.a,P(J(Q(o*(QG(),R)))),P(J(Q(r*R))),P(J(Q(N*R))),P(J(Q(M*R))))}}y=iH(f.p+1);h=iH(f.p+1);for(A=1;A<=f.q;++A)l=f.c[A].i,m=f.c[A].j,o=f.b[l].q,r=f.b[m].q,++h[l],++h[m],y[l]=y[l]/h[l]+r/h[l],y[m]=y[m]/h[m]+o/h[m];jH(g,f.k.v);m=kH(f.k.w);N=iH(f.p+1);r=iH(f.p+1);o=D(mH,u,121,f.p+1,0);for(A=1;A<=f.p;++A)l=\nnH(f,A),(null==l||1>l.length)&&(l=ib),j=f.b[A],3==f.b[A].a&&0<f.b[A].j&&0==f.b[A].n&&0==j.d&&!(4<=j.o&&2==j.j)?(N[A]=r[A]=LD(f.k.w,l),o[A]=oH(f,A,N[A],N[A],m,!1)):(M=y[A]<f.b[A].q,v=!0,1<h[A]&&8.333333333333334>pH(y[A]-f.b[A].q)&&(v=!1),2<h[A]&&(v=!1),1==h[A]&&2.5>pH(y[A]-f.b[A].q)&&(M=!0),t=l,s=n,f.k.oc&&(F=f.b[A].i,0<F&&(s+=Pe,1<F&&(s+=F))),F=n,0!=j.d&&(F=Wf+j.d+cg),j=n,0!=f.b[A].n&&(1<qH(f.b[A].n)&&(j+=qH(f.b[A].n)),0<f.b[A].n?j+=jb:j+=rb),M||!v?l=F+l+s+j+n:l=j+s+n+F+l,v||(t=l),t=LD(f.k.w,t),v=\nLD(f.k.w,l),N[A]=t,r[A]=v,v=o[A]=oH(f,A,t,v,m,M),t=v.c+2+1,M=v.d+m+2,GG(g,g.c),-1==f.i&&0!=f.b[A].c&&GG(g,(FF(),NF)[f.b[A].c]),HG(g,v.c,v.d,v.b,v.a),1==f.i?0!=f.b[A].c?GG(g,(FF(),NF)[f.b[A].c]):GG(g,(EC(),LC)):GG(g,(FF(),KF)[f.b[A].a]),lH(g.a,l,P(J(Q(t*(QG(),R)))),P(J(Q(M*R)))));for(A=1;A<=f.p;++A)h=f.b[A],-99199!=h.f&&(t=N[A],v=r[A],t=f.b[A].q-t/2,M=f.b[A].r+~~(m/2)-1,GG(g,(EC(),QC)),rH(g,ga+(-99199!=h.f?h.f:0),t+v,M));if(0<f.v||0<f.w)if(GG(g,104==f.k.k?(EC(),NC):(EC(),TC)),0<f.v&&106!=f.k.k&&(v=\no[f.v],IG(g,v.c,v.d,v.b,v.a)),0<f.w&&(l=f.c[f.w].i,m=f.c[f.w].j,v=f.b[m].q-f.b[l].q,h=f.b[m].r-f.b[l].r,y=Math.sqrt(v*v+h*h),1>y&&(y=1),h/=y,y=v/y,v=4*h,t=4*y,s=iH(5),j=iH(5),s[0]=f.b[l].q+v,s[1]=f.b[m].q+v,j[0]=f.b[l].r-t,j[1]=f.b[m].r-t,s[3]=f.b[l].q-v,s[2]=f.b[m].q-v,j[3]=f.b[l].r+t,j[2]=f.b[m].r+t,s[4]=s[0],j[4]=j[0],106!=f.k.k&&sH(g,s,j,5),106==f.k.k&&tH(f,f.c[f.w].i,f.c[f.w].j))){h=0;for(A=1;A<=f.p;++A)0<f.a[A]&&++h;if(h>~~(f.p/2))for(A=1;A<=f.p;++A)0<f.a[A]?f.a[A]=0:f.a[A]=1;GG(g,(EC(),NC));\nfor(A=1;A<=f.p;++A)0<f.a[A]&&(v=o[A],IG(g,v.c,v.d,v.b,v.a))}f.y&&(g.b=null,gH(g.a,g.f))}}a.dc&&(d=(c-48)/2,GG(e,(EC(),QC)),SG(e.a,P(J(Q(d*R))),P(J(Q(b/2*R))),P(J(Q((d+48)*R))),P(J(Q(b/2*R)))),SG(e.a,P(J(Q((d+48)*R))),P(J(Q(b/2*R))),P(J(Q((d+48-6)*R))),P(J(Q((b/2+6)*R)))),SG(e.a,P(J(Q((d+48)*R))),P(J(Q(b/2*R))),P(J(Q((d+48-6)*R))),P(J(Q((b/2-6)*R)))));a.J&&(a.hb=new oD(Ue,0,13),a.kb=BB(a.hb),null!=a.sb&&(d=LD(a.kb,a.sb),d=(c-d)/2,f=b-13,GG(e,(EC(),LC)),jH(e,a.hb),rH(e,a.sb,d,f)));a.J&&a.nc&&cH(a,e,\nc,b,0.6/a.xb);b=P(J(Q(uH(a,a.nb))));c=P(J(Q(vH(a,a.nb))));wH(a.Ec,a.vb.a,b,c);a.Ib=!1;if(a.hc){oE();c=new xH;c.a=a.o;c.f=a.Sb;b=!1;for(e=1;99>e;++e)if(d=a.zb[e])0<d.p&&(b=!0),c.d[e]=new WF(d);else break;c.i=a.dc;c.e=a.Fb;c.b=a.xb;c.c=a.cb;e=a.pb;b=new yH(b?c:null);c=e.a.c;e.a.c=b;b.b=e.a;c&&(b.c=c,c.b=b);e.a=b;a.hc=!1}a.r&&null!=a.r.a&&(null!=a.Qb&&bF(a.Qb,null),a.r&&null!=a.r.a&&a.eg(),zH(a.r),a.Mb&&(a.Mb=!1,a.Kb=!0,a.bf(a.Ec.d)))}}function AH(a){a.Ib=!0;a.vb?(dH(a),a.Ib=!1):qF(a)}\nfunction YG(a,b,c,d,e){var f,g,h,j,l;f=a.mb/4;g=!1;j=D(rG,nl,-1,9,1);l=D(rG,nl,-1,9,1);c+=a.mb/2;d+=a.mb/2;f=a.mb/2-f/2;1==e&&(e=6,g=!0);for(a=0;a<=e;++a)h=6.283185307179586/e*(a-0.5),j[a]=c+f*Math.sin(h),l[a]=d+f*Math.cos(h);sH(b,j,l,e+1);if(g){for(a=0;a<=e;++a)h=6.283185307179586/e*(a-0.5),j[a]=c+(f-3)*Math.sin(h),l[a]=d+(f-3)*Math.cos(h);RG(b,j[0],l[0],j[1],l[1]);RG(b,j[2],l[2],j[3],l[3]);RG(b,j[4],l[4],j[5],l[5])}}\nfunction UG(a,b,c,d,e){var f,g,h,j,l,o,m,r;l=d/4;c-=1;o=2+l/2;g=2+l;r=c+10*d/24;j=r+l;m=b+d;e?(h=2+b,f=o+b,g+=b):(f=m-o,h=m-2,g=m-g);SG(a.a,P(J(Q(h*(QG(),R)))),P(J(Q(r*R))),P(J(Q(f*R))),P(J(Q(j*R))));SG(a.a,P(J(Q(g*R))),P(J(Q(r*R))),P(J(Q(f*R))),P(J(Q(j*R))));h=l/3-0.5;SG(a.a,P(J(Q(f*R))),P(J(Q((r+h)*R))),P(J(Q(f*R))),P(J(Q(j*R))));f=d-o-4;c=c+o-h;d=d-4-h-1;j=270;e?(b+=o,e=270):(b=m-f-o,j*=-1,e=-90);BH(a.a,P(J(Q(b*R))),P(J(Q(c*R))),P(J(Q(f*R))),P(J(Q(d*R))),P(J(Math.round(e))),P(J(Math.round(j))))}\nfunction mG(a){var b,c,d;b=-99999;for(d=1;d<=a.Sb;++d)c=a.zb[d],c=CH(c),c>b&&(b=c);return b}\nfunction DH(a,b,c,d){var e=OF?350:170,f,g,h,j;EH(d);b=FH(a,b);c=FH(a,c);h=e;for(g=1;g<=a.Sb;++g){j=new GH(e);f=a.zb[g];for(var l=b,o=c,m=j,r=void 0,t=void 0,y=void 0,v=void 0,s=r=r=r=v=r=void 0,A=void 0,F=void 0,M=t=y=r=r=void 0,N=void 0,$=void 0,s=0,F=m.a,A=1;A<=f.q;++A)r=HH(l,o,f.c[A].a,f.c[A].b),r<F&&(F=r,s=A);s*=-1;for(A=1;A<=f.p;++A)r=HH(l,o,f.b[A].q,f.b[A].r),r<F&&(F=r,s=A);if(0==s)for(A=1;A<=f.q;++A)r=f.c[A].i,v=f.c[A].j,t=f.b[r].q,y=f.b[r].r,r=f.b[v].q,v=f.b[v].r,r-=t,v-=y,N=l-t,$=o-y,y=r*\nr+v*v,t=N*N+$*$,M=HH(N,$,r,v),t+M>y+F||(r=N*r+$*v,0>r||(y=Math.sqrt(y),t=Math.sqrt(t),r/=y*t,1<=r||(r=1.5707963267948966-Math.acos(r),r=t*Math.cos(r),r*=r,r<F&&(s=-A,F=r))));m.a=F;f=s;j.a<h&&(h=j.a,EH(d),d.c=g,0<f?d.a=f:d.b=-f)}}function tG(a){var b;(0>=a.yb||0>=a.ub)&&(!a.M&&(a.M=nC(a)),IH(a,a.M));b=new JH;b.b=a.yb;b.a=a.ub;return b}function uG(a){var b;b=tG(a);b.b/=a.xb;b.a/=a.xb;return b}\nfunction KH(a,b,c,d){var e,f;if(!b||LH(b)){if((e=0<a.ob.v||0<a.ob.w)&&(104==a.k||106==a.k))return!0;if(e&&!a.J){a.xc&&(f=a.xc,f.k==a&&(f.k=null,wm(a.Uc,f)));f=a.ob;var g,b=new BD;e=a.Rb||a.A||a.dc;f.f.a?g=new uD(Qf):g=new uD(Kf);tD(g,MH(f));zD(b,g);xC(g.d,a);if(e&&0<f.v){g=new uD(ue);xC(g.d,a.Y);var h=a.Y;h.d=null;h.e=h.a=0;a.Y.a=f.v;a.Y.d=f;a.Y.e=a.o;zD(b,g)}g=new uD(He);a:{for(h=f.p;1<=h;--h)if(1==f.b[h].a){h=!0;break a}h=!1}tD(g,h);zD(b,g);xC(g.d,a);e&&(e=new uD(be),xC(e.d,a),zD(b,e),e=new uD(Ge),\nxC(e.d,a),zD(b,e),tD(e,0<CH(f)));a.xc=b;xB(a,a.xc);NH(a.xc.a,a,c,d)}else a.dc?f=(a.G=CG(a,!0),a.G):f=(a.F=CG(a,!1),a.F),LH(b)||(c=dw(c*a.nb+0.5),d=dw(d*a.nb+0.5)),NH(f.a,a,c,d);d=new lu(null,0,OH(0));PH(a,d,0,0);return!0}return!1}\nfunction QH(a,b){var c;if(0==a.ob.p)return!1;c=null;switch(b){case 102:1<a.Sb?c="Delete selected molecule (red)":c="Clear canvas";var d=(EC(),MC);a.ob.y=d;a.yc=a.ob;break;case 109:c="Copy selected (blue) molecule to the other side of the reaction",d=(EC(),SC),a.ob.y=d,a.yc=a.ob}null!=c?(mu(a,c),a.Ib=!0,a.Kb=!0):(a.Ib=!1,a.Kb=!1);return null!=c}\nfunction RH(a,b){var c;if(a.yc&&(102==b||a.dc&&109==b)){a.yc.y=null;a.yc=null;for(c=1;c<=a.Sb;++c)a.zb[c].y=null;mu(a,n);a.Ib=!0;a.Kb=!0}else a.Ib=!1,a.Kb=!1;return a.Ib}\nfunction SH(a,b,c,d){var e,f,b=new TH(b);e=null;f=!1;oF(a.r,Pd);mu(a,n);if(b.f==(UH(),VH)&&b.c){var g=b.c;b.a=g.a;b.f=g.f;b.i=g.i;b.e=g.e;b.c=g.c;b.b=g.b}b.a==(WH(),XH)&&b.i!=(YH(),ZH)?$H(a,b.b,d)||(e="Invalid V2000 molfile"):b.a==aI?bI(a,b.b,d)||(e="Invalid JME string"):b.a==cI?e="Reading "+b.f+ma:a.Ac&&(f=!0,rq(1,new dI(a,b,c,d)));f||(a.Ib=null==e,c?null==e?eI(c):fI(c,new Dp(e)):null!=e&&(mu(a,Je+e),a.bf(a.Ec.d)))}\nfunction $H(a,b,c){var d,e,f,g,h,j;mu(a,n);if(0==b.indexOf(La)){a.Sb=0;a.dc=!0;a.Fb=!0;d=gI(b);h=new WE(b,d,!0);b=n;for(e=1;5>=e;++e)b=hI(h,d);e=OH(DE(oy(b.substr(0,3)),10)).a;g=OH(DE(oy(b.substr(3,3)),10)).a;hI(h,d);for(b=1;b<=e+g;++b){for(f=n;!(j=hI(h,d),null==j||H(j,"$MOL"));)f+=j+d;a.zb[++a.Sb]=new iI(a,f)}a.xb=1;qG(a,1,e,1,!1);qG(a,e+1,e+g,3,!1);d="readRXNFile"}else{(a.J||a.Vb)&&(a.dc=!1);a.ob=new iI(a,b);if(!a.ob||0==a.ob.p)return!a.ob&&(mu(a,"ERROR - problems in reading/processing MOL input"),\na.bf(a.Ec.d)),!!a.ob;d=(a.dc||a.Fb)&&a.p||a.Mb;null!=a.t&&a.ob&&jI(a.ob,a.t,!0);null!=a.u&&a.ob&&jI(a.ob,a.u,!1);d||(a.Sb=0,a.xb=1);h=kI(a.ob);if(1>=h||a.J)a.zb[++a.Sb]=a.ob;else{a.Fb=!0;for(b=1;b<=h;++b)a.zb[++a.Sb]=new lI(a,a.ob,b)}d?a.o=a.Sb:a.o=1;a.ob=a.zb[a.o];a.J?qG(a,1,1,0,!0):qG(a,1,h,0,!d);d=uj}mI(a);null!=d&&(oF(a.r,Pd),a.r&&AG(Xp(a.r,d),0,0,0),a.hc=!0);a.Ib=!0;c&&a.bf(a.Ec.d);return!0}function mu(a,b){null==b&&(b=n);a.Gb=!0;a.X=b;a.ig("info: "+b)}\nfunction hH(a,b){var c;c=Math.round(b);100>c&&(!PF[c]&&(PF[c]=new oD(Ue,0,c)),!RF[c]&&nq(RF,c,BB(PF[c])),a.v=PF[c],a.w=RF[c])}function LH(a){var b;if(!a)return!1;b=a.tf();a=0!=(a.e&2);return b||a}function uH(a,b){return(a.mb+(a.Lb?1:0))*b}function ZG(a,b){var c,d;d=-1;for(c=0;c<JF.length;c+=2)if(JF[c]==b){d=JF[c+1];break}32==d&&!a.Bc&&a.cc&&(d=33);return d}\nfunction tu(a,b){var c,d,e;if(0==b)return!1;dG(a,!1);d=!1;c=a.k;a.k=b;if(300>=b)switch(a.Kb=!0,a.Hb=!0,mu(a,n),b){case 102:yG(a,!0);RH(a,102);QH(a,102);d=!0;break;case 110:a.Ib=!0;a.k=c;a.pb.a!=a.pb.b&&a.pb.a.b!=a.pb.b?a.q&&(++a.Sb,a.o=a.Sb,a.q=!1):mu(a,"No more undo");if(!(a.pb.a!=a.pb.b&&a.pb.a.b!=a.pb.b))break;nI(a,oI(a.pb));a.r&&AG(Xp(a.r,yk),0,0,0);a.hc=!0;a.hc=!1;a.Ib=!0;break;case 111:a.k=c;if(a.pb.a.c)a.q&&(++a.Sb,a.o=a.Sb,a.q=!1);else{mu(a,"No more redo");break}if(!a.pb.a.c)break;e=a.pb;\nif(!e.a.c)throw new yy("Cannot redo. Index is out of range.");if(!e.a.c)throw new yy($e);e.a=e.a.c;nI(a,e.a.a);a.r&&AG(Xp(a.r,wj),0,0,0);a.hc=!0;a.hc=!1;a.Ib=!0;break;case 214:KH(a,null,a.R.a,a.R.b);a.k=c;break;case 151:case 152:case 154:case 153:e=null;a.k=c;switch(b){case 152:e=pI(a.jc);break;case 151:e=qI(a.jc);break;case 154:e=a.jc;e.a=e.c;e=pI(e);break;case 153:e=a.jc,e.a=-1,e=qI(e)}null==e?mu(a,"No more molecules in SDF buffer"):(BG(a),a.Vb=!0,rI(a,e,!1),a.Vb=!1,H(a.X,n)&&(mu(a,"MOL n. "+(a.jc.a+\n1)+" of "+a.jc.c),d=!0,a.r&&AG(Xp(a.r,"SDFstack"),0,0,0),a.hc=!0,a.hc=!1));break;case 101:rq(4,new sI(a));a.k=c;break;case 107:rq(2,new tI(a));break;case 114:rq(3,new uI(a));a.k=c;break;case 103:a.Mb=!0;a.k=c;break;case 105:a.A&&a.Bb&&(a.Bb=!1,vI(a.ob),a.Ib=!0,a.r&&AG(Xp(a.r,yg),0,0,0),d=a.hc=!0,a.k=c);a.I=1;break;case 109:a.k=c;e=wI(a.ob);if(2==e){mu(a,"Copying the agent not possible !");break}d=sG(a.ob);a.Ib=!0;a.ob=new WF(a.ob);d=dw((a.M.b-a.mb)/2-d.a);for(e=1;e<=a.ob.p;++e)wG(a.ob.b[e],2*d/a.xb,\n0/a.xb);a.zb[++a.Sb]=a.ob;a.o=a.Sb;a.r&&AG(Xp(a.r,"reactionCopy"),0,0,0);d=a.hc=!0;RH(a,109);QH(a,109);break;case 104:d=XF(a);break;case 213:a.k=c;if(!a.S){var f,g,h,j,l;l=new BD;for(f=a.U,g=0,h=f.length;g<h;++g)e=f[g],j=new uD(e),zD(l,j),j.c=e,xC(j.d,a);xB(a,l);a.S=l}f=a.T.b;e=dw(a.T.a*a.nb+0.5);f=dw(f*a.nb+0.5);NH(a.S.a,a,e,f);break;case 108:0<a.ob.v&&xI(a.ob,a.ob.v,0)&&(ZF(a,Rg,a.ob.v),d=!0)}else a.Hb=!0,a.Kb=!0,a.n=ZG(a,b),32==a.n&&rq(5,new yI(a)),1301<=b&&1310>=b&&(a.n=33+(b-1301)),0<a.ob.v&&\n(a.n!=a.ob.b[a.ob.v].a&&32!=a.n?(zI(a.ob,a.ob.v,a.n),a.ob.b[a.ob.v].n=0,a.ob.b[a.ob.v].d=0,a.ob.b[a.ob.v].i=0,ZF(a,Mj+a.n,a.ob.v),d=!0):32==a.n&&(d=Uq((qu(),ru).Tc.a.pb,Ak),AI(a.ob,a.ob.v,d),ZF(a,Mj+a.n,a.ob.v),d=!0));if(!d&&(0<a.ob.v||0<a.ob.w))if(206<=a.k&&229>=a.k)a.cb=2,BI(a.ob),d=!0,lG(a,kg,a.o,0,a.ob.w);else if(202==a.k||203==a.k||204==a.k)if(0<a.ob.v)a.cb=0,d=a.ob,CI(d,d.v,0),lG(a,hg,a.o,0,a.ob.w),d=!0;else{d=1;e=Oj;switch(a.k){case 203:d=2;e=Nj;break;case 204:d=3,e=Pj}a.ob.c[a.ob.w].c=d;lG(a,\ne,a.o,0,a.ob.w);d=!0;a.ob.c[a.ob.w].f=0}d&&(a.Ib=!0,a.k=c);a.bf(a.Ec.d);return!0}\nfunction Qt(a,b,c){var d=null,e;null==d&&(d=UF(a));e=n;if(a.dc){var f,g,h;h=Yv([DI,B],[am,q],[87,-1],[4,a.Sb+1],0,2,1);for(g=1;3>=g;++g){f=0;for(c=1;c<=a.Sb;++c)wI(a.zb[c])==g&&(h[g][++f]=c);h[g][0]=f}e+=Oa;e+=EI(h[1][0],3)+EI(h[3][0],3)+ea;for(c=1;c<=h[1][0];++c)e+=Ja+FI(a.zb[h[1][c]],d,b);for(c=1;c<=h[3][0];++c)e+=Ja+FI(a.zb[h[3][c]],d,b)}else{1<a.Sb&&(a.ob=new GI(a,a.zb,a.Sb));if(c){e=a.ob;var j,l,d=HI(e,d,b,!0),d=d+("M V30 BEGIN CTAB"+(FF(),ea)),d=d+("M V30 COUNTS "+e.p+ga+e.q+" 0 0 "+(e.f.a&&\nMH(e)?1:0)+ea),d=d+"M V30 BEGIN ATOM\\n";f=-1.7976931348623157E308;c=1.7976931348623157E308;for(b=1;b<=e.p;++b)e.b[b].r>f&&(f=e.b[b].r),e.b[b].q<c&&(c=e.b[b].q);for(b=1;b<=e.p;++b)d+=nf,g=nH(e,b),d+=b+ga+g,g=II(e.b[b]),d+=ga+JI(0.055999999999999994*(e.b[b].q-c),0,4)+ga+JI(0.055999999999999994*(f-e.b[b].r),0,4)+ga+JI(0,0,4)+ga+g,0!=e.b[b].n&&(d+=" CHG="+e.b[b].n),d+=ea;d+="M V30 END ATOM\\nM V30 BEGIN BOND\\n";for(b=1;b<=e.q;++b)c=e.c[b],f=c.c,d+=nf+b,j=f,1==c.c?j=1:2==c.c&&(j=2),g=c.i+ga+c.j,l=0,\n1==f&&1==c.f?l=1:1==f&&2==c.f&&(l=3),1==f&&3==c.f&&(l=1,g=c.j+ga+c.i),1==f&&4==c.f&&(l=3,g=c.j+ga+c.i),d+=ga+j+ga+g,0!=l&&(d+=" CFG="+l),d+=ea;d+="M V30 END BOND\\n";c=new Jm;g=new Jm;f=new Jm;for(b=0;10>b;++b)nq(g.b,g.c++,null),nq(f.b,f.c++,null);for(b=1;b<=e.p;++b)j=e.b[b].b,null==j||0==j.length||(H(j,fg)?Dm(c,new uC(b)):0==j.indexOf("mix")?(j=DE(py(j,3),10),l=null,f.c>j&&(l=(eD(j,f.c),f.b[j])),null==l?h=new Jm:h=l,Dm(h,new uC(b)),kD(f,j,h)):0==j.indexOf(aj)&&(j=DE(py(j,2),10),l=null,g.c>j&&(l=\n(eD(j,g.c),g.b[j])),null==l?h=new Jm:h=l,Dm(h,new uC(b)),kD(g,j,h)));d+=KI(of,c);if(0<g.c)for(b=1;b<g.c;++b)d+=KI(qf+b,(eD(b,g.c),g.b[b]));if(0<f.c)for(b=1;b<f.c;++b)d+=KI(pf+b,(eD(b,f.c),f.b[b]));e=d=d+"M V30 END CTAB\\n"+gf}else e=FI(a.ob,d,b);1<a.Sb&&(a.ob=a.zb[a.o])}return e}\nfunction LI(a,b,c,d){var e;a.Ab=!1;if(KH(a,b,c,d))return a.Ab=!0,a.Db=!1,!0;e=!0;a.Cc=c-P(J(Q(uH(a,a.nb))));a.Dc=d-P(J(Q(vH(a,a.nb))));mu(a,n);a.Bb=MI(b);a.Db=!1;if(!a.J&&(c<P(J(Q(uH(a,a.nb))))||d<P(J(Q(vH(a,a.nb)))))){e=$G(a,c,d);if(112==e)return a.rc=!0,mu(a,"Next ring will be added as spiro"),qF(a),a.Ab=!0;if(113==e)if(a.lc)mu(a,"Move one atom"),qF(a);else return a.Ab=!0;if(!a.Bc&&1201==e||!a.ac&&107==e||!a.tc&&201==e||!a.Fb&&103==e||!a.Rb&&!a.A&&105==e||!a.dc&&109==e)return!1;e=tu(a,e)}else{if(!a.J&&\nd>a.M.a-P(J(Q(a.mb*a.nb))))return!1;var b=a.Cc,f=a.Dc,g,h,j,l;l=0;if(0>b||0>f||f>a.ub||b>a.yb)b=0;else if(1==a.Sb)b=a.o;else{b=FH(a,b);f=FH(a,f);j=1.7976931348623157E308;for(h=1;h<=a.Sb;++h){g=a.zb[h];for(var o=void 0,m=void 0,r=void 0,m=1.7976931348623157E308,o=1;o<=g.p;++o)r=HH(b,f,g.b[o].q,g.b[o].r),r<m&&(m=r);g=m;g<j&&(j=g,l=h)}b=l}0<b?(a.o=b,a.ob=a.zb[b]):a.o=0;if(0<a.ob.v&&(iG(),null!=a.b[Vd]?jG:kG).a)if(NI(a,a.o,a.ob.v,0,Vd),a.J&&!a.K)return!0;if(0<a.ob.w&&(iG(),null!=a.b[fe]?jG:kG).a)if(NI(a,\na.o,0,a.ob.w,fe),a.J&&!a.K)return!0;a.Db=!0;c=dw(c-a.mb);d-=P(J(Q(vH(a,a.nb))));if(0<a.ob.v)if(a.eb.c=a.o,104==a.k)XF(a);else{if(106==a.k)return!0;if(108==a.k)xI(a.ob,a.ob.v,0)&&ZF(a,Rg,a.ob.v);else if(202==a.k||203==a.k||204==a.k||201==a.k||205==a.k)a.cb=1,c=a.ob,CI(c,c.v,0),a.ob.x=a.ob.v,205==a.k?(a.ob.r=1,a.ob.e[1]=a.ob.p,a.ob.e[0]=a.ob.v,a.ob.w=0,lG(a,hg,a.o,0,a.ob.w),a.hc=!1):lG(a,hg,a.o,0,a.ob.w);else if(206<=a.k&&229>=a.k)a.cb=2,BI(a.ob),ZF(a,jg,a.ob.v);else if(230==a.k)a.cb=3,ZF(a,ng,a.ob.v);\nelse if(233<=a.k&&262>a.k)OI(a.ob,!1),ZF(a,ig,a.ob.v),a.cb=3;else if(107==a.k){if(a.bc.b)return!0;AI(a.ob,a.ob.v,Uq(a.bc.e.Tc.a.pb,Ak));a.ob.j=!0;ZF(a,"addAtomQuery",a.ob.v)}else if(105==a.k)(c=PI(a.ob))?ZF(a,"markAtom",a.ob.v):ZF(a,"unMarkAtom",a.ob.v);else if(113!=a.k)if(300<a.k){if(a.n!=a.ob.b[a.ob.v].a||32==a.n)zI(a.ob,a.ob.v,a.n),a.ob.b[a.ob.v].n=0,a.ob.b[a.ob.v].d=0,a.ob.b[a.ob.v].i=0,32==a.n&&(c=Uq((qu(),ru).Tc.a.pb,Ak),1>c.length&&(c=Uf),AI(a.ob,a.ob.v,c)),ZF(a,Mj+a.n,a.ob.v)}else e=!1}else if(0<\na.ob.w)if(a.eb.c=a.o,104==a.k)XF(a);else if(106==a.k){c=a.ob;d=a.ob.w;if(0<c.a[c.c[d].i]&&0<c.a[c.c[d].j])mu(c.k,"Removal of substituent not possible.");else for(;;){d=0;for(b=c.p;1<=b;--b)0<c.a[b]&&b>d&&(d=b);if(0==d)break;YF(c,d);c.a[d]=0}aG(a.ob);lG(a,"delBondGroup",a.o,0,a.ob.w);a.ob.w=0}else if(201==a.k)QI(a.ob,a.ob.w),lG(a,"setBondStereo",a.o,0,a.ob.w);else if(202==a.k||205==a.k)1==a.ob.c[a.ob.w].c&&0==a.ob.c[a.ob.w].f?(a.ob.c[a.ob.w].c=2,lG(a,Nj,a.o,0,a.ob.w)):(a.ob.c[a.ob.w].c=1,a.ob.c[a.ob.w].f=\n0,lG(a,Oj,a.o,0,a.ob.w)),a.ob.c[a.ob.w].f=0;else if(203==a.k)a.ob.c[a.ob.w].c=2,a.ob.c[a.ob.w].f=0,aG(a.ob),lG(a,Nj,a.o,0,a.ob.w);else if(204==a.k)a.ob.c[a.ob.w].c=3,a.ob.c[a.ob.w].f=0,aG(a.ob),lG(a,Pj,a.o,0,a.ob.w);else if(206<=a.k&&229>=a.k)a.cb=2,BI(a.ob),lG(a,kg,a.o,0,a.ob.w),aG(a.ob);else if(107==a.k){if(!a.bc.b)return!0;c=Uq(a.bc.e.Tc.a.pb,Ak);a.ob.c[a.ob.w].c=9;a.ob.c[a.ob.w].d=c;lG(a,"setQueryBond",a.o,0,a.ob.w)}else 105==a.k?(c=a.ob,b=a.ob.w,c.k.gb=!0,c.k.sc?(c.i=-1,d=c.c[b].i,b=c.c[b].j,\nf=c.b[d].c,h=c.b[b].c,j=4,f==h&&0<f&&(j=0),c.b[d].c=j,c.b[b].c=j,c=0<j):c=!1,c?lG(a,"markBond",a.o,0,a.ob.w):lG(a,"unMarkBond",a.o,0,a.ob.w)):e=!1;else if((0==a.Sb||a.Mb)&&!a.J){if(201>=a.k)return!1;++a.Sb;a.o=a.Sb;a.zb[a.Sb]=new zG(a);a.ob=a.zb[a.Sb];a.eb.c=a.o;202<=a.k&&204>=a.k||205==a.k?(RI(a.ob,null),a.ob.q=0,SI(a.ob,1,c/a.xb,d/a.xb),a.ob.v=1,a.ob.x=1,a.cb=1,b=a.ob,CI(b,b.v,0),205==a.k?(SI(a.ob,2,(c+21.65)/a.xb,(d-12.5)/a.xb),a.ob.e[0]=1,a.ob.e[1]=2,a.ob.r=1,lG(a,"addChain",a.o,0,a.ob.w)):lG(a,\nhg,a.o,0,a.ob.w)):206<=a.k&&229>=a.k?(a.ob.z=FH(a,c),a.ob.A=FH(a,d),a.cb=2,BI(a.ob),a.r&&AG(Xp(a.r,jg),0,0,0),a.hc=!0):300<a.k?(RI(a.ob,null),zI(a.ob,1,a.n),a.ob.q=0,SI(a.ob,1,c/a.xb,d/a.xb),a.ob.v=1,32==a.n&&(c=Uq((qu(),ru).Tc.a.pb,Ak),1>c.length&&(c=Uf),AI(a.ob,1,c)),ZF(a,"addAtom",a.ob.v)):230==a.k?(bI(a,null,!0),a.r&&AG(Xp(a.r,ng),0,0,0),a.hc=!0):233<=a.k&&262>a.k?(RI(a.ob,null),a.ob.q=0,SI(a.ob,1,c/a.xb,d/a.xb),a.ob.v=1,OI(a.ob,!0),a.r&&AG(Xp(a.r,ig),0,0,0),a.hc=!0):oE()}else e=!1;e&&TI(a)}return a.Ab=\ne}\nfunction UI(a,b,c,d){var e,f,g,h;oE();if(!a.Db||VI(b))return!0;a.Gb=!1;c-=P(J(Q(uH(a,a.nb))));d-=P(J(Q(vH(a,a.nb))));f=FH(a,c-a.Cc);g=FH(a,d-a.Dc);e=FH(a,c);h=FH(a,d);if(2==a.cb||3==a.cb||9==a.cb)return!0;if(1==a.cb){f=!1;a.zb[a.eb.c].v=0;--a.ob.p;g=c;var b=d,j=a.Nb;0>g||0>b||b>a.ub||g>a.yb?EH(j):DH(a,g,b,j);++a.ob.p;if(0<a.Nb.c&&0<a.Nb.a&&(g=a.zb[a.Nb.c],g.v=a.Nb.a,g!=a.ob||a.Nb.a!=a.ob.x))SI(a.ob,a.ob.p,g.b[a.Nb.a].q,g.b[a.Nb.a].r),g.v=a.Nb.a,f=!0,g=a.eb,b=a.Nb,g.c=b.c,g.a=b.a,g.b=b.b;if(!f)a:{f=a.ob;\nvar l,o,m,r;f.v=0;WI(f.b[0],e,h);g=XI(f,0,1,f.p);if(0<g&&205!=f.k.k)f.v=g,g!=f.x?SI(f,f.p,f.b[g].q,f.b[g].r):SI(f,f.p,f.z,f.A);else if(205==f.k.k){f.w=0;g=f.e[f.r];l=f.e[f.r-1];j=f.b[g].q-f.b[l].q;b=f.b[g].r-f.b[l].r;g=Math.sqrt(j*j+b*b);1>g&&(g=1);b/=g;j/=g;o=g/2/Math.tan(0.5235987755982988);m=e-f.b[l].q;r=h-f.b[l].r;l=-g/2+m*j+r*b;b=r*j-m*b;if(0>l)if(1<f.r)YF(f,f.p),ZF(f.k,"deleteAtom",f.p),--f.r,f.u=!1;else if(2==f.p)0>f.b[2].r-f.b[1].r&&0<h-f.b[1].r?f.b[2].r=f.b[1].r+g/2:0<f.b[2].r-f.b[1].r&&\n0>h-f.b[1].r&&(f.b[2].r=f.b[1].r-g/2),0>f.b[2].q-f.b[1].q&&0<e-f.b[1].q?f.b[2].q=f.b[1].q+0.866*g:0<f.b[2].q-f.b[1].q&&0>e-f.b[1].q&&(f.b[2].q=f.b[1].q-0.866*g);else{if(2==f.b[f.e[0]].j&&(o=f.b[f.e[0]].p[1],o==f.e[1]&&(o=f.b[f.e[0]].p[2]),j=f.b[f.e[0]].q-f.b[o].q,b=f.b[f.e[0]].r-f.b[o].r,g=Math.sqrt(j*j+b*b),1>g&&(g=1),b/=g,j/=g,m=e-f.b[o].q,r=h-f.b[o].r,e=r*j-m*b,m=f.b[f.e[1]].q-f.b[o].q,r=f.b[f.e[1]].r-f.b[o].r,h=r*j-m*b,0<e&&0>h||0>e&&0<h))e=f.q,f.v=f.e[0],CI(f,f.v,0),$F(f,e),0<XI(f,f.p,1,f.p)&&\n(f.u=!0)}else{if(f.u)break a;e=-1;l<1.5*g&&(e=(1.5*g-l)*o/(1.5*g));if((0>=b?0-b:b)>e){++f.r;if(100<f.r){YI(f.k,"You are too focused on chains, enough of it for now !");--f.r;break a}f.v=f.p;e=P(J(Math.round(b)));CI(f,f.v,e);e=f.k;lG(e,hg,e.o,0,e.ob.w);f.k.hc=!1;f.e[f.r]=f.p;0<XI(f,f.p,1,f.p)&&(f.u=!0)}}f.v=0;e=f.r;mu(f.k,e+n)}else j=e-f.b[f.x].q,b=h-f.b[f.x].r,g=Math.sqrt(j*j+b*b),1>g&&(g=1),SI(f,f.p,f.b[f.x].q+25*(j/g),f.b[f.x].r+25*(b/g))}a.B=!0}else if(113==a.k&&0<a.ob.v)a.Eb||(a.Eb=!0),SI(a.ob,\na.ob.v,e,h);else if(MI(b)||VI(b))gG(a.ob,f),a.cb=5;else if(0==a.ob.v&&0==a.ob.w&&!((0>c||0>d||d>a.ub||c>a.yb)&&5!=a.cb))e=uG(a),h=a.ob,j=sG(h),b=j.a,j=j.b,0>f&&b<e.c||0<f&&b>e.b||0>g&&j<e.d||0<g&&j>e.a||ZI(h,f,g),a.cb=5;dG(a,!1);a.Ib=!0;qF(a);a.Cc=c;a.Dc=d;return!0}\nfunction PH(a,b,c,d){var e,f;if(!a.J||a._f().a||a.ag().a||a.K)if(f=!1,e=$G(a,c,d),e!=a.Cb&&(f|=RH(a,a.Cb),f|=QH(a,e),a.Cb=e),!LH(b)){c-=P(J(Q(uH(a,a.nb))));d-=P(J(Q(vH(a,a.nb))));b=c;c=a.Nb;0>b||0>d||d>a.ub||b>a.yb?EH(c):DH(a,b,d,c);113==e&&0<a.Nb.b&&(a.Nb.b=0);if(!(a.Nb.c==a.eb.c&&a.Nb.a==a.eb.a&&a.Nb.b==a.eb.b)&&(0<a.Nb.c&&(0<a.Nb.a||0<a.Nb.b)||0<a.eb.c&&(0<a.eb.a||0<a.eb.b)))f=a.eb.c,0<f&&(a.zb[f].v=0,a.zb[f].w=0),f=a.Nb.c,0<f&&(a.zb[f].v=a.Nb.a,a.zb[f].w=a.Nb.b,f!=a.o&&(a.o=f,a.ob=a.zb[a.o])),\nf=!0,e=a.Nb.a,a._f().a&&(e=$I(a,e,a.$b),-1!=e&&(a.$b=e,null!=a.Pb&&bF(a.Pb,z(aJ,u,100,[new uC(a.o),new uC(e)])),a.fg(a.o,e))),e=a.Nb.b,a.ag().a&&(e=$I(a,e,a._b),-1!=e&&(a._b=e,a.hg(a.o,e))),e=a.eb,d=a.Nb,e.c=d.c,e.a=d.a,e.b=d.b;f&&(dG(a,!1),a.Ib=!0,a.bf(a.Ec.d))}}\nfunction bJ(a){var b,c,d,e,f;d=!1;if(a.J&&!a.K)return a.vc&&(cJ(a,Pi,!0),a.e&&(a=a.e,a.b.a.apply(null,[dJ(a.a)]))),!0;a.Eb&&(a.Eb=!1,xG(a.ob),d=a.hc=!0);a.Gb=!1;a.db=Lk;if(1==a.cb){if(205==a.k)d=a.ob,d.u&&(e=XI(d,d.p,1,d.p),6>d.b[e].j&&(eJ(d,null),b=d.e[d.r-1],d.c[d.q].i=e,d.c[d.q].j=b,fJ(d.b[e],b),fJ(d.b[e],b)),YF(d,d.p)),d.u=!1,a.hc=!0;else if(0!=a.eb.c&&a.o!=a.eb.c){YF(a.ob,a.ob.p);b=a.ob.x;c=a.eb.a+a.ob.p;e=a.zb[a.eb.c];d=new GI(a,z(gJ,u,120,[null,a.ob,e]),2);d.b[0]=new hJ;iJ(d,b,c,1);b=D(gJ,\nu,120,a.zb.length,0);for(f=0,c=0;f<a.zb.length;++f)a.zb[f]==a.ob?b[c++]=d:a.zb[f]!=e&&(b[c++]=a.zb[f]);a.zb=b;--a.Sb;a.ob=d;EH(a.eb)}else d=a.ob,e=XI(d,d.p,1,d.p),0!=e&&(--d.p,b=jJ(d,e,d.x),0!=b?(--d.q,kJ(d,d.x),3>d.c[b].c?(++d.c[b].c,d.c[b].f=0):mu(d.k,"Maximum allowed bond order is 3 !")):6==d.b[e].j?(--d.q,kJ(d,d.x),mu(d.k,"Not possible connection !")):(d.c[d.q].j=e,kJ(d,d.x),b=d.x,fJ(d.b[e],b),fJ(d.b[b],e),lJ(d.c[d.q],d.b)));xG(a.ob);a.B&&(d=a.pb,d.a!=d.b&&d.a.b!=d.b&&(e=d.a.c,oI(d),d.a.c=e),\nlG(a,hg,a.o,0,a.ob.w),a.B=!1);d=!0}else 5==a.cb&&(xG(a.ob),d=a.hc=!0);0<a.cb&&(dG(a,!1),a.Ib=!0,qF(a),a.cb=0,a.q=!1,d=!0);if(OF&&(0!=a.ob.w||0!=a.ob.v))a.ob.w=0,a.ob.v=0,dG(a,!1),a.Ib=!0,qF(a),d=!0;a.vc&&!a.Ab&&!d&&(a.J?cJ(a,Pi,!0):cJ(a,lh,!0),a.e&&(a=a.e,a.b.a.apply(null,[dJ(a.a)])),d=!0);return d}function dG(a,b){a.Hb=b;a.Kb=b;a.Ib=b;a.Gb=b;a.Jb=b}function $I(a,b,c){if(0>=b&&0==c||b==c&&a.o==a.Zb)return-1;0>=b&&0<c&&(b=0);a.Zb=a.o;return b}\nfunction cJ(a,b,c){var d,e,b=b.toLowerCase();(e=mJ(a,b,"rbutton"))&&(a.cc=e.a);(e=mJ(a,b,"hydrogens"))&&(a.oc=e.a);-1<b.indexOf("keephs")&&(a.bb=!0,a.ec=!1);-1<b.indexOf("removehs")&&(a.bb=!1,a.ec=!1);-1<b.indexOf("removehsc")&&(a.bb=!1,a.ec=!0);(e=mJ(a,b,"query"))&&(a.ac=e.a);(e=mJ(a,b,"reaction"))&&(a.dc=e.a);(e=mJ(a,b,"autoez"))&&(a.z=e.a);(e=mJ(a,b,"stereo"))&&(a.tc=e.a);(e=mJ(a,b,"canonize"))&&(a.C=e.a);(e=mJ(a,b,Li))&&(a.Fb=e.a);if((e=(iG(),mJ(a,b,yg)?jG:kG)).a)a.A=e.a,a.A&&(a.Rb=!0);if((e=\nmJ(a,b,Ui)?jG:kG).a)a.Rb=e.a,a.Rb||(a.A=!1);if(e=mJ(a,b,"newlook"))a.Lb=e.a,a.jg();if(e=mJ(a,b,"oldlook"))a.Lb=!e.a,a.jg();(e=mJ(a,b,"star"))&&(a.Rb=a.sc=e.a);(e=mJ(a,b,"polarnitro"))&&(a.Xb=e.a);(e=mJ(a,b,"toggle"))&&(a.vc=e.a);if(e=mJ(a,b,"depictaction"))(a.K=e.a)&&(b+=" depict");if(e=mJ(a,b,lh))if(e.a&&!a.J&&(a.J=!0,a.mb=0,a.vb=null,a.Tb=!1,a.jg()),!e.a&&a.J){a.J=!1;for(d=a.xb=1;d<=a.Sb;++d)nJ(a.zb[d]),vG(a.zb[d]);a.mb=24;a.ob&&(a.ob.s=!0);a.Tb=!0;a.jg()}(e=mJ(a,b,"showDragAndDropSymbolInDepictMode"))&&\n(a.nc=e.a);(e=mJ(a,b,"addNewPart"))&&(a.p=e.a);(e=mJ(a,b,"exportInchi"))&&(a.N=e.a);(e=mJ(a,b,"exportInchiKey"))&&(a.P=e.a);(e=mJ(a,b,"exportInchiAuxInfo"))&&(a.O=e.a);(e=mJ(a,b,"searchInchiKey"))&&(a.kc=e.a);(e=mJ(a,b,"exportSVG"))&&(a.Q=e.a);(e=mJ(a,b,"useOclIDCode"))&&(a.zc=e.a);(e=mJ(a,b,"xbutton"))&&(a.Bc=e.a);(e=mJ(a,b,jj))&&(a.Tb=e.a);(e=mJ(a,b,Gg))&&(a.L=e.a);-1<b.indexOf("nocenter")&&(a.Ob=!0);-1<b.indexOf("jmeh")&&(a.ab=!0);-1<b.indexOf("showan")&&(a.mc=!0);(e=mJ(a,b,"atommovebutton"))&&\n(a.lc=e.a);(e=mJ(a,b,"useopenchemlib"))&&(a.Ac=e.a);(e=mJ(a,b,"zoom"))&&(a.s=e.a);a.dc&&(a.A=!0,a.Fb=!0);a.J||(a.L=!1);aH=bH(a);a.F=null;a.G=null;c&&a.bf(a.Ec.d)}function mJ(a,b,c){var d;d=!!ZE(aF(bg+c+bg,2),b).a;b=!!ZE(aF("\\\\bno"+c+bg,2),b).a;return d&&b?(a.ig("check option "+c),null):d?(iG(),iG(),jG):b?(iG(),iG(),kG):null}\nfunction oJ(a,b){var c,d,e;e=n;for(d=1;d<=a.Sb;++d){if(0<b&&(c=wI(a.zb[d]),c!=b))continue;c=a.zb[d];for(var f=void 0,g=void 0,h=f=void 0,j=void 0,l=g=g=void 0,o=void 0,m=void 0,f=void 0,o=n+c.p+ga+c.q,j=1;j<=c.p;++j)f=c.b[j],g=f.d,f=n,0!=g&&(f+=g),f+=nH(c,j),c.k.ab&&0<c.b[j].i&&(f+=Pe,1<c.b[j].i&&(f+=c.b[j].i)),0!=c.b[j].n&&(0<c.b[j].n?f+=jb:f+=rb,1<qH(c.b[j].n)&&(f+=qH(c.b[j].n))),g=pJ(c,j),0!=g&&(f+=bd+g),o+=ga+f+ga+JI(0.055999999999999994*c.b[j].q,0,2)+ga+JI(0.055999999999999994*-c.b[j].r,0,2);\nfor(j=1;j<=c.q;++j)f=c.c[j].i,g=c.c[j].j,l=c.c[j].c,m=c.c[j].f,1==m?l=-1:2==m?l=-2:3==m?(l=-1,h=f,f=g,g=h):4==m?(l=-2,h=f,f=g,g=h):10==m&&(l=-5),9==c.c[j].c&&(l=m),o+=ga+f+ga+g+ga+l;c=o;0<c.length&&(0<e.length&&(e+=Jk),e+=c)}return e}\nfunction VF(a,b){var c,d,e,f;e=n;for(c=1;c<=a.Sb;++c){if(0<b&&(d=wI(a.zb[c]),d!=b))continue;for(var g=a.zb[c],h=void 0,j=void 0,l=void 0,o=void 0,l=n,j=bG(g),h=0;h<j.length;++h){var m=j[h],r=(iG(),g.k.tc?jG:kG),t=g.k.C?jG:kG,y=void 0,v=void 0,s=void 0,A=void 0,F=void 0,M=void 0,N=void 0,$=void 0,U=void 0,V=void 0,da=void 0,la=void 0,sa=void 0,cc=void 0,K=void 0,pa=void 0,Ac=void 0,jd=void 0,tb=void 0,L=void 0,Ga=void 0,ub=void 0,Jc=void 0,uc=void 0,Ba=void 0,kd=void 0,cd=void 0,ta=void 0,Da=void 0,\naa=void 0,da=iH(m.p+10),la=iH(m.p+10),U=iH(m.p+1),V=iH(7),Ba=iH(m.p+1),cc=[],K=[],ub=0;if(0==m.p)o=n;else{kI(m);uc=!0;for($=1;$<=m.q;++$)if(9==m.c[$].c){uc=!1;break}if(t.a&&uc){oG(m);qJ(m);rJ(m,K);sJ(m,cc,K);var Eb=void 0,db=void 0,Fb=void 0,Qc=void 0,nc=void 0,ca=void 0,ld=void 0,S=void 0,O=void 0,Bb=void 0,Ra=void 0,T=void 0,eb=void 0,Ma=void 0,dd=void 0,Rc=void 0,Na=void 0,fb=void 0,Lc=void 0,Yd=void 0,Bd=void 0,Yc=void 0,Ib=void 0,Eb=iH(m.p+1),db=iH(m.p+1),S=iH(m.p+1);var lb=m.p,ic=void 0,vc=\nvoid 0,ec=void 0,I=void 0,oc=void 0,fc=void 0,Bc=void 0,oc=iH(lb+2),fc=iH(100),Bc=5,I=0;fc[0]=3;oc[1]=Nk;oc[2]=Ok;ec=2;if(!(3>lb))for(;Bc<fc[I]*fc[I];){vc=0;for(ic=!0;ic&&vc<=I&&Bc>=fc[vc]*fc[vc];)0==Bc%fc[vc]?ic=!1:++vc;if(ic){oc[++ec]=Jw(Bc);if(ec>=lb)break;I<fc.length-1&&(++I,fc[I]=Bc)}Bc+=2}Na=oc;for(T=1;T<=m.p;++T){Fb=m.b[T];for(eb=Bd=1;eb<=m.q;++eb)(m.c[eb].i==T||m.c[eb].j==T)&&(Bd*=m.d[eb]);Yd=m.b[T].a;32==Yd&&(Ib=m.b[T].e,0<Ib.length&&(ca=Ib.charCodeAt(0)-65+1,ld=0,1<Ib.length&&(ld=Ib.charCodeAt(1)-\n97),0>ca&&(ca=0),0>ld&&(ld=0),Yd=28*ca+ld));fb=0;0!=m.b[T].n&&(-2>m.b[T].n?fb=1:-2==m.b[T].n?fb=2:-1==m.b[T].n?fb=3:1==m.b[T].n?fb=4:2==m.b[T].n?fb=5:2<m.b[T].n&&(fb=6));Bb=0;0!=Fb.d&&(Bb=tJ(nH(m,T),Fb.d),0>Bb&&(Bb=10-Bb));Yc=126;O=Bd;O+=126*m.b[T].i;Yc*=7;O+=fb*Yc;Yc*=7;0!=Bb&&(O+=Bb*Yc);Yc*=7;O+=Yd*Yc;Yc*=783;O+=m.b[T].j*Yc;S[T]=Jw(O)}for(nc=0;!uJ(m,Eb,S);){Rc=!1;for(T=1;T<=m.p;++T)Eb[T]!=db[T]&&(db[T]=Eb[T],Rc=!0);if(Rc){for(T=1;T<=m.p;++T){S[T]=Mk;for(eb=1;eb<=m.b[T].j;++eb)S[T]=Nw(S[T],Na[Eb[m.b[T].p[eb]]])}nc=\n0}else if(0<nc){for(T=1;T<=m.p;++T)S[T]=Mk;T=1;b:for(;T<=m.p-1;++T)for(eb=T+1;eb<=m.p;++eb)if(Eb[T]==Eb[eb]){S[T]=Nk;break b}}else{for(T=1;T<=m.p;++T){S[T]=Mk;for(eb=1;eb<=m.b[T].j;++eb)Fb=m.b[T].p[eb],S[T]=Nw(S[T],Jw(m.b[Fb].a*m.d[jJ(m,T,Fb)]))}nc=1}uJ(m,Eb,S);for(T=1;T<=m.p;++T)S[T]=Jw(db[T]*m.p+Eb[T])}for(T=1;T<=m.p;++T)db[T]=Eb[T];for(Lc=1;Lc<=m.p;++Lc)for(T=1;T<=m.p;++T)if(db[T]==Lc){var Sc=m.b,Hd=T,Sd=void 0,Sd=Sc[Lc];nq(Sc,Lc,Sc[Hd]);nq(Sc,Hd,Sd);db[T]=db[Lc];db[Lc]=Lc;break}for(T=1;T<=m.q;++T)m.c[T].i=\nEb[m.c[T].i],m.c[T].j=Eb[m.c[T].j],m.c[T].i>m.c[T].j&&(Ra=m.c[T].i,m.c[T].i=m.c[T].j,m.c[T].j=Ra,1==m.c[T].f?m.c[T].f=3:2==m.c[T].f?m.c[T].f=4:3==m.c[T].f?m.c[T].f=1:4==m.c[T].f&&(m.c[T].f=2));for(T=1;T<m.q;++T){dd=Ma=m.p;Qc=0;for(eb=T;eb<=m.q;++eb)m.c[eb].i<Ma?(Ma=m.c[eb].i,dd=m.c[eb].j,Qc=eb):m.c[eb].i==Ma&&m.c[eb].j<dd&&(dd=m.c[eb].j,Qc=eb);var Cd=m.c,Td=T,ed=void 0,ed=Cd[Qc];nq(Cd,Qc,Cd[Td]);nq(Cd,Td,ed)}vJ(m);wJ(m);rJ(m,K);sJ(m,cc,K)}else{rJ(m,K);m.d=iH(m.q+1);for(sa=1;sa<=m.q;++sa)m.d[sa]=m.c[sa].c}v=\n1;m.a=iH(m.p+1);aa=1;m.a[1]=1;for(L=0;;){Ga=0;for(sa=1;sa<=m.b[v].j;++sa)if(M=m.b[v].p[sa],0<m.a[M]){if(!(m.a[M]>m.a[v])&&M!=Ba[v]){Jc=!0;for(Ac=1;Ac<=ub;++Ac)if(da[Ac]==v&&la[Ac]==M||da[Ac]==M&&la[Ac]==v){Jc=!1;break}Jc&&(++ub,da[ub]=v,la[ub]=M)}}else V[++Ga]=M;if(0==Ga){if(aa==m.p)break;v=U[L--]}else if(1==Ga)Ba[V[1]]=v,v=V[1],m.a[v]=++aa;else{U[++L]=v;A=0;for(sa=1;sa<=Ga;++sa)if($=jJ(m,V[sa],v),!K[$]){A=V[sa];break}if(0==A)for(sa=1;sa<=Ga;++sa)if($=jJ(m,V[sa],v),2==m.d[$]||3==m.d[$]){A=V[sa];break}0==\nA&&(A=V[1]);Ba[A]=v;v=A;m.a[A]=++aa}}Ba=iH(m.p+1);y=iH(m.p+1);jd=[];kd=[];F=aa=L=0;for(sa=1;sa<=m.p;++sa)if(1==m.a[sa]){v=sa;break}b:for(;;){0<F&&(Ba[v]=F);y[++aa]=v;for(m.a[v]=0;;){Ga=A=0;tb=m.p+1;sa=1;c:for(;sa<=m.b[v].j;++sa){M=m.b[v].p[sa];for(pa=1;pa<=ub;++pa)if(da[pa]==M&&la[pa]==v||da[pa]==v&&la[pa]==M)continue c;0<m.a[M]&&(++Ga,m.a[M]<tb&&(A=M,tb=m.a[M]))}if(0==A){if(0==L)break b;kd[v]=!0;v=U[L--]}else break}F=v;v=A;1<Ga&&(U[++L]=F,jd[A]=!0)}cd=iH(m.q+1);ta=iH(m.p+1);if(r.a){for(var fa=Ba,\nId=ub,Ob=void 0,ge=void 0,Cb=void 0,fd=void 0,Va=void 0,Jb=void 0,Qb=void 0,jc=void 0,Za=void 0,pc=void 0,fd=iH(m.p+1),Ob=1;Ob<=m.p;++Ob)fd[y[Ob]]=Ob;Jb=[];for(jc=1;jc<=m.p;++jc)ge=y[jc],Cb=fa[ge],Va=jJ(m,ge,Cb),0!=Va&&(xJ(m,Va,fd,cd),Jb[Va]=!0);for(jc=1;jc<=m.q;++jc)Jb[jc]||xJ(m,jc,fd,cd);Ob=1;b:for(;Ob<=m.p;++Ob)if(!(2>m.b[Ob].j||4<m.b[Ob].j)){Qb=pc=0;for(Za=1;Za<=m.b[Ob].j;++Za){Va=jJ(m,Ob,m.b[Ob].p[Za]);if(5==m.d[Va])continue b;1==m.c[Va].c&&0!=yJ(m,Va,Ob)&&++pc;2==m.c[Va].c&&(Qb=m.b[Ob].p[Za])}if(0!=\npc)if(0<Qb){var ya=m,Jd=fd,Rb=ta,Mc=void 0,gc=void 0,Cc=void 0,kc=void 0,Dc=void 0,Kd=void 0,Dd=void 0,wc=void 0,md=void 0,Ld=void 0,X=void 0,ob=void 0,pb=void 0,xb=void 0,Af=void 0,$a=void 0,Sb=void 0,mb=void 0,lg=void 0,gb=void 0,Bf=void 0,oe=void 0,nd=void 0,xc=void 0,Cc=zJ(ya,Ob),Ld=Cc[0];if(0!=Ld%2&&(xc=Cc[1],gc=Cc[~~((Ld+1)/2)],Dd=Cc[Ld],!(2>ya.b[Dd].j||3<ya.b[Dd].j))){gb=mb=xb=ob=0;oe=$a=!1;for(md=1;md<=ya.b[xc].j;++md)Mc=ya.b[xc].p[md],Mc!=Cc[2]&&(0==ob?ob=Mc:xb=Mc);0<Jd[xb]&&Jd[ob]>Jd[xb]&&\n(kc=ob,ob=xb,xb=kc);X=ob;0==ob&&(X=xb,$a=!0);for(wc=1;wc<=ya.b[Dd].j;++wc)Mc=ya.b[Dd].p[wc],Mc!=Cc[Ld-1]&&(0==mb?mb=Mc:gb=Mc);0<Jd[gb]&&Jd[mb]>Jd[gb]&&(kc=mb,mb=gb,gb=kc);Sb=mb;0==mb&&(Sb=gb,oe=!0);pb=0<ob?yJ(ya,jJ(ya,xc,ob),xc):0;Af=0<xb?yJ(ya,jJ(ya,xc,xb),xc):0;lg=0<mb?yJ(ya,jJ(ya,Dd,mb),Dd):0;Bf=0<gb?yJ(ya,jJ(ya,Dd,gb),Dd):0;1<(0>pb+Af?-(pb+Af):pb+Af)||0!=lg||0!=Bf?mu(ya.k,"Bad stereoinfo on allene !"):(Dc=ya.b[Cc[Ld-1]].q-ya.b[Dd].q,Kd=ya.b[Cc[Ld-1]].r-ya.b[Dd].r,nd=Math.sqrt(Dc*Dc+Kd*Kd),0.001>\nnd&&(nd=0.001),0<(ya.b[Sb].r-ya.b[Cc[Ld-1]].r)*(Dc/nd)-(ya.b[Sb].q-ya.b[Cc[Ld-1]].q)*(Kd/nd)?Rb[gc]=1:Rb[gc]=-1,$a&&(Rb[gc]*=-1),oe&&(Rb[gc]*=-1),X==ob&&0>pb&&(Rb[gc]*=-1),X==xb&&0>Af&&(Rb[gc]*=-1),Jd[X]>Jd[Sb]&&(Rb[gc]*=-1))}}else c:{var qc=m,Gb=Ob,Ae=fa,wd=fd,Tc=da,Tb=la,od=Id,pe=ta,Zd=void 0,Zc=void 0,Be=void 0,rc=void 0,Xa=void 0,sc=void 0,yb=void 0,he=void 0,Md=void 0,$c=void 0,Sa=void 0,Ta=void 0,Ec=void 0,Ub=void 0,pd=void 0,ba=void 0,qd=void 0,Ta=iH(4),Ub=iH(4),$d=void 0,xd=void 0,qe=void 0,\nhf=void 0,jf=void 0,Xg=void 0,Xg=-1;0<Ae[Gb]&&(Ta[++Xg]=Ae[Gb]);for(xd=1;xd<=od;++xd)Tc[xd]==Gb&&(Ta[++Xg]=Tb[xd]),Tb[xd]==Gb&&(Ta[++Xg]=Tc[xd]);for(xd=Xg+1;xd<qc.b[Gb].j;++xd){jf=qc.p+1;qe=1;d:for(;qe<=qc.b[Gb].j;++qe){$d=qc.b[Gb].p[qe];for(hf=0;hf<xd;++hf)if($d==Ta[hf])continue d;wd[$d]<jf&&(jf=wd[$d],Ta[xd]=$d)}}0==Ae[Gb]&&0<qc.b[Gb].i?(Ta[3]=Ta[2],Ta[2]=Ta[1],Ta[1]=Ta[0],Ta[0]=-1):0<qc.b[Gb].i&&(Ta[3]=Ta[2],Ta[2]=Ta[1],Ta[1]=-1);for(Xa=he=sc=rc=qd=yb=$c=0;4>Xa;++Xa)0>=Ta[Xa]||(Zd=jJ(qc,Gb,Ta[Xa]),\nUb[Xa]=yJ(qc,Zd,Gb),0<Ub[Xa]?(++$c,qd=Ta[Xa],sc=Ta[Xa]):0>Ub[Xa]?(++yb,rc=Ta[Xa],sc=Ta[Xa]):he=Ta[Xa]);Md=$c+yb;ba=iH(4);pd=0;if(3==qc.b[Gb].j){if(1==$c&&1==yb||3==Md&&0<$c&&0<yb){mu(qc.k,"Error in C3H stereospecification !");break c}Ec=Ta[0];1==Md?Ec=sc:2==Md&&(Ec=he);Sa=AJ(qc,Gb,Ec,Ta);ba[0]=sc;ba[1]=-1;ba[2]=Sa[2];ba[3]=Sa[1];0<$c?pd=1:pd=-1}else if(4==qc.b[Gb].j)if(1==Md)Sa=AJ(qc,Gb,sc,Ta),ba[0]=Sa[0],ba[1]=Sa[3],ba[2]=Sa[2],ba[3]=Sa[1],0<$c?pd=1:pd=-1;else{Ec=Ta[0];1<he&&(Ec=he);1==$c?Ec=qd:\n1==yb&&(Ec=rc);Sa=AJ(qc,Gb,Ec,Ta);Zc=iH(4);for(Xa=0;4>Xa;++Xa)Zd=jJ(qc,Gb,Sa[Xa]),Zc[Xa]=yJ(qc,Zd,Gb);if(4==Md){if(0==$c||0==yb){mu(qc.k,"Error in C4 stereospecification !");break c}if(1==$c||1==yb)ba[0]=Sa[0],ba[1]=Sa[3],ba[2]=Sa[2],ba[3]=Sa[1],pd=Zc[0];else{for(Xa=0;4>Xa;++Xa)-1==Zc[Xa]&&(Zc[Xa]=0);Md=2}}else if(3==Md)if(3==$c||3==yb)ba[0]=Sa[0],ba[1]=Sa[3],ba[2]=Sa[2],ba[3]=Sa[1],0<$c?pd=-1:pd=1;else{1==$c?$c=Be=1:yb=Be=-1;for(Xa=0;4>Xa;++Xa)Zc[Xa]==Be&&(Zc[Xa]=0);Md=2}if(2==Md)if(1==$c&&1==yb)Sa[1]==\nrc?(Sa[1]=Sa[2],Sa[2]=Sa[3]):Sa[2]==rc&&(Sa[2]=Sa[3]),ba[0]=qd,ba[1]=rc,ba[2]=Sa[2],ba[3]=Sa[1],pd=1;else{if(Zc[0]==Zc[1]||Zc[1]==Zc[2]){mu(qc.k,"Error in C4 stereospecification ! 2/0r");break c}0!=Zc[0]?(ba[0]=Sa[0],ba[1]=Sa[2],ba[2]=Sa[1],ba[3]=Sa[3]):(ba[0]=Sa[1],ba[1]=Sa[3],ba[2]=Sa[2],ba[3]=Sa[0]);1<$c?pd=1:pd=-1}}var Kb=void 0;Ta[0]==ba[1]?(Kb=ba[0],ba[0]=ba[1],ba[1]=Kb,Kb=ba[2],ba[2]=ba[3],ba[3]=Kb):Ta[0]==ba[2]?(Kb=ba[2],ba[2]=ba[0],ba[0]=Kb,Kb=ba[1],ba[1]=ba[3],ba[3]=Kb):Ta[0]==ba[3]&&(Kb=\nba[3],ba[3]=ba[0],ba[0]=Kb,Kb=ba[1],ba[1]=ba[2],ba[2]=Kb);Ta[1]==ba[2]?(Kb=ba[1],ba[1]=ba[2],ba[2]=Kb,Kb=ba[2],ba[2]=ba[3],ba[3]=Kb):Ta[1]==ba[3]&&(Kb=ba[1],ba[1]=ba[3],ba[3]=Kb,Kb=ba[2],ba[2]=ba[3],ba[3]=Kb);ba[2]==Ta[2]?pe[Gb]=1:ba[2]==Ta[3]?pe[Gb]=-1:mu(qc.k,"Error in stereoprocessing ! - t30");pe[Gb]*=pd}}}Da=new BJ;N=iH(m.p+1);for(sa=1;sa<=m.p;++sa)N[y[sa]]=sa;for(sa=1;sa<=m.p;++sa){v=y[sa];jd[v]&&(Da.a.a+=cb);0<Ba[sa]&&CJ(m,v,Ba[v],Da,cd);var Qe=v,Re=Da,rd=cc[v],yd=ta,Se=void 0,Te=void 0,sd=\nvoid 0,mg=void 0,ae=void 0,Hg=void 0,Cf=void 0,ie=void 0,Ea=void 0,Ea=Uf,Te=m.b[Qe],ae=Te.d,Cf=Te.i,ie=Te.n,Se=Te.a,sd=!1;(0!=ie||0!=ae)&&(sd=!0);0!=yd[Qe]&&(sd=!0);Hg=pJ(m,Qe);mg=0!=Hg;sd=sd||mg;m.k.sc&&0<m.b[Qe].c&&(sd=!0);switch(Se){case 2:Ea=ce;break;case 3:rd?Ea=Mg:Ea=me;break;case 4:rd?(Ea=Mi,0<Cf&&(sd=!0)):Ea=sf;break;case 5:rd?Ea="o":Ea=xf;break;case 7:rd?(Ea=hj,0<Cf&&(sd=!0)):Ea=yf;break;case 8:rd?Ea=Fj:Ea=Hf;break;case 13:rd?Ea=Ij:Ea=Jf;sd=!0;break;case 6:Ea=Lf;sd=!0;break;case 9:Ea=Ke;\nbreak;case 10:Ea=ve;break;case 11:Ea=le;break;case 12:Ea=Xe;break;case 1:Ea=Pe;sd=!0;break;case 32:sd=!0,Ea=m.b[Qe].e,!mg&&(H(Ea,ib)||H(Ea,eg)||H(Ea,Od))&&(sd=!1)}0<TF(Se)&&(Ea=(FF(),MF)[Se],sd=!0);33<=Se&&42>=Se&&(sd=!0,Ea=(FF(),MF)[Se]);sd&&(0!=ae?Ea=Wf+ae+Ea:Ea=Wf+Ea,1==yd[Qe]?Ea+=Nd:-1==yd[Qe]&&(Ea+="@@"),1==Cf?Ea+=Pe:1<Cf&&(Ea+=Pe+Cf),0!=ie&&(0<ie?Ea+=jb:Ea+=rb,1<(0>ie?-ie:ie)&&(Ea+=0>ie?-ie:ie)),mg&&(Ea+=bd+Hg),Ea+=cg);Bp(Re.a,Ea);for(pa=1;pa<=ub;++pa)if(da[pa]==v||la[pa]==v)s=la[pa],s==v&&\n(s=da[pa]),N[v]<N[s]&&CJ(m,da[pa],la[pa],Da,cd),9<pa&&(Da.a.a+=Pa),Ap(Da,n+(new uC(pa)).a);kd[v]&&(Da.a.a+=hb)}o=Da.a.a}0<l.length&&(l+=lc);l+=o}f=l;0<f.length&&(0<e.length&&(e+=lc),e+=f)}return e}function rI(a,b,c){try{$H(a,b,c)||a.bf(a.Ec.d)}catch(d){if(d=yq(d),G(d,97))a.bf(a.Ec.d);else throw d;}}\nfunction bI(a,b,c){var d;try{var e;a:{var f,g,h,j,l,o,m,r,t;g=l=0;t=new WE(b,"|>",!0);j=-1<b.indexOf(Fd);m=1;o=PE(t);f=0<a.Sb;if(!((a.dc||a.Fb)&&a.p||a.Mb)||j)a.Sb=0,f=!1;for(h=1;h<=o;++h)if(r=TE(t),oy(r),!H(r,Jk))if(H(r,Fd))++m,2==m?l=a.Sb:3==m&&(g=a.Sb+1);else{a.ob=new DJ(a,r);if(0==a.ob.p){mu(a,"ERROR - problems in reading/processing molecule !");a.bf(a.Ec.d);oE();e=!1;break a}++a.Sb;a.o=a.Sb;a.zb[a.Sb]=a.ob}2==m?(mu(a,"ERROR - strange reaction - fixing !"),a.bf(a.Ec.d),oE(),e=!1):3<m?(mu(a,"ERROR - strange reaction !"),\na.bf(a.Ec.d),oE(),e=!1):(1<a.Sb&&!j&&cJ(a,Li,!0),j&&!a.dc&&(a.dc=!0),j?f||(qG(a,1,l,1,!1),qG(a,l+1,g-1,2,!1),qG(a,g,a.Sb,3,!1)):a.dc||qG(a,1,a.Sb,0,!f),mI(a),a.r&&AG(Xp(a.r,"readJME"),0,0,0),a.hc=!0,oF(a.r,Pd),a.Ib=!0,c&&a.bf(a.Ec.d),e=!0)}(d=e)||a.bf(a.Ec.d)}catch(y){if(y=yq(y),G(y,97))d=!1,a.bf(a.Ec.d);else throw y;}return d}function lG(a,b,c,d,e){a.r&&AG(Xp(a.r,b),d,e,c);a.hc=!0}function ZF(a,b,c){lG(a,b,a.o,c,0)}function TI(a){dG(a,!1);a.Ib=!0;a.bf(a.Ec.d)}\nfunction EJ(a){a.k=202;a.Mb=!1;BG(a);mu(a,n);a.sb=null;a.xb=1;a.r&&AG(Xp(a.r,"reset"),0,0,0);a.hc=!0;a.bf(a.Ec.d)}function FJ(a){dG(a,!0);a.vb=null;a.wc=null;a.fb=null;a.W=null;a.fc=null}function nI(a,b){var c,d;if(b){a.o=b.a;a.Sb=b.f;for(c=1;99>c;++c)(d=b.d[c])?a.zb[c]=new WF(d):a.zb[c]=null;0<b.a?a.ob=a.zb[a.o]:a.ob=new zG(a);a.dc=b.i;a.Fb=b.e;a.xb=b.b}else for(;0<a.Sb;)yG(a,!1);switch(b.c){case 5:case 7:case 9:break;default:null!=a.Qb&&bF(a.Qb,null),a.r&&null!=a.r.a&&a.eg()}}\nfunction FH(a,b){return P(J(Math.round(b/a.xb)))}function GJ(a,b){mu(a,n);return 1>b||b>a.Sb?(mu(a,"ERROR - invalid mol index: "+b),a.bf(a.Ec.d),null):a.zb[b]}function mI(a){var b,c,d;b=mG(a);for(d=1;d<=a.Sb;++d)c=a.zb[d],c.o=b}function HJ(a,b){b!=a.nb&&(a.nb=b,a.jg(),a.bf(a.Ec.d))}function IJ(a,b){var c,d,e;if(b!=a.xb){c=uG(a);a.xb=b;d=uG(a);e=P(J(Q((d.b-d.c)/2-(c.b-c.c)/2)));d=P(J(Q((d.a-d.d)/2-(c.a-c.d)/2)));for(c=1;c<=a.Sb;++c)ZI(a.zb[c],e,d),xG(a.zb[c]);a.Ib=!0;a.bf(a.Ec.d)}}\nfunction pG(a,b){var c;c=-1;H(b,"Select substituent")?(c=202,b=n):H(b,Ab)?c=235:H(b,Hb)?c=240:H(b,zb)?c=260:H(b,Pb)?c=261:H(b,$b)?c=241:H(b,Nb)?c=233:H(b,Mb)?c=236:H(b,Lb)?c=237:H(b,Zb)?c=234:H(b,Yb)?c=243:H(b,ac)?c=252:H(b,Vb)?c=244:H(b,bc)?c=239:H(b,"-PO3H2")?c=251:H(b,wb)?c=242:H(b,sb)?c=245:H(b,vb)&&(c=238);0<c?tu(a,c):b="Not known group!";mu(a,b);a.bf(a.Ec.d)}function YI(a,b){mu(a,b);a.bf(a.Ec.d)}\nfunction WG(a,b,c,d,e){var f,g,h,j;f=a.kb;j=LD(f,e);if(j>=a.mb-1)for(g=f.b.b;j>=a.mb-1&&1<g;){--g;h=new oD(f.b.a,f.b.c,g);f=(ju(),new CB(h));j=LD(f,e);var l=b,o=h.b*(QG(),R);h=new oD(h.a,h.c,Math.round(o));l.e=h;JJ(b.a,b.e)}else jH(b,a.hb);f=qD(f.b).a-qD(f.b).b;rH(b,e,c+(a.mb-j)/2,d+(a.mb-f)/2+f)}function XG(a,b,c,d,e,f){var g,h;g=kH(a.jb);h=LD(a.jb,f);jH(b,a.ib);!b.b?gH(b.a,e):e==b.c||WC(e,b.c)?gH(b.a,b.c):gH(b.a,b.b);rH(b,f,c+(a.mb-h)/2,d+(a.mb-g)/2+g)}\nfunction kH(a){return qD(a.b).a-qD(a.b).b}function vH(a,b){return(2*a.mb+(a.Lb?1:0))*b}\nfunction KJ(a){var b,c;a.vb?(c=nC(a),(b=c.b!=a.M.b||c.a!=a.M.a)&&(a.M=c)):b=!0;b&&(dG(a,!0),IH(a,a.M),a.ig("update(): "+a.M+" initOrResize: true "+a.yb+ga+a.ub),a.vb=DG(a,a.vb,a.yb,a.ub),a.J?(b=a.xb,qG(a,1,a.Sb,0,a.J),a.ig("update() in depict mode: oldMolecularAreaScale = "+b+" new molecularAreaScale = "+a.xb)):(a.wc=DG(a,a.wc,a.M.b,P(J(Q(vH(a,a.nb))))),b=a.M.a-P(J(Q(vH(a,a.nb)))),1>b&&(b=1),a.fb=DG(a,a.fb,P(J(Q(uH(a,a.nb)))),b),a.W=DG(a,a.W,a.yb+P(J(Q((a.Lb?1:3)*a.nb))),P(J(Q(a.mb*a.nb)))),a.fc=\nDG(a,a.fc,P(J(Q((a.Lb?1:3)*a.nb))),a.ub)));dH(a);if(!a.J){var d;a.ig("drawInfo: "+a.Gb+" : "+a.X);a.Gb&&(null==a.X&&(a.X=n),eH(a.W.b.a,a.nb/R),d=a.W.b,c=a.M.b/a.nb-(a.mb+(a.Lb?1:0)),b=a.mb,GG(d,HF),PG(d.a,P(J(Q(0*(QG(),R)))),P(J(Q(0*R))),P(J(Q(c*R))),P(J(Q(b*R)))),a.Lb?(GG(d,(EC(),JC)),TG(d.a,P(J(Q(-10*R))),P(J(Q(0*R))),P(J(Q((c-1+10)*R))),P(J(Q((b-1)*R))))):(GG(d,IF),RG(d,0,0,c-(a.Lb?1:3)+1,0),GG(d,VC(HF)),SG(d.a,P(J(Q(0*R))),P(J(Q((b-1)*R))),P(J(Q((c-1)*R))),P(J(Q((b-1)*R)))),SG(d.a,P(J(Q((c-1)*\nR))),P(J(Q(0*R))),P(J(Q((c-1)*R))),P(J(Q((b-1)*R))))),jH(d,a.lb),GG(d,(EC(),LC)),-1!=a.X.toLowerCase().indexOf(yh)&&GG(d,NC),rH(d,a.X,10,15),a.J||cH(a,d,c,b,1),b=P(J(Q(uH(a,a.nb)))),c=a.M.a-P(J(Q(a.mb*a.nb))),wH(a.Ec,a.W.a,b,c));var e;if(a.Kb){eH(a.wc.b.a,a.nb/R);b=a.wc.b;d=a.M.b/a.nb;c=2*a.mb+(a.Lb?1:0);GG(b,HF);PG(b.a,P(J(Q(0*(QG(),R)))),P(J(Q(0*R))),P(J(Q(d*R))),P(J(Q(c*R))));a.Lb?(GG(b,(EC(),JC)),e=14*(a.mb+(a.Lb?1:0)),TG(b.a,P(J(Q(e*R))),P(J(Q(0*R))),P(J(Q((d-e-1)*R))),P(J(Q((c-1)*R))))):(GG(b,\nVC(HF)),SG(b.a,P(J(Q((d-1)*R))),P(J(Q(0*R))),P(J(Q((d-1)*R))),P(J(Q((c-1)*R)))),SG(b.a,P(J(Q(0*R))),P(J(Q((c-1)*R))),P(J(Q((d-1)*R))),P(J(Q((c-1)*R)))),GG(b,IF),SG(b.a,P(J(Q(0*R))),P(J(Q(0*R))),P(J(Q((d-1)*R))),P(J(Q(0*R)))));d=a.k;233<=a.k&&262>=a.k&&(a.k=213);for(c=1;14>=c;++c)FG(a,b,c,1),FG(a,b,c,2);a.k=d;wH(a.Ec,a.wc.a,0,0)}var f;if(a.Hb){eH(a.fb.b.a,a.nb/R);b=a.fb.b;d=a.mb+(a.Lb?1:0);c=(a.M.a-P(J(Q(vH(a,a.nb)))))/a.nb;f=c-a.mb;GG(b,HF);PG(b.a,P(J(Q(0*(QG(),R)))),P(J(Q(0*R))),P(J(Q(d*R))),P(J(Q(c*\nR))));a.Lb?(GG(b,(EC(),JC)),e=aH*(a.mb+(a.Lb?1:0))+3,f>e&&(RG(b,0,e,a.mb-1,e),SG(b.a,P(J(Q(0*R))),P(J(Q(e*R))),P(J(Q(0*R))),P(J(Q((c-1)*R)))),RG(b,a.mb-1,e,a.mb-1,f),RG(b,a.mb-1,f,d,f))):(GG(b,IF),SG(b.a,P(J(Q(0*R))),P(J(Q(0*R))),P(J(Q(0*R))),P(J(Q((c-1)*R)))),RG(b,0,aH*a.mb,c-1,aH*a.mb),GG(b,VC(HF)),SG(b.a,P(J(Q((d-1)*R))),P(J(Q(0*R))),P(J(Q((d-1)*R))),P(J(Q((f+1)*R)))));SG(b.a,P(J(Q(0*R))),P(J(Q((c-1)*R))),P(J(Q(d*R))),P(J(Q((c-1)*R))));for(c=3;c<=aH+2;++c)FG(a,b,1,c);b=P(J(Q(vH(a,a.nb))));wH(a.Ec,\na.fb.a,0,b)}a.Jb&&(eH(a.fc.b.a,a.nb/R),d=a.fc.b,c=a.Lb?1:3,b=(a.M.a-P(J(Q(vH(a,a.nb))))-P(J(Q(a.mb*a.nb))))/a.nb,a.Lb?(GG(d,(EC(),JC)),PG(d.a,P(J(Q(0*(QG(),R)))),P(J(Q(0*R))),P(J(Q(c*R))),P(J(Q(b*R))))):(GG(d,VC(HF)),SG(d.a,P(J(Q((c-1)*(QG(),R)))),P(J(Q(0*R))),P(J(Q((c-1)*R))),P(J(Q(b*R)))),GG(d,HF),SG(d.a,P(J(Q((c-2)*R))),P(J(Q(0*R))),P(J(Q((c-2)*R))),P(J(Q(b*R)))),GG(d,IF),SG(d.a,P(J(Q((c-3)*R))),P(J(Q(0*R))),P(J(Q((c-3)*R))),P(J(Q(b*R))))),b=a.M.b-P(J(Q((a.Lb?1:3)*a.nb))),c=P(J(Q(vH(a,a.nb)))),\nwH(a.Ec,a.fc.a,b,c))}}function su(a,b){a.A?0==b&&(a.I=-1,mu(a,Vg),qF(a)):(a.gb?a.I=b:-1<a.I&&10>a.I?a.I=10*a.I+b:a.I=b,a.gb=!1,0==a.I?(a.I=-1,mu(a,Vg)):mu(a,a.I+ga),qF(a))}function IH(a,b){var c,d;d=b.b;c=b.a;a.J||(d-=P(J(Q(uH(a,a.nb))))+P(J(Q((a.Lb?1:3)*a.nb))),c-=P(J(Q(vH(a,a.nb))))+P(J(Q(a.mb*a.nb))));1>d&&(d=1);1>c&&(c=1);a.yb=dw(d);a.ub=dw(c)}function TF(a){FF();return 14<=a&&20>=a?1:21<=a&&28>=a?2:29<=a&&31>=a?3:0}w(577,469,Yl);_.zf=function(a){cG(this,a)};_.$f=LJ;\n_._f=function(){return iG(),null!=this.Pb?jG:kG};_.ag=function(){return iG(),iG(),kG};_.bg=XB;_.cg=function(a,b,c){return jC(this,b,c)};_.dg=XB;_.eg=function(){oE()};_.fg=hD;_.gg=MJ;_.hg=hD;_.ig=function(){oE()};\n_.Af=function(a){var b,c;if(this.s)if(c=a.c,b=a.f,a=a.i,c=(100+2*c)/100,this.J||!(b<P(J(Q(uH(this,this.nb))))||a<P(J(Q(vH(this,this.nb))))||a>this.M.a-P(J(Q(this.mb*this.nb)))||b>this.M.b-P(J(Q((this.Lb?1:3)*this.nb))))){if(b=this.xb*c,b>this.xb&&10>=b||b<this.xb&&0.3<=b)this.cb=8,IJ(this,b)}else b=this.nb*c,0.7<=b&&4>=b&&HJ(this,b)};_.bf=function(){KJ(this)};_.jg=function(){FJ(this)};_.kg=Fy;_.j=null;_.k=0;_.n=0;_.o=0;_.p=!1;_.q=!1;_.s=!0;_.t=null;_.u=null;_.v=null;_.w=null;_.x=13;_.y=null;_.z=!0;\n_.A=!1;_.B=!1;_.C=!0;_.F=null;_.G=null;_.I=1;_.J=!1;_.K=!1;_.L=!1;_.M=null;_.N=!0;_.O=!1;_.P=!0;_.Q=!0;_.R=null;_.S=null;_.T=null;_.V="http://peter-ertl.com/jsme/2013_03/help.html";_.W=null;_.X=null;_.Y=null;_._=null;_.ab=!1;_.bb=!0;_.cb=0;_.db=Lk;_.fb=null;_.gb=!0;_.hb=null;_.ib=null;_.jb=null;_.kb=null;_.lb=null;_.mb=24;_.nb=1;_.ob=null;_.pb=null;_.rb=null;_.sb=null;_.tb=!0;_.ub=0;_.vb=null;_.wb=1;_.xb=1;_.yb=0;_.Ab=!1;_.Bb=!1;_.Cb=0;_.Db=!1;_.Eb=!1;_.Fb=!0;_.Gb=!0;_.Hb=!0;_.Ib=!0;_.Jb=!0;\n_.Kb=!0;_.Lb=!1;_.Mb=!1;_.Ob=!1;_.Pb=null;_.Qb=null;_.Rb=!1;_.Sb=0;_.Tb=!0;_.Ub=null;_.Vb=!1;_.Wb=null;_.Xb=!1;_.Yb=null;_.Zb=0;_.$b=0;_._b=0;_.ac=!1;_.bc=null;_.cc=!1;_.dc=!1;_.ec=!1;_.fc=null;_.gc=!1;_.hc=!1;_.kc=!0;_.lc=!1;_.mc=!1;_.nc=!0;_.oc=!0;_.pc=null;_.qc=null;_.rc=!1;_.sc=!1;_.tc=!0;_.uc=null;_.vc=!1;_.wc=null;_.xc=null;_.yc=null;_.zc=!1;_.Ac=!0;_.Bc=!0;_.Cc=0;_.Dc=0;var aH=10,JF,PF,RF,HF,IF,KF,GF,OF,NJ=null,NF,MF;\nfunction NI(a,b,c,d,e){a.b[e]&&(zH(a.r),oF(a.r,Ne),a.r.a=e,a.r.d=c,a.r.e=d,a.r.f=b,OJ(a.c,a.r,e),zH(a.r))}function PJ(a,b,c){return a.b[c]?(zH(a.r),a.r.a=c,a.r.b=b,OJ(a.c,a.r,c),zH(a.r),!0):!1}function qF(a){KJ(a);a.f&&(QJ(a.Ec),a.f=!1)}function RJ(a,b,c){b in a.b?a.b[b]=c:$wnd.alert("Invalid callback name: "+b)}\nfunction SJ(){FF();hC.call(this);this.Ec=(PB(),PB(),QB).a;this.eb=new TJ;this.Nb=new TJ;this.H=new oD(null,0,8);this.Z=(this.mb-6)/1.5;this.r=new UJ;this.D=(EC(),GC);this.zb=D(gJ,u,120,99,0);this.qb=new fC;this.jc=new VJ;this.$=H((oE(),pE[ai]),bf);this.E=new WJ;this.U=z(hw,u,1,[Ab,Hb,$b,zb,Pb,Nb,Mb,Lb,Zb,ac,Vb,Yb,wb,vb,sb]);this.ic=new XJ;this.ob=new zG(this);NF[0]=IC;NF[1]=new km(255,153,153);NF[2]=new km(255,204,102);NF[3]=new km(255,255,153);NF[4]=new km(102,255,255);NF[5]=new km(51,204,255);NF[6]=\nnew km(255,153,255);this.eb.c=1;this.Nb.c=1;this.zb[1]=this.ob;this.Y=new YJ(this);this.a=z(hw,u,1,[ee,Qd,Wd,ke,Vd,fe,Ye]);var a,b,c,d;this.b={};for(b=this.a,c=0,d=b.length;c<d;++c)a=b[c],this.b[a]=null;this.c=new ZJ(this)}w(576,577,Yl,SJ);_.$f=function(){var a;return a=$J(),-1==a||9<=a};_._f=function(){return iG(),null!=this.b[Wd]||(null!=this.Pb?jG:kG).a?jG:kG};_.ag=function(){return iG(),null!=this.b[ke]?jG:kG};_.bg=function(a){var b=Qt(this,!1,!0);(a=new aK(this,a))&&wF(new CF(a,b))};\n_.cg=function(a,b,c){var d;return a?(d=a.a,iy(d.t,b,c),a):jC(this,b,c)};_.dg=function(a){PJ(this,a,"AfterPaste")};_.eg=function(){oF(this.r,Ne);OJ(this.c,this.r,Qd);oE()};_.fg=function(a,b){NI(this,a,b,0,Wd)};_.gg=function(a){return PJ(this,a,ee)};_.hg=function(a,b){NI(this,a,0,b,ke)};_.ig=XB;_.bf=function(){qF(this)};_.jg=function(){FJ(this);var a=this.Ec,b,c;for(c=new zv(new yC(a.a));c.b<c.d.Tf();)b=Av(c),0<Qy(a.f.p,b.t)&&Uy(a.f,b.t),wm(a.a,b);this.f=!0};\n_.kg=function(){var a=Qt(this,!0,!1),b=new bK(this);b&&wF(new CF(b,a))};_.b=null;_.c=null;_.d=null;_.e=null;_.f=!1;_.i="http://www.google.com/search?q=%22{INCHIKEY}%22";function OJ(a,b,c){if((c=a.a.b[c])&&b){var d=a.a.d;d.action=b.a;d.atom=b.d;d.bond=b.e;d.molecule=b.f;null!=b.b?d.argument=b.b:b.c&&(d.argument=b.c);null!=b.i?d.origin=b.i:b.i=null;c(a.a.d)}}function ZJ(a){this.a=a}w(578,1,{},ZJ);_.a=null;function aK(a,b){this.a=a;this.b=b}w(579,1,{},aK);_.zd=XB;\n_.Zf=function(a){if(null!=DF(a))nu(DF(a)),YI(this.a,"InChI "+DF(a));else{switch(this.b){case 3:nu(a.inchi==n?null:a.inchi);break;case 4:nu(a.key==n?null:a.key);break;case 5:nu(a.auxinfo==n?null:a.auxinfo)}null!=EF(a)&&YI(this.a,"InChI "+EF(a))}};_.a=null;_.b=0;function bK(a){this.a=a}w(580,1,{},bK);_.zd=XB;\n_.Zf=function(a){if(null!=DF(a))nu(DF(a)),YI(this.a,"InChI "+DF(a));else{var b=this.a,c;if(b.b[Ye])try{zH(b.r),Xp(b.r,Ye),b.r.c=a,OJ(b.c,b.r,Ye),zH(b.r)}catch(d){if(d=yq(d),G(d,97))YI(b,Je+d.yd());else throw d;}else try{var e=a.key==n?null:a.key,f,g;f=null;null!=e&&0<e.length&&(f=b.i,-1!=f.indexOf("{INCHIKEY}")?f=(g=cK(cK(e,$f,"\\\\\\\\\\\\\\\\"),"\\\\$","\\\\\\\\$"),cK(f,"\\\\{INCHIKEY\\\\}",g)):f+=e);c=new wE(f);dK(c)}catch(h){if(h=yq(h),G(h,83))YI(b,Je+h.f);else throw h;}null!=EF(a)&&YI(this.a,"InChI "+EF(a))}};\n_.a=null;function eK(a,b){return null!=b&&0<b.length?eK(a,b):!1}function fK(a){a.c.pb.style.display!=Qi&&(mC(a.b),QJ(a.d))}function gK(a){hK.call(this,a,Kc,Kc,null)}function iK(a,b){hK.call(this,a,Kc,Kc,b)}function jK(a,b,c){hK.call(this,a,b,c,null)}\nfunction hK(a,b,c,d){var e;if(null==a)dF("JSME initialization error: HTML id argument is null.");else if(H(af,a))dF(\'JSME initialization error: Due to an Internet Explorer bug, HTML id argument can not be "JSME".\');else if(e=RA(a)){this.a=kK;++kK;this.c=e;this.b=new SJ;this.b.d||(this.b.d={},this.b.d.src=dJ(this));this.d=new lK(this.b,b,c,d);Ly(e,this.d,e.pb);d&&ug in d&&(this.d.b=d[ug]);a=this.d;a.d||(a.d=kC(a,oC(a),pC(a)),a.d.j=!1);var b=a.c,f,g,h,j,l,o,m,r;b.$?NJ=af:NJ="JME";xC(b.Sc.Pc,b);mu(b,\nNJ+" Molecular Editor by Peter Ertl and Bruno Bienfait");b.M=nC(b);cC(b,null);b.hb||(b.hb=new oD(Ue,0,13),b.kb=BB(b.hb));b.ib||(b.ib=new oD(Ue,1,13),b.jb=BB(b.ib));b.lb||(b.lb=new oD(Ue,0,11),BB(b.lb));hH(b,b.x);b.ac=!1;b.dc=!1;b.z=!0;b.tc=!0;b.C=!0;b.Bc=!0;b.cc=!1;aH=bH(b);b.oc=!0;try{m=mK(b.Ec,"options");null!=m&&cJ(b,m,!1);h=mK(b.Ec,"jme");null!=h&&(b._=h);l=mK(b.Ec,Ci);null!=l&&(b.rb=l);g=mK(b.Ec,"depictcgi");null!=g&&(b.gc=!0);r=mK(b.Ec,"smiles");null!=r&&(b.qc=r);o=mK(b.Ec,gk);null!=o&&(b.sb=\no,qF(b));b.u=mK(b.Ec,"atomcolors");b.t=mK(b.Ec,"atombg");f=mK(b.Ec,"depictbg");if(null!=f&&b.J){var t;var y,v,s,A;v=(EC(),GC);try{if(0!=f.indexOf(Fa))throw new Dp("bad hex encoding");A=DE(f.substr(1,2),16);s=DE(f.substr(3,2),16);y=DE(f.substr(5,2),16);t=v=new km(A,s,y)}catch(F){if(F=yq(F),G(F,97))oE(),t=v;else throw F;}b.D=t}b.mc&&b.ob&&vI(b.ob);j=mK(b.Ec,"notify_structural_change_js_function");b.Qb=j}catch(M){if(M=yq(M),!G(M,97))throw M;}b.k=202;dC(b);b.pb=new nK;f=a.c;null!=f._?(bI(f,f._,!1),null!=\nf.t&&f.ob&&jI(f.ob,f.t,!0),null!=f.u&&f.ob&&jI(f.ob,f.u,!1)):null!=f.rb?rI(f,f.rb,!1):null!=f.qc&&f.Ac&&(f.Ib=!1,SH(f,f.qc,null,!0));qF(a.c);h=this.b;f=this.d;var N,$,U,V,da,la;g=($=new cA((uF(),tF)),$.pb.alt="drag out MOL or RXN file",ky($,$.pb.alt),$);$=(N=new oK,V=g.a.e,da=g.a.a,U=~~((24-da)/2),0>U&&(U=0),la=new pK(f,V,U,g),qK(la),Dm(f.k,la),N.c=V,N.b=da,N.d=24,N.a=U,N);da=$.c;V=$.b;hF(new mF(h),f);U=0>=$J();N=new rF(h);U?(U=new rK,ky(U,g.pb.alt),0<=da&&(U.pb.style[Fk]=da+oj),0<=V&&(U.pb.style[Uh]=\nV+oj),V=new sF(f,U,da,$),Ty(V.d.f,V.b,oC(V.d)-V.c-V.a.a,pC(V.d)-(V.a.d-V.a.a)),Dm(f.k,V),U.pb.draggable=xk,U.pb.style[ih]=(hr(),Ji),uy(U,N,(Nt(),Nt(),Ot)),U.pb.style[Tf]=Qi):(g.pb.draggable=xk,g.pb.style[ih]=(hr(),Ji),uy(g,N,(Nt(),Nt(),Ot)),g.pb.style[Tf]=Qi)}else dF("JSME initialization error: HTML id "+a+" not found.")}function sK(){return kw(null)}function tK(a){return kw(a)}w(581,1,Kl,gK,iK,jK,hK);_.lg=function(a){vy(this.d,new uK(this,a),(ut(),ut(),vt))};\n_.mg=function(a){vy(this.d,new vK(this,a),(uu(),uu(),vu))};_.ng=function(a){vy(this.d,new wK(this,a),(Au(),Au(),Bu))};_.og=function(a){vy(this.d,new xK(this,a),(Du(),Du(),Eu))};_.pg=function(a){rq(2,new yK(this.b,a))};_.qg=function(){yG(this.b,!0)};_.rg=function(){Jq((Gq(),Hq),new zK(this))};_.sg=function(){var a,b,c;c=[];for(b=new zv(this.d.a);b.b<b.d.Tf();)a=Av(b),c[c.length]=a.q;return c};_.tg=function(){return this.b.a};_.ug=function(a){return this.b.b[a]};_.vg=Xw;_.wg=function(){return this.b.V};\n_.xg=function(){return this.b.nb};_.yg=function(){return this.b.tb};_.zg=function(){var a,b,c;b=null;if(a=(c=this.b.vb.a,c.a)){b=this.b;var d;c=b.ob.v;d=b.ob.w;b.ob.v=0;b.ob.w=0;zH(b.r);TI(b);b.ob.v=c;b.ob.w=d;b=a.q}return b};_.Ag=function(){return this.b.wb};_.Bg=function(){return this.b.xb};_.Cg=function(){return this.b.Qb};_.ge=function(){return Tq(this.d.pb,Wi)};_.Dg=function(){var a;a=[];a.length=2;a[0]=Tq(this.d.pb,Xi);a[1]=Tq(this.d.pb,Wi);return a};_.he=function(){return Tq(this.d.pb,Xi)};\n_.Eg=function(){return this.c.pb};_.Fg=function(){return this.b.Wb};_.Gg=function(){return this.b.Yb};_.Hg=function(){return this.b.i};_.Ig=function(a){dF("JSME initialization error: "+a)};_.Jg=function(){return this.b.J};_.je=function(){return this.c.pb.style.display!=Qi};_.Kg=function(){var a=this.b,b;a.dc?b=oJ(a,1)+Fd+oJ(a,2)+Fd+oJ(a,3):b=oJ(a,0);return b};_.Lg=function(a){return Qt(this.b,!0,a)};_.Mg=function(){var a=this.b,b,c;b=a.tc;a.tc=!1;c=UF(a);a.tc=b;return c};\n_.Ng=function(a){null!=a&&0<a.length&&cJ(this.b,a,!0)};_.Og=function(a){null!=a&&0<a.length&&SH(this.b,a,null,!0)};_.Pg=function(a){null!=a&&0<a.length&&rI(this.b,a,!0)};_.Qg=function(a){null!=a&&0<a.length&&bI(this.b,a,!0)};_.Rg=function(a){return eK(this,a)};_.gf=function(){fK(this)};_.Sg=function(){EJ(this.b)};_.Tg=function(a){var b=this.b;if(a=GJ(b,a)){var c;for(c=1;c<=a.p;++c)a.b[c].c=0;TI(b)}};_.Ug=function(a){this.b.k=a};_.Vg=function(a){this.b.e=new AK(this,a)};\n_.Wg=function(a){RJ(this.b,"AfterPaste",a)};_.Xg=function(a){RJ(this.b,Qd,a)};_.Yg=function(a){var b=this.d,c,d;if(b.b!=a){b.b=a;for(d=new zv(b.a);d.b<d.d.Tf();)c=Av(d),a?c.b=n:c.b=Qj}mC(b.c);b=this.b;b.tb=a;AH(b);dG(this.b,!0);mC(this.b)};_.Zg=function(a,b){var c=this.b,d;if(d=GJ(c,a))jI(d,b,!0),TI(c)};_.$g=function(a){var b=this.b;b.x!=a&&0<a&&100>a&&(b.x=a,hH(b,a),AH(b))};_._g=function(a,b){var c=this.b,d;d=GJ(c,a);1>b||b>d.p?(mu(c,"ERROR - invalid atom index: "+b),qF(c)):(d.v=b,TI(c))};\n_.ah=function(a){RJ(this.b,ee,a)};_.bh=function(a,b){RJ(this.b,a,b)};_.le=function(a){hy(this.d,a);fK(this)};_.ch=function(a){this.b.V=a};_.dh=function(a){HJ(this.b,a)};_.eh=function(a){var b=this.b;b.tb=a;AH(b)};_.fh=function(a){var b=this.b;b.wb=a;AH(b)};_.gh=function(a){IJ(this.b,a)};_.hh=function(a){this.b.Pb=a};_.ih=function(a){this.b.Qb=a};_.jh=function(a){var b=this.b;b.Wb=a;b.F=CG(b,!1)};_.kh=function(a){this.b.Yb=a};_.lh=function(a,b){iy(this.d,a,b);fK(this)};\n_.mh=function(a,b,c){c&&iy(this.c,a,b);iy(this.d,a,b);fK(this)};_.nh=function(a,b){jy(this.d,a,b);fK(this)};_.oh=function(a,b,c){c&&jy(this.c,a,b);jy(this.d,a,b);fK(this)};_.ph=function(a){pG(this.b,a)};_.qh=function(a,b){var c=this.b,d;c.q=!1;d=c.sc;c.sc=!1;c.uc=new DJ(c,a);c.sc=d;c.k=253;mu(c,b);qF(c)};_.me=function(a){qy(this.c.pb,a)};_.rh=function(a){this.b.i=a};_.ne=function(a){this.d.pb.style[Fk]=a;fK(this)};_.sh=function(a){YI(this.b,a)};_.th=function(){return UF(this.b)};_.a=-1;_.b=null;\n_.c=null;_.d=null;var kK=0;function zK(a){this.a=a}w(582,1,{},zK);_.pd=function(){var a,b;for(b=new zv(this.a.d.a);b.b<b.d.Tf();)a=Av(b),a.t.pb.innerHTML=a.q||n};_.a=null;function uK(a,b){this.a=a;this.b=b}w(583,1,{},uK);_.Jd=function(a){a=a.a;Jq((Gq(),Hq),new BK(this,this.b,a))};_.a=null;_.b=null;function BK(a,b,c){this.a=a;this.c=b;this.b=c}w(584,1,{},BK);_.pd=CK;_.a=null;_.b=null;_.c=null;function vK(a,b){this.a=a;this.b=b}w(585,1,{},vK);_.ld=function(a){a=a.a;Jq((Gq(),Hq),new DK(this,this.b,a))};\n_.a=null;_.b=null;function DK(a,b,c){this.a=a;this.c=b;this.b=c}w(586,1,{},DK);_.pd=CK;_.a=null;_.b=null;_.c=null;function xK(a,b){this.a=a;this.b=b}w(587,1,{},xK);_.a=null;_.b=null;function Gu(a,b,c){this.a=a;this.c=b;this.b=c}w(588,1,{},Gu);_.pd=CK;_.a=null;_.b=null;_.c=null;function wK(a,b){this.a=a;this.b=b}w(589,1,{},wK);_.nd=function(a){a=a.a;Jq((Gq(),Hq),new EK(this,this.b,a))};_.a=null;_.b=null;function EK(a,b,c){this.a=a;this.c=b;this.b=c}w(590,1,{},EK);_.pd=CK;_.a=null;_.b=null;_.c=null;\nfunction AK(a,b){this.a=a;this.b=b}w(591,1,{},AK);_.a=null;_.b=null;\nfunction FK(){var a=GK("JSApplet.JSME"),b;$wnd.JSApplet.JSME=C(function(){var a;HK(IK,arguments)?a=arguments[0]:3==arguments.length?a=new jK(arguments[0],arguments[1],arguments[2]):1==arguments.length?a=new gK(arguments[0]):4==arguments.length?a=new hK(arguments[0],arguments[1],arguments[2],arguments[3]):2==arguments.length&&(a=new iK(arguments[0],arguments[1]));this.g=a;JK();a[dg]=this;return this});b=$wnd.JSApplet.JSME.prototype={};b.addClickHandler=C(function(a){this.g.lg(null==a?null:a.constructor==\n$wnd.JSApplet.JsClosureJsme?a.g:new KK(a))});b.addMouseDownHandler=C(function(a){this.g.mg(null==a?null:a.constructor==$wnd.JSApplet.JsClosureJsme?a.g:new KK(a))});b.addMouseOutHandler=C(function(a){this.g.ng(null==a?null:a.constructor==$wnd.JSApplet.JsClosureJsme?a.g:new KK(a))});b.addMouseOverHandler=C(function(a){this.g.og(null==a?null:a.constructor==$wnd.JSApplet.JsClosureJsme?a.g:new KK(a))});b.alert=C(function(a){this.g.pg(a)});b.clear=C(function(){this.g.qg()});b.deferredRepaint=C(function(){this.g.rg()});\nb.getAllGraphicsString=C(function(){return this.g.sg()});b.getAlldefinedCallBackNames=C(function(){var a=this.g.b.a;JK();return a});b.getCallBack=C(function(a){return this.g.ug(a)});b.getCreationIndex=C(function(){return this.g.vg()});b.getHelpURL=C(function(){return this.g.b.V});b.getMenuScale=C(function(){return this.g.b.nb});b.getMolecularAreaAntiAlias=C(function(){return this.g.b.tb});b.getMolecularAreaGraphicsString=C(function(){return this.g.zg()});b.getMolecularAreaLineWidth=C(function(){return this.g.b.wb});\nb.getMolecularAreaScale=C(function(){return this.g.b.xb});b.getNotifyStructuralChangeJSfunction=C(function(){return this.g.b.Qb});b.getOffsetHeight=C(function(){return this.g.ge()});b.getOffsetSize=C(function(){return this.g.Dg()});b.getOffsetWidth=C(function(){return this.g.he()});b.getParentContainer=C(function(){return this.g.c.pb});b.getPasteLabel=C(function(){return this.g.b.Wb});b.getPrePasteJSfunction=C(function(){return this.g.b.Yb});b.getWebSearchInchiKeyBaseUrl=C(function(){return this.g.b.i});\nb.initializationError=C(function(a){this.g.Ig(a)});b.isDepictMode=C(function(){return this.g.b.J});b.isVisible=C(function(){return this.g.je()});b.jmeFile=C(function(){return this.g.Kg()});b.molFile=C(function(a){return this.g.Lg(a)});b.nonisomericSmiles=C(function(){return this.g.Mg()});b.options=C(function(a){this.g.Ng(a)});b.readGenericMolecularInput=C(function(a){this.g.Og(a)});b.readMolFile=C(function(a){this.g.Pg(a)});b.readMolecule=C(function(a){this.g.Qg(a)});b.read_MOL_SDF_RXN=C(function(a){return this.g.Rg(a)});\nb.repaint=C(function(){this.g.gf()});$wnd.JSApplet.JSME.replaceAllAppletsByJSME=C(function(a){return LK(null,arguments,!0)[0]});b.reset=C(function(){this.g.Sg()});b.resetAtomColors=C(function(a){this.g.Tg(a)});b.setAction=C(function(a){this.g.Ug(a)});b.setAfterDepictEditToggleEventHandler=C(function(a){this.g.Vg(null==a?null:a.constructor==$wnd.JSApplet.JsClosureJsme?a.g:new KK(a))});b.setAfterPasteCallback=C(function(a){this.g.Wg(a)});b.setAfterStructureModifiedCallback=C(function(a){this.g.Xg(a)});\nb.setAntialias=C(function(a){this.g.Yg(a)});b.setAtomBackgroundColors=C(function(a,b){this.g.Zg(a,b)});b.setAtomMolecularAreaFontSize=C(function(a){this.g.$g(a)});b.setAtomToHighLight=C(function(a,b){this.g._g(a,b)});b.setBeforePasteCallback=C(function(a){this.g.ah(a)});b.setCallBack=C(function(a,b){this.g.bh(a,b)});b.setHeight=C(function(a){this.g.le(a)});b.setHelpURL=C(function(a){this.g.ch(a)});b.setMenuScale=C(function(a){this.g.dh(a)});b.setMolecularAreaAntiAlias=C(function(a){this.g.eh(a)});\nb.setMolecularAreaLineWidth=C(function(a){this.g.fh(a)});b.setMolecularAreaScale=C(function(a){this.g.gh(a)});b.setNotifyAtomHighLightChangeJSfunction=C(function(a){this.g.hh(a)});b.setNotifyStructuralChangeJSfunction=C(function(a){this.g.ih(a)});b.setPasteLabel=C(function(a){this.g.jh(a)});b.setPrePasteJSfunction=C(function(a){this.g.kh(a)});b.setSize=C(function(a,b,e){LK(this.g,arguments,!1)});b.setSubstituent=C(function(a){this.g.ph(a)});b.setTemplate=C(function(a,b){this.g.qh(a,b)});b.setVisible=\nC(function(a){this.g.me(a)});b.setWebSearchInchiKeyBaseUrl=C(function(a){this.g.rh(a)});b.setWidth=C(function(a){this.g.ne(a)});b.showInfo=C(function(a){this.g.sh(a)});b.smiles=C(function(){return this.g.th()});MK({"0":{2:[[function(){return this.lh.apply(this,arguments)},null,void 0,Ui,Ui],[function(){return this.nh.apply(this,arguments)},null,void 0,Vj,Vj]],3:[[function(){return this.oh.apply(this,arguments)},null,void 0,Vj,Vj,Fg],[function(){return this.mh.apply(this,arguments)},null,void 0,Ui,\nUi,Fg]]}},!1);MK({"0":{"0":[[sK,null,void 0]],1:[[tK,null,function(a,b){var e;null==b[0]?e=null:(e=b[0],e=e.constructor==$wnd.JSApplet.JsClosure?e.g:new NK(e));return[e]},Gh]]}},!0);OK(IK,$wnd.JSApplet.JSME);if(a)for(p in a)void 0===$wnd.JSApplet.JSME[p]&&($wnd.JSApplet.JSME[p]=a[p])}function iw(){PK||(PK=!0,FK())}w(592,1,{},iw);var PK=!1;\nfunction mw(){if($wnd.jsmeOnLoad&&typeof $wnd.jsmeOnLoad==Gh)$wnd.jsmeOnLoad();else try{$wnd.console.log(\'Warning: the global function "jsmeOnLoad" is not defined.\\n If you have defined it, there might be a syntax error in your javascript code.\')}catch(a){}}function lw(){}w(594,1,{},lw);_.pd=function(){mw()};function NK(a){this.a=a}w(596,1,{85:1,133:1},NK);_.eQ=function(a){return null!=a&&G(a,85)&&this.a==a.a};_.a=null;function KK(a){this.a=a}w(597,1,{86:1,133:1},KK);\n_.eQ=function(a){return null!=a&&G(a,86)&&this.a==a.a};_.a=null;function qK(a){Ty(a.e.f,a.b,oC(a.e)-a.d-a.c,pC(a.e)-(a.a-a.c))}function pK(a,b,c,d){this.e=a;this.d=b;this.c=c;this.a=24;this.b=d}w(598,1,{},pK);_.Yf=function(){qK(this)};_.a=0;_.b=null;_.c=0;_.d=0;_.e=null;function oK(){}w(599,1,{},oK);_.a=0;_.b=0;_.c=0;_.d=0;\nfunction gF(a){var b,c,d,e,f,g;if(a.b>=a.c.length)return!1;c=a.c[a.b];g=c.getAttribute(Fk)||n;b=c.getAttribute(Uh)||n;f=c.getAttribute(Ni)||n;e=c.getAttribute(Xh)||n;var h,j,l;l={};for(d=0;d<c.childNodes.length;++d)h=c.childNodes[d],"PARAM"==h.nodeName&&(j=h,h=j.getAttribute(Ni)||n,j=j.getAttribute(Ak)||n,null!=h&&0<h.length&&null!=j&&0<j.length&&(l[h]=j));c.removeAttribute(Yg);c.removeAttribute(Ni);c.removeAttribute("archive");c.removeAttribute(Uh);c.removeAttribute(Fk);c.removeAttribute(tg);c.removeAttribute("hspace");\nc.removeAttribute("vspace");c.removeAttribute("codebase");c.textContent=n||n;d=cr();c.setAttribute(Xh,d);c.style[Fk]=cF(g);c.style[Uh]=cF(b);b=new QK(a,d,l,e,c,f);Jq((Gq(),Hq),b);++a.b;return!0}function fF(a){this.a="JME.class";this.d=a}w(600,1,{},fF);_.Bd=function(){return gF(this)};_.a=null;_.b=0;_.c=null;_.d=null;function QK(a,b,c,d,e,f){this.a=a;this.d=b;this.b=c;this.e=d;this.c=e;this.f=f}w(601,1,{},QK);\n_.pd=function(){var a,b,c;c=new $wnd.JSApplet.JSME(this.d,Kc,Kc,this.b);null!=this.e&&0<this.e.length?this.c.setAttribute(Xh,this.e):this.c.removeAttribute(Xh);b=$doc;null!=this.f&&0<this.f.length&&(b[this.f]=c);a=b.jsapplets;a||(a=[],b.jsapplets=a);a[a.length]=c;this.a.d&&this.a.d.a.apply(c,[c])};_.a=null;_.b=null;_.c=null;_.d=null;_.e=null;_.f=null;function RK(){}w(602,1,Kl,RK);function SK(a){this.a=a}w(603,1,{},SK);_.pd=function(){this.a()};_.a=null;function TK(a){this.a=a}w(604,1,{},TK);\n_.Bd=function(){this.a();return!1};_.a=null;\nfunction UK(){var a=GK("JSApplet.Utils");$wnd.JSApplet.Utils=C(function(){var a;HK(VK,arguments)?a=arguments[0]:0==arguments.length&&(a=new RK);this.g=a;JK();a[dg]=this;return this});$wnd.JSApplet.Utils.prototype={};$wnd.JSApplet.Utils.runAfterBrowserEventLoopReturns=C(function(a){Jq((Gq(),Hq),new SK(a))});$wnd.JSApplet.Utils.runAfterFixedDelay=C(function(a,c){Mq((Gq(),new TK(a)),c)});$wnd.JSApplet.Utils.safeLog=C(function(a){dF(a)});OK(VK,$wnd.JSApplet.Utils);if(a)for(p in a)void 0===$wnd.JSApplet.Utils[p]&&\n($wnd.JSApplet.Utils[p]=a[p])}function jw(){WK||(WK=!0,UK())}w(605,1,{},jw);var WK=!1;function XK(a){this.f=a}w(606,547,Jl,XK);function sw(){this.f="divide by zero"}w(607,136,dm,sw);function Oy(){}function YK(a){this.f=a}w(609,136,dm,Oy,YK);function bw(){}w(610,136,dm,bw);function iG(){iG=x;kG=new ZK(!1);jG=new ZK(!0)}function ZK(a){this.a=a}w(611,1,{89:1,91:1,94:1},ZK);_.eQ=function(a){return G(a,91)&&a.a==this.a};_.hC=function(){return this.a?1231:1237};_.tS=function(){return this.a?xk:zh};\n_.a=!1;var kG,jG;function UE(a,b,c){var d,e;d=$K(a,b++);if(c=55296<=d&&56319>=d&&b<c)a=e=a.charCodeAt(b),c=56320<=a&&57343>=a;return c?65536+((d&1023)<<10)+(e&1023):d}function aL(a,b){return 2>b||36<b?-1:48<=a&&a<48+(10>b?b:10)?a-48:97<=a&&a<b+97-10?a-97+10:65<=a&&a<b+65-10?a-65+10:-1}function eF(a){return null!=String.fromCharCode(a).match(/\\d/)}function bL(){}function cL(a){return typeof a==Ui?Hf+(0>a?-a:a):a}\nfunction dL(a,b){var c;c=new bL;c.d=we+(eL(0!=a?-a:0)?cL(0!=a?-a:0):n+Op(c));fL(0!=a?-a:0)&&gL(0!=a?-a:0,c);c.b=4;c.a=b;return c}function W(a){var b;b=new bL;b.d=we+(eL(a)?cL(a):n+Op(b));fL(a)&&gL(a,b);return b}function hL(a,b){var c;c=new bL;c.d=we+(eL(a)?cL(a):n+Op(c));fL(a)&&gL(a,c);c.b=b?8:0;return c}function iL(){var a;a=new bL;a.d=we+(eL(0)?cL(0):n+Op(a));fL(0)&&gL(0,a);a.b=2;return a}function jL(a){var b;b=new bL;b.d=we+(eL(a)?cL(a):n+Op(b));fL(a)&&gL(a,b);b.b=1;return b}\nfunction fL(a){return typeof a==Ui&&0<a}function eL(a){return null!=a&&0!=a}function gL(a,b){var c;b.c=a;if(2==a)c=String.prototype;else if(0<a)if(c=hl[b.c])c=c.prototype;else{c=hl[a]=function(){};c.cZ=b;return}else return;c.cZ=b}w(613,1,{},bL);_.tS=function(){return(0!=(this.b&2)?"interface ":0!=(this.b&1)?n:"class ")+this.d};_.a=null;_.b=0;_.c=0;_.d=null;\nfunction kL(a){var b;if(!(b=lL,!b&&(b=lL=/^\\s*[+-]?(NaN|Infinity|((\\d+\\.?\\d*)|(\\.\\d+))([eE][+-]?\\d+)?[dDfF]?)\\s*$/),b.test(a)))throw new mL(Le+a+na);return parseFloat(a)}function DE(a,b){var c,d;if(null==a)throw new mL(Ti);if(2>b||36<b)throw new mL("radix "+b+" out of range");d=a.length;for(c=0<d&&45==a.charCodeAt(0)?1:0;c<d;++c)if(-1==aL(a.charCodeAt(c),b))throw new mL(Le+a+na);c=parseInt(a,b);if(isNaN(c))throw new mL(Le+a+na);if(-2147483648>c||2147483647<c)throw new mL(Le+a+na);return c}\nw(615,1,{89:1,102:1});var lL=null;function nL(a){this.a=a}w(614,615,{89:1,94:1,95:1,102:1},nL);_.eQ=function(a){return G(a,95)&&a.a==this.a};_.hC=oL;_.tS=pL;_.a=0;function DC(a){this.a=a}w(616,615,{89:1,94:1,98:1,102:1},DC);_.eQ=function(a){return G(a,98)&&a.a==this.a};_.hC=oL;_.tS=pL;_.a=0;function rC(){}function Sm(a){this.f=a}w(617,136,{89:1,97:1,99:1,105:1,106:1},rC,Sm);function uC(a){this.a=a}\nfunction Fw(a){var b,c;if(0>a)return 0;if(0==a)return 32;b=-(a>>16)>>16&16;c=16-b;a>>=b;b=a-256>>16&8;c+=b;a<<=b;b=a-4096>>16&4;c+=b;a<<=b;b=a-16384>>16&2;c+=b;a=a<<b>>14;return c+2-(a&~(a>>1))}function xw(a){var b,c;if(0==a)return 32;c=0;for(b=1;0==(b&a);b<<=1)++c;return c}function gm(a){var b,c,d;b=D(qL,sl,-1,8,1);c=(rL(),sL);d=7;if(0<=a)for(;15<a;)b[d--]=c[a&15],a>>=4;else for(;0<d;)b[d--]=c[a&15],a>>=4;b[d]=c[a&15];return tL(b,d,8)}\nfunction OH(a){var b,c;return-129<a&&128>a?(b=a+128,c=(uL(),vL)[b],!c&&(c=vL[b]=new uC(a)),c):new uC(a)}w(618,615,{89:1,94:1,100:1,102:1},uC);_.eQ=function(a){return G(a,100)&&a.a==this.a};_.hC=Xw;_.tS=pL;_.a=0;function uL(){uL=x;vL=D(aJ,u,100,256,0)}var vL;function pH(a){return 0>=a?0-a:a}function qH(a){return 0>a?-a:a}function Xm(a,b){return a>b?a:b}function Q(a){return Math.round(a)}function wL(a){return Math.sqrt(a)}function nE(){}function ov(a){this.f=a}\nw(622,136,{89:1,97:1,101:1,105:1,106:1},nE,ov);function rL(){rL=x;sL=z(qL,sl,-1,[48,49,50,51,52,53,54,55,56,57,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122])}var sL;function mL(a){this.f=a}w(624,617,{89:1,97:1,99:1,103:1,105:1,106:1},mL);function $K(a,b){return a.charCodeAt(b)}function xL(a,b){return-1!=a.lastIndexOf(b)&&a.lastIndexOf(b)==a.length-b.length}function H(a,b){return!G(b,1)?!1:""+a==b}function my(a,b){return a.indexOf(b)}\nfunction BE(a,b,c){return a.indexOf(b,c)}function zB(a,b){return a.lastIndexOf(b)}function cK(a,b,c){var d;for(d=0;0<=(d=c.indexOf(Yf,d));)36==c.charCodeAt(d+1)?c=c.substr(0,d-0)+Ha+py(c,++d):c=c.substr(0,d-0)+py(c,++d);return a.replace(RegExp(b,Hh),c)}\nfunction yL(a,b){for(var c=RegExp(b,Hh),d=[],e=0,f=a,g=null;;){var h=c.exec(f);if(null==h||f==n){d[e]=f;break}else d[e]=f.substring(0,h.index),f=f.substring(h.index+h[0].length,f.length),c.lastIndex=0,g==f&&(d[e]=f.substring(0,1),f=f.substring(1)),g=f,e++}if(0<a.length){for(c=d.length;0<c&&d[c-1]==n;)--c;c<d.length&&d.splice(c,d.length-c)}c=D(hw,u,1,d.length,0);for(e=0;e<d.length;++e)c[e]=d[e];return c}function py(a,b){return a.substr(b,a.length-b)}function mE(a,b,c){return a.substr(b,c-b)}\nfunction oy(a){return 0==a.length||a[0]>ga&&a[a.length-1]>ga?a:a.replace(/^(\\s*)/,n).replace(/\\s*$/,n)}function tL(a,b,c){a=a.slice(b,c);return String.fromCharCode.apply(null,a)}\nfunction zL(a,b,c){if(128>c)return a[b]=(c&127)<<24>>24,1;if(2048>c)return a[b++]=(c>>6&31|192)<<24>>24,a[b]=(c&63|128)<<24>>24,2;if(65536>c)return a[b++]=(c>>12&15|224)<<24>>24,a[b++]=(c>>6&63|128)<<24>>24,a[b]=(c&63|128)<<24>>24,3;if(2097152>c)return a[b++]=(c>>18&7|240)<<24>>24,a[b++]=(c>>12&63|128)<<24>>24,a[b++]=(c>>6&63|128)<<24>>24,a[b]=(c&63|128)<<24>>24,4;if(67108864>c)return a[b++]=(c>>24&3|248)<<24>>24,a[b++]=(c>>18&63|128)<<24>>24,a[b++]=(c>>12&63|128)<<24>>24,a[b++]=(c>>6&63|128)<<24>>\n24,a[b]=(c&63|128)<<24>>24,5;throw new Sm("Character out of range: "+c);}function ny(a){var b;return 65536<=a?(b=56320+(a-65536&1023)&65535,String.fromCharCode(55296+(a-65536>>10&1023)&65535)+String.fromCharCode(b)):String.fromCharCode(a&65535)}function AL(a){var b,c,d,e,f;e=a.length;for(d=b=0;d<e;)c=UE(a,d,a.length),d+=65536<=c?2:1,128>c?++b:2048>c?b+=2:65536>c?b+=3:2097152>c?b+=4:67108864>c&&(b+=5);b=D(BL,rl,-1,b,1);for(d=f=0;d<e;)c=UE(a,d,a.length),d+=65536<=c?2:1,f+=zL(b,f,c);return b}_=String.prototype;\n_.cM={1:1,89:1,92:1,94:1};_.eQ=function(a){return H(this,a)};_.hC=function(){return $D(this)};_.tS=_.toString;function CL(){CL=x;DL={};EL={}}function $D(a){CL();var b=bd+a,c=EL[b];if(null!=c)return c;c=DL[b];if(null==c){var d,e,f,c=0;e=a.length;f=e-4;for(d=0;d<f;)c=a.charCodeAt(d+3)+31*(a.charCodeAt(d+2)+31*(a.charCodeAt(d+1)+31*(a.charCodeAt(d)+31*c)))|0,d+=4;for(;d<e;)c=31*c+$K(a,d++);c|=0}256==FL&&(DL=EL,EL={},FL=0);++FL;return EL[b]=c}var DL,FL=0,EL;function GL(a){a.a=new Sq}\nfunction Ap(a,b){Bp(a.a,b);return a}function zp(){GL(this)}function BJ(){GL(this);this.a.a+=n}w(626,1,Bl,zp,BJ);_.tS=HL;function zE(a,b){Bp(a.a,String.fromCharCode(b))}function Tw(){GL(this)}function yE(){GL(this)}function Rv(a){GL(this);Bp(this.a,a)}w(627,1,Bl,Tw,yE,Rv);_.tS=HL;function CE(a){this.f="String index out of range: "+a}w(628,609,dm,CE);function IE(a){this.f=a}w(630,136,dm,IE);function IL(a,b){for(var c;a.Zd();)if(c=a.$d(),null==b?null==c:Kp(b,c))return a;return null}\nfunction JL(a,b){var c;return(c=IL(a.ye(),b))?(c._d(),!0):!1}function KL(a){var b,c,d,e;d=new zp;b=null;d.a.a+=Wf;for(c=a.ye();c.Zd();)null!=b?Bp(d.a,b):b=nb,e=c.$d(),Bp(d.a,e===a?"(this Collection)":n+e);d.a.a+=cg;return d.a.a}w(633,1,{});_.uh=function(){throw new IE("Add not supported on this collection");};_.vh=function(a){return!!IL(this.ye(),a)};_.Qf=HE;_.wh=function(a){return JL(this,a)};_.tS=function(){return KL(this)};w(635,633,Il);\n_.eQ=function(a){var b;if(a===this)return!0;if(!G(a,112)||a.Tf()!=this.Tf())return!1;for(a=a.ye();a.Zd();)if(b=a.$d(),!this.vh(b))return!1;return!0};_.hC=function(){var a,b,c;a=0;for(b=this.ye();b.Zd();)c=b.$d(),null!=c&&(a+=Np(c),a=~~a);return a};function LL(a,b){var c;return G(b,110)&&(c=b.xh(),Wx(a.a,c))?(c=Fv(a.a,c),a.a.Uf(b.yh(),c)):!1}function NE(a){this.a=a}w(634,635,Il,NE);_.vh=function(a){return LL(this,a)};_.ye=function(){return new ML(this.a)};\n_.wh=function(a){return LL(this,a)?(a=a.xh(),Hv(this.a,a),!0):!1};_.Tf=NL;_.a=null;function OL(a){if(a.b)PL(a.a),Hv(a.c,a.b.xh()),a.b=null;else throw new yy("Must call next() before remove().");}function ML(a){var b;this.c=a;b=new Jm;a.c&&Dm(b,new QL(a));var c=a.e,d;for(d in c)if(58==d.charCodeAt(0)){var e=new RL(a,d.substring(1));b.uh(e)}var a=a.a,f;for(f in a)if(c=parseInt(f,10),f==c){c=a[c];d=0;for(e=c.length;d<e;++d)b.uh(c[d])}this.a=new zv(b)}w(636,1,{},ML);_.Zd=function(){return SL(this.a)};\n_.$d=function(){return this.b=Av(this.a)};_._d=function(){OL(this)};_.a=null;_.b=null;_.c=null;w(638,1,Gl);_.eQ=function(a){return G(a,110)&&GE(this.xh(),a.xh())&&GE(this.yh(),a.yh())?!0:!1};_.hC=function(){var a,b;b=a=0;null!=this.xh()&&(a=Np(this.xh()));null!=this.yh()&&(b=Np(this.yh()));return a^b};_.tS=function(){return this.xh()+Ed+this.yh()};function QL(a){this.a=a}w(637,638,Gl,QL);_.xh=function(){return null};_.yh=function(){return this.a.b};_.zh=function(a){return KE(this.a,a)};_.a=null;\nfunction RL(a,b){this.b=a;this.a=b}w(639,638,Gl,RL);_.xh=Xw;_.yh=function(){return this.b.e[bd+this.a]};_.zh=function(a){return LE(this.b,this.a,a)};_.a=null;_.b=null;function TL(a,b){var c,d,e,f;if(b===a)return!0;if(!G(b,108)||a.Tf()!=b.Tf())return!1;e=a.ye();for(f=b.ye();e.Zd();)if(c=e.$d(),d=f.$d(),!(null==c?null==d:Kp(c,d)))return!1;return!0}function eD(a,b){(0>a||a>=b)&&UL(a,b)}function UL(a,b){throw new YK("Index: "+a+", Size: "+b);}w(640,633,ql);\n_.Ah=function(){throw new IE("Add not supported on this list");};_.uh=function(a){this.Ah(this.Tf(),a);return!0};_.eQ=function(a){return TL(this,a)};_.hC=function(){var a,b,c;b=1;for(a=this.ye();a.Zd();)c=a.$d(),b=31*b+(null==c?0:Np(c)),b=~~b;return b};_.ye=function(){return new zv(this)};_.Ch=function(){return this.Dh(0)};_.Dh=function(a){return new VL(this,a)};_.Eh=function(){throw new IE("Remove not supported on this list");};function SL(a){return a.b<a.d.Tf()}\nfunction Av(a){if(a.b>=a.d.Tf())throw new Ry;return a.d.Bh(a.c=a.b++)}function PL(a){if(0>a.c)throw new sB;a.d.Eh(a.c);a.b=a.c;a.c=-1}function zv(a){this.d=a}w(641,1,{},zv);_.Zd=function(){return SL(this)};_.$d=function(){return Av(this)};_._d=function(){PL(this)};_.b=0;_.c=-1;_.d=null;function VL(a,b){var c;this.d=this.a=a;c=a.Tf();(0>b||b>c)&&UL(b,c);this.b=b}w(642,641,{},VL);_.Fh=function(){return 0<this.b};_.Gh=function(){if(0>=this.b)throw new Ry;return this.a.Bh(this.c=--this.b)};_.a=null;\nfunction WL(a){a=new ML(a.b.a);return new XL(a)}function YL(a,b){this.a=a;this.b=b}w(643,635,Il,YL);_.vh=ZL;_.ye=function(){return WL(this)};_.Tf=function(){return this.b.a.d};_.a=null;_.b=null;function XL(a){this.a=a}w(644,1,{},XL);_.Zd=function(){return SL(this.a.a)};_.$d=function(){return(this.a.b=Av(this.a.a)).xh()};_._d=function(){OL(this.a)};_.a=null;function $L(a){a.b=D(aM,u,0,0,0)}function AD(a,b,c){(0>b||b>a.c)&&UL(b,a.c);a.b.splice(b,0,c);++a.c}\nfunction Dm(a,b){nq(a.b,a.c++,b);return!0}function Dx(a,b){eD(b,a.c);return a.b[b]}function AA(a,b){for(var c=0;c<a.c;++c)if(GE(b,a.b[c]))return c;return-1}function bM(a,b){var c;c=(eD(b,a.c),a.b[b]);a.b.splice(b,1);--a.c;return c}function wm(a,b){var c;c=AA(a,b);if(-1==c)return!1;bM(a,c);return!0}function kD(a,b,c){eD(b,a.c);nq(a.b,b,c)}function Vm(a,b){var c;if(b.length<a.c){c=b;var d;d=Xv(0,a.c);z(c.cZ,c.cM,c.qI,d);b=d}for(c=0;c<a.c;++c)nq(b,c,a.b[c]);b.length>a.c&&nq(b,a.c,null);return b}\nfunction Jm(){$L(this)}function jD(a){$L(this);this.b.length=a}function yC(a){$L(this);a=Wv(a.b,a.c);Array.prototype.splice.apply(this.b,[0,0].concat(a));this.c=this.b.length}w(648,640,kl,Jm,jD,yC);_.Ah=function(a,b){AD(this,a,b)};_.uh=function(a){return Dm(this,a)};_.qg=function(){this.b=D(aM,u,0,0,0);this.c=0};_.vh=function(a){return-1!=AA(this,a)};_.Bh=function(a){return Dx(this,a)};_.Qf=function(){return 0==this.c};_.Eh=function(a){return bM(this,a)};_.wh=function(a){return wm(this,a)};_.Tf=At;\n_.c=0;function Iv(){Iv=x;Ov=new cM}var Ov;function cM(){}w(651,640,$l,cM);_.vh=MJ;_.Bh=function(){throw new Oy;};_.Tf=function(){return 0};function dM(){this.a=new Date}function eM(a){return 10>a?Fc+a:n+a}w(654,1,{89:1,93:1,94:1,107:1},dM);_.eQ=function(a){return G(a,107)&&Gw(J(this.a.getTime()),J(a.a.getTime()))};\n_.hC=function(){var a;a=J(this.a.getTime());var b,c,d,e;c=32;d=a.h&1048575;22>c?(e=d>>>c,b=a.m>>c|d<<22-c,c=a.l>>c|a.m<<22-c):44>c?(e=0,b=d>>>c-22,c=a.m>>c-22|a.h<<44-c):(b=e=0,c=d>>>c-44);b=ow(c&4194303,b&4194303,e&1048575);a=ow(a.l^b.l,a.m^b.m,a.h^b.h);return P(a)};\n_.tS=function(){var a,b;b=-this.a.getTimezoneOffset();a=(0<=b?jb:n)+~~(b/60);b=10>(0>b?-b:b)%60?Fc+(0>b?-b:b)%60:n+(0>b?-b:b)%60;return(fM(),gM)[this.a.getDay()]+ga+hM[this.a.getMonth()]+ga+eM(this.a.getDate())+ga+eM(this.a.getHours())+bd+eM(this.a.getMinutes())+bd+eM(this.a.getSeconds())+" GMT"+a+b+ga+this.a.getFullYear()};_.a=null;function fM(){fM=x;gM=z(hw,u,1,"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(","));hM=z(hw,u,1,"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","))}var gM,hM;\nfunction xv(a,b){return null==E(a.a,b,a)}function wv(){this.a=new xp}w(656,635,{89:1,93:1,112:1},wv);_.uh=function(a){return xv(this,a)};_.vh=ZL;_.Qf=function(){return 0==this.a.d};_.ye=function(){return WL(new YL(this.a,new NE(this.a)))};_.wh=function(a){return null!=Hv(this.a,a)};_.Tf=NL;_.tS=function(){return KL(new YL(this.a,new NE(this.a)))};_.a=null;function FE(a,b){this.a=a;this.b=b}w(660,638,Gl,FE);_.xh=Xw;_.yh=Bz;_.zh=function(a){var b;b=this.b;this.b=a;return b};_.a=null;_.b=null;\nfunction Ry(){}w(661,136,{89:1,97:1,105:1,106:1,111:1},Ry);function iM(a){var b,c;b=a.b;c=a.d.length;if(b<c){if(a.c){if(0<=BE(a.a,ny(a.d.charCodeAt(a.b)),0))return a=$K(a.d,a.b++),String.fromCharCode(a);for(++a.b;a.b<c;++a.b)if(0<=BE(a.a,ny(a.d.charCodeAt(a.b)),0))return mE(a.d,b,a.b);return py(a.d,b)}for(;b<c&&0<=BE(a.a,ny(a.d.charCodeAt(b)),0);)++b;a.b=b;if(b<c){for(++a.b;a.b<c;++a.b)if(0<=BE(a.a,ny(a.d.charCodeAt(a.b)),0))return mE(a.d,b,a.b);return py(a.d,b)}}throw new Ry;}\nfunction jM(a){if(null!=a)this.d=a,this.a=ha,this.c=!1,this.b=0;else throw new nE;}w(663,1,{},jM);_.a=null;_.b=0;_.c=!1;_.d=null;function GE(a,b){return cw(a)===cw(b)||null!=a&&Kp(a,b)}function iD(a){var b=D(kM,u,60,0,0);return Vm(a.a,b)}function fC(){this.a=new Jm}w(675,640,kl,fC);_.Ah=function(a,b){AD(this.a,a,b)};_.uh=function(a){return Dm(this.a,a)};_.vh=function(a){return-1!=AA(this.a,a)};_.Bh=function(a){return Dx(this.a,a)};_.Qf=function(){return 0==this.a.c};_.ye=function(){return new zv(this.a)};\n_.Eh=function(a){return bM(this.a,a)};_.Tf=function(){return this.a.c};_.tS=function(){return KL(this.a)};_.a=null;function lM(a,b){this.b=a;this.a=b}w(676,1,{},lM);_.a=null;_.b=null;function mM(){wB.call(this,"^[A-Z]{14}\\\\-[A-Z]{10}\\\\-[A-Z]$",0)}function nM(a,b){wB.call(this,a,b)}w(677,468,{},mM,nM);function iH(a){for(var b=[],c=0;c<a;c++)b[c]=0;return b}\nfunction oM(){oM=x;aF("^(\\\\d+)([A-Z][a-z]?)(\\\\b.*)",0);pM=aF("^(\\\\d+)?\\\\s*([A-Z][a-z]?)\\\\s*(?:(?:(\\\\d+)([+-]))|((?:\\\\++)|(?:-+)))?([^:+-]+?([,;#!])?[^:+-]+?)?(?::(\\\\d+))?$",0)}function WI(a,b,c){a.q=b;a.r=c}function fJ(a,b){6>a.j&&(++a.j,a.p[a.j]=b)}function qM(a){var b;b=new hJ;b.f=a.f;b.d=a.d;b.q=a.q;b.r=a.r;b.s=a.s;b.n=a.n;b.e=a.e;b.p=a.p.slice();b.j=a.j;b.c=a.c;b.a=a.a;b.b=a.b;b.i=a.i;b.o=a.o;b.k=a.k;return b}function II(a){return-99199!=a.f?a.f:0}function rM(a){return 4<=a.o&&2==a.j}\nfunction wG(a,b,c){a.q+=b;a.r+=c}function nG(a){var b;b=-99199!=a.f;a.f=-99199;return b}function hJ(){oM();this.p=iH(7)}w(681,1,{115:1},hJ);_.a=3;_.b=null;_.c=0;_.d=0;_.e=null;_.f=-99199;_.i=0;_.j=0;_.k=0;_.n=0;_.o=0;_.q=0;_.r=0;_.s=0;var pM;function tJ(a,b){var c;c=sM(a);return 0<c?b-c:0}function sM(a){a=Fv((!tM&&uM(),tM),a);return null!=a?a[0]:-1}\nfunction uM(){var a,b,c,d,e,f;a=yL("H.1,2,3.He.3,4.Li.6,7.Be.9.B.10,11.C.12,13,14.N.14,15.O.16,17,18.F.19.Ne.20,21,22.Na.23.Mg.24,25,26.Al.27.Si.28,29,30.P.31.S.32,33,34,36.Cl.35,37.Ar.36,38,40.K.39,40,41.Ca.40,42,43,44,46,48.Sc.45.Ti.46,47,48,49,50.V.50,51.Cr.50,52,53,54.Mn.55.Fe.54,56,57,58.Co.59.Ni.58,60,61,62,64.Cu.63,65.Zn.64,66,67,68,70.Ga.69,71.Ge.70,72,73,74,76.As.75.Se.74,76,77,78,80,82.Br.79,81.Kr.78,80,82,83,84,86.Rb.85,87.Sr.84,86,87,88.Y.90.Zr.90,91,92,94,96.Nb.93.Mo.92,94,95,96,97,98,100.Tc.99.Ru.96,98,99,100,101,102,104.Rh.103.Pd.102,104,105,106,108,110.Ag.107,109.Cd.106,108,110,111,112,113,114,116.In.113,115.Sn.112,114,115,116,117,118,119,120,122,124.Sb.121,123.Te.120,122,123,124,125,126,128,130.I.127.Xe.124,126,128,129,130,131,132,134,136.Cs.133.Ba.130,132,134,135,136,137,138.La.138,139.Ce.136,138,140,142.Pr.141.Nd.142,143,144,145,146,148,150.Pm.145.Sm.144,147,148,149,150,152,154.Eu.151,153.Gd.152,154,155,156,157,158,160.Tb.159.Dy.156,158,160,161,162,163,164.Ho.165.Er.162,164,166,167,168,170.Tm.169.Yb.168,170,171,172,173,174,176.Lu.175,176.Hf.174,176,177,178,179,180.Ta.180,181.W.180,182,183,184,186.Re.185,187.Os.184,186,187,188,189,190,192.Ir.191,193.Pt.190,192,194,195,196,198.Au.197.Hg.197,198,199,200,201,202,204.Tl.203,205.Pb.204,206,207,208.Bi.209.Po.209.At.210.Rn.222.Fr.223.Ra.226.Ac.227.Th.232.Pa.231.U.234,235,238.Np.237.Pu.244.Am.243.Cm.247.Bk.247.Cf.251.Es.254.Fm.257.Md.258.No.255.Lr.256.Ku.261",Zf);\ntM=new xp;for(b=0;b<a.length-1;b+=2){f=a[b];e=yL(a[b+1],kb);c=D(B,q,-1,e.length,1);for(d=0;d<e.length;++d)c[d]=DE(e[d],10);E(tM,f,c)}}var tM=null;function vM(a){var b;b=new wM;xM(b,a);return b}function lJ(a,b){var c,d;c=b[a.i];d=b[a.j];a.a=P(J(Q((c.q+d.q)/2)));a.b=P(J(Q((c.r+d.r)/2)))}function xM(a,b){a.i=b.i;a.j=b.j;a.c=b.c;a.f=b.f;a.d=b.d;a.a=b.a;a.b=b.b;a.e=b.e}function wM(){}w(686,1,{116:1},wM);_.a=0;_.b=0;_.c=1;_.d=null;_.e=0;_.f=0;_.i=0;_.j=0;function yM(){}w(687,1,{},yM);_.a=0;_.b=0;_.c=0;\n_.d=0;function oI(a){if(!(a.a!=a.b&&a.a.b!=a.b))throw new yy("Cannot undo. Index is out of range.");if(!a.a.b)throw new yy($e);a.a=a.a.b;return a.a.a}function nK(){this.a=this.b=new zM}w(688,1,{},nK);_.a=null;function zM(){this.a=null}function yH(a){this.a=a}w(689,1,{},zM,yH);_.a=null;_.b=null;_.c=null;function AM(){AM=x;BM=new mM;CM=new nM("^[a-z0-9@+\\\\-\\\\[\\\\]\\\\(\\\\)\\\\\\\\\\\\/%=#$:>\\\\.]+$",2);DM=new nM("\\\\s+",2)}\nfunction TH(a){AM();var b,c,d,e;this.i=this.f=null;this.j=0;this.e=!1;this.a=this.c=null;var f,g,h;if(null==a||0==a.length)c=0;else{g=1;f=a.length;for(h=0;h<f&&!(5<g);++h){c=a.charCodeAt(h);13==c?(++g,h+1<f&&10==a.charCodeAt(h+1)&&++h):10==c&&++g}c=g}this.j=c;1>=this.j?this.b=oy(a):this.b=a;c=new lM(DM,this.b);this.d=c.b.a.test(c.a);do if(4<this.j)0==a.indexOf(id)?0==a.toLowerCase().indexOf("<svg")&&(c=a,hm(),g=f=h=g=void 0,f=null,g=c.indexOf("chemical:x-mdl-molfile"),0<g&&(h=c.indexOf(Fd,g)+1,g=\nc.indexOf("<\/chemical:x-mdl-molfile",h),20<g-h&&(f=c.substr(h,g-h))),c=f=cK(f,ag,ea),null!=c&&(this.c=new TH(c),this.c.f&&(this.f=(UH(),VH)))):-1!=a.indexOf(ff)&&(this.a=(WH(),XH),this.f=(UH(),EM),-1!=a.indexOf(Rf)&&(this.i=(YH(),FM)),-1!=a.indexOf(Sf)&&(this.i=(YH(),ZH)),0==a.indexOf(La)?this.f=GM:-1!=a.indexOf(Ia)&&(this.f=HM));else if(1==this.j)if(0==a.indexOf("InChI="))this.f=(UH(),IM);else{if(27==a.length&&(c=new lM(BM,a),c.b.a.test(c.a))){this.f=(UH(),JM);break}if(1<=a.length)if(this.d){c=new jM(a);\ntry{d=OH(DE(iM(c),10)).a;e=OH(DE(iM(c),10)).a;for(b=0;b<3*(d+e);++b)iM(c);this.e=0<a.indexOf(Fd);this.f=(UH(),KM);this.a=(WH(),aI)}catch(j){if(j=yq(j),!G(j,97))throw j;}}else c=new lM(CM,a),c.b.a.test(c.a)&&0>a.indexOf("j")&&((this.e=0<a.indexOf(Fd))?this.f=(UH(),LM):this.f=(UH(),MM))}while(0);(this.f==(UH(),JM)||this.f==IM)&&(this.a=(WH(),cI));(this.f==MM||this.f==NM||this.f==LM)&&(this.a=(WH(),OM))}w(690,1,{},TH);_.a=null;_.b=null;_.c=null;_.d=!1;_.e=!1;_.f=null;_.i=null;_.j=0;var BM,CM,DM;\nfunction WH(){WH=x;XH=new PM(0);OM=new PM(1);cI=new PM(2);QM=new PM(3);aI=new PM(4);RM=z(SM,u,117,[XH,OM,cI,QM,aI])}function PM(a){this.b=a}w(691,193,{89:1,94:1,96:1,117:1},PM);var RM,OM,cI,XH,QM,aI;function UH(){UH=x;EM=new TM(0);GM=new TM(1);HM=new TM(2);UM=new TM(3);MM=new TM(4);NM=new TM(5);LM=new TM(6);IM=new TM(7);JM=new TM(8);VM=new TM(9);KM=new TM(10);VH=new TM(11);WM=z(XM,u,118,[EM,GM,HM,UM,MM,NM,LM,IM,JM,VM,KM,VH])}function TM(a){this.b=a}w(692,193,{89:1,94:1,96:1,118:1},TM);\nvar WM,IM,JM,KM,EM,VM,UM,GM,HM,NM,MM,LM,VH;function YH(){YH=x;FM=new YM(0);ZH=new YM(1);ZM=z($M,u,119,[FM,ZH])}function YM(a){this.b=a}w(693,193,{89:1,94:1,96:1,119:1},YM);var ZM,FM,ZH;function GH(a){this.a=a}w(694,1,{},GH);_.a=0;function YJ(a){this.c=a}w(696,1,Wl,YJ);_.zf=function(a){rq(7,new aN(this,a))};_.a=0;_.b=null;_.c=null;_.d=null;_.e=0;w(698,1,Ul);_.zd=function(){$wnd.alert("Loading JS code failed.")};function aN(a,b){this.a=a;this.b=b}w(697,698,Ul,aN);_.a=null;_.b=null;\nfunction pF(a,b){if(null!=b)if(null!=a.a.Yb)bF(a.a.Yb,z(hw,u,1,[b]));else if(!a.a.gg(b)){var c=a.a,d=new bN(a,b),e;c.ic.a=n;oF(c.r,Pd);e=c.jc;var f,g,h,j;if(null==b)e=0;else if(f=yL(b,"\\\\$\\\\$\\\\$\\\\$\\r?\\n?"),1>=f.length)e=0;else{for(h=0,j=f.length;h<j;++h)g=f[h],nq(e.b,e.c++,g);e=f.length}0<e&&(c.ic.a=" Use Page Up/Down for SDF access ("+e+hb);d=new cN(c,d);try{SH(c,b,d,!1)}catch(l){if(l=yq(l),G(l,97))fI(d,l);else throw l;}}}function pu(a){this.a=a}w(699,1,{},pu);_.a=null;\nfunction bN(a,b){this.a=a;this.b=b}w(700,1,Ul,bN);_.zd=XB;_.a=null;_.b=null;function fI(a,b){mu(a.a,"ERROR: "+b.yd());rq(2,new yK(a.a,a.a.X));EJ(a.a);mC(a.a)}function eI(a){mu(a.a,"Structure pasted. "+a.a.ic.a);a.a.Ib=!0;mC(a.a);a=a.b;a.a.a.dg(a.b)}function cN(a,b){this.a=a;this.b=b}w(701,1,Ul,cN);_.zd=function(a){fI(this,a)};_.a=null;_.b=null;function dI(a,b,c,d){this.a=a;this.b=b;this.d=c;this.c=d}w(702,698,Ul,dI);_.a=null;_.b=null;_.c=!1;_.d=null;function yK(a,b){this.a=a;this.b=b}\nw(703,698,Ul,yK);_.a=null;_.b=null;function uI(a){this.a=a}w(704,698,Ul,uI);_.a=null;function tI(a){this.a=a}w(705,698,Ul,tI);_.a=null;function sI(a){this.a=a}w(706,698,Ul,sI);_.a=null;function yI(a){this.a=a}w(707,698,Ul,yI);_.a=null;function eG(a){this.a=a}w(708,1,Ul,eG);_.zd=XB;_.a=null;function fG(a){this.a=a}w(709,1,Ul,fG);_.zd=XB;_.a=null;function xH(){this.d=D(gJ,u,120,99,0)}w(710,1,{},xH);_.a=0;_.b=1;_.c=0;_.e=!1;_.f=0;_.i=!1;function XJ(){}w(711,1,{},XJ);_.a=null;\nfunction zH(a){a.d=0;a.e=0;a.f=0;a.a=null;a.b=null;a.i=null}function AG(a,b,c,d){a.e=c;a.d=b;a.f=d}function oF(a,b){null==a.i&&(a.i=b)}function UJ(){zH(this)}w(712,1,{},UJ);_.a=null;_.b=null;_.c=null;_.d=0;_.e=0;_.f=0;_.i=null;function dN(a){a.b=D(eN,u,115,10,0);a.c=D(fN,u,116,10,0);a.e=iH(101);a.f=(iG(),iG(),kG)}function zI(a,b,c){a.b[b].a=c}\nfunction AJ(a,b,c,d){var e,f,g,h,j,l,o,m,r;j=iH(4);f=a.b[c].q-a.b[b].q;g=a.b[c].r-a.b[b].r;o=Math.sqrt(f*f+g*g);0.001>o&&(o=0.001);r=g/o;e=f/o;l=iH(4);for(h=0;4>h;++h)d[h]==c||0>=d[h]||(0==l[1]?l[1]=d[h]:0==l[2]?l[2]=d[h]:0==l[3]&&(l[3]=d[h]));m=iH(4);d=iH(4);for(h=1;3>=h;++h)3==h&&0==l[3]||(f=(a.b[l[h]].q-a.b[b].q)*e+(a.b[l[h]].r-a.b[b].r)*r,g=(a.b[l[h]].r-a.b[b].r)*e-(a.b[l[h]].q-a.b[b].q)*r,o=Math.sqrt(f*f+g*g),0.001>o&&(o=0.001),m[h]=g/o,d[h]=f/o);a=gN(m[1],d[1],m[2],d[2]);0<l[3]?(b=gN(m[2],d[2],\nm[3],d[3]),d=gN(m[1],d[1],m[3],d[3]),0<a&&0<b?(j[1]=l[1],j[2]=l[2],j[3]=l[3]):0<d&&0>b?(j[1]=l[1],j[2]=l[3],j[3]=l[2]):0>a&&0<d?(j[1]=l[2],j[2]=l[1],j[3]=l[3]):0<b&&0>d?(j[1]=l[2],j[2]=l[3],j[3]=l[1]):0>d&&0<a?(j[1]=l[3],j[2]=l[1],j[3]=l[2]):0>b&&0>a&&(j[1]=l[3],j[2]=l[2],j[3]=l[1])):0<a?(j[1]=l[1],j[2]=l[2]):(j[1]=l[2],j[2]=l[1]);j[0]=c;return j}function SI(a,b,c,d){WI(a.b[b],c,d)}\nfunction CI(a,b,c){var d,e,f,g,h,j,l,o;e=!1;RI(a,null);switch(a.b[b].j){case 0:SI(a,a.p,a.b[b].q+21.65,a.b[b].r+12.5);break;case 1:d=a.b[b].p[1];e=0;2==a.b[d].j&&(a.b[d].p[1]==b?e=a.b[d].p[2]:e=a.b[d].p[1]);f=a.b[b].q-a.b[d].q;g=a.b[b].r-a.b[d].r;j=Math.sqrt(f*f+g*g);0.001>j&&(j=0.001);g/=j;f/=j;l=j+25*Math.cos(1.0471975511965976);o=25*Math.sin(1.0471975511965976);h=jJ(a,b,d);if(3==a.c[h].c||204==a.k.k||1!=a.c[h].c&&(203==a.k.k||204==a.k.k)||a.n)l=j+25,o=0;0<e&&0<(a.b[e].r-a.b[d].r)*f-(a.b[e].q-a.b[d].q)*\ng&&(o=-o);0<c&&0>o?o=-o:0>c&&0<o&&(o=-o);SI(a,a.p,a.b[d].q+l*f-o*g,a.b[d].r+o*f+l*g);e=!0;break;case 2:c=iH(2);hN(a,b,25,c);SI(a,a.p,c[0],c[1]);break;case 3:case 4:case 5:for(h=1;h<=a.b[b].j&&!(d=a.b[b].p[h],f=a.b[b].q-a.b[d].q,g=a.b[b].r-a.b[d].r,j=Math.sqrt(f*f+g*g),0.001>j&&(j=0.001),SI(a,a.p,a.b[b].q+25*f/j,a.b[b].r+25*g/j),0==XI(a,a.p,1,a.p)||h==a.b[b].j);++h);break;default:return--a.p,mu(a.k,"Are you trying to draw an hedgehog ?"),a.k.cb=9,!1}b=iJ(a,a.v,a.p,1);203==a.k.k&&(b.c=2);204==a.k.k&&\n(b.c=3);201==a.k.k&&QI(a,a.q);a.z=a.b[a.p].q;a.A=a.b[a.p].r;return e}function KI(a,b){var c,d;if(!b||0==b.c)return n;d=n;d+="M V30 BEGIN COLLECTION"+(FF(),ea);d+=nf+a+" [ATOMS=("+b.c;for(c=new zv(b);c.b<c.d.Tf();)d+=ga+Av(c);return d+")]\\nM V30 END COLLECTION\\n"}\nfunction OI(a,b){var c;a.x=a.v;c=0;if(233==a.k.k||237==a.k.k||236==a.k.k||239==a.k.k||251==a.k.k||252==a.k.k)CI(a,a.v,0),a.v=a.p,a.n=!0,CI(a,a.v,0),a.n=!1,a.v=a.p-1,CI(a,a.v,0),a.v=a.p-2,CI(a,a.v,0),237==a.k.k&&(zI(a,a.p,10),zI(a,a.p-1,10),zI(a,a.p-2,10)),236==a.k.k&&(zI(a,a.p,9),zI(a,a.p-1,9),zI(a,a.p-2,9)),239==a.k.k&&(zI(a,a.p,5),zI(a,a.p-1,5),zI(a,a.p-2,5),zI(a,a.p-3,8),a.c[a.q].c=2,a.c[a.q-1].c=2),252==a.k.k&&(zI(a,a.p,5),zI(a,a.p-1,5),zI(a,a.p-2,4),zI(a,a.p-3,8),a.c[a.q].c=2,a.c[a.q-1].c=2),\n251==a.k.k&&(zI(a,a.p,5),zI(a,a.p-1,5),zI(a,a.p-2,5),zI(a,a.p-3,7),a.c[a.q].c=2),c=4;else if(244==a.k.k)CI(a,a.v,0),zI(a,a.p,4),a.v=a.p,CI(a,a.v,0),zI(a,a.p,8),a.v=a.p,a.n=!0,CI(a,a.v,0),a.n=!1,a.v=a.p-1,CI(a,a.v,0),zI(a,a.p,5),a.c[a.q].c=2,a.v=a.p-2,CI(a,a.v,0),zI(a,a.p,5),a.c[a.q].c=2,c=5;else if(234==a.k.k)CI(a,a.v,0),zI(a,a.p,4),a.v=a.p,a.k.Xb&&xI(a,a.v,1),CI(a,a.v,0),zI(a,a.p,5),a.c[a.q].c=2,a.v=a.p-1,CI(a,a.v,0),zI(a,a.p,5),a.k.Xb?(a.c[a.q].c=1,xI(a,a.p,-1)):a.c[a.q].c=2,c=3;else if(235==a.k.k)CI(a,\na.v,0),a.v=a.p,CI(a,a.v,0),zI(a,a.p,5),a.v=a.p-1,CI(a,a.v,0),zI(a,a.p,5),a.c[a.q].c=2,c=3;else if(240==a.k.k)CI(a,a.v,0),a.v=a.p,CI(a,a.v,0),zI(a,a.p,5),a.v=a.p,CI(a,a.v,0),a.v=a.p-2,CI(a,a.v,0),zI(a,a.p,5),a.c[a.q].c=2,c=4;else if(260==a.k.k)CI(a,a.v,0),a.v=a.p,CI(a,a.v,0),zI(a,a.p,4),a.v=a.p-1,CI(a,a.v,0),zI(a,a.p,5),a.c[a.q].c=2,c=3;else if(261==a.k.k)CI(a,a.v,0),zI(a,a.p,4),a.v=a.p,CI(a,a.v,0),a.v=a.p,CI(a,a.v,0),zI(a,a.p,5),a.c[a.q].c=2,c=3;else if(241==a.k.k)CI(a,a.v,0),zI(a,a.p,5),a.v=a.p,\nCI(a,a.v,0),a.v=a.p,CI(a,a.v,0),a.v=a.p-1,CI(a,a.v,0),a.c[a.q].c=2,zI(a,a.p,5),c=4;else if(243==a.k.k)CI(a,a.v,0),zI(a,a.p,4),a.v=a.p,CI(a,a.v,0),a.v=a.p-1,CI(a,a.v,0),c=3;else if(238==a.k.k)CI(a,a.v,0),a.v=a.p,a.n=!0,CI(a,a.v,0),a.c[a.q].c=3,a.n=!1,c=2;else if(249==a.k.k)CI(a,a.v,0),a.v=a.p,CI(a,a.v,0),a.c[a.q].c=2,zI(a,a.p,5),c=2;else if(250==a.k.k)CI(a,a.v,0),a.c[a.q].c=2,zI(a,a.p,5),c=1;else if(245==a.k.k)CI(a,a.v,0),a.v=a.p,a.n=!0,CI(a,a.v,0),a.v=a.p,a.c[a.q].c=3,CI(a,a.v,0),a.n=!1,c=3;else if(242==\na.k.k)CI(a,a.v,0),a.v=a.p,a.n=!0,CI(a,a.v,0),a.c[a.q].c=3,zI(a,a.p,4),a.n=!1,c=2;else if(254==a.k.k)CI(a,a.v,0),zI(a,a.p,9),c=1;else if(255==a.k.k)CI(a,a.v,0),zI(a,a.p,10),c=1;else if(256==a.k.k)CI(a,a.v,0),zI(a,a.p,11),c=1;else if(257==a.k.k)CI(a,a.v,0),zI(a,a.p,12),c=1;else if(258==a.k.k)CI(a,a.v,0),zI(a,a.p,4),c=1;else if(259==a.k.k)CI(a,a.v,0),zI(a,a.p,5),c=1;else if(246==a.k.k)CI(a,a.v,0),a.v=a.p,CI(a,a.v,0),c=2;else if(247==a.k.k)CI(a,a.v,0),a.v=a.p,CI(a,a.v,0),a.v=a.p,CI(a,a.v,0),c=3;else if(248==\na.k.k)CI(a,a.v,0),a.v=a.p,CI(a,a.v,0),a.v=a.p,CI(a,a.v,0),a.v=a.p,CI(a,a.v,0),c=4;else if(253==a.k.k){var d,e,f,g,h,j,l,o;if(!a.k.uc||0==a.k.uc.p)c=0;else{c=0;o=a.k.uc;for(e=1;e<=o.p;++e)if(1==II(o.b[e])){c=e;break}g=a.p;h=a.v;e=new iN;f=jN(e,a,h,1);d=null;f&&(d=new iN,jN(d,a,h,-1));l=new iN;jN(l,o,c,0);var m;m=a.p;for(j=1;j<=o.p;++j)RI(a,o.b[j]),zI(a,a.p,o.b[j].a);for(j=1;j<=o.q;++j)eJ(a,null),xM(a.c[a.q],o.c[j]),a.c[a.q].i=o.c[j].i+m,a.c[a.q].j=o.c[j].j+m;vJ(a);nG(a.b[g+c]);kN(l,a,g+1,a.p,h,e);\nif(f&&(f=lN(a,g+1,a.p),0<f)){for(j=1;j<=o.p;++j)SI(a,g+j,o.b[j].q,o.b[j].r);kN(l,a,g+1,a.p,h,d);d=lN(a,g+1,a.p);if(!(d<=f)){for(j=1;j<=o.p;++j)SI(a,g+j,o.b[j].q,o.b[j].r);kN(l,a,g+1,a.p,h,e)}}eJ(a,null);a.c[a.q].i=h;a.c[a.q].j=c+g;vJ(a);b&&(YF(a,h),vG(a));c=o.p}}mN(a,c);a.v=a.x;b&&(a.v=0)}\nfunction hN(a,b,c,d){var e,f,g,h,j;e=a.b[b].p[1];f=a.b[b].p[2];g=a.b[f].q-a.b[e].q;h=-(a.b[f].r-a.b[e].r);j=Math.sqrt(g*g+h*h);0.001>j&&(j=0.001);1>pH((a.b[b].r-a.b[e].r)*(g/j)+(a.b[b].q-a.b[e].q)*(h/j))?(g=a.b[b].q-a.b[e].q,h=a.b[b].r-a.b[e].r,j=Math.sqrt(g*g+h*h),0.001>j&&(j=0.001),b=h/j,g/=j,d[0]=a.b[e].q+j*g-c*b,d[1]=a.b[e].r+c*g+j*b):(g=(a.b[e].q+a.b[f].q)/2,e=(a.b[e].r+a.b[f].r)/2,g=a.b[b].q-g,h=a.b[b].r-e,j=Math.sqrt(g*g+h*h),0.001>j&&(j=0.001),d[0]=a.b[b].q+c*g/j,d[1]=a.b[b].r+c*h/j)}\nfunction BI(a){var b,c,d,e,f,g,h,j,l,o,m,r,t,y;o=-1;j=6;switch(a.k.k){case 206:j=3;break;case 207:j=4;break;case 208:case 221:case 223:j=5;break;case 210:case 209:j=6;break;case 211:j=7;break;case 212:j=8;break;case 229:j=9}f=6.283185307179586/j;l=wL(312.5/(1-Math.cos(f)));if(0<a.v)if(2>a.b[a.v].j)nN(a,j,f,l);else if(!a.k.Bb&&!a.k.rc)o=a.v,CI(a,a.v,0),a.v=a.p,nN(a,j,f,l);else{a.k.rc=!1;if(209==a.k.k||221==a.k.k||223==a.k.k){mu(a.k,"ERROR - cannot add aromatic spiro ring !");a.k.cb=9;return}for(d=\n1;d<=a.b[a.v].j;++d)if(b=a.c[jJ(a,a.v,a.b[a.v].p[d])].c,2<d||1!=b){mu(a.k,"ERROR - spiro ring not possible here !");a.k.cb=9;return}b=iH(2);hN(a,a.v,l,b);e=a.b[a.v].q-b[0];g=a.b[a.v].r-b[1];m=Math.sqrt(e*e+g*g);0.001>m&&(m=0.001);g/=m;e/=m;for(d=1;d<=j;++d)h=RI(a,null),r=f*d+1.5707963267948966,WI(h,b[0]+l*(Math.sin(r)*e-Math.cos(r)*g),b[1]+l*(Math.cos(r)*e+Math.sin(r)*g))}else if(0<a.w){b=a.c[a.w].i;c=a.c[a.w].j;d=0;2==a.b[b].j?a.b[b].p[1]!=c?d=a.b[b].p[1]:d=a.b[b].p[2]:2==a.b[c].j&&(a.b[c].p[1]!=\nb?d=a.b[c].p[1]:d=a.b[c].p[2],m=b,b=c,c=m);0==d&&(a.b[b].p[1]!=c?d=a.b[b].p[1]:d=a.b[b].p[2]);e=a.b[c].q-a.b[b].q;g=a.b[c].r-a.b[b].r;m=Math.sqrt(e*e+g*g);0.001>m&&(m=0.001);g/=m;e/=m;h=m/2;r=l*Math.sin(0.5*(3.141592653589793-f));m=1;0<(a.b[d].r-a.b[b].r)*e-(a.b[d].q-a.b[b].q)*g&&(r=-r,m=0);t=a.b[b].q+h*e-r*g;y=a.b[b].r+r*e+h*g;for(d=1;d<=j;++d)h=RI(a,null),r=f*(d+0.5)+3.141592653589793*m,WI(h,t+l*(Math.sin(r)*e-Math.cos(r)*g),y+l*(Math.cos(r)*e+Math.sin(r)*g)),1==m?(d==j&&WI(h,a.b[b].q,a.b[b].r),\nd==j-1&&WI(h,a.b[c].q,a.b[c].r)):(d==j-1&&WI(h,a.b[b].q,a.b[b].r),d==j&&WI(h,a.b[c].q,a.b[c].r))}else{b=0.5;6==j&&(b=0);for(d=1;d<=j;++d)h=RI(a,null),r=f*(d-b),WI(h,a.z+l*Math.sin(r),a.A+l*Math.cos(r))}b=j;l=0;for(f=1;f<=b;++f)eJ(a,null),l=a.p-b+f,a.b[l].j=2,a.c[a.q].i=l,a.c[a.q].j=l+1;a.c[a.q].j=a.p-b+1;if(209==a.k.k){if(a.c[a.q-4].c=2,a.c[a.q-2].c=2,a.c[a.q].c=2,0<a.w)if(1==a.c[a.w].c){if(b=0,1<a.b[a.c[a.w].i].j&&(b=a.b[a.c[a.w].i].p[1],l=a.c[a.w].i,b==a.c[a.w].j&&(b=a.b[a.c[a.w].i].p[2])),0==b&&\n1<a.b[a.c[a.w].j].j&&(b=a.b[a.c[a.w].j].p[1],l=a.c[a.w].j,b==a.c[a.w].j&&(b=a.b[a.c[a.w].j].p[2])),0<b)for(f=1;f<=a.q;++f)if(a.c[f].i==b&&a.c[f].j==l||a.c[f].i==l&&a.c[f].j==b){1!=a.c[f].c&&(a.c[a.q-4].c=1,a.c[a.q-2].c=1,a.c[a.q].c=1,a.c[a.q-5].c=2,a.c[a.q-3].c=2,a.c[a.q-1].c=3);break}}else a.c[a.q-4].c=1,a.c[a.q-2].c=1,a.c[a.q].c=1,a.c[a.q-5].c=2,a.c[a.q-3].c=2,a.c[a.q-1].c=2}else if(221==a.k.k||223==a.k.k)if(0<a.w){if(1==a.c[a.w].c){b=!1;for(f=1;f<=a.b[a.c[a.w].i].j;++f)if(l=a.b[a.c[a.w].i].p[f],\n1<a.c[jJ(a,a.c[a.w].i,l)].c){b=!0;break}for(f=1;f<=a.b[a.c[a.w].j].j;++f)if(l=a.b[a.c[a.w].j].p[f],1<a.c[jJ(a,a.c[a.w].j,l)].c){b=!0;break}b||(a.c[a.w].c=2)}a.c[a.q-4].c=2;zI(a,a.p-2,5)}else 0<a.v?221==a.k.k?(a.c[a.q-4].c=1,a.c[a.q-2].c=1,a.c[a.q-1].c=1,a.c[a.q-3].c=2,a.c[a.q].c=2,zI(a,a.p-1,5)):(a.c[a.q-3].c=1,a.c[a.q-2].c=1,a.c[a.q].c=1,a.c[a.q-4].c=2,a.c[a.q-1].c=2,zI(a,a.p-2,5)):(a.c[a.q-3].c=1,a.c[a.q-2].c=1,a.c[a.q].c=1,a.c[a.q-4].c=2,a.c[a.q-1].c=2,zI(a,a.p-2,5));l=iH(a.p+1);for(f=1;f<=j;++f)b=\na.p-j+f,c=a.q-j+f,a.b[b].p[1]=b-1,a.b[b].p[2]=b+1,lJ(a.c[c],a.b);a.b[a.p-j+1].p[1]=a.p;a.b[a.p].p[2]=a.p-j+1;for(f=a.p-j+1;f<=a.p;++f){l[f]=0;c=51;g=0;for(b=1;b<=a.p-j;++b)e=a.b[f].q-a.b[b].q,d=a.b[f].r-a.b[b].r,e=e*e+d*d,50>e&&e<c&&(c=e,g=b);0<g&&(0==a.v||g==a.v)&&(l[f]=g)}g=a.q-j;f=g+1;a:for(;f<=g+j;++f)if(b=a.c[f].i,e=a.c[f].j,0<l[b]&&0<l[e]){for(c=1;c<=g;++c)if(a.c[c].i==l[b]&&a.c[c].j==l[e]||a.c[c].j==l[b]&&a.c[c].i==l[e])continue a;iJ(a,l[b],l[e],a.c[f].c)}else 0<l[b]?iJ(a,l[b],e,a.c[f].c):\n0<l[e]&&iJ(a,l[e],b,a.c[f].c);d=a.p-j;for(f=a.p;f>d;--f)if(0<l[f]&&(YF(a,f),3==a.b[l[f]].a)){m=0;for(b=1;b<=a.b[l[f]].j;++b){e=a.b[l[f]].p[b];for(c=1;c<=a.q;++c)(a.c[c].i==l[f]&&a.c[c].j==e||a.c[c].i==e&&a.c[c].j==l[f])&&(m+=a.c[c].c)}if(4<m)for(c=g+1;c<=g+j;++c)a.c[c].c=1}0<a.v&&mN(a,j);-1<o&&(a.v=o)}\nfunction nN(a,b,c,d){var e,f,g,h,j,l,o;0==a.b[a.v].j?(e=0,f=1):(e=a.b[a.v].p[1],f=a.b[a.v].q-a.b[e].q,e=a.b[a.v].r-a.b[e].r,g=Math.sqrt(f*f+e*e),0.001>g&&(g=0.001),e/=g,f/=g);l=a.b[a.v].q+d*f;o=a.b[a.v].r+d*e;for(g=1;g<=b;++g)h=RI(a,null),j=c*g-1.5707963267948966,WI(h,l+d*(Math.sin(j)*f-Math.cos(j)*e),o+d*(Math.cos(j)*f+Math.sin(j)*e))}function mN(a,b){var c,d;0==b&&(b=a.p);for(c=a.p;c>a.p-b;--c)d=XI(a,c,1,a.p),0!=d&&wG(a.b[c],6,6)}\nfunction jJ(a,b,c){var d,e,f;for(e=1;e<=a.q;++e)if(d=a.c[e],f=d.i,d=d.j,f==b&&d==c||f==c&&d==b)return e;return 0}function MH(a){var b;for(b=1;b<=a.q;++b)if(1==a.c[b].c&&0<a.c[b].f)return!0;return!1}function uJ(a,b,c){var d,e,f,g;e=Lk;for(f=g=0;;){++g;for(d=1;d<=a.p;++d)if(Mw(c[d])){e=c[d];break}for(d=1;d<=a.p;++d)Mw(c[d])&&!Bw(c[d],e)&&(e=c[d]);for(d=1;d<=a.p;++d)Gw(c[d],e)&&(b[d]=g,c[d]=Lk,++f);if(f==a.p)break}return g==a.p}\nfunction vG(a){var b,c,d;d=c=0;a.k&&(b=uG(a.k),c=b.b,d=b.a);0>=c||0>=d?a.s=!0:(b=sG(a),c=c/2-b.a,b=d/2-b.b,a.k.Ob||ZI(a,c,b),xG(a))}\nfunction xI(a,b,c){var d,e,f;if(1==c)return a.b[b].n+=1,!0;if(-1==c)return a.b[b].n+=-1,!0;e=a.b[b].n;f=a.b[b].i;d=a.b[b].o;-1==d&&0==c&&(0==a.b[b].n?a.b[b].n=1:1==a.b[b].n?a.b[b].n=-1:-1==a.b[b].n&&(a.b[b].n=0));switch(a.b[b].a){case 1:0==d&&(0==a.b[b].n?a.b[b].n=1:1==a.b[b].n?a.b[b].n=-1:a.b[b].n=0);break;case 2:2<d&&mu(a.k,"Charge change not possible on this boron !");0==a.b[b].n?a.b[b].n=1:1==a.b[b].n&&(a.b[b].n=0);break;case 3:3<d?mu(a.k,"Charge change not possible on this carbon !"):4>d&&(0==\na.b[b].n?a.b[b].n=-1:-1==a.b[b].n?a.b[b].n=1:1==a.b[b].n&&(a.b[b].n=0));break;case 4:case 7:3<d?mu(a.k,"Charge change not possible on multibonded N or P !"):3==d&&0==a.b[b].n?a.b[b].n=1:3==d&&1==a.b[b].n?a.b[b].n=0:3>d&&0==a.b[b].n?a.b[b].n=1:3>d&&1==a.b[b].n?a.b[b].n=-1:3>d&&-1==a.b[b].n&&(a.b[b].n=0);break;case 5:case 8:case 13:2<d?mu(a.k,"Charge change not possible on multibonded "+(FF(),MF)[a.b[b].a]+" !"):2==d&&0==a.b[b].n?a.b[b].n=1:2==d&&1==a.b[b].n?a.b[b].n=0:2>d&&0==a.b[b].n?a.b[b].n=-1:\n2>d&&-1==a.b[b].n?a.b[b].n=1:2>d&&1==a.b[b].n&&(a.b[b].n=0);break;case 9:case 10:case 11:case 12:0==d&&0==a.b[b].n?a.b[b].n=-1:0==d&&-1==a.b[b].n?a.b[b].n=0:mu(a.k,"Charge change not possible on the halogen !");break;case 32:mu(a.k,"Use X button to change charge on the X atom !")}if(0<TF(a.b[b].a)){var c=a.b[b],g,h,j,l;g=!1;h=TF(c.a);0<h&&(h-=d,0<h&&(l=c.n,j=c.i,l+j<h?l+=h-j:l+j==h&&(l==h?(l=0,j=h):(j=l=0,0==d&&mu(a.k,"Metallic "+(FF(),MF)[c.a]))),g=c.n!=l||c.i!=j,c.n=l,c.i=j));g||mu(a.k,"Charge change not possible on "+\n(FF(),MF)[a.b[b].a])}return e!=a.b[b].n||f!=a.b[b].i}function kI(a){var b,c,d,e,f;e=0;f=!1;for(a.a=iH(a.p+1);;){for(d=1;d<=a.p;++d)if(0==a.a[d]){a.a[d]=++e;f=!0;break}if(!f)break;for(;f;){f=!1;for(d=1;d<=a.q;++d)b=a.c[d].i,c=a.c[d].j,0<a.a[b]&&0==a.a[c]?(a.a[c]=e,f=!0):0<a.a[c]&&0==a.a[b]&&(a.a[b]=e,f=!0)}}return e}function XI(a,b,c,d){var e,f,g,h;g=51;for(h=0;c<=d;++c)b!=c&&(e=a.b[b].q-a.b[c].q,f=a.b[b].r-a.b[c].r,e=e*e+f*f,50>e&&e<g&&(g=e,h=c));return h}function aG(a){wJ(a);qJ(a)}\nfunction qJ(a){var b,c,d,e,f;for(f=1;f<=a.q;++f){d=a.c[f];b=d.i;c=d.j;e=d.c;if(1==a.b[b].n&&-1==a.b[c].n||-1==a.b[b].n&&1==a.b[c].n)if(1==e||2==e){if(3!=a.b[b].a&&3!=a.b[c].a&&a.k.Xb)continue;if(1==a.b[b].a||1==a.b[c].a)continue;if(2==a.b[b].a||2==a.b[c].a)continue;if(9==a.b[b].a||10==a.b[b].a||11==a.b[b].a||12==a.b[b].a||9==a.b[c].a||10==a.b[c].a||11==a.b[c].a||12==a.b[c].a)continue;a.b[b].n=0;a.b[c].n=0;++e;d.c=e;wJ(a)}1==a.b[b].n&&1==a.b[c].n&&(2==e?e=1:3==e&&(e=2),d.c=e,wJ(a));4==e&&(e=1);d.c=\ne}}function gN(a,b,c,d){var e,f;f=e=0;0<=a&&0<=b?e=1:0<=a&&0>b?e=2:0>a&&0>b?e=3:0>a&&0<=b&&(e=4);0<=c&&0<=d?f=1:0<=c&&0>d?f=2:0>c&&0>d?f=3:0>c&&0<=d&&(f=4);if(e<f)return 1;if(e>f)return-1;switch(e){case 1:case 4:return a<c?1:-1;case 2:case 3:return a>c?1:-1}return 0}function vJ(a){oN(a);xG(a);wJ(a)}\nfunction sG(a){var b,c,d,e,f,g;b=new yM;f=9999;d=-9999;g=9999;e=-9999;for(c=1;c<=a.p;++c)a.b[c].q<f&&(f=a.b[c].q),a.b[c].q>d&&(d=a.b[c].q),a.b[c].r<g&&(g=a.b[c].r),a.b[c].r>e&&(e=a.b[c].r);b.a=f+(d-f)/2;b.b=g+(e-g)/2;b.c=d-f;b.d=e-g;25>b.c&&(b.c=25);25>b.d&&(b.d=25);return b}function lN(a,b,c){var d,e;e=0;for(d=1;d<=a.p;++d)d>=b&&d<=c||0!=XI(a,d,b,c)&&++e;return e}function iJ(a,b,c,d){var e;e=eJ(a,null);fJ(a.b[b],c);fJ(a.b[c],b);e.i=b;e.j=c;lJ(e,a.b);e.c=d;return e}\nfunction RI(a,b){++a.p;b?a.b[a.p]=qM(b):a.b[a.p]=new hJ;return a.b[a.p]}function oH(a,b,c,d,e,f){var g;g=a.b[b].q-c/2;f||(g-=d-c);a=a.b[b].r-~~(e/2);return new pN(g-1-2,a-2,d+1+4,e+4)}function eJ(a,b){var c;++a.q;c=new wM;b&&xM(c,b);return a.c[a.q]=c}\nfunction FI(a,b,c){var d,e,f,g,h,c=HI(a,b,c,!1);e=-1.7976931348623157E308;d=1.7976931348623157E308;for(b=1;b<=a.p;++b)a.b[b].r>e&&(e=a.b[b].r),a.b[b].q<d&&(d=a.b[b].q);for(b=1;b<=a.p;++b)c+=JI(0.055999999999999994*(a.b[b].q-d),10,4)+JI(0.055999999999999994*(e-a.b[b].r),10,4)+JI(0,10,4),g=nH(a,b),1==g.length?g+=ia:2==g.length?g+=ga:3<g.length&&(g="Q "),c+=ga+g,f=0,0<a.b[b].n&&4>a.b[b].n?f=4-a.b[b].n:0>a.b[b].n&&-4<a.b[b].n&&(f=4-a.b[b].n),h=0,0!=a.b[b].d&&(g=tJ(nH(a,b),a.b[b].d),-3<=g&&4>=g&&(h=g)),\ng=EI(h,2)+EI(f,3)+" 0 0 0 0 0 0 0",f=pJ(a,b),g+=EI(f,3),c+=g+ja+(FF(),ea);for(b=1;b<=a.q;++b)d=a.c[b],g=e=d.c,1==a.c[b].c?g=1:2==a.c[b].c&&(g=2),f=EI(d.i,3)+EI(d.j,3),h=0,1==e&&1==d.f?h=1:1==e&&2==d.f&&(h=6),1==e&&3==d.f&&(h=1,f=EI(d.j,3)+EI(d.i,3)),1==e&&4==d.f&&(h=6,f=EI(d.j,3)+EI(d.i,3)),c+=f+EI(g,3)+EI(h,3)+ka+(FF(),ea);for(b=1;b<=a.p;++b)0!=a.b[b].n&&(c+="M CHG 1"+EI(b,4)+EI(a.b[b].n,4)+(FF(),ea)),0!=a.b[b].d&&(c+="M ISO 1"+EI(b,4)+EI(a.b[b].d,4)+(FF(),ea));return c+=ff+(FF(),ea)}\nfunction YF(a,b){var c,d,e,f,g,h,j;g=j=0;for(h=1;h<=a.q;++h)e=a.c[h],c=e.i,d=e.j,c!=b&&d!=b?(++j,f=a.c[j],xM(f,e),f.i=c,c>b&&--f.i,f.j=d,d>b&&--f.j):g+=e.c;a.q=j;for(h=b;h<a.p;++h)a.b[h]=a.b[h+1];--a.p;if(0==a.p)yG(a.k,!0);else for(h=1;h<=a.p;++h){d=0;for(j=1;j<=a.b[h].j;++j)c=a.b[h].p[j],c==b?a.b[h].i+=g:(c>b&&--c,a.b[h].p[++d]=c);a.b[h].j=d}}\nfunction $F(a,b){var c,d,e,f;c=a.c[b].i;d=a.c[b].j;for(e=b;e<a.q;++e)a.c[e]=a.c[e+1];--a.q;f=0;for(e=1;e<=a.b[c].j;++e)a.b[c].p[e]!=d&&(a.b[c].p[++f]=a.b[c].p[e]);a.b[c].j=f;f=0;for(e=1;e<=a.b[d].j;++e)a.b[d].p[e]!=c&&(a.b[d].p[++f]=a.b[d].p[e]);a.b[d].j=f;c<d&&(f=c,c=d,d=f);0==a.b[c].j&&YF(a,c);0==a.b[d].j&&YF(a,d)}\nfunction oG(a){var b,c,d;c=!1;oN(a);d=a.p;a:for(;1<=d;--d)if(b=a.b[d].p[1],!(a.k&&a.k.ec&&3!=a.b[b].a)&&1==a.b[d].a&&1==a.b[d].j&&0==a.b[d].n&&1!=a.b[b].a&&32>a.b[b].a&&0==a.b[d].d){if(0!=(-99199!=a.b[d].f?a.b[d].f:0))continue a;b=jJ(a,d,b);if(1==a.c[b].c&&(0==a.c[b].f||!a.k.tc))YF(a,d),c=!0}return c}function qN(a,b){var c,d,e,f,g;g=z(B,q,-1,[0,0]);for(e=1,f=0;e<=a.b[b].j;++e)c=a.b[b].p[e],d=jJ(a,b,c),2!=a.c[d].c&&(g[f++]=c);return g}\nfunction oN(a){var b,c,d;for(d=1;d<=a.p;++d)a.b[d].j=0;for(d=1;d<=a.q;++d)b=a.c[d].i,c=a.c[d].j,fJ(a.b[b],c),fJ(a.b[c],b)}\nfunction sJ(a,b,c){var d,e,f,g,h,j,l,o,m;a.d=iH(a.q+1);m=[];for(j=1;j<=a.p;++j){m[j]=!1;b[j]=!1;a:{d=void 0;for(d=1;d<=a.b[j].j;++d)if(c[jJ(a,j,a.b[j].p[d])]){d=!0;break a}d=!1}if(d&&!(3<a.b[j].j+a.b[j].i))switch(a.b[j].a){case 3:case 4:case 7:case 5:case 8:case 13:m[j]=!0;break;case 32:0==a.b[j].e.indexOf(Od)?m[j]=!1:m[j]=!0}}if(a.j){var r;d=[];e=!1;for(j=1;j<=a.q;++j)f=a.c[j].i,g=a.c[j].j,d[f]=!0,d[g]=!0,(32==a.b[f].a||32==a.b[g].a)&&(e=!0);if(e){j=1;a:for(;j<=a.q;++j)if(c[j]){f=a.c[j].i;g=a.c[j].j;\ne=[];for(l=1;l<=a.b[f].j;++l)h=a.b[f].p[l],h!=g&&d[h]&&(e[h]=!0);for(r=!1;;){for(l=1;l<=a.p;++l){r=!1;if(e[l]&&d[l]&&l!=f)for(o=1;o<=a.b[l].j;++o){h=a.b[l].p[o];if(h==g){for(f=1;f<=a.p;++f)e[f]&&(5==a.b[f].a&&(a.b[f].a=32,a.b[f].e="#8"),4==a.b[f].a&&(a.b[f].a=32,a.b[f].e="#7"),8==a.b[f].a&&(a.b[f].a=32,a.b[f].e="#16"));continue a}!e[h]&&d[h]&&(r=e[h]=!0)}if(r)break}if(!r)break}}}}for(h=1;h<=a.q;++h)1==a.c[h].c?a.d[h]=1:2==a.c[h].c?a.d[h]=2:3==a.c[h].c&&(a.d[h]=3);h=1;a:for(;h<=a.q;++h)if(c[h]&&(f=\na.c[h].i,g=a.c[h].j,m[f]&&m[g])){d=[];for(j=1;j<=a.b[f].j;++j)e=a.b[f].p[j],e!=g&&m[e]&&(d[e]=!0);for(o=!1;;){for(j=1;j<=a.p;++j){o=!1;if(d[j]&&m[j]&&j!=f)for(l=1;l<=a.b[j].j;++l){e=a.b[j].p[l];if(e==g){b[f]=!0;b[g]=!0;a.d[h]=5;continue a}!d[e]&&m[e]&&(o=d[e]=!0)}if(o)break}if(!o)break}}}function pJ(a,b){var c,d;c=a.b[b];d=-99199!=c.f?c.f:0;0==(-99199!=c.f?c.f:0)&&a.k&&a.k.sc&&0<a.b[b].c&&(d=1);return d}function xG(a){var b;for(b=1;b<=a.q;++b)lJ(a.c[b],a.b)}\nfunction zJ(a,b){var c,d,e,f,g,h;h=1;f=b;e=iH(a.p+1);if(rM(a.b[b]))return e[0]=0,e;e[1]=b;a:for(;;){g=1;b:for(;g<=a.b[f].j;++g){c=a.b[f].p[g];if(c==e[1]||c==e[h-1])continue b;d=jJ(a,f,c);if(2==a.c[d].c&&5!=a.d[d]){f=e[++h]=c;continue a}}break a}e[0]=h;return e}function rJ(a,b){var c;for(c=1;c<=a.q;++c)tH(a,a.c[c].i,a.c[c].j)?b[c]=!1:b[c]=!0}function CH(a){var b,c,d;if(0==a.p)return 0;d=-999999;for(b=1;b<=a.p;++b)c=II(a.b[b]),c>d&&(d=c);return d}\nfunction nH(a,b){var c;c=(FF(),MF)[a.b[b].a];32==a.b[b].a&&(c=a.b[b].e);return c}function kJ(a,b){a.b[b].j+=-1}function tH(a,b,c){var d,e,f,g,h;h=1;a.a=iH(a.p+1);for(e=a.a[b]=1;e<=a.b[b].j;++e)d=a.b[b].p[e],d!=c&&(a.a[d]=++h);for(g=!1;;){for(d=1;d<=a.p;++d){g=!1;if(0<a.a[d]&&d!=b)for(f=1;f<=a.b[d].j;++f)e=a.b[d].p[f],0==a.a[e]&&(a.a[e]=++h,g=!0);if(g)break}if(!g)break}return 0==a.a[c]}\nfunction PI(a){var b;a.k.gb=!0;if(a.k.sc){a.i=-1;if(0==a.b[a.v].c)return a.b[a.v].c=4,!0;a.b[a.v].c=0;return!1}b=a.b[a.v];-1==a.k.I?nG(b):(a.k.Bb||++a.o,b.f=a.o);return!0}function HI(a,b,c,d){var e,f;f=d?0:a.f.a&&MH(a)?1:0;e=b;79<b.length&&(e=b.substr(0,76)+mc);e+=(FF(),ea);c?e+="JME 2017-02-26 "+new dM+"\\n\\n":e+="JME\\n\\n";e+=EI(d?0:a.p,3)+EI(d?0:a.q,3);return e+=ja+EI(f,3)+" 0 0 0 0 0999 "+(d?Sf:Rf)+ea}function ZI(a,b,c){var d;for(d=1;d<=a.p;++d)wG(a.b[d],b,c)}\nfunction vI(a){var b;a.t=0;a.o=0;for(b=1;b<=a.p;++b)a.v=b,PI(a);a.v=0}function wI(a){var b,c;b=sG(a);c=a.k.M.b;a.k.J||(c=dw(c-a.k.mb));return b.a<~~(c/2)-24?1:b.a>~~(c/2)+24?3:2}function gG(a,b){var c,d,e,f,g,h,j;c=sG(a);d=c.a;e=c.b;g=Math.sin(3.141592653589793*b/180);c=Math.cos(3.141592653589793*b/180);for(f=1;f<=a.p;++f)h=a.b[f].q*c+a.b[f].r*g,j=-a.b[f].q*g+a.b[f].r*c,WI(a.b[f],h,j);c=sG(a);ZI(a,d-c.a,e-c.b)}\nfunction nJ(a){var b,c,d,e,f;e=f=0;for(d=1;d<=a.q;++d)b=a.b[a.c[d].i].q-a.b[a.c[d].j].q,c=a.b[a.c[d].i].r-a.b[a.c[d].j].r,f+=Math.sqrt(b*b+c*c);0<a.q?(f/=a.q,e=25/f):1<a.p&&(e=75/wL((a.b[1].q-a.b[2].q)*(a.b[1].q-a.b[2].q)+(a.b[1].r-a.b[2].r)*(a.b[1].r-a.b[2].r)));for(d=1;d<=a.p;++d)b=a.b[d],c=e,b.q*=c,b.r*=c}\nfunction AI(a,b,c){var d,e,f,g,h;if(0==c.indexOf(Wf)&&xL(c,cg))c=mE(c,1,c.length-1),a.b[b].a=32,a.b[b].e=c,a.b[b].i=0;else{e=a.b[b];var j,l,o,m,r,t;j=ZE(pM,c);if(j.a){m=j.a[1];h=j.a[2];f=j.a[3];g=j.a[4];r=j.a[5];t=j.a[6];j=j.a[8];l=0;o=!0;if(-1!=sM(h)){if(null!=m&&0<m.length){m=DE(m,10);var y;a:{var v;v=Fv((!tM&&uM(),tM),h);if(null!=v)for(y=0;y<v.length;++y)if(m==v[y]){y=!0;break a}y=!1}y?e.d=m:o=!1}}else o=!1;o&&(null!=f&&0<f.length?(l=DE(f,10),l*=H(g,rb)?-1:1):null!=r&&0<r.length&&(l=r.length,l*=\nH(r,rb)?-1:1));o&&(c=h+(null!=t?t:n),e.n=l);null!=j&&0<j.length&&(f=DE(j,10),e.f=f)}g=!1;-1<c.indexOf(kb)&&(g=!0);-1<c.indexOf(hd)&&(g=!0);-1<c.indexOf(Fa)&&(g=!0);-1<c.indexOf("!")&&(g=!0);f=c.indexOf(bd);e=c.indexOf(Pe);if(-1<f){h=py(c,f+1);try{d=DE(h,10),a.b[b].f=d}catch(s){if(s=yq(s),!G(s,97))throw s;}c=c.substr(0,f-0)}if(g)a.b[b].e=c,a.b[b].a=32,a.b[b].i=0;else{d=c;0<e&&(d=c.substr(0,e-0));b:{f=d;for(g=1;33>=g;++g)if(H(f,(FF(),MF)[g])){f=g;break b}f=32}zI(a,b,f);32==a.b[b].a&&(a.b[b].e=d);c+=\nga;d=0;0<e&&(d=1,e=$K(c,++e),48<=e&&57>=e&&(d=e-48));32==a.b[b].a&&(a.b[b].i=d)}}}function jI(a,b,c){var d,e;a.i=1;c&&(a.i=-1);b=new XE(b);try{for(;b.j=QE(b,b.a),b.j<b.i;)d=OH(DE(TE(b),10)).a,c=e=OH(DE(TE(b),10)).a,(0>c||6<c)&&(c=0),a.b[d].c=c}catch(f){if(f=yq(f),G(f,97))yp(f);else throw f;}}function hG(a,b){return a.f!=b?(a.f=b,!0):!1}\nfunction CJ(a,b,c,d,e){b=jJ(a,b,c);5!=a.d[b]&&2==a.c[b].c?d.a.a+=Ed:3==a.c[b].c?d.a.a+=Fa:9==a.c[b].c?(e=Gd,a=a.c[b].d,null!=a&&(e=a),Bp(d.a,e)):1==e[b]?d.a.a+=tc:-1==e[b]&&(d.a.a+=Yf)}\nfunction bG(a){var b,c,d,e,f,g;c=0;for(d=1;d<=a.p;++d)a.b[d].k=0;for(f=1;f<=a.q;++f)a.c[f].e=0;a:for(;;){b=!1;for(d=1;d<=a.p;++d)if(e=a.b[d],0==e.k){e.k=++c;b=!0;break}if(!b)break a;for(;b;){b=!1;for(f=1;f<=a.q;++f)g=a.c[f],0<g.e||(d=a.b[g.i],e=a.b[g.j],d.k!=e.k?(g.e=d.k=e.k=c,b=!0):g.e=d.k)}}b=c;d=D(gJ,u,120,b,0);for(c=1;c<=b;++c)d[c-1]=new rN(a.k,a,c);return d}function HH(a,b,c,d){a=c-a;b=d-b;return a*a+b*b}\nfunction QI(a,b){var c,d,e;e=a.c[b];if(1==e.c)if(c=a.c[b].i,d=a.c[b].j,2>a.b[c].j&&2>a.b[d].j)e.f=0,mu(a.k,"Stereomarking meaningless on this bond !");else switch(e.f){case 0:a.b[d].j<=a.b[c].j?e.f=1:e.f=3;break;case 1:e.f=2;break;case 2:2<a.b[d].j?e.f=3:e.f=1;break;case 3:e.f=4;break;case 4:2<a.b[c].j?e.f=1:e.f=3}else 2==e.c?10==e.f?e.f=0:e.f=10:mu(a.k,"Stereomarking allowed only on single and double bonds!")}\nfunction xJ(a,b,c,d){var e,f,g,h,j,l,o,m,r,t;if(!(2!=a.c[b].c||5==a.d[b])&&(10==a.c[b].f||a.k.z))if(f=a.c[b].i,b=a.c[b].j,!rM(a.b[f])||!rM(a.b[b])){e=null;rM(a.b[f])?e=zJ(a,b):rM(a.b[b])&&(e=zJ(a,f));if(null!=e)if(1==(e[0]-1)%2)f=e[1],b=e[e[0]];else return;e=z(B,q,-1,[f,b]);for(o=0,j=e.length;o<j;++o)if(h=e[o],h=a.b[h].j,2>h||3<h)return;c[f]>c[b]&&(j=f,f=b,b=j);j=qN(a,f);h=j[0];l=j[1];e=0;o=!1;0<l&&c[h]>c[l]&&(j=h,h=l,l=j);j=jJ(a,f,h);0!=d[j]?e=h:1==a.c[j].c&&5!=a.d[j]&&(e=h);0==e&&0<l&&(j=jJ(a,f,\nl),0!=d[j]?e=l:1==a.c[j].c&&5!=a.d[j]&&(e=l));c[e]>c[f]&&(o=!0);j=qN(a,b);l=j[0];g=j[1];h=0;0<g&&c[l]<c[g]&&(j=l,l=g,g=j);j=jJ(a,b,l);1==a.c[j].c&&5!=a.d[j]&&0==d[j]&&(h=l);0==h&&0<g&&(j=jJ(a,b,g),1==a.c[j].c&&5!=a.d[j]&&(h=g));if(!(0==e||0==h))if(l=a.b[b].q-a.b[f].q,j=a.b[b].r-a.b[f].r,g=Math.sqrt(l*l+j*j),0.001>g&&(g=0.001),j/=g,g=l/g,l=(a.b[e].r-a.b[f].r)*g-(a.b[e].q-a.b[f].q)*j,t=(a.b[h].r-a.b[f].r)*g-(a.b[h].q-a.b[f].q)*j,2>(0>=l?0-l:l)||2>(0>=t?0-t:t))mu(a.k,"Not unique E/Z geometry !");else{g=\njJ(a,e,f);h=jJ(a,h,b);r=1;if(0==d[g]){for(m=1;m<=a.b[e].j;++m)if(b=a.b[e].p[m],b!=f&&(j=jJ(a,e,b),0!=d[j])){c[b]>c[e]?r=-d[j]:r=d[j];break}d[g]=r}0==d[h]&&(0<l&&0<t||0>l&&0>t?d[h]=-d[g]:d[h]=d[g],o&&(d[h]=-d[h]))}}}function yJ(a,b,c){var d;d=a.c[b].f;return 1>d||4<d?0:1==d&&a.c[b].i==c?1:2==d&&a.c[b].i==c?-1:3==d&&a.c[b].j==c?1:4==d&&a.c[b].j==c?-1:0}\nfunction wJ(a){var b;for(b=1;b<=a.p;++b){var c;a:{for(var d=c=void 0,e=void 0,e=0,d=1;d<=a.b[b].j;++d)if(c=a.c[jJ(a,b,a.b[b].p[d])],1==c.c)e+=1;else if(2==c.c)e+=2;else if(3==c.c)e+=3;else if(9==c.c){c=-1;break a}c=e}a.b[b].o=c;c=a;var d=b,f=e=void 0,g=void 0,e=c.b[d],g=e.o;if(-1==g)e.i=0;else{switch(e.a){case 1:2==g?c.b[d].n=1:1<=g&&(c.b[d].n=0);e.i=0;break;case 2:3==g||5==g?(e.i=0,c.b[d].n=0):3>g?e.i=3-g-c.b[d].n:4==g?(c.b[d].n=-1,e.i=0):5<g&&(c.b[d].n=g-5,e.i=0);break;case 3:case 6:4>g?0<c.b[d].n?\ne.i=2-g+c.b[d].n:0>c.b[d].n?e.i=2-g-c.b[d].n:e.i=4-g:(c.b[d].n=g-4,e.i=4-g+c.b[d].n);break;case 4:case 7:3>g?e.i=3-g+c.b[d].n:3==g?0>c.b[d].n?(c.b[d].n=0,e.i=0):0<c.b[d].n?e.i=c.b[d].n:e.i=0:(c.b[d].n=4==g?1:6==g?-1:g-5,e.i=0);break;case 5:2==g&&(0>c.b[d].n?(c.b[d].n=0,e.i=0):0<c.b[d].n?e.i=c.b[d].n:e.i=0);2<g&&(c.b[d].n=g-2);e.i=2-g+c.b[d].n;break;case 8:case 13:2>g?e.i=2-g+c.b[d].n:2==g?0>c.b[d].n?(c.b[d].n=0,e.i=0):0<c.b[d].n?e.i=c.b[d].n:e.i=0:3==g?2==c.b[d].j?(c.b[d].n=0,e.i=1):(c.b[d].n=1,e.i=\n0):4==g?(c.b[d].n=0,e.i=0):5==g?(c.b[d].n=0,e.i=1):(c.b[d].n=g-6,e.i=0);break;case 9:case 10:case 11:case 12:1<=g&&(c.b[d].n=g-1);e.i=1-g+c.b[d].n;2<g&&(c.b[d].n=0,e.i=0);break;case 33:case 32:e.i=0}f=TF(e.a);if(0<f)for(;e.n+e.i+g>f;)if(0<e.i)--e.i;else if(0<e.n)--e.n;else break;0>e.i&&(e.i=0)}}}function zG(a){dN(this);this.b[0]=new hJ;this.t=this.q=this.p=0;this.k=a}\nfunction iI(a,b){var c,d,e,f,g,h,j,l,o;zG.call(this,a);if(null!=b&&(f=n,l=gI(b),null!=l)){o=new WE(b,l,!0);for(g=1;4>=g;++g)f=hI(o,l);e=OH(DE(oy(f.substr(0,3)),10)).a;j=OH(DE(oy(f.substr(3,3)),10)).a;g=0;try{g=OH(DE(oy(f.substr(14,1)),10)).a}catch(m){if(m=yq(m),!G(m,97))throw m;}hG(this,(iG(),1==g?jG:kG));for(g=1;g<=e;++g){d=RI(this,null);f=hI(o,l);d.q=(new nL(kL(oy(f.substr(0,10))))).a;d.r=-(new nL(kL(oy(f.substr(10,10))))).a;d=34;34>f.length&&(d=f.length);d=oy(f.substr(31,d-31));AI(this,g,d);62<=\nf.length&&(h=oy(f.substr(60,3)),0<h.length&&(h=OH(DE(h,10)).a,0!=h&&(this.b[this.p].f=h)));if(36<=f.length&&(h=oy(f.substr(34,2)),0<h.length&&(h=OH(DE(h,10)).a,0!=h&&-3<=h&&4>=h))){var r=void 0,r=sM(d);d=0<r?r+h:-1;0>d&&(d=0);this.b[g].d=d}if(39<=f.length&&(h=oy(f.substr(37,2)),0<h.length&&(h=OH(DE(h,10)).a,0<h&&7>=h))){f=0;switch(h){case 1:f=3;break;case 2:f=2;break;case 3:f=1;break;case 4:f=0;break;case 5:f=-1;break;case 6:f=-2;break;case 7:f=-3}this.b[g].n=f}}for(g=1;g<=j;++g)e=eJ(this,null),f=\nhI(o,l),e.i=OH(DE(oy(f.substr(0,3)),10)).a,e.j=OH(DE(oy(f.substr(3,3)),10)).a,d=OH(DE(oy(f.substr(6,3)),10)).a,1==d?c=1:2==d?c=2:3==d?c=3:c=9,h=0,11<f.length&&(h=OH(DE(oy(f.substr(9,3)),10)).a),1==d&&1==h&&(c=1,e.f=1),1==d&&6==h&&(c=1,e.f=2),e.c=c;nJ(this);for(vG(this);(o.j=QE(o,o.a),o.j<o.i)&&!(null==(f=TE(o)));){if(0==f.indexOf(ff))break;if(0==f.indexOf(ef)){l=new VE(f);TE(l);TE(l);j=OH(DE(TE(l),10)).a;for(g=1;g<=j;++g)c=OH(DE(TE(l),10)).a,e=OH(DE(TE(l),10)).a,this.b[c].n=e}if(0==f.indexOf(kf)){l=\nnew VE(f);TE(l);TE(l);j=OH(DE(TE(l),10)).a;for(g=1;g<=j;++g)c=OH(DE(TE(l),10)).a,this.b[c].d=OH(DE(TE(l),10)).a}if(0==f.indexOf("M APO")){l=new VE(f);TE(l);TE(l);j=OH(DE(TE(l),10)).a;for(g=1;g<=j;++g)c=OH(DE(TE(l),10)).a,f=OH(DE(TE(l),10)).a,this.v=c,CI(this,this.v,0),AI(this,this.p,Ef+f),this.v=0}}a&&!a.bb&&oG(this);vJ(this)}}\nfunction DJ(a,b){var c,d,e,f,g,h,j,l,o,m;zG.call(this,a);0==b.indexOf(na)&&(b=mE(b,1,b.length));xL(b,na)&&(b=mE(b,0,b.length-1));if(1>b.length)this.p=0;else{try{j=new VE(b);g=OH(DE(TE(j),10)).a;h=OH(DE(TE(j),10)).a;for(f=1;f<=g;++f)o=TE(j),c=(m=RI(this,null),AI(this,this.p,o),m),c.q=(new nL(kL(TE(j)))).a,c.r=-(new nL(kL(TE(j)))).a;for(f=1;f<=h;++f){d=eJ(this,null);d.i=OH(DE(TE(j),10)).a;d.j=OH(DE(TE(j),10)).a;e=OH(DE(TE(j),10)).a;l=0;if(-1==e)l=e=1;else if(-2==e)e=1,l=2;else if(-5==e)e=2,l=10;else if(11==\ne||12==e||13==e||14==e)l=e,e=9;d.c=e;d.f=l}oN(this);nJ(this);vG(this)}catch(r){r=yq(r);if(G(r,97)){r.yd();this.p=0;return}throw r;}a&&!a.bb&&oG(this);vJ(this)}}function lI(a,b,c){var d,e,f,g;zG.call(this,a);g=iH(b.p+1);for(e=1;e<=b.p;++e)b.a[e]==c&&(RI(this,b.b[e]),g[e]=this.p);for(e=1;e<=b.q;++e)if(a=b.c[e].i,d=b.c[e].j,!(b.a[a]!=c&&b.a[d]!=c)&&!(b.a[a]!=c||b.a[d]!=c))f=eJ(this,b.c[e]),f.i=g[a],f.j=g[d];this.i=b.i;oN(this)}\nfunction rN(a,b,c){var d,e,f;zG.call(this,a);f=iH(b.p+1);for(d=1;d<=b.p;++d)b.b[d].k==c&&(RI(this,b.b[d]),f[d]=this.p);for(d=1;d<=b.q;++d)a=b.c[d],a.e==c&&(e=eJ(this,a),e.i=f[a.i],e.j=f[a.j]);hG(this,b.f);this.i=b.i;oN(this)}\nfunction GI(a,b,c){var d,e,f,g;zG.call(this,a);for(a=1;a<=c;++a)this.p+=b[a].p,this.q+=b[a].q,this.t+=b[a].t,b[a].f.a&&hG(this,(iG(),iG(),jG));this.b=D(eN,u,115,this.p+1,0);this.c=D(fN,u,116,this.q+1,0);f=g=e=0;for(a=1;a<=c;++a){for(d=1;d<=b[a].p;++d)++e,this.b[e]=qM(b[a].b[d]);for(d=1;d<=b[a].q;++d)++g,this.c[g]=vM(b[a].c[d]),this.c[g].i+=f,this.c[g].j+=f;f=e}oN(this)}\nfunction WF(a){var b;dN(this);this.k=a.k;this.p=a.p;this.q=a.q;this.t=a.t;this.b=D(eN,u,115,this.p+1,0);for(b=0;b<this.b.length;++b)a.b[b]&&(this.b[b]=qM(a.b[b]));this.c=D(fN,u,116,this.q+1,0);for(b=0;b<this.c.length;++b)a.c[b]&&(this.c[b]=vM(a.c[b]));this.i=a.i;this.f=a.f}\nfunction JI(a,b,c){var d,e,f;if(0==c)return EI(dw(a),b);9.0E-4>(0>=a?0-a:a)&&(a=0);a=P(J(Q(a*Math.pow(10,c))))/Math.pow(10,c);e=n+(new nL(a)).a;d=my(e,ny(46));0>d&&(e+=lc,d=my(e,ny(46)));f=e.length;for(a=1;a<=c-f+d+1;++a)e+=Fc;if(0==b)return e;e.length>b&&(e=Gd);c=n;for(a=1;a<=b-e.length;++a)c+=ga;return c+e}function gI(a){var b;b=new WE(a,ea,!0);if(4<PE(b))return ea;b=new WE(a,Jk,!0);return 4<PE(b)?Jk:null}\nfunction EI(a,b){var c,d,e;d=n+(new uC(a)).a;d.length>b&&(d=Gd);e=n;for(c=1;c<=b-d.length;++c)e+=ga;return e+d}function hI(a,b){for(var c,d;a.j=QE(a,a.a),a.j<a.i;){d=TE(a);if(H(d,b))return ga;for(TE(a);;)if(c=d.charCodeAt(d.length-1),124==c||10==c||13==c){if(d=mE(d,0,d.length-1),0==d.length)return ga}else break;return d}return null}w(713,1,{120:1},zG,iI,DJ,lI,rN,GI,WF);_.a=null;_.d=null;_.i=0;_.j=!1;_.k=null;_.n=!1;_.o=0;_.p=0;_.q=0;_.r=0;_.s=!1;_.t=0;_.u=!1;_.v=0;_.w=0;_.x=0;_.y=null;_.z=0;_.A=0;\nfunction jN(a,b,c,d){var e,f,g;e=CI(b,c,d);d=b.p;a.c=b.b[d].q;a.d=b.b[d].r;f=b.b[c].q-a.c;c=b.b[c].r-a.d;g=Math.sqrt(f*f+c*c);a.b=c/g;a.a=f/g;YF(b,d);return e}function kN(a,b,c,d,e,f){var g,h,j;g=c;for(;g<=d;++g)c=b.b[g],wG(c,-a.c,-a.d),h=c.q*a.a+c.r*a.b,j=c.r*a.a-c.q*a.b,c.q=h,c.r=j,h=-c.q*f.a+c.r*f.b,j=-c.r*f.a-c.q*f.b,c.q=h,c.r=j,wG(c,b.b[e].q,b.b[e].r)}function iN(){}w(714,1,{},iN);_.a=0;_.b=0;_.c=0;_.d=0;function qu(){qu=x;ru=new MD(Pe)}var ru;\nfunction QG(){QG=x;sN=new BC(1);H((oE(),pE[ai]),bf)?R=30:R=1}function OG(a,b,c,d,e){BH(a.a,P(J(Q(b*R))),P(J(Q(c*R))),P(J(Q(d*R))),P(J(Q(e*R))),P(J(Math.round(-35))),P(J(Math.round(-110))))}function RG(a,b,c,d,e){SG(a.a,P(J(Q(b*R))),P(J(Q(c*R))),P(J(Q(d*R))),P(J(Q(e*R))))}function sH(a,b,c,d){var e,f,g;f=D(B,q,-1,d,1);g=D(B,q,-1,d,1);for(e=0;e<d;++e)f[e]=P(J(Q(b[e]*R))),g[e]=P(J(Q(c[e]*R)));a=a.a;a.n&&(LG(a,!1),MG(a,tN(a,f,g,d,2<d)))}\nfunction IG(a,b,c,d,e){TG(a.a,P(J(Q(b*R))),P(J(Q(c*R))),P(J(Q(d*R))),P(J(Q(e*R))))}function rH(a,b,c,d){lH(a.a,b,P(J(Q(c*R))),P(J(Q(d*R))))}\nfunction JG(a,b,c,d,e,f){var g,h;g=a.a.e;f?(h=UC(g),f=new km(dw(0.7*(g.d>>16&255)),dw(0.7*(g.d>>8&255)),dw(0.7*(g.d&255))),gH(a.a,g)):(h=new km(dw(0.7*(g.d>>16&255)),dw(0.7*(g.d>>8&255)),dw(0.7*(g.d&255))),f=UC(g),gH(a.a,h));g=P(J(Q(R)));d=P(J(Q(d*R)));e=P(J(Q(e*R)));b=P(J(Q(b*R)));c=P(J(Q(c*R)));d-=g;e-=g;PG(a.a,b+g,c+g,d-g,e-g);gH(a.a,h);PG(a.a,b,c,d,g);PG(a.a,b,c+g,g,e);gH(a.a,f);PG(a.a,b+d,c,g,e+g);PG(a.a,b+1,c+e,d,g)}\nfunction KG(a,b,c,d,e){a=a.a;b=P(J(Q(b*R)));c=P(J(Q(c*R)));d=P(J(Q(d*R)));e=P(J(Q(e*R)));LG(a,!0);MG(a,NG(a,b,c,d,e))}function VG(a,b,c,d){var e,f,g;f=D(B,q,-1,d,1);g=D(B,q,-1,d,1);for(e=0;e<d;++e)f[e]=P(J(Q(b[e]*R))),g[e]=P(J(Q(c[e]*R)));a=a.a;LG(a,!0);MG(a,tN(a,f,g,d,2<d))}function HG(a,b,c,d,e){PG(a.a,P(J(Q(b*R))),P(J(Q(c*R))),P(J(Q(d*R))),P(J(Q(e*R))))}function GG(a,b){!a.b?gH(a.a,b):b==a.c||WC(b,a.c)?gH(a.a,a.c):gH(a.a,a.b)}function jH(a,b){a.e=new oD(b.a,b.c,Math.round(b.b*R));JJ(a.a,a.e)}\nfunction uN(a){QG();this.a=a;1<R&&(this.d=new BC(R*sN.e),fH(this.a,this.d))}w(716,1,{},uN);_.a=null;_.b=null;_.c=null;_.d=null;_.e=null;_.f=null;var sN,R=0;function EG(a){this.a=a;this.b=new uN(a.a)}w(717,1,{},EG);_.a=null;_.b=null;function JH(){}function pN(a,b,c,d){this.c=a;this.d=b;this.b=c;this.a=d}w(719,1,{121:1},JH,pN);_.a=0;_.b=0;_.c=0;_.d=0;function qI(a){return a.a<a.c-1?(++a.a,Dx(a,a.a)):null}function pI(a){return 0<a.a?(--a.a,Dx(a,a.a)):null}function VJ(){$L(this)}w(720,648,kl,VJ);\n_.qg=function(){this.a=-1;this.b=D(aM,u,0,0,0);this.c=0};_.a=-1;function ou(a,b){var c;a.a=b;var d,e;d=null;if(e=c=(e=SD().a.ai(a),null!=e?new gE(e):null))e=(VD(),YD),e=ZD(e,(VD(),YD))||ZD(e,WD);if(e)try{d=dE(c)}catch(f){if(f=yq(f),G(f,74))yp(f);else if(G(f,82))yp(f);else throw f;}c=d;null!=c&&pF(b,c)}function nu(a){var a=new gE(a),b=SD(),c,d;try{c=dE(a),d=Lp(c)?c.tS():Pp(c),b.a.bi(d)}catch(e){if(e=yq(e),G(e,74))yp(e);else if(G(e,82))yp(e);else throw e;}}function WJ(){}w(722,1,Wl,WJ);\n_.zf=function(a){pF(this.a,a.a)};_.a=null;function EH(a){a.c=0;a.a=0;a.b=0}function TJ(){}w(723,1,{},TJ);_.a=0;_.b=0;_.c=0;function rK(){this.pb=Lz()}w(725,402,ll,rK);\nfunction ju(){var a;ju=x;vN=(a=!1,Yi in $wnd||Yi in $doc.documentElement?a=!0:$wnd.navigator.msPointerEnabled&&-1!==navigator.userAgent.toLowerCase().indexOf("touch")&&(a=!0),a);wN=-1!=$wnd.navigator.userAgent.indexOf("Windows NT");xN=vN&!wN;var b;a=z(B,q,-1,[8,8,127,46,1005,40,1001,35,10,13,27,27,1E3,36,1006,37,1003,34,1002,33,1007,39,1,16,9,9,1004,38]);ku=D(B,q,-1,1E3,1);for(b=0;b<ku.length;++b)ku[b]=-999;for(b=0;b<a.length;b+=2)ku[a[b+1]]=a[b]}\nfunction kC(a,b,c){var d;d=new yN;iy(d.t,b,c);Ty(a.f,d.t,0,0);Dm(a.a,d);return d}function pC(a){var b;b=Tq(a.pb,Wi);0==b&&(b=parseInt(a.pb.style[Uh])||0);return b}function mK(a,b){return!a.e?null:b in a.e?a.e[b]:null}function oC(a){var b;b=Tq(a.pb,Xi);0==b&&(b=parseInt(a.pb.style[Fk])||0);return b}function wH(a,b,c,d){b=b.a;if(b.r!=c||b.s!=d)Wy(a.f,b.t,c,d),b.r=c,b.s=d;zN(b)}function QJ(a){var b;for(b=new zv(a.k);b.b<b.d.Tf();)a=Av(b),a.Yf()}function dK(a){a=vE(a);$wnd.open(a,"_blank",n)}\nfunction lK(a,b,c,d){ju();this.pb=Lz();this.i=new AN;this.a=new Jm;this.k=new Jm;this.e=d;this.pb.style[ij]=Fc;this.pb.style[bj]=Fc;this.pb.style[hk]=fi;this.pb.style[Fk]=b;this.pb.style[Uh]=c;this.f=new BN;this.f.pb.style[Fk]=Kc;hy(this.f,Kc);xN?(b=new CN,c=new DN,Ty(b,this.f,0,0),Ty(b,c,0,0),$y(this,b)):$y(this,this.f);this.c=a;a.Sc=this.i;a.Ec=this;xN&&(this.n=new EN(this),this.n.i=new FN(this),this.n.j=new GN(this),this.n.n=new HN(this),this.n.k=new IN(this),this.c&&(this.n.e=new JN(this),this.n.f=\nnew KN(this),this.n.a=new LN(this)));vy(this,new MN(this),(uu(),uu(),vu));vy(this,this,(xt(),xt(),yt));vy(this,new NN(this),(xu(),xu(),yu));vy(this,new ON(this),(Hu(),Hu(),Iu));vy(this,new PN(this),(Au(),Au(),Bu));vy(this,new QN(this),(Ku(),Ku(),Lu));vy(this,new RN(this),(gu(),gu(),hu));(PB(),PB(),QB).a=this;Gx(new SN(this))}w(724,725,ll,lK);_.b=!1;_.c=null;_.d=null;_.e=null;_.f=null;_.j=!1;_.n=null;var xN,wN,vN,ku=null;function BN(){Yy.call(this);this.pb[Tg]=bi}w(727,377,ll,BN);\nfunction CN(){BN.call(this);this.pb.style[Fk]=Kc;this.pb.style[Uh]=Kc}w(726,727,ll,CN);function Zt(a,b){var c;c=J(Q(100*b.c));c=new iE(b,0,Gj,c);cG(a.a.c,c);return!0}function KN(a){this.a=a}w(728,1,{},KN);_.Lh=function(a){return Zt(this,a)};_.a=null;function cu(a,b){var c;c=new iE(b,0,xh,Lk);cG(a.a.c,c);return!0}function LN(a){this.a=a}w(729,1,{},LN);_.Lh=function(a){return cu(this,a)};_.a=null;function MN(a){this.a=a}w(730,1,{},MN);\n_.ld=function(a){var b,c,d,e;d=st(a);e=tt(a);c=$q(a.a);b=new TN(a);2==c&&(b.e=4);b=LI(this.a.c,b,d,e);this.a.j=!0;b&&a.a.stopPropagation()};_.a=null;function NN(a){this.a=a}w(731,1,{},NN);_.md=function(a){var b,c;b=st(a);c=tt(a);a=new TN(a);(0>=b||b>=oC(this.a)-1||0>=c||c>=pC(this.a)-1)&&(this.a.j=!1);this.a.j?UI(this.a.c,a,b,c):PH(this.a.c,a,b,c);this.a.pb.focus()};_.a=null;function ON(a){this.a=a}w(732,1,{},ON);_.od=function(){this.a.j=!1;bJ(this.a.c)};_.a=null;function PN(a){this.a=a}\nw(733,1,{},PN);_.nd=function(){this.a.j&&(this.a.j=!1)};_.a=null;function QN(a){this.a=a}w(734,1,{},QN);_.a=null;function RN(a){this.a=a}w(735,1,{},RN);_.a=null;function DN(){BN.call(this);this.pb.style[Fk]=Kc;this.pb.style[Uh]=Kc}w(736,727,ll,DN);function SN(a){this.a=a}w(737,1,{},SN);_.Ud=function(){Jq((Gq(),Hq),new UN(this))};_.a=null;function UN(a){this.a=a}w(738,1,{},UN);_.pd=function(){this.a.a.c&&(mC(this.a.a.c),QJ(this.a.a))};_.a=null;\nfunction VN(a,b){var c;c=b.a;c.e=4;return LI(a.a.c,c,b.d,b.e)}function FN(a){this.a=a}w(739,1,{},FN);_.Lh=function(a){return VN(this,a)};_.a=null;function fv(a,b){PH(a.a.c,b.a,b.d,b.e);return LI(a.a.c,b.a,b.d,b.e)}function GN(a){this.a=a}w(740,1,{},GN);_.Lh=function(a){return fv(this,a)};_.a=null;function HN(a){this.a=a}w(741,1,{},HN);_.Lh=function(a){return UI(this.a.c,a.a,a.d,a.e)};_.a=null;function IN(a){this.a=a}w(742,1,{},IN);_.Lh=function(){return bJ(this.a.c)};_.a=null;\nfunction Yt(a,b){var c;c=J(Q(b.b));c=new iE(b,0,Aj,c);cG(a.a.c,c);return!0}function JN(a){this.a=a}w(743,1,{},JN);_.Lh=function(a){return Yt(this,a)};var WN=_.a=null;function XN(){XN=x;WN=new Qw((gx(),new fx("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAAEklEQVR42mM4MzPtPzJmIF0AAOqfLKHtSuV7AAAAAElFTkSuQmCC")),4,4)}function YN(){YN=x;ZN={}}\nfunction $N(a,b,c){var d;c&&(b.style[Ch]=c.b+oj,d=c.a,d!=Ie&&(b.style[Bh]=d),0!=(c.c&1)&&(b.style[Eh]=Eg),0!=(c.c&2)&&(b.style[Dh]=$h));a.e.style[Ek]=Si}\nfunction qD(a){var b=aO,c,d,e,f,g,h,j,l,o,m,r,t,y;c=Op(a);c in ZN?a=ZN[c]:(d=$doc.getElementsByTagName("body")[0],e=$doc.createElement(Sj),f=$doc.createElement(Yh),f.style[oh]=(Ur(),"inline"),f.style[Bk]=(Ks(),"baseline"),f.style[pi]=Gc,f.style[qi]=Gc,f.width=1,f.height=1,g=(XN(),WN),f.src=g.d.a,a=(h=$doc.createTextNode(zf),$N(b,e,a),e.appendChild(h),e.appendChild(f),d.appendChild(e),j=br(e),l=br(e)+(e.offsetHeight||0),o=l-j,m=br(f)+(f.offsetHeight||0)+1,r=l-m,t=m-j,d.removeChild(e),y=new bO,y.a=\nt,y.b=r,y.c=o,y),ZN[c]=a);return a}function cO(){YN();var a,b,c,d,e;ps();this.a=z(hw,u,1,["monospace","sans-serif",Lj]);this.c={};this.b={};this.d=$doc.getElementsByTagName("body")[0];this.e=$doc.createElement(Sj);this.e.innerHTML=this.f||n;this.e.style[Ch]="72.0px";for(b=this.a,c=0,d=b.length;c<d;++c)a=b[c],this.e.style[Bh]=a,this.d.appendChild(this.e),e=this.e.offsetWidth||0,this.c[a]=e,this.b[a]=this.e.offsetHeight||0,this.d.removeChild(this.e)}w(746,1,{},cO);_.d=null;_.e=null;_.f="mmmmmmmmmmlli";\nvar ZN;function bO(){}w(747,1,{},bO);_.a=0;_.b=0;_.c=0;function VI(a){if(0!=(a.e&4))return!0;try{if(a.a&&G(a.a,26))return!!a.a.a.metaKey}catch(b){if(b=yq(b),!G(b,105))throw b;}return!1}function MI(a){try{if(a.a&&G(a.a,26))return!!a.a.a.shiftKey}catch(b){if(b=yq(b),!G(b,105))throw b;}return!1}function TN(a){lu.call(this,null,0,null);this.a=a}w(748,492,Ql,TN);_.tf=function(){return VI(this)};_.uf=function(){return MI(this)};_.a=null;\nfunction LD(a,b){var c;if(b in a.a)return a.a[b];var d=a.b;c=aO;null==b||!b.length?c=0:(c.d.appendChild(c.e),c.e.innerHTML=b||n,$N(c,c.e,d),d=c.e.offsetWidth||0,c.d.removeChild(c.e),c=d);return a.a[b]=c}function CB(a){this.b=a;this.a={};!aO&&(aO=new cO)}w(749,495,bm,CB);var aO=null;function lC(a){this.a=a}w(750,502,{},lC);_.a=null;function AN(){eC.call(this)}w(751,471,El,AN);function dO(a,b){this.a=a;this.b=b}w(752,1,{},dO);_.a=null;_.b=null;\nfunction eO(){aA.call(this);this.pb[Tg]="jsa-resetTable";this.pb.style[Fk]=xg}w(753,415,ll,eO);function fO(){fO=x;var a=gO=new cO;ps();a.f="9p";a.e.style[Bh]=Lj;a.e.style[Ch]="144.0pt";a.e.innerHTML=a.f||n;a.d.appendChild(a.e);a.d.removeChild(a.e);a.e.style[Ch]="144.0px";a.d.appendChild(a.e);a.d.removeChild(a.e);hO=new BC(1)}function MG(a,b){a.p=!0;if(a.j){a.o&&(a.d.length=0,a.o=!1);var c=a.d;c[c.length]=b}else c=a.d,c[c.length]=b,zN(a)}\nfunction BH(a,b,c,d,e,f,g){var h,j,l,o,m,r,t,y,v,s,A;a.n&&(LG(a,!1),360<=g||-360>=g?h=NG(a,b,c,d,e):h=(j=f+g,l=0,j<f&&(l=1),o=0,(180<g||-180>g)&&(o=1),m=b+d/2,r=c+e/2,t=d/2,y=e/2,v=iO(m,r,t,y,f),s=iO(m,r,t,y,j),A="<g"+a.k+Fd,A+=\'<path d ="M \'+v.a+ga+v.b+" A "+t+ga+y+" 0 "+o+ga+l+ga+s.a+ga+s.b+Aa,A+=td,A),MG(a,h))}function SG(a,b,c,d,e){var f,g,h,j,l,o;a.n&&(b=(f=a.a,a.a=!1,g=n+b,h=n+d,j=n+c,l=n+e,o=zd+g+wa+j+va+h+xa+l+ua+a.f+oa+a.c+a.b+zc,a.a=f,o),MG(a,b))}\nfunction TG(a,b,c,d,e){a.n&&(LG(a,!1),MG(a,\'<rect x="\'+b+za+c+ra+e+\'" width="\'+d+na+a.k+zc))}function lH(a,b,c,d){var e,b=b.replace(/&/g,Ua).replace(/<\/g,ab).replace(/>/g,Ya),b=(e=a.f,Ad+c+za+d+oa+a.i+\' fill="\'+e+Ca+b+vd);MG(a,b)}function PG(a,b,c,d,e){LG(a,!0);MG(a,\'<rect x="\'+b+za+c+ra+e+\'" width="\'+d+na+a.k+zc)}\nfunction zN(a){var b;if(a.p){for(;null!=(b=a.u.pop());){var c=a.d;c[c.length]=b}b=a.d.join(ea);var d=a.t,c=ar(d.pb)+(d.pb.offsetWidth||0)-ar(d.pb);0==c&&(c=parseInt(d.pb.style[Fk])||0);var d=a.t,e;e=br(d.pb)+(d.pb.offsetHeight||0)-br(d.pb);0==e&&(e=parseInt(d.pb.style[Uh])||0);var c=\'<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="\'+c+ra+e+Ca,f,d=!(f=$wnd.navigator.userAgent,-1!=f.indexOf("Firefox"))?"<style> text { cursor: default; } <\/style>":n;b=c+d+b+ud;b!==a.q&&(a.t.pb.innerHTML=\nb||n,a.q=b);a.o=!0;a.p=!1}}function gH(a,b){(a.e=b)&&(a.f=jO(b))}function JJ(a,b){var c,d,e;a.i=(c=b.b,d=b.a,e=n,12!=c&&(e=\' font-size="\'+c+\'px"\'),"Plain"!=d&&(e+=\' font-family="\'+d+na),0!=(b.c&1)&&(e+=\'font-weight="bold"\'),0!=(b.c&2)&&(e+=\'font-style="italic"\'),e)}function fH(a,b){(a.n=b)&&b&&(a.c=\'stroke-width="\'+(b.e==dw(b.e)?n+dw(b.e):n+b.e)+oa)}w(754,498,{});_.d=null;_.e=null;_.f=Bg;_.i=null;_.j=!0;_.k=null;_.o=!1;_.p=!1;_.q=n;_.r=0;_.s=0;_.t=null;_.u=null;var hO,gO;\nfunction bv(a,b){var c;c=b.a.targetTouches;return 1==c.length?(c=c[0],a.b.d=c.clientX-ar(a.o.pb)+(a.o.pb.scrollLeft||0)+fr(a.o.pb.ownerDocument),a.b.e=c.clientY-br(a.o.pb)+(a.o.pb.scrollTop||0)+gr(a.o.pb.ownerDocument),a.b.a=new TN(b),b.a.preventDefault(),!0):!1}\nfunction EN(a){this.o=a;this.b=new kO;this.c=new lO(this);vy(this.o,new mO(this),(cv(),cv(),dv));vy(this.o,new nO(this),(Vu(),Vu(),Wu));vy(this.o,new oO(this),(Zu(),Zu(),$u));vy(this.o,new pO(this),(Ru(),Ru(),Su));vy(this.o,new qO,(du(),du(),eu));vy(this.o,new rO(this),($t(),$t(),au));vy(this.o,new sO(this),(Vt(),Vt(),Wt))}w(755,1,{},EN);_.a=null;_.b=null;_.c=null;_.d=!1;_.e=null;_.f=null;_.i=null;_.j=null;_.k=null;_.n=null;_.o=null;function lO(a){Lm();this.a=a}w(756,65,{},lO);\n_.vd=function(){!this.a.d&&this.a.i&&VN(this.a.i,this.a.b)};_.a=null;function mO(a){this.a=a}w(757,1,{},mO);_.a=null;function nO(a){this.a=a}w(758,1,{},nO);_.a=null;function oO(a){this.a=a}w(759,1,{},oO);_.a=null;function pO(a){this.a=a}w(760,1,{},pO);_.a=null;function qO(){}w(761,1,{},qO);function rO(a){this.a=a}w(762,1,{},rO);_.a=null;function sO(a){this.a=a}w(763,1,{},sO);_.a=null;function kO(){}w(764,1,{},kO);_.a=null;_.b=0;_.c=0;_.d=0;_.e=0;\nfunction jO(a){var b,c;c=a.d>>16&255;b=a.d>>8&255;a=a.d&255;if(0==c*b*a){if(0==c&&0==b&&0==a)return Bg;if(255==c&&0==b&&0==a)return"red";if(0==c&&255==b&&0==a)return"green";if(0==c&&0==b&&255==a)return Cg}return 255==c&&255==b&&255==a?"white":yj+c+kb+b+kb+a+hb}function $J(){var a=$wnd.navigator.userAgent.match(/MSIE\\s+(\\d+\\.\\d+)/);return a?parseFloat(a[1]):-1}\nfunction tO(a){var b,c,d,e,f;By(a);d=(Cy(),RA(null));e=new eO;Yz(e,a);Ly(d,e,d.pb);f=a.he();b=a.ge();c=$J();9<=c?(++f,++b):7==c&&G(a,39)&&(c=a.pb.textContent,2>=c.length&&(f+=8));$z(e,a);Uy(d,e);return new JB(f,b)}function dF(a){try{$wnd.console.log(a)}catch(b){}}function uO(){this.pb=$doc.createElement(ph);this.pb[Tg]=bi;this.pb.style[cj]=Vh;this.pb.style[lj]=gg;this.pb.style[Fk]=Kc;this.pb.style[Uh]=Kc;this.pb.setAttribute("contenteditable",zh)}w(766,380,pl,uO);\nfunction iO(a,b,c,d,e){e*=0.017453292519943295;a+=c*Math.cos(e);b+=-d*Math.sin(e);return new dO(new nL(a),new nL(b))}function NG(a,b,c,d,e){return\'<ellipse cx="\'+(b+d/2)+qa+(c+e/2)+\'" rx="\'+d/2+\'" ry="\'+e/2+na+a.k+zc}function tN(a,b,c,d,e){var f,g,h,j;if(1>d)return n;g=d;e&&(d-=1,b[0]==b[d]&&c[0]==c[d]&&--g);d=\' points="\';for(f=0;f<g;++f)h=b[f],j=c[f],d+=h+kb+j,f<g-1&&(d+=ga);d+=na;b=id;e?b+="polygon":b+="polyline";return b+=d+a.k+zc}\nfunction eH(a,b){MG(a,"<g "+(\'transform="scale(\'+b+\')"\')+Fd);var c=a.u;c[c.length]=td}function LG(a,b){var c;c=a.f;(a.a=b)?a.k=\' stroke="none" fill="\'+c+oa+a.b:a.k=\' fill="none" stroke="\'+c+oa+a.c+a.b}function yN(){fO();this.n=hO;this.d=[];this.t=new uO;this.u=[]}w(767,754,{},yN);_.a=!1;_.b=n;_.c=n;function vO(){vO=x;wO=new JB(0,0)}function UB(a,b){var c;if(a.Qf())return wO;if(-1!=a.e.b&&-1!=a.e.a)return a.e;a.Sh(AB(b));c=tO(a.If());a.e.b=c.b;a.e.a=c.a;return c}\nfunction xO(){this.e=new aD;this.e.a=-1;this.e.b=-1}w(769,1,{});_.Qf=LJ;_.Sh=function(a){var b=this.If().pb,c,d,e;c=(mD(),nD);e=a.b;d=a.a;e!=c.b?b.style[Ch]=n+e+"pt":b.style[Ch]=n;d!=c.a?b.style[Bh]=d:b.style[Bh]=n;0!=(a.c&1)?b.style[Eh]=Eg:b.style[Eh]=n;0!=(a.c&2)?b.style[Dh]=$h:b.style[Dh]=n};_.e=null;var wO;function gC(){vO();xO.call(this);this.d=new Yy}w(773,769,{},gC);_.If=XC;_.d=null;function vD(a){this.a=new GA(a.f,new yO(a));FA(this.a,a.e)}w(775,1,{},vD);_.a=null;\nfunction BA(a){var b,c,d,e,f;f=new hE(a.a,1001,null!=a.a.c?a.a.c:a.a.f);for(c=Ou(a.a.d,D(zO,u,75,0,0)),d=0,e=c.length;d<e;++d)if(b=c[d],G(b,55)){b.Ec.j=!1;break}a=a.a;b=a.n.d;f!=b.a&&(b.a=f,b.b=Fv((sC(),tC),new uC(f.k)));b=b.b;if(Gw(!b?Kk:b.a,Vk))for(b=(!a.d.a||0==a.d.a.c?(Iv(),Iv(),Ov):new yC(a.d.a)).ye();b.Zd();)a=b.$d(),1001==f.k&&a.zf(f);var g,h,j;1001==f.k?(g=new lu(f.n,f.k,f.a),g.e=f.b&15):601==f.k?(null.ei(),null.ei()):100==f.k&&G(f.n,72)?(h=f.n,j=new lu(h,205,null),j.i=h.We(),j.j=h.Xe()):\n1004<=f.k&&1005>=f.k||(701==f.k?null.ei():401==f.k||402==f.k?(null.ei(),null.ei(),null.ei(),null.ei(),null.ei()):500<=f.k&&507>=f.k&&(g=null.fi,500!=g&&(g=new lu(null.fi,g,null),g.i=f.f,g.j=f.i,f=f.j&63,g.e=f&12)))}function yO(a){this.a=a}w(776,1,Dl,yO);_.pd=function(){BA(this)};_.a=null;function QD(){vO();xO.call(this);this.a=new eB}w(777,769,{},QD);_.If=Xw;_.a=null;function TD(){new wv;var a;a:{switch(ew){case 1:case 3:case 5:case 7:a=new AO;break a}a=new BO}this.a=a}w(790,522,{},TD);_.a=null;\nfunction BO(){}w(792,1,{},BO);_.ai=function(a){a&&a&&rq(8,new CO(a));return null};_.bi=function(a){rq(8,new DO(a))};function AO(){}w(791,792,{},AO);_.ai=function(){return $wnd.clipboardData.getData("Text")};_.bi=function(a){$wnd.clipboardData.setData("Text",a)};function CO(a){this.a=a}w(795,1,Ul,CO);_.zd=XB;_.a=null;function DO(a){this.a=a}w(797,1,Ul,DO);_.zd=XB;_.a=null;function Ut(a,b){a.onloadend=function(a){b.Xf(a.target.result)}}function lF(a){this.a=a}w(802,1,{},lF);_.a=null;\nfunction iF(){}w(803,1,{},iF);function jF(){}w(804,1,{},jF);function kF(){}w(805,1,{},kF);function RD(){this.b=new UD;this.d=new wC}w(808,520,{},RD);function NH(a,b,c,d){b=DB(b);c+=b.a;d+=b.b;hz(a.a,c,d);iz(a.a)}function CD(){vO();xO.call(this);var a=this.a=new EO;a.ab=!0;a.a.f=!0;this.a.db=!0}w(810,769,{},CD);_.If=Xw;_.a=null;function AE(){}w(818,549,{},AE);\nfunction xE(){xE=x;var a;a=(oE(),pE["os.encoding"]);if(null!=a)try{if(H("UTF-8",a))AL(n);else if(H("ISO-8859-1",a)||H("ISO-LATIN-1",a))D(BL,rl,-1,0,1);else throw new XK(a+ma);}catch(b){if(b=yq(b),!G(b,106))throw b;}}function wD(a,b){a.a=31*a.a+dw((new nL(b)).a)}function CC(){}w(823,1,{},CC);_.hC=Xw;_.a=1;\nfunction EO(){var a=(pz(),sz);jz.call(this,!0,wi);this.U=a.a;this.a=new FO(this);this.a.d=!0;$y(this,this.a);this.ab=!0;this.a.f=!0;if(-1==this.lb){var a=this.pb,b=1|(this.pb.__eventBits||0);tx();dy(a,b)}else this.lb|=1;Yq(Xq(this.pb))[Tg]=Rh;this.pb.style[Hk]="2147483647"}w(854,382,ll,EO);_.ae=function(a){zy(this,a);1==rx(a.type)&&ez(this,!1)};_.a=null;\nfunction FO(a){this.b=a;this.c=new Jm;this.i=new Jm;a=(EA(),DA);new uB(a.d,a.b,a.c,a.e,a.a);var b;b=$doc.createElement(Yj);this.e=$doc.createElement(ak);lx(b,this.e);this.o=!0;a=Lz();b=(mx(),nx(b));a.appendChild(b);this.pb=a;Un();this.pb.setAttribute("role",yo.a);-1==this.lb?(a=this.pb,b=2225|(this.pb.__eventBits||0),tx(),dy(a,b)):this.lb|=2225;this.pb[Tg]=Qh;a=ly(this.pb)+"-vertical";gy(this.ie(),a,!0);this.pb.style[bj]=Hc;this.pb.setAttribute("hideFocus",xk);vy(this,new CA(this),(mt(),mt(),nt))}\nw(855,424,pl,FO);_.ae=function(a){switch(rx(a.type)){case 16:this.a=!1;break;case 32:this.a=!0}uA(this,a)};_.Ke=function(a,b){yA(this,a,b);b||this.a&&ez(this.b,!1)};_.a=!0;_.b=null;w(903,1,{});\nfunction GO(a,b,c,d){var e,f,g,h,j,l;h=(!c?b.b:JE(b,c,~~Op(c)))[0][d.length];b=j=e=null;for(c=0,f=!h?0:h.length;c<f;++c){g=h[c];var o;a:{o=g;var m=d,r=void 0,t=void 0,y=void 0,v=t=r=void 0,s=t=void 0,A=void 0,t=void 0;for(y=0,A=m.length;y<A;++y)if(s=o[y+3],v=m[y],r=null==v?Ti:typeof v,r=r==Vi?Object.prototype.toString.call(v)==Xf||typeof v.length==Ui?"array":r:r,!H(r,s)&&(!H(Vj,s)||!H(Ti,r)))if(v=H(Ui,r),r=H(Fg,r),HO===s)v&&(m[y]=new nL(m[y])),r&&(m[y]=(iG(),m[y]?jG:kG));else{t=v||r;if(t=!t&&null!=\ns&&Jp(s)==IO){t=m[y];if(null==t||JO(t,s))continue;if(Ip(t)&&(t=t&&t.g?t.g:null,null!=t&&JO(t,s))){m[y]=t;continue}}if(!H(Vi,s)||v||r){o=!1;break a}}o=!0}if(o){e=g[0];j=g[1];b=g[2];break}}return e?(d=b?b(a,d):d,a=(l=e.apply(a,d),[j?j(l):l])):null}function KO(){this.c=new xp;this.a=new xp;this.b=new xp}function JO(a,b){var c;if(HO==b||LO==b&&G(a,133))return!0;if(null!=a)for(c=Jp(a);c&&c!=HO;c=null)if(c==b)return!0;return!1}w(902,903,{},KO);function JK(){JK=x;MO=new KO}\nfunction OK(a,b){JK();E(MO.c,a,b)}function GK(a){JK();var b,c,d;d=yL(a,Zf);c=$wnd;a=0;for(b=d.length-1;a<b;++a)H(d[a],"client")||(c[d[a]]||(c[d[a]]={}),c=null!=c?c[d[a]]:null);return null!=c?c[d[a]]:null}function HK(a,b){var c;JK();return c=b&&b[0]&&(typeof b[0]==Vi||typeof b[0]==Gh)?b[0]:null,JO(c,a)}function MK(a,b){var c=IK;JK();var d=MO,e;e=b?d.b:d.a;if(d=!c?e.b:JE(e,c,~~Op(c))){var f=d;for(p in a)f[p]=a[p]}else d=a;!c?KE(e,d):ME(e,c,d,~~Op(c))}\nfunction LK(a,b,c){var d=IK;JK();var e=MO,c=c?e.b:e.a,e=GO(a,c,d,b);if(!e){e=[a];for(i=0;i<b.length;i++)e.push(b[i]);b=e;e=GO(a,c,d,b)}if(!e)throw new Ep("Can\'t find exported method for given arguments: 0"+bd+b.length+ea);return e}function dJ(a){JK();var b=MO,c;null==a?a=null:(c=a[dg],c||(0!=(Jp(a).b&4)?a=[]:(b=(b=Fv(b.c,Jp(a)))&&typeof b==Gh?new b(a):a,a=a[dg]=b),c=a),a=c);return a}var MO;\nfunction C(a){return function(){try{var b;var c=arguments,d;var e;0!=Cq&&(e=zm(),2E3<e-Eq&&(Eq=e,Dq=Bq()));if(0==Cq++){var f=(Gq(),Hq),g,h;if(f.b){h=null;do g=f.b,f.b=null,h=Pq(g,h);while(f.b);f.b=h}d=!0}else d=!1;try{b=a.apply(this,c)}finally{if(c=d){var j=(Gq(),Hq),l,o;if(j.c){o=null;do l=j.c,j.c=null,o=Pq(l,o);while(j.c);j.c=o}}--Cq;c&&-1!=Dq&&($wnd.clearTimeout(Dq),Dq=-1)}return b}catch(m){throw m;}}}\nfunction gwtOnLoad(a,b,c,d){$moduleName=b;$moduleBase=c;ew=d;if(a)try{C(fw)()}catch(e){a(b)}else C(fw)()}var HO=W(1),Mp=W(142),NO=jL(" I"),B=dL(909,NO);W(151);var aM=dL(913,HO),oq=dL(917,aM),OO=jL(" Z"),pq=dL(907,OO),PO=iL(),qq=dL(918,PO),QO=iL(),sq=dL(919,QO);W(138);W(137);W(136);W(154);W(155);W(153);W(156);W(152);var RO=W(329),Lw=dL(920,RO);W(330);W(193);W(594);W(148);W(611);var SO=jL(" B");W(615);var TO=jL(" C"),qL=dL(921,TO),IO=W(613),UO=jL(" D"),rG=dL(908,UO);W(614);W(616);\nvar VO=W(618),aJ=dL(922,VO),WO=jL(" J"),XO=W(2),hw=dL(914,XO),BL=dL(923,SO);W(627);W(610);W(141);W(249);W(592);var IK=W(581);W(605);var VK=W(602);W(600);W(601);W(607);W(169);W(159);W(166);W(167);W(161);W(162);W(163);W(164);W(170);W(139);W(622);W(617);W(603);W(604);W(582);W(583);W(584);W(585);W(586);W(587);W(588);W(589);W(590);W(591);var YO=W(472);W(471);W(470);W(469);W(577);W(576);W(578);W(579);W(580);W(723);\nvar YC=W(486),LF=dL(924,YC),ZO=W(494),QF=dL(925,ZO),$O=W(495),SF=dL(926,$O),aP=W(713),gJ=dL(927,aP),DI=dL(928,B);W(710);W(711);W(696);W(698);W(702);W(703);W(704);W(705);W(706);W(707);W(708);W(709);W(699);W(700);W(701);W(697);var kM=dL(929,YO),bP=iL(),Pu=dL(930,bP);W(722);W(571);W(572);W(597);iL();W(596);iL();W(903);W(902);var LO=iL();W(381);var cP=W(380);W(379);W(385);W(402);W(444);W(751);W(725);W(724);W(378);W(377);W(727);W(726);W(736);W(737);W(738);W(739);W(740);W(741);W(742);W(743);W(728);W(729);\nW(730);W(731);W(732);W(733);W(734);W(735);W(309);W(308);W(390);W(391);W(392);W(65);W(363);W(755);W(764);W(756);W(757);W(758);W(759);W(760);W(761);W(762);W(763);W(497);W(498);W(754);W(633);W(640);W(648);W(641);W(642);W(440);W(443);W(441);W(442);W(599);W(598);W(564);W(563);W(562);W(565);W(566);W(567);W(802);W(803);W(804);W(805);\nvar dP=hL(228,function(){ps();return Is}),Js=dL(931,dP),eP=hL(199,function(){hr();return Sr}),Tr=dL(933,eP),fP=hL(218,function(){Ur();return cs}),ds=dL(934,fP),gP=hL(223,function(){es();return ns}),os=dL(935,gP),hP=hL(238,function(){Ks();return at}),bt=dL(936,hP);hL(229,null);hL(230,null);hL(231,null);hL(232,null);hL(233,null);hL(234,null);hL(235,null);hL(236,null);hL(237,null);hL(200,null);hL(210,null);hL(211,null);hL(212,null);hL(213,null);hL(214,null);hL(215,null);hL(216,null);hL(217,null);\nhL(201,null);hL(202,null);hL(203,null);hL(204,null);hL(205,null);hL(206,null);hL(207,null);hL(208,null);hL(209,null);hL(219,null);hL(220,null);hL(221,null);hL(222,null);hL(224,null);hL(225,null);hL(226,null);hL(227,null);hL(239,null);hL(240,null);hL(241,null);hL(242,null);hL(243,null);hL(244,null);hL(245,null);hL(246,null);W(553);W(552);W(635);W(634);W(636);W(638);W(637);W(639);W(643);W(644);W(261);W(260);W(259);W(265);W(264);W(263);W(269);var iP=W(268);W(267);W(284);W(286);W(287);W(502);W(717);\nvar jP=W(719),kP=W(681),lP=W(686),eN=dL(937,kP),fN=dL(938,lP),mH=dL(939,jP);W(714);W(712);W(365);W(303);W(367);W(306);W(305);W(304);W(465);W(466);W(467);W(507);W(506);W(505);W(510);var mP=iL(),zO=dL(941,mP);W(361);W(551);W(656);W(315);W(520);W(521);W(675);W(690);var nP=hL(692,function(){UH();return WM}),XM=dL(943,nP),oP=hL(693,function(){YH();return ZM}),$M=dL(944,oP),pP=hL(691,function(){WH();return RM}),SM=dL(945,pP);W(293);W(295);W(555);W(624);W(630);W(687);W(688);W(689);W(509);var yD=W(508);W(492);\nW(720);W(491);var bD=W(490);W(518);W(519);W(150);W(501);W(266);W(808);W(455);var pB=dL(946,cP);W(456);W(767);W(766);W(416);W(418);W(417);W(419);W(290);W(307);W(716);W(515);W(516);W(517);W(480);W(554);W(479);W(478);var qP=dL(915,WO);W(660);W(626);W(298);W(285);W(288);W(289);W(282);W(281);W(283);W(300);W(271);W(275);W(500);W(474);W(473);W(527);W(476);W(477);W(513);W(512);var DD=W(511);W(654);W(556);W(557);W(676);W(663);W(468);W(677);W(135);var lD=W(493);W(609);W(746);W(747);W(273);W(272);W(274);W(276);\nW(661);W(823);var pD=W(749);W(769);W(810);W(530);W(775);W(776);W(487);W(297);W(294);W(296);W(292);W(280);W(279);W(278);W(384);W(383);W(382);W(854);W(424);W(855);var rP=hL(386,function(){pz();return wz}),xz=dL(951,rP),sP=hL(436,function(){lz();return MA}),NA=dL(952,sP);W(58);W(437);W(438);W(433);W(434);W(435);W(59);W(60);W(61);W(425);W(426);W(427);W(428);W(431);W(694);W(750);W(343);W(412);W(413);W(432);W(773);W(777);var rD=W(503);W(336);W(532);W(533);W(526);W(388);W(752);W(395);W(447);W(446);W(448);\nvar tP=hL(449,function(){dB();return nB}),oB=dL(966,tP);hL(450,null);hL(451,null);hL(452,null);hL(453,null);W(310);W(68);W(69);W(67);W(70);W(73);W(74);W(75);W(76);W(77);W(78);var uP=W(90),zA=dL(967,uP);W(79);W(80);W(81);W(82);W(83);W(84);W(85);W(87);W(86);W(88);W(89);W(91);W(92);W(94);W(95);W(93);W(96);W(97);W(98);W(99);W(101);W(103);W(104);W(102);W(100);W(105);W(106);W(107);W(108);W(110);W(113);W(112);W(114);W(117);W(118);W(116);W(119);W(120);W(121);W(122);W(123);W(124);W(126);W(127);W(125);W(128);\nW(129);W(130);W(131);W(133);W(134);W(132);W(396);W(415);W(414);W(651);W(389);W(337);var aE=W(523),cE=dL(970,aE);W(524);W(522);W(753);W(459);W(258);W(374);W(375);W(345);W(347);W(346);W(341);W(458);W(338);W(547);W(546);W(548);W(628);W(302);W(72);W(348);W(421);W(423);W(748);W(790);W(525);W(549);W(340);W(71);W(109);W(792);W(795);W(797);W(791);W(542);W(543);W(550);W(606);W(818);W(62);W(63);var vP=W(66),Um=dL(974,vP);W(64);W(335);function YB(){return KB(this)}function XB(){}\nfunction Iz(a){return uy(this,a,(Rt(),Rt(),St))}function Xw(){return this.a}function CK(){var a=this.b;this.c.a.apply(a,[dJ(this.a.a),a])}function MJ(){return!1}function Vw(){return $D(this.a)}function sy(){return Tq(this.pb,Xi)}function fm(){return Op(this)}function Hz(a){return uy(this,a,(Kt(),Kt(),Lt))}function Fy(){}function em(a){return this===a}function ZB(){return this.cZ.d+Wf+this.cf()+cg}function HE(){return 0==this.Tf()}function Fz(a){return uy(this,a,(Dt(),Dt(),Et))}\nfunction At(){return this.c}function pL(){return n+this.a}function ty(){return this.pb}function XC(){return this.d}function WB(){return IB(this)}function Bz(){return this.b}function NL(){return this.a.d}function hD(){}function Gz(a){return uy(this,a,(Ht(),Ht(),It))}function Yw(a){return!G(a,33)?!1:H(this.a,a.Xd())}function ZL(a){return Wx(this.a,a)}function ry(){return Tq(this.pb,Wi)}function LJ(){return!1}function oL(){return dw(this.a)}\nfunction OD(){var a;0<this.a?(a=KD(this,this.a),a=!a?IB(this):a):a=IB(this);return a}function Gy(){Ay(this)}function PD(){var a;0<this.a?(a=KD(this,this.a),a=!a?KB(this):a):a=KB(this);return a}function HL(){return this.a.a}function Uu(a){var b=a.a;if(a=a.a.k)bv(b,this),a.Lh(b.b);b.d=!0};window.gwtOnLoad=gwtOnLoad;$sendStats(\'moduleStartup\', \'moduleEvalEnd\');gwtOnLoad(__gwtModuleFunction.__errFn, __gwtModuleFunction.__moduleName, __gwtModuleFunction.__moduleBase, __gwtModuleFunction.__softPermutationId,__gwtModuleFunction.__computePropValue);$sendStats(\'moduleStartup\', \'end\');\n//@ sourceURL=0.js \n']);
|
Root.js
|
CostSheetApp/CostSheetsApp
|
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Provider } from 'react-redux';
import routes from '../routes';
import { Router } from 'react-router';
export default class Root extends Component {
render() {
const { store, history } = this.props;
return (
<Provider store={store}>
<Router history={history} routes={routes} />
</Provider>
);
}
}
Root.propTypes = {
store: PropTypes.object.isRequired,
history: PropTypes.object.isRequired
};
|
docs/src/shared/components/ReactMD/drawers/index.js
|
lwhitlock/grow-tracker
|
import React from 'react';
import SimpleExample from './SimpleExample';
import SimpleExampleRaw from '!!raw!./SimpleExample';
import MobileRightDrawerExample from './MobileRightDrawerExample';
import MobileRightDrawerExampleRaw from '!!raw!./MobileRightDrawerExample';
export default [{
title: 'Simple Example',
description: `
The \`Drawer\` can be docked to the left or right of the screen. The size of the drawer depends on
whether it has been docked on the left or right of the screen and the device type or screen size.
#### Docked Left
- On mobile devices, the width of the drawer will be \`calc(100vw - 56px)\` and a max width of \`320px\`.
- On tablets and desktop screens, the width will be equal to the \`$md-drawer-tablet-width\` and \`$md-drawer-desktop-width\`
but no more than \`400px\`.
#### Docked Right
- On mobile devices, the width of the drawer will be the entire viewport.
- On tablets and desktops, the width of the drawer will be the size of its content.
`,
code: SimpleExampleRaw,
children: <SimpleExample />,
}, {
title: 'Right Drawer Mobile',
description: `
This example shows how you could use a right drawer on mobile devices. Click on on one of the ListItem
to show a bigger version of the picture from [unsplash.it](https://unsplash.it).
`,
code: MobileRightDrawerExampleRaw,
children: <MobileRightDrawerExample />,
}];
|
src/routes/login/Login.js
|
jaruesink/ruesinkdds
|
/**
* React Starter Kit (https://www.reactstarterkit.com/)
*
* Copyright © 2014-present Kriasoft, LLC. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
import React from 'react';
import PropTypes from 'prop-types';
import withStyles from 'isomorphic-style-loader/lib/withStyles';
import s from './Login.css';
class Login extends React.Component {
static propTypes = {
title: PropTypes.string.isRequired,
};
render() {
return (
<div className={s.root}>
<div className={s.container}>
<h1>{this.props.title}</h1>
<p className={s.lead}>Log in with your username or company email address.</p>
<div className={s.formGroup}>
<a className={s.facebook} href="/login/facebook">
<svg
className={s.icon}
width="30"
height="30"
viewBox="0 0 30 30"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M22 16l1-5h-5V7c0-1.544.784-2 3-2h2V0h-4c-4.072 0-7 2.435-7 7v4H7v5h5v14h6V16h4z"
/>
</svg>
<span>Log in with Facebook</span>
</a>
</div>
<div className={s.formGroup}>
<a className={s.google} href="/login/google">
<svg
className={s.icon}
width="30"
height="30"
viewBox="0 0 30 30"
xmlns="http://www.w3.org/2000/svg"
>
<path
d={'M30 13h-4V9h-2v4h-4v2h4v4h2v-4h4m-15 2s-2-1.15-2-2c0 0-.5-1.828 1-3 ' +
'1.537-1.2 3-3.035 3-5 0-2.336-1.046-5-3-6h3l2.387-1H10C5.835 0 2 3.345 2 7c0 ' +
'3.735 2.85 6.56 7.086 6.56.295 0 .58-.006.86-.025-.273.526-.47 1.12-.47 1.735 ' +
'0 1.037.817 2.042 1.523 2.73H9c-5.16 0-9 2.593-9 6 0 3.355 4.87 6 10.03 6 5.882 ' +
'0 9.97-3 9.97-7 0-2.69-2.545-4.264-5-6zm-4-4c-2.395 0-5.587-2.857-6-6C4.587 ' +
'3.856 6.607.93 9 1c2.394.07 4.603 2.908 5.017 6.052C14.43 10.195 13 13 11 ' +
'13zm-1 15c-3.566 0-7-1.29-7-4 0-2.658 3.434-5.038 7-5 .832.01 2 0 2 0 1 0 ' +
'2.88.88 4 2 1 1 1 2.674 1 3 0 3-1.986 4-7 4z'}
/>
</svg>
<span>Log in with Google</span>
</a>
</div>
<div className={s.formGroup}>
<a className={s.twitter} href="/login/twitter">
<svg
className={s.icon}
width="30"
height="30"
viewBox="0 0 30 30"
xmlns="http://www.w3.org/2000/svg"
>
<path
d={'M30 6.708c-1.105.49-2.756 1.143-4 1.292 1.273-.762 2.54-2.56 ' +
'3-4-.97.577-2.087 1.355-3.227 1.773L25 5c-1.12-1.197-2.23-2-4-2-3.398 0-6 ' +
'2.602-6 6 0 .4.047.7.11.956L15 10C9 10 5.034 8.724 2 5c-.53.908-1 1.872-1 ' +
'3 0 2.136 1.348 3.894 3 5-1.01-.033-2.17-.542-3-1 0 2.98 4.186 6.432 7 7-1 ' +
'1-4.623.074-5 0 .784 2.447 3.31 3.95 6 4-2.105 1.648-4.647 2.51-7.53 2.51-.5 ' +
'0-.988-.03-1.47-.084C2.723 27.17 6.523 28 10 28c11.322 0 17-8.867 17-17 ' +
'0-.268.008-.736 0-1 1.2-.868 2.172-2.058 3-3.292z'}
/>
</svg>
<span>Log in with Twitter</span>
</a>
</div>
<strong className={s.lineThrough}>OR</strong>
<form method="post">
<div className={s.formGroup}>
<label className={s.label} htmlFor="usernameOrEmail">
Username or email address:
</label>
<input
className={s.input}
id="usernameOrEmail"
type="text"
name="usernameOrEmail"
autoFocus
/>
</div>
<div className={s.formGroup}>
<label className={s.label} htmlFor="password">
Password:
</label>
<input
className={s.input}
id="password"
type="password"
name="password"
/>
</div>
<div className={s.formGroup}>
<button className={s.button} type="submit">
Log in
</button>
</div>
</form>
</div>
</div>
);
}
}
export default withStyles(s)(Login);
|
ajax/libs/material-ui/5.0.0-alpha.23/node/internal/svg-icons/MoreHoriz.js
|
cdnjs/cdnjs
|
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var React = _interopRequireWildcard(require("react"));
var _createSvgIcon = _interopRequireDefault(require("../../utils/createSvgIcon"));
/**
* @ignore - internal component.
*/
var _default = (0, _createSvgIcon.default)( /*#__PURE__*/React.createElement("path", {
d: "M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"
}), 'MoreHoriz');
exports.default = _default;
|
app/javascript/mastodon/components/status_action_bar.js
|
ambition-vietnam/mastodon
|
import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types';
import IconButton from './icon_button';
import DropdownMenuContainer from '../containers/dropdown_menu_container';
import { defineMessages, injectIntl } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component';
import { me } from '../initial_state';
const messages = defineMessages({
delete: { id: 'status.delete', defaultMessage: 'Delete' },
edit: {id: 'status.edit', defaultMessage: 'Edit'},
mention: { id: 'status.mention', defaultMessage: 'Mention @{name}' },
mute: { id: 'account.mute', defaultMessage: 'Mute @{name}' },
block: { id: 'account.block', defaultMessage: 'Block @{name}' },
reply: { id: 'status.reply', defaultMessage: 'Reply' },
share: { id: 'status.share', defaultMessage: 'Share' },
more: { id: 'status.more', defaultMessage: 'More' },
replyAll: { id: 'status.replyAll', defaultMessage: 'Reply to thread' },
reblog: { id: 'status.reblog', defaultMessage: 'Boost' },
cannot_reblog: { id: 'status.cannot_reblog', defaultMessage: 'This post cannot be boosted' },
favourite: { id: 'status.favourite', defaultMessage: 'Favourite' },
open: { id: 'status.open', defaultMessage: 'Expand this status' },
report: { id: 'status.report', defaultMessage: 'Report @{name}' },
muteConversation: { id: 'status.mute_conversation', defaultMessage: 'Mute conversation' },
unmuteConversation: { id: 'status.unmute_conversation', defaultMessage: 'Unmute conversation' },
pin: { id: 'status.pin', defaultMessage: 'Pin on profile' },
unpin: { id: 'status.unpin', defaultMessage: 'Unpin from profile' },
embed: { id: 'status.embed', defaultMessage: 'Embed' },
translate: { id: 'status.translate', defaultMessage: 'Translate' },
});
@injectIntl
export default class StatusActionBar extends ImmutablePureComponent {
static contextTypes = {
router: PropTypes.object,
};
static propTypes = {
status: ImmutablePropTypes.map.isRequired,
onReply: PropTypes.func,
onFavourite: PropTypes.func,
onReblog: PropTypes.func,
onEdit: PropTypes.func,
onDelete: PropTypes.func,
onMention: PropTypes.func,
onMute: PropTypes.func,
onBlock: PropTypes.func,
onReport: PropTypes.func,
onEmbed: PropTypes.func,
onMuteConversation: PropTypes.func,
onPin: PropTypes.func,
onTranslate: PropTypes.func,
withDismiss: PropTypes.bool,
intl: PropTypes.object.isRequired,
};
// Avoid checking props that are functions (and whose equality will always
// evaluate to false. See react-immutable-pure-component for usage.
updateOnProps = [
'status',
'withDismiss',
]
handleReplyClick = () => {
this.props.onReply(this.props.status, this.context.router.history);
}
handleShareClick = () => {
navigator.share({
text: this.props.status.get('search_index'),
url: this.props.status.get('url'),
});
}
handleFavouriteClick = () => {
this.props.onFavourite(this.props.status);
}
handleReblogClick = (e) => {
this.props.onReblog(this.props.status, e);
}
handleEditClick = () => {
this.props.onEdit(this.props.status, this.context.router.history);
}
handleDeleteClick = () => {
this.props.onDelete(this.props.status);
}
handlePinClick = () => {
this.props.onPin(this.props.status);
}
handleMentionClick = () => {
this.props.onMention(this.props.status.get('account'), this.context.router.history);
}
handleMuteClick = () => {
this.props.onMute(this.props.status.get('account'));
}
handleBlockClick = () => {
this.props.onBlock(this.props.status.get('account'));
}
handleOpen = () => {
this.context.router.history.push(`/statuses/${this.props.status.get('id')}`);
this.props.onReply(this.props.status, this.context.router.history);
}
handleEmbed = () => {
this.props.onEmbed(this.props.status);
}
handleReport = () => {
this.props.onReport(this.props.status);
}
handleConversationMuteClick = () => {
this.props.onMuteConversation(this.props.status);
}
handleTranslateClick = () => {
this.props.onTranslate(this.props.status);
}
render () {
const { status, intl, withDismiss } = this.props;
const mutingConversation = status.get('muted');
const anonymousAccess = !me;
const publicStatus = ['public', 'unlisted'].includes(status.get('visibility'));
let menu = [];
let reblogIcon = 'retweet';
let replyIcon;
let replyTitle;
menu.push({ text: intl.formatMessage(messages.open), action: this.handleOpen });
menu.push({ text: intl.formatMessage(messages.translate), action: this.handleTranslateClick });
if (publicStatus) {
menu.push({ text: intl.formatMessage(messages.embed), action: this.handleEmbed });
}
menu.push(null);
if (status.getIn(['account', 'id']) === me || withDismiss) {
menu.push({ text: intl.formatMessage(mutingConversation ? messages.unmuteConversation : messages.muteConversation), action: this.handleConversationMuteClick });
menu.push(null);
}
if (status.getIn(['account', 'id']) === me) {
if (publicStatus) {
menu.push({ text: intl.formatMessage(status.get('pinned') ? messages.unpin : messages.pin), action: this.handlePinClick });
}
menu.push({ text: intl.formatMessage(messages.edit), action: this.handleEditClick });
menu.push({ text: intl.formatMessage(messages.delete), action: this.handleDeleteClick });
} else {
menu.push({ text: intl.formatMessage(messages.mention, { name: status.getIn(['account', 'username']) }), action: this.handleMentionClick });
menu.push(null);
menu.push({ text: intl.formatMessage(messages.mute, { name: status.getIn(['account', 'username']) }), action: this.handleMuteClick });
menu.push({ text: intl.formatMessage(messages.block, { name: status.getIn(['account', 'username']) }), action: this.handleBlockClick });
menu.push({ text: intl.formatMessage(messages.report, { name: status.getIn(['account', 'username']) }), action: this.handleReport });
}
if (status.get('visibility') === 'direct') {
reblogIcon = 'envelope';
} else if (status.get('visibility') === 'private') {
reblogIcon = 'lock';
}
if (status.get('in_reply_to_id', null) === null) {
replyIcon = 'reply';
replyTitle = intl.formatMessage(messages.reply);
} else {
replyIcon = 'reply-all';
replyTitle = intl.formatMessage(messages.replyAll);
}
const shareButton = ('share' in navigator) && status.get('visibility') === 'public' && (
<IconButton className='status__action-bar-button' title={intl.formatMessage(messages.share)} icon='share-alt' onClick={this.handleShareClick} />
);
return (
<div className='status__action-bar'>
<IconButton className='status__action-bar-button' disabled={anonymousAccess} title={replyTitle} icon={replyIcon} onClick={this.handleReplyClick} />
<IconButton className='status__action-bar-button' disabled={anonymousAccess || !publicStatus} active={status.get('reblogged')} pressed={status.get('reblogged')} title={!publicStatus ? intl.formatMessage(messages.cannot_reblog) : intl.formatMessage(messages.reblog)} icon={reblogIcon} onClick={this.handleReblogClick} />
<IconButton className='status__action-bar-button star-icon' disabled={anonymousAccess} animate active={status.get('favourited')} pressed={status.get('favourited')} title={intl.formatMessage(messages.favourite)} icon='star' onClick={this.handleFavouriteClick} />
{shareButton}
<div className='status__action-bar-dropdown'>
<DropdownMenuContainer disabled={anonymousAccess} status={status} items={menu} icon='ellipsis-h' size={18} direction='right' title={intl.formatMessage(messages.more)} />
</div>
</div>
);
}
}
|
src/components/MediaList/MediaRowBase.js
|
u-wave/web
|
import cx from 'clsx';
import React from 'react';
import PropTypes from 'prop-types';
import { useDrag } from 'react-dnd';
import { getEmptyImage } from 'react-dnd-html5-backend';
import { MEDIA } from '../../constants/DDItemTypes';
import { useMediaListContext } from './BaseMediaList';
const {
useCallback,
useEffect,
useRef,
} = React;
function MediaRowBase({
className,
style,
dragType = MEDIA,
media,
onClick,
children,
containerRef,
...props
}) {
const { selection } = useMediaListContext();
const selected = selection.isSelected(media);
const localRef = useRef();
const ref = containerRef ?? localRef;
const [, drag, connectDragPreview] = useDrag({
type: dragType,
item: () => ({
media: selected ? selection.get() : [media],
}),
});
useEffect(() => {
connectDragPreview(getEmptyImage());
}, [connectDragPreview]);
const handleKeyPress = useCallback((event) => {
if (event.code === 'Space') {
onClick();
}
}, [onClick]);
drag(ref);
return (
<div
role="checkbox"
aria-checked={selected}
tabIndex={0}
className={cx('MediaListRow', className, selected && 'is-selected')}
style={style}
onKeyPress={handleKeyPress}
onClick={onClick}
{...props}
ref={ref}
>
{children}
</div>
);
}
MediaRowBase.propTypes = {
className: PropTypes.string,
style: PropTypes.object, // from virtual list positioning
dragType: PropTypes.string,
media: PropTypes.object.isRequired,
onClick: PropTypes.func,
children: PropTypes.node.isRequired,
containerRef: PropTypes.any,
};
export default MediaRowBase;
|
ajax/libs/mobx-react/2.1.5/index.js
|
hare1039/cdnjs
|
(function() {
function mrFactory(mobservable, React, ReactDOM) {
if (!mobservable)
throw new Error("mobservable-react requires the Mobservable package")
if (!React)
throw new Error("mobservable-react requires React to be available");
var isTracking = false;
// WeakMap<Node, Object>;
var componentByNodeRegistery = typeof WeakMap !== "undefined" ? new WeakMap() : undefined;
var renderReporter = new mobservable.extras.SimpleEventEmitter();
function findDOMNode(component) {
if (ReactDOM)
return ReactDOM.findDOMNode(component);
return null;
}
function reportRendering(component) {
var node = findDOMNode(component);
if (node)
componentByNodeRegistery.set(node, component);
renderReporter.emit({
event: 'render',
renderTime: component.__$mobRenderEnd - component.__$mobRenderStart,
totalTime: Date.now() - component.__$mobRenderStart,
component: component,
node: node
});
}
var reactiveMixin = {
componentWillMount: function() {
var baseRender = this.render;
this.__$mobDependencies = [];
this.render = function() {
if (isTracking)
this.__$mobRenderStart = Date.now();
// invoke the old render function and in the mean time track all dependencies using
// 'autorun'.
// when the dependencies change, the function is triggered, but we don't want to
// rerender because that would ignore the normal React lifecycle,
// so instead we dispose the current observer and trigger a force update.
var hasRendered = false;
var self = this;
var rendering;
this.__$mobRenderDisposer = mobservable.autorun(function reactiveRender() {
if (!hasRendered) {
hasRendered = true;
// withStrict: throw errors if the render function tries to alter state.
mobservable.extras.withStrict(true, function() {
rendering = baseRender.call(self);
});
} else {
self.__$mobRenderDisposer(); // dispose
if (self.__$mobHasUnmounted !== true) // Fixes #12, should not be needed after fixing mobservable #71
React.Component.prototype.forceUpdate.call(self);
}
});
this.render.$mobservable = this.__$mobRenderDisposer.$mobservable;
// Generate friendly name for debugging
this.render.$mobservable.context.name = [
this.displayName || this.name || (this.constructor && this.constructor.name) || "<component>",
"#", this._reactInternalInstance && this._reactInternalInstance._rootNodeID,
".render()"
].join("");
// make sure views are not disposed between the clean-up of the observer and the next render
// (invoked through force update)
var newDependencies = this.__$mobRenderDisposer.$mobservable.observing.map(function(dep) {
dep.setRefCount(+1);
return dep;
});
this.__$mobDependencies.forEach(function(dep) {
dep.setRefCount(-1);
});
this.__$mobDependencies = newDependencies;
if (isTracking)
this.__$mobRenderEnd = Date.now();
return rendering;
}
},
componentWillUnmount: function() {
this.__$mobRenderDisposer && this.__$mobRenderDisposer();
this.__$mobDependencies.forEach(function(dep) {
dep.setRefCount(-1);
});
this.__$mobHasUnmounted = true;
delete this.render.$mobservable;
if (isTracking) {
var node = findDOMNode(this);
if (node) {
componentByNodeRegistery.delete(node);
}
renderReporter.emit({
event: 'destroy',
component: this,
node: node
});
}
},
componentDidMount: function() {
if (isTracking)
reportRendering(this);
},
componentDidUpdate: function() {
if (isTracking)
reportRendering(this);
},
shouldComponentUpdate: function(nextProps, nextState) {
// update on any state changes (as is the default)
if (this.state !== nextState)
return true;
// update if props are shallowly not equal, inspired by PureRenderMixin
var keys = Object.keys(this.props);
var key;
if (keys.length !== Object.keys(nextProps).length)
return true;
for(var i = keys.length -1; i >= 0, key = keys[i]; i--) {
var newValue = nextProps[key];
if (newValue !== this.props[key]) {
return true;
} else if (newValue && typeof newValue === "object" && !mobservable.isObservable(newValue)) {
/**
* If the newValue is still the same object, but that object is not observable,
* fallback to the default React behavior: update, because the object *might* have changed.
* If you need the non default behavior, just use the React pure render mixin, as that one
* will work fine with mobservable as well, instead of the default implementation of
* observer.
*/
return true;
}
}
return false;
}
}
function patch(target, funcName) {
var base = target[funcName];
var mixinFunc = reactiveMixin[funcName];
target[funcName] = function() {
base && base.apply(this, arguments);
mixinFunc.apply(this, arguments);
}
}
function observer(componentClass) {
// If it is function but doesn't seem to be a react class constructor,
// wrap it to a react class automatically
if (typeof componentClass === "function" && !componentClass.prototype.render && !componentClass.isReactClass && !React.Component.isPrototypeOf(componentClass)) {
return observer(React.createClass({
displayName: componentClass.displayName || componentClass.name,
propTypes: componentClass.propTypes,
contextTypes: componentClass.contextTypes,
getDefaultProps: function() { return componentClass.defaultProps; },
render: function() { return componentClass.call(this, this.props, this.context); }
}));
}
if (!componentClass)
throw new Error("Please pass a valid component to 'observer'");
var target = componentClass.prototype || componentClass;
[
"componentWillMount",
"componentWillUnmount",
"componentDidMount",
"componentDidUpdate"
].forEach(function(funcName) {
patch(target, funcName)
});
if (!target.shouldComponentUpdate)
target.shouldComponentUpdate = reactiveMixin.shouldComponentUpdate;
componentClass.isMobservableReactObserver = true;
return componentClass;
}
function trackComponents() {
if (typeof WeakMap === "undefined")
throw new Error("[mobservable-react] tracking components is not supported in this browser.");
if (!isTracking)
isTracking = true;
}
return ({
observer: observer,
reactiveComponent: function() {
console.warn("[mobservable-react] `reactiveComponent` has been renamed to `observer` and will be removed in 1.1.");
return observer.apply(null, arguments);
},
renderReporter: renderReporter,
componentByNodeRegistery: componentByNodeRegistery,
trackComponents: trackComponents
});
}
// UMD
if (typeof define === 'function' && define.amd) {
define('mobservable-react', ['mobservable', 'react', 'react-dom'], mrFactory);
} else if (typeof exports === 'object') {
module.exports = mrFactory(require('mobservable'), require('react'), require('react-dom'));
} else {
this.mobservableReact = mrFactory(this['mobservable'], this['React'], this['ReactDOM']);
}
})();
|
example/example/static/js/jquery.min.js
|
okwrtdsh/django_cbv_utils
|
/*! jQuery v1.11.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */
!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l="1.11.1",m=function(a,b){return new m.fn.init(a,b)},n=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,o=/^-ms-/,p=/-([\da-z])/gi,q=function(a,b){return b.toUpperCase()};m.fn=m.prototype={jquery:l,constructor:m,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=m.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return m.each(this,a,b)},map:function(a){return this.pushStack(m.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},m.extend=m.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||m.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(m.isPlainObject(c)||(b=m.isArray(c)))?(b?(b=!1,f=a&&m.isArray(a)?a:[]):f=a&&m.isPlainObject(a)?a:{},g[d]=m.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},m.extend({expando:"jQuery"+(l+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===m.type(a)},isArray:Array.isArray||function(a){return"array"===m.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!m.isArray(a)&&a-parseFloat(a)>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==m.type(a)||a.nodeType||m.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(k.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&m.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(o,"ms-").replace(p,q)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=r(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(n,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(r(Object(a))?m.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=r(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),m.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||m.guid++,e):void 0},now:function(){return+new Date},support:k}),m.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function r(a){var b=a.length,c=m.type(a);return"function"===c||m.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var s=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+-new Date,v=a.document,w=0,x=0,y=gb(),z=gb(),A=gb(),B=function(a,b){return a===b&&(l=!0),0},C="undefined",D=1<<31,E={}.hasOwnProperty,F=[],G=F.pop,H=F.push,I=F.push,J=F.slice,K=F.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},L="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",N="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=N.replace("w","w#"),P="\\["+M+"*("+N+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+O+"))|)"+M+"*\\]",Q=":("+N+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+P+")*)|.*)\\)|)",R=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),S=new RegExp("^"+M+"*,"+M+"*"),T=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),V=new RegExp(Q),W=new RegExp("^"+O+"$"),X={ID:new RegExp("^#("+N+")"),CLASS:new RegExp("^\\.("+N+")"),TAG:new RegExp("^("+N.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+Q),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+L+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),db=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{I.apply(F=J.call(v.childNodes),v.childNodes),F[v.childNodes.length].nodeType}catch(eb){I={apply:F.length?function(a,b){H.apply(a,J.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],!a||"string"!=typeof a)return d;if(1!==(k=b.nodeType)&&9!==k)return[];if(p&&!e){if(f=_.exec(a))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return I.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return I.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=9===k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+qb(o[l]);w=ab.test(a)&&ob(b.parentNode)||b,x=o.join(",")}if(x)try{return I.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function gb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function hb(a){return a[u]=!0,a}function ib(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function jb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function kb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||D)-(~a.sourceIndex||D);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function lb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function nb(a){return hb(function(b){return b=+b,hb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function ob(a){return a&&typeof a.getElementsByTagName!==C&&a}c=fb.support={},f=fb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fb.setDocument=function(a){var b,e=a?a.ownerDocument||a:v,g=e.defaultView;return e!==n&&9===e.nodeType&&e.documentElement?(n=e,o=e.documentElement,p=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){m()},!1):g.attachEvent&&g.attachEvent("onunload",function(){m()})),c.attributes=ib(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ib(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(e.getElementsByClassName)&&ib(function(a){return a.innerHTML="<div class='a'></div><div class='a i'></div>",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=ib(function(a){return o.appendChild(a).id=u,!e.getElementsByName||!e.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==C&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c=typeof a.getAttributeNode!==C&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==C?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==C&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(e.querySelectorAll))&&(ib(function(a){a.innerHTML="<select msallowclip=''><option selected=''></option></select>",a.querySelectorAll("[msallowclip^='']").length&&q.push("[*^$]="+M+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+M+"*(?:value|"+L+")"),a.querySelectorAll(":checked").length||q.push(":checked")}),ib(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+M+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ib(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",Q)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===v&&t(v,a)?-1:b===e||b.ownerDocument===v&&t(v,b)?1:k?K.call(k,a)-K.call(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],i=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:k?K.call(k,a)-K.call(k,b):0;if(f===g)return kb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?kb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},e):n},fb.matches=function(a,b){return fb(a,null,null,b)},fb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fb(b,n,null,[a]).length>0},fb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&E.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fb.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fb.selectors={cacheLength:50,createPseudo:hb,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(cb,db).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+M+")"+a+"("+M+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==C&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?hb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=K.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:hb(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?hb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:hb(function(a){return function(b){return fb(a,b).length>0}}),contains:hb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:hb(function(a){return W.test(a||"")||fb.error("unsupported lang: "+a),a=a.replace(cb,db).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:nb(function(){return[0]}),last:nb(function(a,b){return[b-1]}),eq:nb(function(a,b,c){return[0>c?c+b:c]}),even:nb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:nb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:nb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:nb(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=lb(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=mb(b);function pb(){}pb.prototype=d.filters=d.pseudos,d.setFilters=new pb,g=fb.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=S.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=T.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(R," ")}),h=h.slice(c.length));for(g in d.filter)!(e=X[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?fb.error(a):z(a,i).slice(0)};function qb(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function rb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function sb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function tb(a,b,c){for(var d=0,e=b.length;e>d;d++)fb(a,b[d],c);return c}function ub(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function vb(a,b,c,d,e,f){return d&&!d[u]&&(d=vb(d)),e&&!e[u]&&(e=vb(e,f)),hb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||tb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ub(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ub(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?K.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ub(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):I.apply(g,r)})}function wb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=rb(function(a){return a===b},h,!0),l=rb(function(a){return K.call(b,a)>-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>i;i++)if(c=d.relative[a[i].type])m=[rb(sb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return vb(i>1&&sb(m),i>1&&qb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&wb(a.slice(i,e)),f>e&&wb(a=a.slice(e)),f>e&&qb(a))}m.push(c)}return sb(m)}function xb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=G.call(i));s=ub(s)}I.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&fb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?hb(f):f}return h=fb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xb(e,d)),f.selector=a}return f},i=fb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&ob(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qb(j),!a)return I.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&ob(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ib(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ib(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||jb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ib(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||jb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ib(function(a){return null==a.getAttribute("disabled")})||jb(L,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fb}(a);m.find=s,m.expr=s.selectors,m.expr[":"]=m.expr.pseudos,m.unique=s.uniqueSort,m.text=s.getText,m.isXMLDoc=s.isXML,m.contains=s.contains;var t=m.expr.match.needsContext,u=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,v=/^.[^:#\[\.,]*$/;function w(a,b,c){if(m.isFunction(b))return m.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return m.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(v.test(b))return m.filter(b,a,c);b=m.filter(b,a)}return m.grep(a,function(a){return m.inArray(a,b)>=0!==c})}m.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?m.find.matchesSelector(d,a)?[d]:[]:m.find.matches(a,m.grep(b,function(a){return 1===a.nodeType}))},m.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(m(a).filter(function(){for(b=0;e>b;b++)if(m.contains(d[b],this))return!0}));for(b=0;e>b;b++)m.find(a,d[b],c);return c=this.pushStack(e>1?m.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(w(this,a||[],!1))},not:function(a){return this.pushStack(w(this,a||[],!0))},is:function(a){return!!w(this,"string"==typeof a&&t.test(a)?m(a):a||[],!1).length}});var x,y=a.document,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=m.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||x).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof m?b[0]:b,m.merge(this,m.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:y,!0)),u.test(c[1])&&m.isPlainObject(b))for(c in b)m.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=y.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return x.find(a);this.length=1,this[0]=d}return this.context=y,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):m.isFunction(a)?"undefined"!=typeof x.ready?x.ready(a):a(m):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),m.makeArray(a,this))};A.prototype=m.fn,x=m(y);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};m.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!m(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),m.fn.extend({has:function(a){var b,c=m(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(m.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=t.test(a)||"string"!=typeof a?m(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&m.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?m.unique(f):f)},index:function(a){return a?"string"==typeof a?m.inArray(this[0],m(a)):m.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(m.unique(m.merge(this.get(),m(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}m.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return m.dir(a,"parentNode")},parentsUntil:function(a,b,c){return m.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return m.dir(a,"nextSibling")},prevAll:function(a){return m.dir(a,"previousSibling")},nextUntil:function(a,b,c){return m.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return m.dir(a,"previousSibling",c)},siblings:function(a){return m.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return m.sibling(a.firstChild)},contents:function(a){return m.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:m.merge([],a.childNodes)}},function(a,b){m.fn[a]=function(c,d){var e=m.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=m.filter(d,e)),this.length>1&&(C[a]||(e=m.unique(e)),B.test(a)&&(e=e.reverse())),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return m.each(a.match(E)||[],function(a,c){b[c]=!0}),b}m.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):m.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){m.each(b,function(b,c){var d=m.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&m.each(arguments,function(a,c){var d;while((d=m.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?m.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},m.extend({Deferred:function(a){var b=[["resolve","done",m.Callbacks("once memory"),"resolved"],["reject","fail",m.Callbacks("once memory"),"rejected"],["notify","progress",m.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return m.Deferred(function(c){m.each(b,function(b,f){var g=m.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&m.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?m.extend(a,d):d}},e={};return d.pipe=d.then,m.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&m.isFunction(a.promise)?e:0,g=1===f?a:m.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&m.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;m.fn.ready=function(a){return m.ready.promise().done(a),this},m.extend({isReady:!1,readyWait:1,holdReady:function(a){a?m.readyWait++:m.ready(!0)},ready:function(a){if(a===!0?!--m.readyWait:!m.isReady){if(!y.body)return setTimeout(m.ready);m.isReady=!0,a!==!0&&--m.readyWait>0||(H.resolveWith(y,[m]),m.fn.triggerHandler&&(m(y).triggerHandler("ready"),m(y).off("ready")))}}});function I(){y.addEventListener?(y.removeEventListener("DOMContentLoaded",J,!1),a.removeEventListener("load",J,!1)):(y.detachEvent("onreadystatechange",J),a.detachEvent("onload",J))}function J(){(y.addEventListener||"load"===event.type||"complete"===y.readyState)&&(I(),m.ready())}m.ready.promise=function(b){if(!H)if(H=m.Deferred(),"complete"===y.readyState)setTimeout(m.ready);else if(y.addEventListener)y.addEventListener("DOMContentLoaded",J,!1),a.addEventListener("load",J,!1);else{y.attachEvent("onreadystatechange",J),a.attachEvent("onload",J);var c=!1;try{c=null==a.frameElement&&y.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!m.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}I(),m.ready()}}()}return H.promise(b)};var K="undefined",L;for(L in m(k))break;k.ownLast="0"!==L,k.inlineBlockNeedsLayout=!1,m(function(){var a,b,c,d;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",k.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(d))}),function(){var a=y.createElement("div");if(null==k.deleteExpando){k.deleteExpando=!0;try{delete a.test}catch(b){k.deleteExpando=!1}}a=null}(),m.acceptData=function(a){var b=m.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var M=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,N=/([A-Z])/g;function O(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(N,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:M.test(c)?m.parseJSON(c):c}catch(e){}m.data(a,b,c)}else c=void 0}return c}function P(a){var b;for(b in a)if(("data"!==b||!m.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;return!0}function Q(a,b,d,e){if(m.acceptData(a)){var f,g,h=m.expando,i=a.nodeType,j=i?m.cache:a,k=i?a[h]:a[h]&&h;
if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||m.guid++:h),j[k]||(j[k]=i?{}:{toJSON:m.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=m.extend(j[k],b):j[k].data=m.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[m.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[m.camelCase(b)])):f=g,f}}function R(a,b,c){if(m.acceptData(a)){var d,e,f=a.nodeType,g=f?m.cache:a,h=f?a[m.expando]:m.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){m.isArray(b)?b=b.concat(m.map(b,m.camelCase)):b in d?b=[b]:(b=m.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!P(d):!m.isEmptyObject(d))return}(c||(delete g[h].data,P(g[h])))&&(f?m.cleanData([a],!0):k.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}m.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?m.cache[a[m.expando]]:a[m.expando],!!a&&!P(a)},data:function(a,b,c){return Q(a,b,c)},removeData:function(a,b){return R(a,b)},_data:function(a,b,c){return Q(a,b,c,!0)},_removeData:function(a,b){return R(a,b,!0)}}),m.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=m.data(f),1===f.nodeType&&!m._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=m.camelCase(d.slice(5)),O(f,d,e[d])));m._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){m.data(this,a)}):arguments.length>1?this.each(function(){m.data(this,a,b)}):f?O(f,a,m.data(f,a)):void 0},removeData:function(a){return this.each(function(){m.removeData(this,a)})}}),m.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=m._data(a,b),c&&(!d||m.isArray(c)?d=m._data(a,b,m.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=m.queue(a,b),d=c.length,e=c.shift(),f=m._queueHooks(a,b),g=function(){m.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return m._data(a,c)||m._data(a,c,{empty:m.Callbacks("once memory").add(function(){m._removeData(a,b+"queue"),m._removeData(a,c)})})}}),m.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?m.queue(this[0],a):void 0===b?this:this.each(function(){var c=m.queue(this,a,b);m._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&m.dequeue(this,a)})},dequeue:function(a){return this.each(function(){m.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=m.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=m._data(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var S=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=["Top","Right","Bottom","Left"],U=function(a,b){return a=b||a,"none"===m.css(a,"display")||!m.contains(a.ownerDocument,a)},V=m.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===m.type(c)){e=!0;for(h in c)m.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,m.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(m(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},W=/^(?:checkbox|radio)$/i;!function(){var a=y.createElement("input"),b=y.createElement("div"),c=y.createDocumentFragment();if(b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",k.leadingWhitespace=3===b.firstChild.nodeType,k.tbody=!b.getElementsByTagName("tbody").length,k.htmlSerialize=!!b.getElementsByTagName("link").length,k.html5Clone="<:nav></:nav>"!==y.createElement("nav").cloneNode(!0).outerHTML,a.type="checkbox",a.checked=!0,c.appendChild(a),k.appendChecked=a.checked,b.innerHTML="<textarea>x</textarea>",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,c.appendChild(b),b.innerHTML="<input type='radio' checked='checked' name='t'/>",k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,k.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){k.noCloneEvent=!1}),b.cloneNode(!0).click()),null==k.deleteExpando){k.deleteExpando=!0;try{delete b.test}catch(d){k.deleteExpando=!1}}}(),function(){var b,c,d=y.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(k[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),k[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var X=/^(?:input|select|textarea)$/i,Y=/^key/,Z=/^(?:mouse|pointer|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=/^([^.]*)(?:\.(.+)|)$/;function ab(){return!0}function bb(){return!1}function cb(){try{return y.activeElement}catch(a){}}m.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=m.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof m===K||a&&m.event.triggered===a.type?void 0:m.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(E)||[""],h=b.length;while(h--)f=_.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=m.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=m.event.special[o]||{},l=m.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&m.expr.match.needsContext.test(e),namespace:p.join(".")},i),(n=g[o])||(n=g[o]=[],n.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?n.splice(n.delegateCount++,0,l):n.push(l),m.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m.hasData(a)&&m._data(a);if(r&&(k=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=_.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=m.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,n=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=n.length;while(f--)g=n[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(n.splice(f,1),g.selector&&n.delegateCount--,l.remove&&l.remove.call(a,g));i&&!n.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||m.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)m.event.remove(a,o+b[j],c,d,!0);m.isEmptyObject(k)&&(delete r.handle,m._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,n,o=[d||y],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||y,3!==d.nodeType&&8!==d.nodeType&&!$.test(p+m.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[m.expando]?b:new m.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:m.makeArray(c,[b]),k=m.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!m.isWindow(d)){for(i=k.delegateType||p,$.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||y)&&o.push(l.defaultView||l.parentWindow||a)}n=0;while((h=o[n++])&&!b.isPropagationStopped())b.type=n>1?i:k.bindType||p,f=(m._data(h,"events")||{})[b.type]&&m._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&m.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&m.acceptData(d)&&g&&d[p]&&!m.isWindow(d)){l=d[g],l&&(d[g]=null),m.event.triggered=p;try{d[p]()}catch(r){}m.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=m.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(m._data(this,"events")||{})[a.type]||[],k=m.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=m.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((m.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?m(c,this).index(i)>=0:m.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},fix:function(a){if(a[m.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=Z.test(e)?this.mouseHooks:Y.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new m.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=f.srcElement||y),3===a.target.nodeType&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,g.filter?g.filter(a,f):a},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button,g=b.fromElement;return null==a.pageX&&null!=b.clientX&&(d=a.target.ownerDocument||y,e=d.documentElement,c=d.body,a.pageX=b.clientX+(e&&e.scrollLeft||c&&c.scrollLeft||0)-(e&&e.clientLeft||c&&c.clientLeft||0),a.pageY=b.clientY+(e&&e.scrollTop||c&&c.scrollTop||0)-(e&&e.clientTop||c&&c.clientTop||0)),!a.relatedTarget&&g&&(a.relatedTarget=g===a.target?b.toElement:g),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==cb()&&this.focus)try{return this.focus(),!1}catch(a){}},delegateType:"focusin"},blur:{trigger:function(){return this===cb()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return m.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):void 0},_default:function(a){return m.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=m.extend(new m.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?m.event.trigger(e,null,b):m.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},m.removeEvent=y.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){var d="on"+b;a.detachEvent&&(typeof a[d]===K&&(a[d]=null),a.detachEvent(d,c))},m.Event=function(a,b){return this instanceof m.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?ab:bb):this.type=a,b&&m.extend(this,b),this.timeStamp=a&&a.timeStamp||m.now(),void(this[m.expando]=!0)):new m.Event(a,b)},m.Event.prototype={isDefaultPrevented:bb,isPropagationStopped:bb,isImmediatePropagationStopped:bb,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=ab,a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=ab,a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=ab,a&&a.stopImmediatePropagation&&a.stopImmediatePropagation(),this.stopPropagation()}},m.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){m.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!m.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),k.submitBubbles||(m.event.special.submit={setup:function(){return m.nodeName(this,"form")?!1:void m.event.add(this,"click._submit keypress._submit",function(a){var b=a.target,c=m.nodeName(b,"input")||m.nodeName(b,"button")?b.form:void 0;c&&!m._data(c,"submitBubbles")&&(m.event.add(c,"submit._submit",function(a){a._submit_bubble=!0}),m._data(c,"submitBubbles",!0))})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&m.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){return m.nodeName(this,"form")?!1:void m.event.remove(this,"._submit")}}),k.changeBubbles||(m.event.special.change={setup:function(){return X.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(m.event.add(this,"propertychange._change",function(a){"checked"===a.originalEvent.propertyName&&(this._just_changed=!0)}),m.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1),m.event.simulate("change",this,a,!0)})),!1):void m.event.add(this,"beforeactivate._change",function(a){var b=a.target;X.test(b.nodeName)&&!m._data(b,"changeBubbles")&&(m.event.add(b,"change._change",function(a){!this.parentNode||a.isSimulated||a.isTrigger||m.event.simulate("change",this.parentNode,a,!0)}),m._data(b,"changeBubbles",!0))})},handle:function(a){var b=a.target;return this!==b||a.isSimulated||a.isTrigger||"radio"!==b.type&&"checkbox"!==b.type?a.handleObj.handler.apply(this,arguments):void 0},teardown:function(){return m.event.remove(this,"._change"),!X.test(this.nodeName)}}),k.focusinBubbles||m.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){m.event.simulate(b,a.target,m.event.fix(a),!0)};m.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=m._data(d,b);e||d.addEventListener(a,c,!0),m._data(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=m._data(d,b)-1;e?m._data(d,b,e):(d.removeEventListener(a,c,!0),m._removeData(d,b))}}}),m.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(f in a)this.on(f,b,c,a[f],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=bb;else if(!d)return this;return 1===e&&(g=d,d=function(a){return m().off(a),g.apply(this,arguments)},d.guid=g.guid||(g.guid=m.guid++)),this.each(function(){m.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,m(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=bb),this.each(function(){m.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){m.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?m.event.trigger(a,b,c,!0):void 0}});function db(a){var b=eb.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}var eb="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",fb=/ jQuery\d+="(?:null|\d+)"/g,gb=new RegExp("<(?:"+eb+")[\\s/>]","i"),hb=/^\s+/,ib=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,jb=/<([\w:]+)/,kb=/<tbody/i,lb=/<|&#?\w+;/,mb=/<(?:script|style|link)/i,nb=/checked\s*(?:[^=]|=\s*.checked.)/i,ob=/^$|\/(?:java|ecma)script/i,pb=/^true\/(.*)/,qb=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,rb={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:k.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},sb=db(y),tb=sb.appendChild(y.createElement("div"));rb.optgroup=rb.option,rb.tbody=rb.tfoot=rb.colgroup=rb.caption=rb.thead,rb.th=rb.td;function ub(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==K?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==K?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||m.nodeName(d,b)?f.push(d):m.merge(f,ub(d,b));return void 0===b||b&&m.nodeName(a,b)?m.merge([a],f):f}function vb(a){W.test(a.type)&&(a.defaultChecked=a.checked)}function wb(a,b){return m.nodeName(a,"table")&&m.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function xb(a){return a.type=(null!==m.find.attr(a,"type"))+"/"+a.type,a}function yb(a){var b=pb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function zb(a,b){for(var c,d=0;null!=(c=a[d]);d++)m._data(c,"globalEval",!b||m._data(b[d],"globalEval"))}function Ab(a,b){if(1===b.nodeType&&m.hasData(a)){var c,d,e,f=m._data(a),g=m._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)m.event.add(b,c,h[c][d])}g.data&&(g.data=m.extend({},g.data))}}function Bb(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!k.noCloneEvent&&b[m.expando]){e=m._data(b);for(d in e.events)m.removeEvent(b,d,e.handle);b.removeAttribute(m.expando)}"script"===c&&b.text!==a.text?(xb(b).text=a.text,yb(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),k.html5Clone&&a.innerHTML&&!m.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&W.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}m.extend({clone:function(a,b,c){var d,e,f,g,h,i=m.contains(a.ownerDocument,a);if(k.html5Clone||m.isXMLDoc(a)||!gb.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(tb.innerHTML=a.outerHTML,tb.removeChild(f=tb.firstChild)),!(k.noCloneEvent&&k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||m.isXMLDoc(a)))for(d=ub(f),h=ub(a),g=0;null!=(e=h[g]);++g)d[g]&&Bb(e,d[g]);if(b)if(c)for(h=h||ub(a),d=d||ub(f),g=0;null!=(e=h[g]);g++)Ab(e,d[g]);else Ab(a,f);return d=ub(f,"script"),d.length>0&&zb(d,!i&&ub(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,l,n=a.length,o=db(b),p=[],q=0;n>q;q++)if(f=a[q],f||0===f)if("object"===m.type(f))m.merge(p,f.nodeType?[f]:f);else if(lb.test(f)){h=h||o.appendChild(b.createElement("div")),i=(jb.exec(f)||["",""])[1].toLowerCase(),l=rb[i]||rb._default,h.innerHTML=l[1]+f.replace(ib,"<$1></$2>")+l[2],e=l[0];while(e--)h=h.lastChild;if(!k.leadingWhitespace&&hb.test(f)&&p.push(b.createTextNode(hb.exec(f)[0])),!k.tbody){f="table"!==i||kb.test(f)?"<table>"!==l[1]||kb.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)m.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}m.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),k.appendChecked||m.grep(ub(p,"input"),vb),q=0;while(f=p[q++])if((!d||-1===m.inArray(f,d))&&(g=m.contains(f.ownerDocument,f),h=ub(o.appendChild(f),"script"),g&&zb(h),c)){e=0;while(f=h[e++])ob.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=m.expando,j=m.cache,l=k.deleteExpando,n=m.event.special;null!=(d=a[h]);h++)if((b||m.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)n[e]?m.event.remove(d,e):m.removeEvent(d,e,g.handle);j[f]&&(delete j[f],l?delete d[i]:typeof d.removeAttribute!==K?d.removeAttribute(i):d[i]=null,c.push(f))}}}),m.fn.extend({text:function(a){return V(this,function(a){return void 0===a?m.text(this):this.empty().append((this[0]&&this[0].ownerDocument||y).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?m.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||m.cleanData(ub(c)),c.parentNode&&(b&&m.contains(c.ownerDocument,c)&&zb(ub(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&m.cleanData(ub(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&m.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return m.clone(this,a,b)})},html:function(a){return V(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(fb,""):void 0;if(!("string"!=typeof a||mb.test(a)||!k.htmlSerialize&&gb.test(a)||!k.leadingWhitespace&&hb.test(a)||rb[(jb.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(ib,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(m.cleanData(ub(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,m.cleanData(ub(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,n=this,o=l-1,p=a[0],q=m.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&nb.test(p))return this.each(function(c){var d=n.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(i=m.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=m.map(ub(i,"script"),xb),f=g.length;l>j;j++)d=i,j!==o&&(d=m.clone(d,!0,!0),f&&m.merge(g,ub(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,m.map(g,yb),j=0;f>j;j++)d=g[j],ob.test(d.type||"")&&!m._data(d,"globalEval")&&m.contains(h,d)&&(d.src?m._evalUrl&&m._evalUrl(d.src):m.globalEval((d.text||d.textContent||d.innerHTML||"").replace(qb,"")));i=c=null}return this}}),m.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){m.fn[a]=function(a){for(var c,d=0,e=[],g=m(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),m(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Cb,Db={};function Eb(b,c){var d,e=m(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:m.css(e[0],"display");return e.detach(),f}function Fb(a){var b=y,c=Db[a];return c||(c=Eb(a,b),"none"!==c&&c||(Cb=(Cb||m("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=(Cb[0].contentWindow||Cb[0].contentDocument).document,b.write(),b.close(),c=Eb(a,b),Cb.detach()),Db[a]=c),c}!function(){var a;k.shrinkWrapBlocks=function(){if(null!=a)return a;a=!1;var b,c,d;return c=y.getElementsByTagName("body")[0],c&&c.style?(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:1px;width:1px;zoom:1",b.appendChild(y.createElement("div")).style.width="5px",a=3!==b.offsetWidth),c.removeChild(d),a):void 0}}();var Gb=/^margin/,Hb=new RegExp("^("+S+")(?!px)[a-z%]+$","i"),Ib,Jb,Kb=/^(top|right|bottom|left)$/;a.getComputedStyle?(Ib=function(a){return a.ownerDocument.defaultView.getComputedStyle(a,null)},Jb=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ib(a),g=c?c.getPropertyValue(b)||c[b]:void 0,c&&(""!==g||m.contains(a.ownerDocument,a)||(g=m.style(a,b)),Hb.test(g)&&Gb.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0===g?g:g+""}):y.documentElement.currentStyle&&(Ib=function(a){return a.currentStyle},Jb=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ib(a),g=c?c[b]:void 0,null==g&&h&&h[b]&&(g=h[b]),Hb.test(g)&&!Kb.test(b)&&(d=h.left,e=a.runtimeStyle,f=e&&e.left,f&&(e.left=a.currentStyle.left),h.left="fontSize"===b?"1em":g,g=h.pixelLeft+"px",h.left=d,f&&(e.left=f)),void 0===g?g:g+""||"auto"});function Lb(a,b){return{get:function(){var c=a();if(null!=c)return c?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d,e,f,g,h;if(b=y.createElement("div"),b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",d=b.getElementsByTagName("a")[0],c=d&&d.style){c.cssText="float:left;opacity:.5",k.opacity="0.5"===c.opacity,k.cssFloat=!!c.cssFloat,b.style.backgroundClip="content-box",b.cloneNode(!0).style.backgroundClip="",k.clearCloneStyle="content-box"===b.style.backgroundClip,k.boxSizing=""===c.boxSizing||""===c.MozBoxSizing||""===c.WebkitBoxSizing,m.extend(k,{reliableHiddenOffsets:function(){return null==g&&i(),g},boxSizingReliable:function(){return null==f&&i(),f},pixelPosition:function(){return null==e&&i(),e},reliableMarginRight:function(){return null==h&&i(),h}});function i(){var b,c,d,i;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),b.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",e=f=!1,h=!0,a.getComputedStyle&&(e="1%"!==(a.getComputedStyle(b,null)||{}).top,f="4px"===(a.getComputedStyle(b,null)||{width:"4px"}).width,i=b.appendChild(y.createElement("div")),i.style.cssText=b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",i.style.marginRight=i.style.width="0",b.style.width="1px",h=!parseFloat((a.getComputedStyle(i,null)||{}).marginRight)),b.innerHTML="<table><tr><td></td><td>t</td></tr></table>",i=b.getElementsByTagName("td"),i[0].style.cssText="margin:0;border:0;padding:0;display:none",g=0===i[0].offsetHeight,g&&(i[0].style.display="",i[1].style.display="none",g=0===i[0].offsetHeight),c.removeChild(d))}}}(),m.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var Mb=/alpha\([^)]*\)/i,Nb=/opacity\s*=\s*([^)]*)/,Ob=/^(none|table(?!-c[ea]).+)/,Pb=new RegExp("^("+S+")(.*)$","i"),Qb=new RegExp("^([+-])=("+S+")","i"),Rb={position:"absolute",visibility:"hidden",display:"block"},Sb={letterSpacing:"0",fontWeight:"400"},Tb=["Webkit","O","Moz","ms"];function Ub(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=Tb.length;while(e--)if(b=Tb[e]+c,b in a)return b;return d}function Vb(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=m._data(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&U(d)&&(f[g]=m._data(d,"olddisplay",Fb(d.nodeName)))):(e=U(d),(c&&"none"!==c||!e)&&m._data(d,"olddisplay",e?c:m.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}function Wb(a,b,c){var d=Pb.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Xb(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=m.css(a,c+T[f],!0,e)),d?("content"===c&&(g-=m.css(a,"padding"+T[f],!0,e)),"margin"!==c&&(g-=m.css(a,"border"+T[f]+"Width",!0,e))):(g+=m.css(a,"padding"+T[f],!0,e),"padding"!==c&&(g+=m.css(a,"border"+T[f]+"Width",!0,e)));return g}function Yb(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=Ib(a),g=k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=Jb(a,b,f),(0>e||null==e)&&(e=a.style[b]),Hb.test(e))return e;d=g&&(k.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Xb(a,b,c||(g?"border":"content"),d,f)+"px"}m.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Jb(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":k.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=m.camelCase(b),i=a.style;if(b=m.cssProps[h]||(m.cssProps[h]=Ub(i,h)),g=m.cssHooks[b]||m.cssHooks[h],void 0===c)return g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b];if(f=typeof c,"string"===f&&(e=Qb.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(m.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||m.cssNumber[h]||(c+="px"),k.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),!(g&&"set"in g&&void 0===(c=g.set(a,c,d)))))try{i[b]=c}catch(j){}}},css:function(a,b,c,d){var e,f,g,h=m.camelCase(b);return b=m.cssProps[h]||(m.cssProps[h]=Ub(a.style,h)),g=m.cssHooks[b]||m.cssHooks[h],g&&"get"in g&&(f=g.get(a,!0,c)),void 0===f&&(f=Jb(a,b,d)),"normal"===f&&b in Sb&&(f=Sb[b]),""===c||c?(e=parseFloat(f),c===!0||m.isNumeric(e)?e||0:f):f}}),m.each(["height","width"],function(a,b){m.cssHooks[b]={get:function(a,c,d){return c?Ob.test(m.css(a,"display"))&&0===a.offsetWidth?m.swap(a,Rb,function(){return Yb(a,b,d)}):Yb(a,b,d):void 0},set:function(a,c,d){var e=d&&Ib(a);return Wb(a,c,d?Xb(a,b,d,k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,e),e):0)}}}),k.opacity||(m.cssHooks.opacity={get:function(a,b){return Nb.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=m.isNumeric(b)?"alpha(opacity="+100*b+")":"",f=d&&d.filter||c.filter||"";c.zoom=1,(b>=1||""===b)&&""===m.trim(f.replace(Mb,""))&&c.removeAttribute&&(c.removeAttribute("filter"),""===b||d&&!d.filter)||(c.filter=Mb.test(f)?f.replace(Mb,e):f+" "+e)}}),m.cssHooks.marginRight=Lb(k.reliableMarginRight,function(a,b){return b?m.swap(a,{display:"inline-block"},Jb,[a,"marginRight"]):void 0}),m.each({margin:"",padding:"",border:"Width"},function(a,b){m.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+T[d]+b]=f[d]||f[d-2]||f[0];return e}},Gb.test(a)||(m.cssHooks[a+b].set=Wb)}),m.fn.extend({css:function(a,b){return V(this,function(a,b,c){var d,e,f={},g=0;if(m.isArray(b)){for(d=Ib(a),e=b.length;e>g;g++)f[b[g]]=m.css(a,b[g],!1,d);return f}return void 0!==c?m.style(a,b,c):m.css(a,b)},a,b,arguments.length>1)},show:function(){return Vb(this,!0)},hide:function(){return Vb(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){U(this)?m(this).show():m(this).hide()})}});function Zb(a,b,c,d,e){return new Zb.prototype.init(a,b,c,d,e)}m.Tween=Zb,Zb.prototype={constructor:Zb,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(m.cssNumber[c]?"":"px")
},cur:function(){var a=Zb.propHooks[this.prop];return a&&a.get?a.get(this):Zb.propHooks._default.get(this)},run:function(a){var b,c=Zb.propHooks[this.prop];return this.pos=b=this.options.duration?m.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Zb.propHooks._default.set(this),this}},Zb.prototype.init.prototype=Zb.prototype,Zb.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=m.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){m.fx.step[a.prop]?m.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[m.cssProps[a.prop]]||m.cssHooks[a.prop])?m.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},Zb.propHooks.scrollTop=Zb.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},m.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},m.fx=Zb.prototype.init,m.fx.step={};var $b,_b,ac=/^(?:toggle|show|hide)$/,bc=new RegExp("^(?:([+-])=|)("+S+")([a-z%]*)$","i"),cc=/queueHooks$/,dc=[ic],ec={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=bc.exec(b),f=e&&e[3]||(m.cssNumber[a]?"":"px"),g=(m.cssNumber[a]||"px"!==f&&+d)&&bc.exec(m.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,m.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function fc(){return setTimeout(function(){$b=void 0}),$b=m.now()}function gc(a,b){var c,d={height:a},e=0;for(b=b?1:0;4>e;e+=2-b)c=T[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function hc(a,b,c){for(var d,e=(ec[b]||[]).concat(ec["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function ic(a,b,c){var d,e,f,g,h,i,j,l,n=this,o={},p=a.style,q=a.nodeType&&U(a),r=m._data(a,"fxshow");c.queue||(h=m._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,n.always(function(){n.always(function(){h.unqueued--,m.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[p.overflow,p.overflowX,p.overflowY],j=m.css(a,"display"),l="none"===j?m._data(a,"olddisplay")||Fb(a.nodeName):j,"inline"===l&&"none"===m.css(a,"float")&&(k.inlineBlockNeedsLayout&&"inline"!==Fb(a.nodeName)?p.zoom=1:p.display="inline-block")),c.overflow&&(p.overflow="hidden",k.shrinkWrapBlocks()||n.always(function(){p.overflow=c.overflow[0],p.overflowX=c.overflow[1],p.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],ac.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(q?"hide":"show")){if("show"!==e||!r||void 0===r[d])continue;q=!0}o[d]=r&&r[d]||m.style(a,d)}else j=void 0;if(m.isEmptyObject(o))"inline"===("none"===j?Fb(a.nodeName):j)&&(p.display=j);else{r?"hidden"in r&&(q=r.hidden):r=m._data(a,"fxshow",{}),f&&(r.hidden=!q),q?m(a).show():n.done(function(){m(a).hide()}),n.done(function(){var b;m._removeData(a,"fxshow");for(b in o)m.style(a,b,o[b])});for(d in o)g=hc(q?r[d]:0,d,n),d in r||(r[d]=g.start,q&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function jc(a,b){var c,d,e,f,g;for(c in a)if(d=m.camelCase(c),e=b[d],f=a[c],m.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=m.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function kc(a,b,c){var d,e,f=0,g=dc.length,h=m.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=$b||fc(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:m.extend({},b),opts:m.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:$b||fc(),duration:c.duration,tweens:[],createTween:function(b,c){var d=m.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(jc(k,j.opts.specialEasing);g>f;f++)if(d=dc[f].call(j,a,k,j.opts))return d;return m.map(k,hc,j),m.isFunction(j.opts.start)&&j.opts.start.call(a,j),m.fx.timer(m.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}m.Animation=m.extend(kc,{tweener:function(a,b){m.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],ec[c]=ec[c]||[],ec[c].unshift(b)},prefilter:function(a,b){b?dc.unshift(a):dc.push(a)}}),m.speed=function(a,b,c){var d=a&&"object"==typeof a?m.extend({},a):{complete:c||!c&&b||m.isFunction(a)&&a,duration:a,easing:c&&b||b&&!m.isFunction(b)&&b};return d.duration=m.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in m.fx.speeds?m.fx.speeds[d.duration]:m.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){m.isFunction(d.old)&&d.old.call(this),d.queue&&m.dequeue(this,d.queue)},d},m.fn.extend({fadeTo:function(a,b,c,d){return this.filter(U).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=m.isEmptyObject(a),f=m.speed(b,c,d),g=function(){var b=kc(this,m.extend({},a),f);(e||m._data(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=m.timers,g=m._data(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&cc.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&m.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=m._data(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=m.timers,g=d?d.length:0;for(c.finish=!0,m.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),m.each(["toggle","show","hide"],function(a,b){var c=m.fn[b];m.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(gc(b,!0),a,d,e)}}),m.each({slideDown:gc("show"),slideUp:gc("hide"),slideToggle:gc("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){m.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),m.timers=[],m.fx.tick=function(){var a,b=m.timers,c=0;for($b=m.now();c<b.length;c++)a=b[c],a()||b[c]!==a||b.splice(c--,1);b.length||m.fx.stop(),$b=void 0},m.fx.timer=function(a){m.timers.push(a),a()?m.fx.start():m.timers.pop()},m.fx.interval=13,m.fx.start=function(){_b||(_b=setInterval(m.fx.tick,m.fx.interval))},m.fx.stop=function(){clearInterval(_b),_b=null},m.fx.speeds={slow:600,fast:200,_default:400},m.fn.delay=function(a,b){return a=m.fx?m.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a,b,c,d,e;b=y.createElement("div"),b.setAttribute("className","t"),b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",d=b.getElementsByTagName("a")[0],c=y.createElement("select"),e=c.appendChild(y.createElement("option")),a=b.getElementsByTagName("input")[0],d.style.cssText="top:1px",k.getSetAttribute="t"!==b.className,k.style=/top/.test(d.getAttribute("style")),k.hrefNormalized="/a"===d.getAttribute("href"),k.checkOn=!!a.value,k.optSelected=e.selected,k.enctype=!!y.createElement("form").enctype,c.disabled=!0,k.optDisabled=!e.disabled,a=y.createElement("input"),a.setAttribute("value",""),k.input=""===a.getAttribute("value"),a.value="t",a.setAttribute("type","radio"),k.radioValue="t"===a.value}();var lc=/\r/g;m.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=m.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,m(this).val()):a,null==e?e="":"number"==typeof e?e+="":m.isArray(e)&&(e=m.map(e,function(a){return null==a?"":a+""})),b=m.valHooks[this.type]||m.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=m.valHooks[e.type]||m.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(lc,""):null==c?"":c)}}}),m.extend({valHooks:{option:{get:function(a){var b=m.find.attr(a,"value");return null!=b?b:m.trim(m.text(a))}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(k.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&m.nodeName(c.parentNode,"optgroup"))){if(b=m(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=m.makeArray(b),g=e.length;while(g--)if(d=e[g],m.inArray(m.valHooks.option.get(d),f)>=0)try{d.selected=c=!0}catch(h){d.scrollHeight}else d.selected=!1;return c||(a.selectedIndex=-1),e}}}}),m.each(["radio","checkbox"],function(){m.valHooks[this]={set:function(a,b){return m.isArray(b)?a.checked=m.inArray(m(a).val(),b)>=0:void 0}},k.checkOn||(m.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var mc,nc,oc=m.expr.attrHandle,pc=/^(?:checked|selected)$/i,qc=k.getSetAttribute,rc=k.input;m.fn.extend({attr:function(a,b){return V(this,m.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){m.removeAttr(this,a)})}}),m.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===K?m.prop(a,b,c):(1===f&&m.isXMLDoc(a)||(b=b.toLowerCase(),d=m.attrHooks[b]||(m.expr.match.bool.test(b)?nc:mc)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=m.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void m.removeAttr(a,b))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(E);if(f&&1===a.nodeType)while(c=f[e++])d=m.propFix[c]||c,m.expr.match.bool.test(c)?rc&&qc||!pc.test(c)?a[d]=!1:a[m.camelCase("default-"+c)]=a[d]=!1:m.attr(a,c,""),a.removeAttribute(qc?c:d)},attrHooks:{type:{set:function(a,b){if(!k.radioValue&&"radio"===b&&m.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),nc={set:function(a,b,c){return b===!1?m.removeAttr(a,c):rc&&qc||!pc.test(c)?a.setAttribute(!qc&&m.propFix[c]||c,c):a[m.camelCase("default-"+c)]=a[c]=!0,c}},m.each(m.expr.match.bool.source.match(/\w+/g),function(a,b){var c=oc[b]||m.find.attr;oc[b]=rc&&qc||!pc.test(b)?function(a,b,d){var e,f;return d||(f=oc[b],oc[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,oc[b]=f),e}:function(a,b,c){return c?void 0:a[m.camelCase("default-"+b)]?b.toLowerCase():null}}),rc&&qc||(m.attrHooks.value={set:function(a,b,c){return m.nodeName(a,"input")?void(a.defaultValue=b):mc&&mc.set(a,b,c)}}),qc||(mc={set:function(a,b,c){var d=a.getAttributeNode(c);return d||a.setAttributeNode(d=a.ownerDocument.createAttribute(c)),d.value=b+="","value"===c||b===a.getAttribute(c)?b:void 0}},oc.id=oc.name=oc.coords=function(a,b,c){var d;return c?void 0:(d=a.getAttributeNode(b))&&""!==d.value?d.value:null},m.valHooks.button={get:function(a,b){var c=a.getAttributeNode(b);return c&&c.specified?c.value:void 0},set:mc.set},m.attrHooks.contenteditable={set:function(a,b,c){mc.set(a,""===b?!1:b,c)}},m.each(["width","height"],function(a,b){m.attrHooks[b]={set:function(a,c){return""===c?(a.setAttribute(b,"auto"),c):void 0}}})),k.style||(m.attrHooks.style={get:function(a){return a.style.cssText||void 0},set:function(a,b){return a.style.cssText=b+""}});var sc=/^(?:input|select|textarea|button|object)$/i,tc=/^(?:a|area)$/i;m.fn.extend({prop:function(a,b){return V(this,m.prop,a,b,arguments.length>1)},removeProp:function(a){return a=m.propFix[a]||a,this.each(function(){try{this[a]=void 0,delete this[a]}catch(b){}})}}),m.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!m.isXMLDoc(a),f&&(b=m.propFix[b]||b,e=m.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=m.find.attr(a,"tabindex");return b?parseInt(b,10):sc.test(a.nodeName)||tc.test(a.nodeName)&&a.href?0:-1}}}}),k.hrefNormalized||m.each(["href","src"],function(a,b){m.propHooks[b]={get:function(a){return a.getAttribute(b,4)}}}),k.optSelected||(m.propHooks.selected={get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}}),m.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){m.propFix[this.toLowerCase()]=this}),k.enctype||(m.propFix.enctype="encoding");var uc=/[\t\r\n\f]/g;m.fn.extend({addClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j="string"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).addClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(uc," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=m.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j=0===arguments.length||"string"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).removeClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(uc," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?m.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(m.isFunction(a)?function(c){m(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=m(this),f=a.match(E)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===K||"boolean"===c)&&(this.className&&m._data(this,"__className__",this.className),this.className=this.className||a===!1?"":m._data(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(uc," ").indexOf(b)>=0)return!0;return!1}}),m.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){m.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),m.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var vc=m.now(),wc=/\?/,xc=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;m.parseJSON=function(b){if(a.JSON&&a.JSON.parse)return a.JSON.parse(b+"");var c,d=null,e=m.trim(b+"");return e&&!m.trim(e.replace(xc,function(a,b,e,f){return c&&b&&(d=0),0===d?a:(c=e||b,d+=!f-!e,"")}))?Function("return "+e)():m.error("Invalid JSON: "+b)},m.parseXML=function(b){var c,d;if(!b||"string"!=typeof b)return null;try{a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b))}catch(e){c=void 0}return c&&c.documentElement&&!c.getElementsByTagName("parsererror").length||m.error("Invalid XML: "+b),c};var yc,zc,Ac=/#.*$/,Bc=/([?&])_=[^&]*/,Cc=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Dc=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Ec=/^(?:GET|HEAD)$/,Fc=/^\/\//,Gc=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Hc={},Ic={},Jc="*/".concat("*");try{zc=location.href}catch(Kc){zc=y.createElement("a"),zc.href="",zc=zc.href}yc=Gc.exec(zc.toLowerCase())||[];function Lc(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(E)||[];if(m.isFunction(c))while(d=f[e++])"+"===d.charAt(0)?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Mc(a,b,c,d){var e={},f=a===Ic;function g(h){var i;return e[h]=!0,m.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Nc(a,b){var c,d,e=m.ajaxSettings.flatOptions||{};for(d in b)void 0!==b[d]&&((e[d]?a:c||(c={}))[d]=b[d]);return c&&m.extend(!0,a,c),a}function Oc(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===e&&(e=a.mimeType||b.getResponseHeader("Content-Type"));if(e)for(g in h)if(h[g]&&h[g].test(e)){i.unshift(g);break}if(i[0]in c)f=i[0];else{for(g in c){if(!i[0]||a.converters[g+" "+i[0]]){f=g;break}d||(d=g)}f=f||d}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function Pc(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}m.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:zc,type:"GET",isLocal:Dc.test(yc[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Jc,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":m.parseJSON,"text xml":m.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Nc(Nc(a,m.ajaxSettings),b):Nc(m.ajaxSettings,a)},ajaxPrefilter:Lc(Hc),ajaxTransport:Lc(Ic),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=m.ajaxSetup({},b),l=k.context||k,n=k.context&&(l.nodeType||l.jquery)?m(l):m.event,o=m.Deferred(),p=m.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!j){j={};while(b=Cc.exec(f))j[b[1].toLowerCase()]=b[2]}b=j[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?f:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return i&&i.abort(b),x(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||zc)+"").replace(Ac,"").replace(Fc,yc[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=m.trim(k.dataType||"*").toLowerCase().match(E)||[""],null==k.crossDomain&&(c=Gc.exec(k.url.toLowerCase()),k.crossDomain=!(!c||c[1]===yc[1]&&c[2]===yc[2]&&(c[3]||("http:"===c[1]?"80":"443"))===(yc[3]||("http:"===yc[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=m.param(k.data,k.traditional)),Mc(Hc,k,b,v),2===t)return v;h=k.global,h&&0===m.active++&&m.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!Ec.test(k.type),e=k.url,k.hasContent||(k.data&&(e=k.url+=(wc.test(e)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=Bc.test(e)?e.replace(Bc,"$1_="+vc++):e+(wc.test(e)?"&":"?")+"_="+vc++)),k.ifModified&&(m.lastModified[e]&&v.setRequestHeader("If-Modified-Since",m.lastModified[e]),m.etag[e]&&v.setRequestHeader("If-None-Match",m.etag[e])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+Jc+"; q=0.01":""):k.accepts["*"]);for(d in k.headers)v.setRequestHeader(d,k.headers[d]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(d in{success:1,error:1,complete:1})v[d](k[d]);if(i=Mc(Ic,k,b,v)){v.readyState=1,h&&n.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,i.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,c,d){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),i=void 0,f=d||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,c&&(u=Oc(k,v,c)),u=Pc(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(m.lastModified[e]=w),w=v.getResponseHeader("etag"),w&&(m.etag[e]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?o.resolveWith(l,[r,x,v]):o.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,h&&n.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),h&&(n.trigger("ajaxComplete",[v,k]),--m.active||m.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return m.get(a,b,c,"json")},getScript:function(a,b){return m.get(a,void 0,b,"script")}}),m.each(["get","post"],function(a,b){m[b]=function(a,c,d,e){return m.isFunction(c)&&(e=e||d,d=c,c=void 0),m.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),m.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){m.fn[b]=function(a){return this.on(b,a)}}),m._evalUrl=function(a){return m.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},m.fn.extend({wrapAll:function(a){if(m.isFunction(a))return this.each(function(b){m(this).wrapAll(a.call(this,b))});if(this[0]){var b=m(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&1===a.firstChild.nodeType)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return this.each(m.isFunction(a)?function(b){m(this).wrapInner(a.call(this,b))}:function(){var b=m(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=m.isFunction(a);return this.each(function(c){m(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){m.nodeName(this,"body")||m(this).replaceWith(this.childNodes)}).end()}}),m.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0||!k.reliableHiddenOffsets()&&"none"===(a.style&&a.style.display||m.css(a,"display"))},m.expr.filters.visible=function(a){return!m.expr.filters.hidden(a)};var Qc=/%20/g,Rc=/\[\]$/,Sc=/\r?\n/g,Tc=/^(?:submit|button|image|reset|file)$/i,Uc=/^(?:input|select|textarea|keygen)/i;function Vc(a,b,c,d){var e;if(m.isArray(b))m.each(b,function(b,e){c||Rc.test(a)?d(a,e):Vc(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==m.type(b))d(a,b);else for(e in b)Vc(a+"["+e+"]",b[e],c,d)}m.param=function(a,b){var c,d=[],e=function(a,b){b=m.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=m.ajaxSettings&&m.ajaxSettings.traditional),m.isArray(a)||a.jquery&&!m.isPlainObject(a))m.each(a,function(){e(this.name,this.value)});else for(c in a)Vc(c,a[c],b,e);return d.join("&").replace(Qc,"+")},m.fn.extend({serialize:function(){return m.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=m.prop(this,"elements");return a?m.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!m(this).is(":disabled")&&Uc.test(this.nodeName)&&!Tc.test(a)&&(this.checked||!W.test(a))}).map(function(a,b){var c=m(this).val();return null==c?null:m.isArray(c)?m.map(c,function(a){return{name:b.name,value:a.replace(Sc,"\r\n")}}):{name:b.name,value:c.replace(Sc,"\r\n")}}).get()}}),m.ajaxSettings.xhr=void 0!==a.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&Zc()||$c()}:Zc;var Wc=0,Xc={},Yc=m.ajaxSettings.xhr();a.ActiveXObject&&m(a).on("unload",function(){for(var a in Xc)Xc[a](void 0,!0)}),k.cors=!!Yc&&"withCredentials"in Yc,Yc=k.ajax=!!Yc,Yc&&m.ajaxTransport(function(a){if(!a.crossDomain||k.cors){var b;return{send:function(c,d){var e,f=a.xhr(),g=++Wc;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)void 0!==c[e]&&f.setRequestHeader(e,c[e]+"");f.send(a.hasContent&&a.data||null),b=function(c,e){var h,i,j;if(b&&(e||4===f.readyState))if(delete Xc[g],b=void 0,f.onreadystatechange=m.noop,e)4!==f.readyState&&f.abort();else{j={},h=f.status,"string"==typeof f.responseText&&(j.text=f.responseText);try{i=f.statusText}catch(k){i=""}h||!a.isLocal||a.crossDomain?1223===h&&(h=204):h=j.text?200:404}j&&d(h,i,j,f.getAllResponseHeaders())},a.async?4===f.readyState?setTimeout(b):f.onreadystatechange=Xc[g]=b:b()},abort:function(){b&&b(void 0,!0)}}}});function Zc(){try{return new a.XMLHttpRequest}catch(b){}}function $c(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}m.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return m.globalEval(a),a}}}),m.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),m.ajaxTransport("script",function(a){if(a.crossDomain){var b,c=y.head||m("head")[0]||y.documentElement;return{send:function(d,e){b=y.createElement("script"),b.async=!0,a.scriptCharset&&(b.charset=a.scriptCharset),b.src=a.url,b.onload=b.onreadystatechange=function(a,c){(c||!b.readyState||/loaded|complete/.test(b.readyState))&&(b.onload=b.onreadystatechange=null,b.parentNode&&b.parentNode.removeChild(b),b=null,c||e(200,"success"))},c.insertBefore(b,c.firstChild)},abort:function(){b&&b.onload(void 0,!0)}}}});var _c=[],ad=/(=)\?(?=&|$)|\?\?/;m.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=_c.pop()||m.expando+"_"+vc++;return this[a]=!0,a}}),m.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(ad.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&ad.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=m.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(ad,"$1"+e):b.jsonp!==!1&&(b.url+=(wc.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||m.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,_c.push(e)),g&&m.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),m.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||y;var d=u.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=m.buildFragment([a],b,e),e&&e.length&&m(e).remove(),m.merge([],d.childNodes))};var bd=m.fn.load;m.fn.load=function(a,b,c){if("string"!=typeof a&&bd)return bd.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=m.trim(a.slice(h,a.length)),a=a.slice(0,h)),m.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(f="POST"),g.length>0&&m.ajax({url:a,type:f,dataType:"html",data:b}).done(function(a){e=arguments,g.html(d?m("<div>").append(m.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,e||[a.responseText,b,a])}),this},m.expr.filters.animated=function(a){return m.grep(m.timers,function(b){return a===b.elem}).length};var cd=a.document.documentElement;function dd(a){return m.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}m.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=m.css(a,"position"),l=m(a),n={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=m.css(a,"top"),i=m.css(a,"left"),j=("absolute"===k||"fixed"===k)&&m.inArray("auto",[f,i])>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),m.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(n.top=b.top-h.top+g),null!=b.left&&(n.left=b.left-h.left+e),"using"in b?b.using.call(a,n):l.css(n)}},m.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){m.offset.setOffset(this,a,b)});var b,c,d={top:0,left:0},e=this[0],f=e&&e.ownerDocument;if(f)return b=f.documentElement,m.contains(b,e)?(typeof e.getBoundingClientRect!==K&&(d=e.getBoundingClientRect()),c=dd(f),{top:d.top+(c.pageYOffset||b.scrollTop)-(b.clientTop||0),left:d.left+(c.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}):d},position:function(){if(this[0]){var a,b,c={top:0,left:0},d=this[0];return"fixed"===m.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),m.nodeName(a[0],"html")||(c=a.offset()),c.top+=m.css(a[0],"borderTopWidth",!0),c.left+=m.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-m.css(d,"marginTop",!0),left:b.left-c.left-m.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||cd;while(a&&!m.nodeName(a,"html")&&"static"===m.css(a,"position"))a=a.offsetParent;return a||cd})}}),m.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c=/Y/.test(b);m.fn[a]=function(d){return V(this,function(a,d,e){var f=dd(a);return void 0===e?f?b in f?f[b]:f.document.documentElement[d]:a[d]:void(f?f.scrollTo(c?m(f).scrollLeft():e,c?e:m(f).scrollTop()):a[d]=e)},a,d,arguments.length,null)}}),m.each(["top","left"],function(a,b){m.cssHooks[b]=Lb(k.pixelPosition,function(a,c){return c?(c=Jb(a,b),Hb.test(c)?m(a).position()[b]+"px":c):void 0})}),m.each({Height:"height",Width:"width"},function(a,b){m.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){m.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return V(this,function(b,c,d){var e;return m.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?m.css(b,c,g):m.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),m.fn.size=function(){return this.length},m.fn.andSelf=m.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return m});var ed=a.jQuery,fd=a.$;return m.noConflict=function(b){return a.$===m&&(a.$=fd),b&&a.jQuery===m&&(a.jQuery=ed),m},typeof b===K&&(a.jQuery=a.$=m),m});
|
website/server/docgenHelpers.js
|
ljhsai/react-native
|
"use strict";
var b = require('react-docgen/node_modules/recast').types.builders;
var docgen = require('react-docgen');
function stylePropTypeHandler(documentation, path) {
var propTypesPath = docgen.utils.getPropertyValuePath(path, 'propTypes');
if (!propTypesPath) {
return;
}
propTypesPath = docgen.utils.resolveToValue(propTypesPath);
if (!propTypesPath || propTypesPath.node.type !== 'ObjectExpression') {
return;
}
// Check if the there is a style prop
propTypesPath.get('properties').each(function(propertyPath) {
if (propertyPath.node.type !== 'Property' ||
docgen.utils.getPropertyName(propertyPath) !== 'style') {
return;
}
var valuePath = docgen.utils.resolveToValue(propertyPath.get('value'));
// If it's a call to StyleSheetPropType, do stuff
if (valuePath.node.type !== 'CallExpression' ||
valuePath.node.callee.name !== 'StyleSheetPropType') {
return;
}
// Get type of style sheet
var styleSheetModule = docgen.utils.resolveToModule(
valuePath.get('arguments', 0)
);
if (styleSheetModule) {
var propDescriptor = documentation.getPropDescriptor('style');
propDescriptor.type = {name: 'stylesheet', value: styleSheetModule};
}
});
}
function findExportedOrFirst(node, recast) {
return docgen.resolver.findExportedReactCreateClassCall(node, recast) ||
docgen.resolver.findAllReactCreateClassCalls(node, recast)[0];
}
function findExportedObject(ast, recast) {
var objPath;
recast.visit(ast, {
visitAssignmentExpression: function(path) {
if (!objPath && docgen.utils.isExportsOrModuleAssignment(path)) {
objPath = docgen.utils.resolveToValue(path.get('right'));
}
return false;
}
});
if (objPath) {
// Hack: This is easier than replicating the default propType
// handler.
// This converts any expression, e.g. `foo` to an object expression of
// the form `{propTypes: foo}`
var b = recast.types.builders;
var nt = recast.types.namedTypes;
var obj = objPath.node;
// Hack: This is converting calls like
//
// Object.apply(Object.create(foo), { bar: 42 })
//
// to an AST representing an object literal:
//
// { ...foo, bar: 42 }
if (nt.CallExpression.check(obj) &&
recast.print(obj.callee).code === 'Object.assign') {
obj = objPath.node.arguments[1];
var firstArg = objPath.node.arguments[0];
if (recast.print(firstArg.callee).code === 'Object.create') {
firstArg = firstArg.arguments[0];
}
obj.properties.unshift(
b.spreadProperty(firstArg)
);
}
objPath.replace(b.objectExpression([
b.property('init', b.literal('propTypes'), obj)
]));
}
return objPath;
}
exports.stylePropTypeHandler = stylePropTypeHandler;
exports.findExportedOrFirst = findExportedOrFirst;
exports.findExportedObject = findExportedObject;
|
assets/cropper_sets/scripts/jquery-1.10.2.min.js
|
manish-kumar9a9/cars
|
/*! jQuery v1.10.2 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license
//@ sourceMappingURL=jquery.min.map
*/
(function(e,t){var n,r,i=typeof t,o=e.location,a=e.document,s=a.documentElement,l=e.jQuery,u=e.$,c={},p=[],f="1.10.2",d=p.concat,h=p.push,g=p.slice,m=p.indexOf,y=c.toString,v=c.hasOwnProperty,b=f.trim,x=function(e,t){return new x.fn.init(e,t,r)},w=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=/\S+/g,C=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,k=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,E=/^[\],:{}\s]*$/,S=/(?:^|:|,)(?:\s*\[)+/g,A=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,j=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,D=/^-ms-/,L=/-([\da-z])/gi,H=function(e,t){return t.toUpperCase()},q=function(e){(a.addEventListener||"load"===e.type||"complete"===a.readyState)&&(_(),x.ready())},_=function(){a.addEventListener?(a.removeEventListener("DOMContentLoaded",q,!1),e.removeEventListener("load",q,!1)):(a.detachEvent("onreadystatechange",q),e.detachEvent("onload",q))};x.fn=x.prototype={jquery:f,constructor:x,init:function(e,n,r){var i,o;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!i||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof x?n[0]:n,x.merge(this,x.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:a,!0)),k.test(i[1])&&x.isPlainObject(n))for(i in n)x.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(o=a.getElementById(i[2]),o&&o.parentNode){if(o.id!==i[2])return r.find(e);this.length=1,this[0]=o}return this.context=a,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):x.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),x.makeArray(e,this))},selector:"",length:0,toArray:function(){return g.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=x.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return x.each(this,e,t)},ready:function(e){return x.ready.promise().done(e),this},slice:function(){return this.pushStack(g.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(x.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:h,sort:[].sort,splice:[].splice},x.fn.init.prototype=x.fn,x.extend=x.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},l=1,u=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},l=2),"object"==typeof s||x.isFunction(s)||(s={}),u===l&&(s=this,--l);u>l;l++)if(null!=(o=arguments[l]))for(i in o)e=s[i],r=o[i],s!==r&&(c&&r&&(x.isPlainObject(r)||(n=x.isArray(r)))?(n?(n=!1,a=e&&x.isArray(e)?e:[]):a=e&&x.isPlainObject(e)?e:{},s[i]=x.extend(c,a,r)):r!==t&&(s[i]=r));return s},x.extend({expando:"jQuery"+(f+Math.random()).replace(/\D/g,""),noConflict:function(t){return e.$===x&&(e.$=u),t&&e.jQuery===x&&(e.jQuery=l),x},isReady:!1,readyWait:1,holdReady:function(e){e?x.readyWait++:x.ready(!0)},ready:function(e){if(e===!0?!--x.readyWait:!x.isReady){if(!a.body)return setTimeout(x.ready);x.isReady=!0,e!==!0&&--x.readyWait>0||(n.resolveWith(a,[x]),x.fn.trigger&&x(a).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===x.type(e)},isArray:Array.isArray||function(e){return"array"===x.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?c[y.call(e)]||"object":typeof e},isPlainObject:function(e){var n;if(!e||"object"!==x.type(e)||e.nodeType||x.isWindow(e))return!1;try{if(e.constructor&&!v.call(e,"constructor")&&!v.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(r){return!1}if(x.support.ownLast)for(n in e)return v.call(e,n);for(n in e);return n===t||v.call(e,n)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||a;var r=k.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=x.buildFragment([e],t,i),i&&x(i).remove(),x.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=x.trim(n),n&&E.test(n.replace(A,"@").replace(j,"]").replace(S,"")))?Function("return "+n)():(x.error("Invalid JSON: "+n),t)},parseXML:function(n){var r,i;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||x.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&x.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(D,"ms-").replace(L,H)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,a=M(e);if(n){if(a){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(a){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:b&&!b.call("\ufeff\u00a0")?function(e){return null==e?"":b.call(e)}:function(e){return null==e?"":(e+"").replace(C,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(M(Object(e))?x.merge(n,"string"==typeof e?[e]:e):h.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(m)return m.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r)for(;r>o;o++)e[i++]=n[o];else while(n[o]!==t)e[i++]=n[o++];return e.length=i,e},grep:function(e,t,n){var r,i=[],o=0,a=e.length;for(n=!!n;a>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,a=M(e),s=[];if(a)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(s[s.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(s[s.length]=r);return d.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),x.isFunction(e)?(r=g.call(arguments,2),i=function(){return e.apply(n||this,r.concat(g.call(arguments)))},i.guid=e.guid=e.guid||x.guid++,i):t},access:function(e,n,r,i,o,a,s){var l=0,u=e.length,c=null==r;if("object"===x.type(r)){o=!0;for(l in r)x.access(e,n,l,r[l],!0,a,s)}else if(i!==t&&(o=!0,x.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(x(e),n)})),n))for(;u>l;l++)n(e[l],r,s?i:i.call(e[l],l,n(e[l],r)));return o?e:c?n.call(e):u?n(e[0],r):a},now:function(){return(new Date).getTime()},swap:function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i}}),x.ready.promise=function(t){if(!n)if(n=x.Deferred(),"complete"===a.readyState)setTimeout(x.ready);else if(a.addEventListener)a.addEventListener("DOMContentLoaded",q,!1),e.addEventListener("load",q,!1);else{a.attachEvent("onreadystatechange",q),e.attachEvent("onload",q);var r=!1;try{r=null==e.frameElement&&a.documentElement}catch(i){}r&&r.doScroll&&function o(){if(!x.isReady){try{r.doScroll("left")}catch(e){return setTimeout(o,50)}_(),x.ready()}}()}return n.promise(t)},x.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){c["[object "+t+"]"]=t.toLowerCase()});function M(e){var t=e.length,n=x.type(e);return x.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=x(a),function(e,t){var n,r,i,o,a,s,l,u,c,p,f,d,h,g,m,y,v,b="sizzle"+-new Date,w=e.document,T=0,C=0,N=st(),k=st(),E=st(),S=!1,A=function(e,t){return e===t?(S=!0,0):0},j=typeof t,D=1<<31,L={}.hasOwnProperty,H=[],q=H.pop,_=H.push,M=H.push,O=H.slice,F=H.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},B="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",P="[\\x20\\t\\r\\n\\f]",R="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",W=R.replace("w","w#"),$="\\["+P+"*("+R+")"+P+"*(?:([*^$|!~]?=)"+P+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+W+")|)|)"+P+"*\\]",I=":("+R+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+$.replace(3,8)+")*)|.*)\\)|)",z=RegExp("^"+P+"+|((?:^|[^\\\\])(?:\\\\.)*)"+P+"+$","g"),X=RegExp("^"+P+"*,"+P+"*"),U=RegExp("^"+P+"*([>+~]|"+P+")"+P+"*"),V=RegExp(P+"*[+~]"),Y=RegExp("="+P+"*([^\\]'\"]*)"+P+"*\\]","g"),J=RegExp(I),G=RegExp("^"+W+"$"),Q={ID:RegExp("^#("+R+")"),CLASS:RegExp("^\\.("+R+")"),TAG:RegExp("^("+R.replace("w","w*")+")"),ATTR:RegExp("^"+$),PSEUDO:RegExp("^"+I),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+P+"*(even|odd|(([+-]|)(\\d*)n|)"+P+"*(?:([+-]|)"+P+"*(\\d+)|))"+P+"*\\)|)","i"),bool:RegExp("^(?:"+B+")$","i"),needsContext:RegExp("^"+P+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+P+"*((?:-\\d)?\\d*)"+P+"*\\)|)(?=[^-]|$)","i")},K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,et=/^(?:input|select|textarea|button)$/i,tt=/^h\d$/i,nt=/'|\\/g,rt=RegExp("\\\\([\\da-f]{1,6}"+P+"?|("+P+")|.)","ig"),it=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:0>r?String.fromCharCode(r+65536):String.fromCharCode(55296|r>>10,56320|1023&r)};try{M.apply(H=O.call(w.childNodes),w.childNodes),H[w.childNodes.length].nodeType}catch(ot){M={apply:H.length?function(e,t){_.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function at(e,t,n,i){var o,a,s,l,u,c,d,m,y,x;if((t?t.ownerDocument||t:w)!==f&&p(t),t=t||f,n=n||[],!e||"string"!=typeof e)return n;if(1!==(l=t.nodeType)&&9!==l)return[];if(h&&!i){if(o=Z.exec(e))if(s=o[1]){if(9===l){if(a=t.getElementById(s),!a||!a.parentNode)return n;if(a.id===s)return n.push(a),n}else if(t.ownerDocument&&(a=t.ownerDocument.getElementById(s))&&v(t,a)&&a.id===s)return n.push(a),n}else{if(o[2])return M.apply(n,t.getElementsByTagName(e)),n;if((s=o[3])&&r.getElementsByClassName&&t.getElementsByClassName)return M.apply(n,t.getElementsByClassName(s)),n}if(r.qsa&&(!g||!g.test(e))){if(m=d=b,y=t,x=9===l&&e,1===l&&"object"!==t.nodeName.toLowerCase()){c=mt(e),(d=t.getAttribute("id"))?m=d.replace(nt,"\\$&"):t.setAttribute("id",m),m="[id='"+m+"'] ",u=c.length;while(u--)c[u]=m+yt(c[u]);y=V.test(e)&&t.parentNode||t,x=c.join(",")}if(x)try{return M.apply(n,y.querySelectorAll(x)),n}catch(T){}finally{d||t.removeAttribute("id")}}}return kt(e.replace(z,"$1"),t,n,i)}function st(){var e=[];function t(n,r){return e.push(n+=" ")>o.cacheLength&&delete t[e.shift()],t[n]=r}return t}function lt(e){return e[b]=!0,e}function ut(e){var t=f.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function ct(e,t){var n=e.split("|"),r=e.length;while(r--)o.attrHandle[n[r]]=t}function pt(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||D)-(~e.sourceIndex||D);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function ft(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function dt(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function ht(e){return lt(function(t){return t=+t,lt(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}s=at.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},r=at.support={},p=at.setDocument=function(e){var n=e?e.ownerDocument||e:w,i=n.defaultView;return n!==f&&9===n.nodeType&&n.documentElement?(f=n,d=n.documentElement,h=!s(n),i&&i.attachEvent&&i!==i.top&&i.attachEvent("onbeforeunload",function(){p()}),r.attributes=ut(function(e){return e.className="i",!e.getAttribute("className")}),r.getElementsByTagName=ut(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),r.getElementsByClassName=ut(function(e){return e.innerHTML="<div class='a'></div><div class='a i'></div>",e.firstChild.className="i",2===e.getElementsByClassName("i").length}),r.getById=ut(function(e){return d.appendChild(e).id=b,!n.getElementsByName||!n.getElementsByName(b).length}),r.getById?(o.find.ID=function(e,t){if(typeof t.getElementById!==j&&h){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},o.filter.ID=function(e){var t=e.replace(rt,it);return function(e){return e.getAttribute("id")===t}}):(delete o.find.ID,o.filter.ID=function(e){var t=e.replace(rt,it);return function(e){var n=typeof e.getAttributeNode!==j&&e.getAttributeNode("id");return n&&n.value===t}}),o.find.TAG=r.getElementsByTagName?function(e,n){return typeof n.getElementsByTagName!==j?n.getElementsByTagName(e):t}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},o.find.CLASS=r.getElementsByClassName&&function(e,n){return typeof n.getElementsByClassName!==j&&h?n.getElementsByClassName(e):t},m=[],g=[],(r.qsa=K.test(n.querySelectorAll))&&(ut(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||g.push("\\["+P+"*(?:value|"+B+")"),e.querySelectorAll(":checked").length||g.push(":checked")}),ut(function(e){var t=n.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("t",""),e.querySelectorAll("[t^='']").length&&g.push("[*^$]="+P+"*(?:''|\"\")"),e.querySelectorAll(":enabled").length||g.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),g.push(",.*:")})),(r.matchesSelector=K.test(y=d.webkitMatchesSelector||d.mozMatchesSelector||d.oMatchesSelector||d.msMatchesSelector))&&ut(function(e){r.disconnectedMatch=y.call(e,"div"),y.call(e,"[s!='']:x"),m.push("!=",I)}),g=g.length&&RegExp(g.join("|")),m=m.length&&RegExp(m.join("|")),v=K.test(d.contains)||d.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},A=d.compareDocumentPosition?function(e,t){if(e===t)return S=!0,0;var i=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t);return i?1&i||!r.sortDetached&&t.compareDocumentPosition(e)===i?e===n||v(w,e)?-1:t===n||v(w,t)?1:c?F.call(c,e)-F.call(c,t):0:4&i?-1:1:e.compareDocumentPosition?-1:1}:function(e,t){var r,i=0,o=e.parentNode,a=t.parentNode,s=[e],l=[t];if(e===t)return S=!0,0;if(!o||!a)return e===n?-1:t===n?1:o?-1:a?1:c?F.call(c,e)-F.call(c,t):0;if(o===a)return pt(e,t);r=e;while(r=r.parentNode)s.unshift(r);r=t;while(r=r.parentNode)l.unshift(r);while(s[i]===l[i])i++;return i?pt(s[i],l[i]):s[i]===w?-1:l[i]===w?1:0},n):f},at.matches=function(e,t){return at(e,null,null,t)},at.matchesSelector=function(e,t){if((e.ownerDocument||e)!==f&&p(e),t=t.replace(Y,"='$1']"),!(!r.matchesSelector||!h||m&&m.test(t)||g&&g.test(t)))try{var n=y.call(e,t);if(n||r.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(i){}return at(t,f,null,[e]).length>0},at.contains=function(e,t){return(e.ownerDocument||e)!==f&&p(e),v(e,t)},at.attr=function(e,n){(e.ownerDocument||e)!==f&&p(e);var i=o.attrHandle[n.toLowerCase()],a=i&&L.call(o.attrHandle,n.toLowerCase())?i(e,n,!h):t;return a===t?r.attributes||!h?e.getAttribute(n):(a=e.getAttributeNode(n))&&a.specified?a.value:null:a},at.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},at.uniqueSort=function(e){var t,n=[],i=0,o=0;if(S=!r.detectDuplicates,c=!r.sortStable&&e.slice(0),e.sort(A),S){while(t=e[o++])t===e[o]&&(i=n.push(o));while(i--)e.splice(n[i],1)}return e},a=at.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=a(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=a(t);return n},o=at.selectors={cacheLength:50,createPseudo:lt,match:Q,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(rt,it),e[3]=(e[4]||e[5]||"").replace(rt,it),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||at.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&at.error(e[0]),e},PSEUDO:function(e){var n,r=!e[5]&&e[2];return Q.CHILD.test(e[0])?null:(e[3]&&e[4]!==t?e[2]=e[4]:r&&J.test(r)&&(n=mt(r,!0))&&(n=r.indexOf(")",r.length-n)-r.length)&&(e[0]=e[0].slice(0,n),e[2]=r.slice(0,n)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(rt,it).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=N[e+" "];return t||(t=RegExp("(^|"+P+")"+e+"("+P+"|$)"))&&N(e,function(e){return t.test("string"==typeof e.className&&e.className||typeof e.getAttribute!==j&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=at.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,l){var u,c,p,f,d,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!l&&!s;if(m){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===y:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&v){c=m[b]||(m[b]={}),u=c[e]||[],d=u[0]===T&&u[1],f=u[0]===T&&u[2],p=d&&m.childNodes[d];while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if(1===p.nodeType&&++f&&p===t){c[e]=[T,d,f];break}}else if(v&&(u=(t[b]||(t[b]={}))[e])&&u[0]===T)f=u[1];else while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===y:1===p.nodeType)&&++f&&(v&&((p[b]||(p[b]={}))[e]=[T,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=o.pseudos[e]||o.setFilters[e.toLowerCase()]||at.error("unsupported pseudo: "+e);return r[b]?r(t):r.length>1?(n=[e,e,"",t],o.setFilters.hasOwnProperty(e.toLowerCase())?lt(function(e,n){var i,o=r(e,t),a=o.length;while(a--)i=F.call(e,o[a]),e[i]=!(n[i]=o[a])}):function(e){return r(e,0,n)}):r}},pseudos:{not:lt(function(e){var t=[],n=[],r=l(e.replace(z,"$1"));return r[b]?lt(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:lt(function(e){return function(t){return at(e,t).length>0}}),contains:lt(function(e){return function(t){return(t.textContent||t.innerText||a(t)).indexOf(e)>-1}}),lang:lt(function(e){return G.test(e||"")||at.error("unsupported lang: "+e),e=e.replace(rt,it).toLowerCase(),function(t){var n;do if(n=h?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===d},focus:function(e){return e===f.activeElement&&(!f.hasFocus||f.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!o.pseudos.empty(e)},header:function(e){return tt.test(e.nodeName)},input:function(e){return et.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:ht(function(){return[0]}),last:ht(function(e,t){return[t-1]}),eq:ht(function(e,t,n){return[0>n?n+t:n]}),even:ht(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:ht(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:ht(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:ht(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}},o.pseudos.nth=o.pseudos.eq;for(n in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})o.pseudos[n]=ft(n);for(n in{submit:!0,reset:!0})o.pseudos[n]=dt(n);function gt(){}gt.prototype=o.filters=o.pseudos,o.setFilters=new gt;function mt(e,t){var n,r,i,a,s,l,u,c=k[e+" "];if(c)return t?0:c.slice(0);s=e,l=[],u=o.preFilter;while(s){(!n||(r=X.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),l.push(i=[])),n=!1,(r=U.exec(s))&&(n=r.shift(),i.push({value:n,type:r[0].replace(z," ")}),s=s.slice(n.length));for(a in o.filter)!(r=Q[a].exec(s))||u[a]&&!(r=u[a](r))||(n=r.shift(),i.push({value:n,type:a,matches:r}),s=s.slice(n.length));if(!n)break}return t?s.length:s?at.error(e):k(e,l).slice(0)}function yt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function vt(e,t,n){var r=t.dir,o=n&&"parentNode"===r,a=C++;return t.first?function(t,n,i){while(t=t[r])if(1===t.nodeType||o)return e(t,n,i)}:function(t,n,s){var l,u,c,p=T+" "+a;if(s){while(t=t[r])if((1===t.nodeType||o)&&e(t,n,s))return!0}else while(t=t[r])if(1===t.nodeType||o)if(c=t[b]||(t[b]={}),(u=c[r])&&u[0]===p){if((l=u[1])===!0||l===i)return l===!0}else if(u=c[r]=[p],u[1]=e(t,n,s)||i,u[1]===!0)return!0}}function bt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function xt(e,t,n,r,i){var o,a=[],s=0,l=e.length,u=null!=t;for(;l>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),u&&t.push(s));return a}function wt(e,t,n,r,i,o){return r&&!r[b]&&(r=wt(r)),i&&!i[b]&&(i=wt(i,o)),lt(function(o,a,s,l){var u,c,p,f=[],d=[],h=a.length,g=o||Nt(t||"*",s.nodeType?[s]:s,[]),m=!e||!o&&t?g:xt(g,f,e,s,l),y=n?i||(o?e:h||r)?[]:a:m;if(n&&n(m,y,s,l),r){u=xt(y,d),r(u,[],s,l),c=u.length;while(c--)(p=u[c])&&(y[d[c]]=!(m[d[c]]=p))}if(o){if(i||e){if(i){u=[],c=y.length;while(c--)(p=y[c])&&u.push(m[c]=p);i(null,y=[],u,l)}c=y.length;while(c--)(p=y[c])&&(u=i?F.call(o,p):f[c])>-1&&(o[u]=!(a[u]=p))}}else y=xt(y===a?y.splice(h,y.length):y),i?i(null,a,y,l):M.apply(a,y)})}function Tt(e){var t,n,r,i=e.length,a=o.relative[e[0].type],s=a||o.relative[" "],l=a?1:0,c=vt(function(e){return e===t},s,!0),p=vt(function(e){return F.call(t,e)>-1},s,!0),f=[function(e,n,r){return!a&&(r||n!==u)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;i>l;l++)if(n=o.relative[e[l].type])f=[vt(bt(f),n)];else{if(n=o.filter[e[l].type].apply(null,e[l].matches),n[b]){for(r=++l;i>r;r++)if(o.relative[e[r].type])break;return wt(l>1&&bt(f),l>1&&yt(e.slice(0,l-1).concat({value:" "===e[l-2].type?"*":""})).replace(z,"$1"),n,r>l&&Tt(e.slice(l,r)),i>r&&Tt(e=e.slice(r)),i>r&&yt(e))}f.push(n)}return bt(f)}function Ct(e,t){var n=0,r=t.length>0,a=e.length>0,s=function(s,l,c,p,d){var h,g,m,y=[],v=0,b="0",x=s&&[],w=null!=d,C=u,N=s||a&&o.find.TAG("*",d&&l.parentNode||l),k=T+=null==C?1:Math.random()||.1;for(w&&(u=l!==f&&l,i=n);null!=(h=N[b]);b++){if(a&&h){g=0;while(m=e[g++])if(m(h,l,c)){p.push(h);break}w&&(T=k,i=++n)}r&&((h=!m&&h)&&v--,s&&x.push(h))}if(v+=b,r&&b!==v){g=0;while(m=t[g++])m(x,y,l,c);if(s){if(v>0)while(b--)x[b]||y[b]||(y[b]=q.call(p));y=xt(y)}M.apply(p,y),w&&!s&&y.length>0&&v+t.length>1&&at.uniqueSort(p)}return w&&(T=k,u=C),x};return r?lt(s):s}l=at.compile=function(e,t){var n,r=[],i=[],o=E[e+" "];if(!o){t||(t=mt(e)),n=t.length;while(n--)o=Tt(t[n]),o[b]?r.push(o):i.push(o);o=E(e,Ct(i,r))}return o};function Nt(e,t,n){var r=0,i=t.length;for(;i>r;r++)at(e,t[r],n);return n}function kt(e,t,n,i){var a,s,u,c,p,f=mt(e);if(!i&&1===f.length){if(s=f[0]=f[0].slice(0),s.length>2&&"ID"===(u=s[0]).type&&r.getById&&9===t.nodeType&&h&&o.relative[s[1].type]){if(t=(o.find.ID(u.matches[0].replace(rt,it),t)||[])[0],!t)return n;e=e.slice(s.shift().value.length)}a=Q.needsContext.test(e)?0:s.length;while(a--){if(u=s[a],o.relative[c=u.type])break;if((p=o.find[c])&&(i=p(u.matches[0].replace(rt,it),V.test(s[0].type)&&t.parentNode||t))){if(s.splice(a,1),e=i.length&&yt(s),!e)return M.apply(n,i),n;break}}}return l(e,f)(i,t,!h,n,V.test(e)),n}r.sortStable=b.split("").sort(A).join("")===b,r.detectDuplicates=S,p(),r.sortDetached=ut(function(e){return 1&e.compareDocumentPosition(f.createElement("div"))}),ut(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||ct("type|href|height|width",function(e,n,r){return r?t:e.getAttribute(n,"type"===n.toLowerCase()?1:2)}),r.attributes&&ut(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||ct("value",function(e,n,r){return r||"input"!==e.nodeName.toLowerCase()?t:e.defaultValue}),ut(function(e){return null==e.getAttribute("disabled")})||ct(B,function(e,n,r){var i;return r?t:(i=e.getAttributeNode(n))&&i.specified?i.value:e[n]===!0?n.toLowerCase():null}),x.find=at,x.expr=at.selectors,x.expr[":"]=x.expr.pseudos,x.unique=at.uniqueSort,x.text=at.getText,x.isXMLDoc=at.isXML,x.contains=at.contains}(e);var O={};function F(e){var t=O[e]={};return x.each(e.match(T)||[],function(e,n){t[n]=!0}),t}x.Callbacks=function(e){e="string"==typeof e?O[e]||F(e):x.extend({},e);var n,r,i,o,a,s,l=[],u=!e.once&&[],c=function(t){for(r=e.memory&&t,i=!0,a=s||0,s=0,o=l.length,n=!0;l&&o>a;a++)if(l[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}n=!1,l&&(u?u.length&&c(u.shift()):r?l=[]:p.disable())},p={add:function(){if(l){var t=l.length;(function i(t){x.each(t,function(t,n){var r=x.type(n);"function"===r?e.unique&&p.has(n)||l.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=l.length:r&&(s=t,c(r))}return this},remove:function(){return l&&x.each(arguments,function(e,t){var r;while((r=x.inArray(t,l,r))>-1)l.splice(r,1),n&&(o>=r&&o--,a>=r&&a--)}),this},has:function(e){return e?x.inArray(e,l)>-1:!(!l||!l.length)},empty:function(){return l=[],o=0,this},disable:function(){return l=u=r=t,this},disabled:function(){return!l},lock:function(){return u=t,r||p.disable(),this},locked:function(){return!u},fireWith:function(e,t){return!l||i&&!u||(t=t||[],t=[e,t.slice?t.slice():t],n?u.push(t):c(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!i}};return p},x.extend({Deferred:function(e){var t=[["resolve","done",x.Callbacks("once memory"),"resolved"],["reject","fail",x.Callbacks("once memory"),"rejected"],["notify","progress",x.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return x.Deferred(function(n){x.each(t,function(t,o){var a=o[0],s=x.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&x.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?x.extend(e,r):r}},i={};return r.pipe=r.then,x.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=g.call(arguments),r=n.length,i=1!==r||e&&x.isFunction(e.promise)?r:0,o=1===i?e:x.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?g.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,l,u;if(r>1)for(s=Array(r),l=Array(r),u=Array(r);r>t;t++)n[t]&&x.isFunction(n[t].promise)?n[t].promise().done(a(t,u,n)).fail(o.reject).progress(a(t,l,s)):--i;return i||o.resolveWith(u,n),o.promise()}}),x.support=function(t){var n,r,o,s,l,u,c,p,f,d=a.createElement("div");if(d.setAttribute("className","t"),d.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=d.getElementsByTagName("*")||[],r=d.getElementsByTagName("a")[0],!r||!r.style||!n.length)return t;s=a.createElement("select"),u=s.appendChild(a.createElement("option")),o=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t.getSetAttribute="t"!==d.className,t.leadingWhitespace=3===d.firstChild.nodeType,t.tbody=!d.getElementsByTagName("tbody").length,t.htmlSerialize=!!d.getElementsByTagName("link").length,t.style=/top/.test(r.getAttribute("style")),t.hrefNormalized="/a"===r.getAttribute("href"),t.opacity=/^0.5/.test(r.style.opacity),t.cssFloat=!!r.style.cssFloat,t.checkOn=!!o.value,t.optSelected=u.selected,t.enctype=!!a.createElement("form").enctype,t.html5Clone="<:nav></:nav>"!==a.createElement("nav").cloneNode(!0).outerHTML,t.inlineBlockNeedsLayout=!1,t.shrinkWrapBlocks=!1,t.pixelPosition=!1,t.deleteExpando=!0,t.noCloneEvent=!0,t.reliableMarginRight=!0,t.boxSizingReliable=!0,o.checked=!0,t.noCloneChecked=o.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!u.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}o=a.createElement("input"),o.setAttribute("value",""),t.input=""===o.getAttribute("value"),o.value="t",o.setAttribute("type","radio"),t.radioValue="t"===o.value,o.setAttribute("checked","t"),o.setAttribute("name","t"),l=a.createDocumentFragment(),l.appendChild(o),t.appendChecked=o.checked,t.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(f in{submit:!0,change:!0,focusin:!0})d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||d.attributes[c].expando===!1;d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip;for(f in x(t))break;return t.ownLast="0"!==f,x(function(){var n,r,o,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",l=a.getElementsByTagName("body")[0];l&&(n=a.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",l.appendChild(n).appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",o=d.getElementsByTagName("td"),o[0].style.cssText="padding:0;margin:0;border:0;display:none",p=0===o[0].offsetHeight,o[0].style.display="",o[1].style.display="none",t.reliableHiddenOffsets=p&&0===o[0].offsetHeight,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",x.swap(l,null!=l.style.zoom?{zoom:1}:{},function(){t.boxSizing=4===d.offsetWidth}),e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(d,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(d,null)||{width:"4px"}).width,r=d.appendChild(a.createElement("div")),r.style.cssText=d.style.cssText=s,r.style.marginRight=r.style.width="0",d.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),typeof d.style.zoom!==i&&(d.innerHTML="",d.style.cssText=s+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===d.offsetWidth,d.style.display="block",d.innerHTML="<div></div>",d.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==d.offsetWidth,t.inlineBlockNeedsLayout&&(l.style.zoom=1)),l.removeChild(n),n=d=o=r=null)}),n=s=l=u=r=o=null,t
}({});var B=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,P=/([A-Z])/g;function R(e,n,r,i){if(x.acceptData(e)){var o,a,s=x.expando,l=e.nodeType,u=l?x.cache:e,c=l?e[s]:e[s]&&s;if(c&&u[c]&&(i||u[c].data)||r!==t||"string"!=typeof n)return c||(c=l?e[s]=p.pop()||x.guid++:s),u[c]||(u[c]=l?{}:{toJSON:x.noop}),("object"==typeof n||"function"==typeof n)&&(i?u[c]=x.extend(u[c],n):u[c].data=x.extend(u[c].data,n)),a=u[c],i||(a.data||(a.data={}),a=a.data),r!==t&&(a[x.camelCase(n)]=r),"string"==typeof n?(o=a[n],null==o&&(o=a[x.camelCase(n)])):o=a,o}}function W(e,t,n){if(x.acceptData(e)){var r,i,o=e.nodeType,a=o?x.cache:e,s=o?e[x.expando]:x.expando;if(a[s]){if(t&&(r=n?a[s]:a[s].data)){x.isArray(t)?t=t.concat(x.map(t,x.camelCase)):t in r?t=[t]:(t=x.camelCase(t),t=t in r?[t]:t.split(" ")),i=t.length;while(i--)delete r[t[i]];if(n?!I(r):!x.isEmptyObject(r))return}(n||(delete a[s].data,I(a[s])))&&(o?x.cleanData([e],!0):x.support.deleteExpando||a!=a.window?delete a[s]:a[s]=null)}}}x.extend({cache:{},noData:{applet:!0,embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){return e=e.nodeType?x.cache[e[x.expando]]:e[x.expando],!!e&&!I(e)},data:function(e,t,n){return R(e,t,n)},removeData:function(e,t){return W(e,t)},_data:function(e,t,n){return R(e,t,n,!0)},_removeData:function(e,t){return W(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&x.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),x.fn.extend({data:function(e,n){var r,i,o=null,a=0,s=this[0];if(e===t){if(this.length&&(o=x.data(s),1===s.nodeType&&!x._data(s,"parsedAttrs"))){for(r=s.attributes;r.length>a;a++)i=r[a].name,0===i.indexOf("data-")&&(i=x.camelCase(i.slice(5)),$(s,i,o[i]));x._data(s,"parsedAttrs",!0)}return o}return"object"==typeof e?this.each(function(){x.data(this,e)}):arguments.length>1?this.each(function(){x.data(this,e,n)}):s?$(s,e,x.data(s,e)):null},removeData:function(e){return this.each(function(){x.removeData(this,e)})}});function $(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(P,"-$1").toLowerCase();if(r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:B.test(r)?x.parseJSON(r):r}catch(o){}x.data(e,n,r)}else r=t}return r}function I(e){var t;for(t in e)if(("data"!==t||!x.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}x.extend({queue:function(e,n,r){var i;return e?(n=(n||"fx")+"queue",i=x._data(e,n),r&&(!i||x.isArray(r)?i=x._data(e,n,x.makeArray(r)):i.push(r)),i||[]):t},dequeue:function(e,t){t=t||"fx";var n=x.queue(e,t),r=n.length,i=n.shift(),o=x._queueHooks(e,t),a=function(){x.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return x._data(e,n)||x._data(e,n,{empty:x.Callbacks("once memory").add(function(){x._removeData(e,t+"queue"),x._removeData(e,n)})})}}),x.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?x.queue(this[0],e):n===t?this:this.each(function(){var t=x.queue(this,e,n);x._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&x.dequeue(this,e)})},dequeue:function(e){return this.each(function(){x.dequeue(this,e)})},delay:function(e,t){return e=x.fx?x.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,o=x.Deferred(),a=this,s=this.length,l=function(){--i||o.resolveWith(a,[a])};"string"!=typeof e&&(n=e,e=t),e=e||"fx";while(s--)r=x._data(a[s],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(l));return l(),o.promise(n)}});var z,X,U=/[\t\r\n\f]/g,V=/\r/g,Y=/^(?:input|select|textarea|button|object)$/i,J=/^(?:a|area)$/i,G=/^(?:checked|selected)$/i,Q=x.support.getSetAttribute,K=x.support.input;x.fn.extend({attr:function(e,t){return x.access(this,x.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){x.removeAttr(this,e)})},prop:function(e,t){return x.access(this,x.prop,e,t,arguments.length>1)},removeProp:function(e){return e=x.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,o,a=0,s=this.length,l="string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).addClass(e.call(this,t,this.className))});if(l)for(t=(e||"").match(T)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(U," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=x.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,a=0,s=this.length,l=0===arguments.length||"string"==typeof e&&e;if(x.isFunction(e))return this.each(function(t){x(this).removeClass(e.call(this,t,this.className))});if(l)for(t=(e||"").match(T)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(U," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?x.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):x.isFunction(e)?this.each(function(n){x(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var t,r=0,o=x(this),a=e.match(T)||[];while(t=a[r++])o.hasClass(t)?o.removeClass(t):o.addClass(t)}else(n===i||"boolean"===n)&&(this.className&&x._data(this,"__className__",this.className),this.className=this.className||e===!1?"":x._data(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(U," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,o=this[0];{if(arguments.length)return i=x.isFunction(e),this.each(function(n){var o;1===this.nodeType&&(o=i?e.call(this,n,x(this).val()):e,null==o?o="":"number"==typeof o?o+="":x.isArray(o)&&(o=x.map(o,function(e){return null==e?"":e+""})),r=x.valHooks[this.type]||x.valHooks[this.nodeName.toLowerCase()],r&&"set"in r&&r.set(this,o,"value")!==t||(this.value=o))});if(o)return r=x.valHooks[o.type]||x.valHooks[o.nodeName.toLowerCase()],r&&"get"in r&&(n=r.get(o,"value"))!==t?n:(n=o.value,"string"==typeof n?n.replace(V,""):null==n?"":n)}}}),x.extend({valHooks:{option:{get:function(e){var t=x.find.attr(e,"value");return null!=t?t:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,a=o?null:[],s=o?i+1:r.length,l=0>i?s:o?i:0;for(;s>l;l++)if(n=r[l],!(!n.selected&&l!==i||(x.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&x.nodeName(n.parentNode,"optgroup"))){if(t=x(n).val(),o)return t;a.push(t)}return a},set:function(e,t){var n,r,i=e.options,o=x.makeArray(t),a=i.length;while(a--)r=i[a],(r.selected=x.inArray(x(r).val(),o)>=0)&&(n=!0);return n||(e.selectedIndex=-1),o}}},attr:function(e,n,r){var o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return typeof e.getAttribute===i?x.prop(e,n,r):(1===s&&x.isXMLDoc(e)||(n=n.toLowerCase(),o=x.attrHooks[n]||(x.expr.match.bool.test(n)?X:z)),r===t?o&&"get"in o&&null!==(a=o.get(e,n))?a:(a=x.find.attr(e,n),null==a?t:a):null!==r?o&&"set"in o&&(a=o.set(e,r,n))!==t?a:(e.setAttribute(n,r+""),r):(x.removeAttr(e,n),t))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(T);if(o&&1===e.nodeType)while(n=o[i++])r=x.propFix[n]||n,x.expr.match.bool.test(n)?K&&Q||!G.test(n)?e[r]=!1:e[x.camelCase("default-"+n)]=e[r]=!1:x.attr(e,n,""),e.removeAttribute(Q?n:r)},attrHooks:{type:{set:function(e,t){if(!x.support.radioValue&&"radio"===t&&x.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{"for":"htmlFor","class":"className"},prop:function(e,n,r){var i,o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return a=1!==s||!x.isXMLDoc(e),a&&(n=x.propFix[n]||n,o=x.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&null!==(i=o.get(e,n))?i:e[n]},propHooks:{tabIndex:{get:function(e){var t=x.find.attr(e,"tabindex");return t?parseInt(t,10):Y.test(e.nodeName)||J.test(e.nodeName)&&e.href?0:-1}}}}),X={set:function(e,t,n){return t===!1?x.removeAttr(e,n):K&&Q||!G.test(n)?e.setAttribute(!Q&&x.propFix[n]||n,n):e[x.camelCase("default-"+n)]=e[n]=!0,n}},x.each(x.expr.match.bool.source.match(/\w+/g),function(e,n){var r=x.expr.attrHandle[n]||x.find.attr;x.expr.attrHandle[n]=K&&Q||!G.test(n)?function(e,n,i){var o=x.expr.attrHandle[n],a=i?t:(x.expr.attrHandle[n]=t)!=r(e,n,i)?n.toLowerCase():null;return x.expr.attrHandle[n]=o,a}:function(e,n,r){return r?t:e[x.camelCase("default-"+n)]?n.toLowerCase():null}}),K&&Q||(x.attrHooks.value={set:function(e,n,r){return x.nodeName(e,"input")?(e.defaultValue=n,t):z&&z.set(e,n,r)}}),Q||(z={set:function(e,n,r){var i=e.getAttributeNode(r);return i||e.setAttributeNode(i=e.ownerDocument.createAttribute(r)),i.value=n+="","value"===r||n===e.getAttribute(r)?n:t}},x.expr.attrHandle.id=x.expr.attrHandle.name=x.expr.attrHandle.coords=function(e,n,r){var i;return r?t:(i=e.getAttributeNode(n))&&""!==i.value?i.value:null},x.valHooks.button={get:function(e,n){var r=e.getAttributeNode(n);return r&&r.specified?r.value:t},set:z.set},x.attrHooks.contenteditable={set:function(e,t,n){z.set(e,""===t?!1:t,n)}},x.each(["width","height"],function(e,n){x.attrHooks[n]={set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}}})),x.support.hrefNormalized||x.each(["href","src"],function(e,t){x.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}}),x.support.style||(x.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}),x.support.optSelected||(x.propHooks.selected={get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}}),x.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){x.propFix[this.toLowerCase()]=this}),x.support.enctype||(x.propFix.enctype="encoding"),x.each(["radio","checkbox"],function(){x.valHooks[this]={set:function(e,n){return x.isArray(n)?e.checked=x.inArray(x(e).val(),n)>=0:t}},x.support.checkOn||(x.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Z=/^(?:input|select|textarea)$/i,et=/^key/,tt=/^(?:mouse|contextmenu)|click/,nt=/^(?:focusinfocus|focusoutblur)$/,rt=/^([^.]*)(?:\.(.+)|)$/;function it(){return!0}function ot(){return!1}function at(){try{return a.activeElement}catch(e){}}x.event={global:{},add:function(e,n,r,o,a){var s,l,u,c,p,f,d,h,g,m,y,v=x._data(e);if(v){r.handler&&(c=r,r=c.handler,a=c.selector),r.guid||(r.guid=x.guid++),(l=v.events)||(l=v.events={}),(f=v.handle)||(f=v.handle=function(e){return typeof x===i||e&&x.event.triggered===e.type?t:x.event.dispatch.apply(f.elem,arguments)},f.elem=e),n=(n||"").match(T)||[""],u=n.length;while(u--)s=rt.exec(n[u])||[],g=y=s[1],m=(s[2]||"").split(".").sort(),g&&(p=x.event.special[g]||{},g=(a?p.delegateType:p.bindType)||g,p=x.event.special[g]||{},d=x.extend({type:g,origType:y,data:o,handler:r,guid:r.guid,selector:a,needsContext:a&&x.expr.match.needsContext.test(a),namespace:m.join(".")},c),(h=l[g])||(h=l[g]=[],h.delegateCount=0,p.setup&&p.setup.call(e,o,m,f)!==!1||(e.addEventListener?e.addEventListener(g,f,!1):e.attachEvent&&e.attachEvent("on"+g,f))),p.add&&(p.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),a?h.splice(h.delegateCount++,0,d):h.push(d),x.event.global[g]=!0);e=null}},remove:function(e,t,n,r,i){var o,a,s,l,u,c,p,f,d,h,g,m=x.hasData(e)&&x._data(e);if(m&&(c=m.events)){t=(t||"").match(T)||[""],u=t.length;while(u--)if(s=rt.exec(t[u])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){p=x.event.special[d]||{},d=(r?p.delegateType:p.bindType)||d,f=c[d]||[],s=s[2]&&RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),l=o=f.length;while(o--)a=f[o],!i&&g!==a.origType||n&&n.guid!==a.guid||s&&!s.test(a.namespace)||r&&r!==a.selector&&("**"!==r||!a.selector)||(f.splice(o,1),a.selector&&f.delegateCount--,p.remove&&p.remove.call(e,a));l&&!f.length&&(p.teardown&&p.teardown.call(e,h,m.handle)!==!1||x.removeEvent(e,d,m.handle),delete c[d])}else for(d in c)x.event.remove(e,d+t[u],n,r,!0);x.isEmptyObject(c)&&(delete m.handle,x._removeData(e,"events"))}},trigger:function(n,r,i,o){var s,l,u,c,p,f,d,h=[i||a],g=v.call(n,"type")?n.type:n,m=v.call(n,"namespace")?n.namespace.split("."):[];if(u=f=i=i||a,3!==i.nodeType&&8!==i.nodeType&&!nt.test(g+x.event.triggered)&&(g.indexOf(".")>=0&&(m=g.split("."),g=m.shift(),m.sort()),l=0>g.indexOf(":")&&"on"+g,n=n[x.expando]?n:new x.Event(g,"object"==typeof n&&n),n.isTrigger=o?2:3,n.namespace=m.join("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=i),r=null==r?[n]:x.makeArray(r,[n]),p=x.event.special[g]||{},o||!p.trigger||p.trigger.apply(i,r)!==!1)){if(!o&&!p.noBubble&&!x.isWindow(i)){for(c=p.delegateType||g,nt.test(c+g)||(u=u.parentNode);u;u=u.parentNode)h.push(u),f=u;f===(i.ownerDocument||a)&&h.push(f.defaultView||f.parentWindow||e)}d=0;while((u=h[d++])&&!n.isPropagationStopped())n.type=d>1?c:p.bindType||g,s=(x._data(u,"events")||{})[n.type]&&x._data(u,"handle"),s&&s.apply(u,r),s=l&&u[l],s&&x.acceptData(u)&&s.apply&&s.apply(u,r)===!1&&n.preventDefault();if(n.type=g,!o&&!n.isDefaultPrevented()&&(!p._default||p._default.apply(h.pop(),r)===!1)&&x.acceptData(i)&&l&&i[g]&&!x.isWindow(i)){f=i[l],f&&(i[l]=null),x.event.triggered=g;try{i[g]()}catch(y){}x.event.triggered=t,f&&(i[l]=f)}return n.result}},dispatch:function(e){e=x.event.fix(e);var n,r,i,o,a,s=[],l=g.call(arguments),u=(x._data(this,"events")||{})[e.type]||[],c=x.event.special[e.type]||{};if(l[0]=e,e.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,e)!==!1){s=x.event.handlers.call(this,e,u),n=0;while((o=s[n++])&&!e.isPropagationStopped()){e.currentTarget=o.elem,a=0;while((i=o.handlers[a++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(i.namespace))&&(e.handleObj=i,e.data=i.data,r=((x.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,l),r!==t&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,n){var r,i,o,a,s=[],l=n.delegateCount,u=e.target;if(l&&u.nodeType&&(!e.button||"click"!==e.type))for(;u!=this;u=u.parentNode||this)if(1===u.nodeType&&(u.disabled!==!0||"click"!==e.type)){for(o=[],a=0;l>a;a++)i=n[a],r=i.selector+" ",o[r]===t&&(o[r]=i.needsContext?x(r,this).index(u)>=0:x.find(r,this,null,[u]).length),o[r]&&o.push(i);o.length&&s.push({elem:u,handlers:o})}return n.length>l&&s.push({elem:this,handlers:n.slice(l)}),s},fix:function(e){if(e[x.expando])return e;var t,n,r,i=e.type,o=e,s=this.fixHooks[i];s||(this.fixHooks[i]=s=tt.test(i)?this.mouseHooks:et.test(i)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,e=new x.Event(o),t=r.length;while(t--)n=r[t],e[n]=o[n];return e.target||(e.target=o.srcElement||a),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,o):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,o,s=n.button,l=n.fromElement;return null==e.pageX&&null!=n.clientX&&(i=e.target.ownerDocument||a,o=i.documentElement,r=i.body,e.pageX=n.clientX+(o&&o.scrollLeft||r&&r.scrollLeft||0)-(o&&o.clientLeft||r&&r.clientLeft||0),e.pageY=n.clientY+(o&&o.scrollTop||r&&r.scrollTop||0)-(o&&o.clientTop||r&&r.clientTop||0)),!e.relatedTarget&&l&&(e.relatedTarget=l===e.target?n.toElement:l),e.which||s===t||(e.which=1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==at()&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===at()&&this.blur?(this.blur(),!1):t},delegateType:"focusout"},click:{trigger:function(){return x.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):t},_default:function(e){return x.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=x.extend(new x.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?x.event.trigger(i,null,t):x.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},x.removeEvent=a.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]===i&&(e[r]=null),e.detachEvent(r,n))},x.Event=function(e,n){return this instanceof x.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?it:ot):this.type=e,n&&x.extend(this,n),this.timeStamp=e&&e.timeStamp||x.now(),this[x.expando]=!0,t):new x.Event(e,n)},x.Event.prototype={isDefaultPrevented:ot,isPropagationStopped:ot,isImmediatePropagationStopped:ot,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=it,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=it,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=it,this.stopPropagation()}},x.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){x.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return(!i||i!==r&&!x.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),x.support.submitBubbles||(x.event.special.submit={setup:function(){return x.nodeName(this,"form")?!1:(x.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=x.nodeName(n,"input")||x.nodeName(n,"button")?n.form:t;r&&!x._data(r,"submitBubbles")&&(x.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),x._data(r,"submitBubbles",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&x.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return x.nodeName(this,"form")?!1:(x.event.remove(this,"._submit"),t)}}),x.support.changeBubbles||(x.event.special.change={setup:function(){return Z.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(x.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),x.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),x.event.simulate("change",this,e,!0)})),!1):(x.event.add(this,"beforeactivate._change",function(e){var t=e.target;Z.test(t.nodeName)&&!x._data(t,"changeBubbles")&&(x.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||x.event.simulate("change",this.parentNode,e,!0)}),x._data(t,"changeBubbles",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return x.event.remove(this,"._change"),!Z.test(this.nodeName)}}),x.support.focusinBubbles||x.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){x.event.simulate(t,e.target,x.event.fix(e),!0)};x.event.special[t]={setup:function(){0===n++&&a.addEventListener(e,r,!0)},teardown:function(){0===--n&&a.removeEventListener(e,r,!0)}}}),x.fn.extend({on:function(e,n,r,i,o){var a,s;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(a in e)this.on(a,n,r,e[a],o);return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),i===!1)i=ot;else if(!i)return this;return 1===o&&(s=i,i=function(e){return x().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=x.guid++)),this.each(function(){x.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,x(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(o in e)this.off(o,n,e[o]);return this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=ot),this.each(function(){x.event.remove(this,e,r,n)})},trigger:function(e,t){return this.each(function(){x.event.trigger(e,t,this)})},triggerHandler:function(e,n){var r=this[0];return r?x.event.trigger(e,n,r,!0):t}});var st=/^.[^:#\[\.,]*$/,lt=/^(?:parents|prev(?:Until|All))/,ut=x.expr.match.needsContext,ct={children:!0,contents:!0,next:!0,prev:!0};x.fn.extend({find:function(e){var t,n=[],r=this,i=r.length;if("string"!=typeof e)return this.pushStack(x(e).filter(function(){for(t=0;i>t;t++)if(x.contains(r[t],this))return!0}));for(t=0;i>t;t++)x.find(e,r[t],n);return n=this.pushStack(i>1?x.unique(n):n),n.selector=this.selector?this.selector+" "+e:e,n},has:function(e){var t,n=x(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(x.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e||[],!0))},filter:function(e){return this.pushStack(ft(this,e||[],!1))},is:function(e){return!!ft(this,"string"==typeof e&&ut.test(e)?x(e):e||[],!1).length},closest:function(e,t){var n,r=0,i=this.length,o=[],a=ut.test(e)||"string"!=typeof e?x(e,t||this.context):0;for(;i>r;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(11>n.nodeType&&(a?a.index(n)>-1:1===n.nodeType&&x.find.matchesSelector(n,e))){n=o.push(n);break}return this.pushStack(o.length>1?x.unique(o):o)},index:function(e){return e?"string"==typeof e?x.inArray(this[0],x(e)):x.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?x(e,t):x.makeArray(e&&e.nodeType?[e]:e),r=x.merge(this.get(),n);return this.pushStack(x.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function pt(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}x.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return x.dir(e,"parentNode")},parentsUntil:function(e,t,n){return x.dir(e,"parentNode",n)},next:function(e){return pt(e,"nextSibling")},prev:function(e){return pt(e,"previousSibling")},nextAll:function(e){return x.dir(e,"nextSibling")},prevAll:function(e){return x.dir(e,"previousSibling")},nextUntil:function(e,t,n){return x.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return x.dir(e,"previousSibling",n)},siblings:function(e){return x.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return x.sibling(e.firstChild)},contents:function(e){return x.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:x.merge([],e.childNodes)}},function(e,t){x.fn[e]=function(n,r){var i=x.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=x.filter(r,i)),this.length>1&&(ct[e]||(i=x.unique(i)),lt.test(e)&&(i=i.reverse())),this.pushStack(i)}}),x.extend({filter:function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?x.find.matchesSelector(r,e)?[r]:[]:x.find.matches(e,x.grep(t,function(e){return 1===e.nodeType}))},dir:function(e,n,r){var i=[],o=e[n];while(o&&9!==o.nodeType&&(r===t||1!==o.nodeType||!x(o).is(r)))1===o.nodeType&&i.push(o),o=o[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});function ft(e,t,n){if(x.isFunction(t))return x.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return x.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(st.test(t))return x.filter(t,e,n);t=x.filter(t,e)}return x.grep(e,function(e){return x.inArray(e,t)>=0!==n})}function dt(e){var t=ht.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}var ht="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",gt=/ jQuery\d+="(?:null|\d+)"/g,mt=RegExp("<(?:"+ht+")[\\s/>]","i"),yt=/^\s+/,vt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bt=/<([\w:]+)/,xt=/<tbody/i,wt=/<|&#?\w+;/,Tt=/<(?:script|style|link)/i,Ct=/^(?:checkbox|radio)$/i,Nt=/checked\s*(?:[^=]|=\s*.checked.)/i,kt=/^$|\/(?:java|ecma)script/i,Et=/^true\/(.*)/,St=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,At={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:x.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},jt=dt(a),Dt=jt.appendChild(a.createElement("div"));At.optgroup=At.option,At.tbody=At.tfoot=At.colgroup=At.caption=At.thead,At.th=At.td,x.fn.extend({text:function(e){return x.access(this,function(e){return e===t?x.text(this):this.empty().append((this[0]&&this[0].ownerDocument||a).createTextNode(e))},null,e,arguments.length)},append:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Lt(this,e);t.appendChild(e)}})},prepend:function(){return this.domManip(arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Lt(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=e?x.filter(e,this):this,i=0;for(;null!=(n=r[i]);i++)t||1!==n.nodeType||x.cleanData(Ft(n)),n.parentNode&&(t&&x.contains(n.ownerDocument,n)&&_t(Ft(n,"script")),n.parentNode.removeChild(n));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++){1===e.nodeType&&x.cleanData(Ft(e,!1));while(e.firstChild)e.removeChild(e.firstChild);e.options&&x.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return x.clone(this,e,t)})},html:function(e){return x.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return 1===n.nodeType?n.innerHTML.replace(gt,""):t;if(!("string"!=typeof e||Tt.test(e)||!x.support.htmlSerialize&&mt.test(e)||!x.support.leadingWhitespace&&yt.test(e)||At[(bt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(vt,"<$1></$2>");try{for(;i>r;r++)n=this[r]||{},1===n.nodeType&&(x.cleanData(Ft(n,!1)),n.innerHTML=e);n=0}catch(o){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=x.map(this,function(e){return[e.nextSibling,e.parentNode]}),t=0;return this.domManip(arguments,function(n){var r=e[t++],i=e[t++];i&&(r&&r.parentNode!==i&&(r=this.nextSibling),x(this).remove(),i.insertBefore(n,r))},!0),t?this:this.remove()},detach:function(e){return this.remove(e,!0)},domManip:function(e,t,n){e=d.apply([],e);var r,i,o,a,s,l,u=0,c=this.length,p=this,f=c-1,h=e[0],g=x.isFunction(h);if(g||!(1>=c||"string"!=typeof h||x.support.checkClone)&&Nt.test(h))return this.each(function(r){var i=p.eq(r);g&&(e[0]=h.call(this,r,i.html())),i.domManip(e,t,n)});if(c&&(l=x.buildFragment(e,this[0].ownerDocument,!1,!n&&this),r=l.firstChild,1===l.childNodes.length&&(l=r),r)){for(a=x.map(Ft(l,"script"),Ht),o=a.length;c>u;u++)i=l,u!==f&&(i=x.clone(i,!0,!0),o&&x.merge(a,Ft(i,"script"))),t.call(this[u],i,u);if(o)for(s=a[a.length-1].ownerDocument,x.map(a,qt),u=0;o>u;u++)i=a[u],kt.test(i.type||"")&&!x._data(i,"globalEval")&&x.contains(s,i)&&(i.src?x._evalUrl(i.src):x.globalEval((i.text||i.textContent||i.innerHTML||"").replace(St,"")));l=r=null}return this}});function Lt(e,t){return x.nodeName(e,"table")&&x.nodeName(1===t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function Ht(e){return e.type=(null!==x.find.attr(e,"type"))+"/"+e.type,e}function qt(e){var t=Et.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function _t(e,t){var n,r=0;for(;null!=(n=e[r]);r++)x._data(n,"globalEval",!t||x._data(t[r],"globalEval"))}function Mt(e,t){if(1===t.nodeType&&x.hasData(e)){var n,r,i,o=x._data(e),a=x._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)x.event.add(t,n,s[n][r])}a.data&&(a.data=x.extend({},a.data))}}function Ot(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!x.support.noCloneEvent&&t[x.expando]){i=x._data(t);for(r in i.events)x.removeEvent(t,r,i.handle);t.removeAttribute(x.expando)}"script"===n&&t.text!==e.text?(Ht(t).text=e.text,qt(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),x.support.html5Clone&&e.innerHTML&&!x.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Ct.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}x.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){x.fn[e]=function(e){var n,r=0,i=[],o=x(e),a=o.length-1;for(;a>=r;r++)n=r===a?this:this.clone(!0),x(o[r])[t](n),h.apply(i,n.get());return this.pushStack(i)}});function Ft(e,n){var r,o,a=0,s=typeof e.getElementsByTagName!==i?e.getElementsByTagName(n||"*"):typeof e.querySelectorAll!==i?e.querySelectorAll(n||"*"):t;if(!s)for(s=[],r=e.childNodes||e;null!=(o=r[a]);a++)!n||x.nodeName(o,n)?s.push(o):x.merge(s,Ft(o,n));return n===t||n&&x.nodeName(e,n)?x.merge([e],s):s}function Bt(e){Ct.test(e.type)&&(e.defaultChecked=e.checked)}x.extend({clone:function(e,t,n){var r,i,o,a,s,l=x.contains(e.ownerDocument,e);if(x.support.html5Clone||x.isXMLDoc(e)||!mt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(Dt.innerHTML=e.outerHTML,Dt.removeChild(o=Dt.firstChild)),!(x.support.noCloneEvent&&x.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||x.isXMLDoc(e)))for(r=Ft(o),s=Ft(e),a=0;null!=(i=s[a]);++a)r[a]&&Ot(i,r[a]);if(t)if(n)for(s=s||Ft(e),r=r||Ft(o),a=0;null!=(i=s[a]);a++)Mt(i,r[a]);else Mt(e,o);return r=Ft(o,"script"),r.length>0&&_t(r,!l&&Ft(e,"script")),r=s=i=null,o},buildFragment:function(e,t,n,r){var i,o,a,s,l,u,c,p=e.length,f=dt(t),d=[],h=0;for(;p>h;h++)if(o=e[h],o||0===o)if("object"===x.type(o))x.merge(d,o.nodeType?[o]:o);else if(wt.test(o)){s=s||f.appendChild(t.createElement("div")),l=(bt.exec(o)||["",""])[1].toLowerCase(),c=At[l]||At._default,s.innerHTML=c[1]+o.replace(vt,"<$1></$2>")+c[2],i=c[0];while(i--)s=s.lastChild;if(!x.support.leadingWhitespace&&yt.test(o)&&d.push(t.createTextNode(yt.exec(o)[0])),!x.support.tbody){o="table"!==l||xt.test(o)?"<table>"!==c[1]||xt.test(o)?0:s:s.firstChild,i=o&&o.childNodes.length;while(i--)x.nodeName(u=o.childNodes[i],"tbody")&&!u.childNodes.length&&o.removeChild(u)}x.merge(d,s.childNodes),s.textContent="";while(s.firstChild)s.removeChild(s.firstChild);s=f.lastChild}else d.push(t.createTextNode(o));s&&f.removeChild(s),x.support.appendChecked||x.grep(Ft(d,"input"),Bt),h=0;while(o=d[h++])if((!r||-1===x.inArray(o,r))&&(a=x.contains(o.ownerDocument,o),s=Ft(f.appendChild(o),"script"),a&&_t(s),n)){i=0;while(o=s[i++])kt.test(o.type||"")&&n.push(o)}return s=null,f},cleanData:function(e,t){var n,r,o,a,s=0,l=x.expando,u=x.cache,c=x.support.deleteExpando,f=x.event.special;for(;null!=(n=e[s]);s++)if((t||x.acceptData(n))&&(o=n[l],a=o&&u[o])){if(a.events)for(r in a.events)f[r]?x.event.remove(n,r):x.removeEvent(n,r,a.handle);
u[o]&&(delete u[o],c?delete n[l]:typeof n.removeAttribute!==i?n.removeAttribute(l):n[l]=null,p.push(o))}},_evalUrl:function(e){return x.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})}}),x.fn.extend({wrapAll:function(e){if(x.isFunction(e))return this.each(function(t){x(this).wrapAll(e.call(this,t))});if(this[0]){var t=x(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&1===e.firstChild.nodeType)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return x.isFunction(e)?this.each(function(t){x(this).wrapInner(e.call(this,t))}):this.each(function(){var t=x(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=x.isFunction(e);return this.each(function(n){x(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){x.nodeName(this,"body")||x(this).replaceWith(this.childNodes)}).end()}});var Pt,Rt,Wt,$t=/alpha\([^)]*\)/i,It=/opacity\s*=\s*([^)]*)/,zt=/^(top|right|bottom|left)$/,Xt=/^(none|table(?!-c[ea]).+)/,Ut=/^margin/,Vt=RegExp("^("+w+")(.*)$","i"),Yt=RegExp("^("+w+")(?!px)[a-z%]+$","i"),Jt=RegExp("^([+-])=("+w+")","i"),Gt={BODY:"block"},Qt={position:"absolute",visibility:"hidden",display:"block"},Kt={letterSpacing:0,fontWeight:400},Zt=["Top","Right","Bottom","Left"],en=["Webkit","O","Moz","ms"];function tn(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=en.length;while(i--)if(t=en[i]+n,t in e)return t;return r}function nn(e,t){return e=t||e,"none"===x.css(e,"display")||!x.contains(e.ownerDocument,e)}function rn(e,t){var n,r,i,o=[],a=0,s=e.length;for(;s>a;a++)r=e[a],r.style&&(o[a]=x._data(r,"olddisplay"),n=r.style.display,t?(o[a]||"none"!==n||(r.style.display=""),""===r.style.display&&nn(r)&&(o[a]=x._data(r,"olddisplay",ln(r.nodeName)))):o[a]||(i=nn(r),(n&&"none"!==n||!i)&&x._data(r,"olddisplay",i?n:x.css(r,"display"))));for(a=0;s>a;a++)r=e[a],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[a]||"":"none"));return e}x.fn.extend({css:function(e,n){return x.access(this,function(e,n,r){var i,o,a={},s=0;if(x.isArray(n)){for(o=Rt(e),i=n.length;i>s;s++)a[n[s]]=x.css(e,n[s],!1,o);return a}return r!==t?x.style(e,n,r):x.css(e,n)},e,n,arguments.length>1)},show:function(){return rn(this,!0)},hide:function(){return rn(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){nn(this)?x(this).show():x(this).hide()})}}),x.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Wt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":x.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,l=x.camelCase(n),u=e.style;if(n=x.cssProps[l]||(x.cssProps[l]=tn(u,l)),s=x.cssHooks[n]||x.cssHooks[l],r===t)return s&&"get"in s&&(o=s.get(e,!1,i))!==t?o:u[n];if(a=typeof r,"string"===a&&(o=Jt.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(x.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||x.cssNumber[l]||(r+="px"),x.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(u[n]="inherit"),s&&"set"in s&&(r=s.set(e,r,i))===t)))try{u[n]=r}catch(c){}}},css:function(e,n,r,i){var o,a,s,l=x.camelCase(n);return n=x.cssProps[l]||(x.cssProps[l]=tn(e.style,l)),s=x.cssHooks[n]||x.cssHooks[l],s&&"get"in s&&(a=s.get(e,!0,r)),a===t&&(a=Wt(e,n,i)),"normal"===a&&n in Kt&&(a=Kt[n]),""===r||r?(o=parseFloat(a),r===!0||x.isNumeric(o)?o||0:a):a}}),e.getComputedStyle?(Rt=function(t){return e.getComputedStyle(t,null)},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),l=s?s.getPropertyValue(n)||s[n]:t,u=e.style;return s&&(""!==l||x.contains(e.ownerDocument,e)||(l=x.style(e,n)),Yt.test(l)&&Ut.test(n)&&(i=u.width,o=u.minWidth,a=u.maxWidth,u.minWidth=u.maxWidth=u.width=l,l=s.width,u.width=i,u.minWidth=o,u.maxWidth=a)),l}):a.documentElement.currentStyle&&(Rt=function(e){return e.currentStyle},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),l=s?s[n]:t,u=e.style;return null==l&&u&&u[n]&&(l=u[n]),Yt.test(l)&&!zt.test(n)&&(i=u.left,o=e.runtimeStyle,a=o&&o.left,a&&(o.left=e.currentStyle.left),u.left="fontSize"===n?"1em":l,l=u.pixelLeft+"px",u.left=i,a&&(o.left=a)),""===l?"auto":l});function on(e,t,n){var r=Vt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function an(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;for(;4>o;o+=2)"margin"===n&&(a+=x.css(e,n+Zt[o],!0,i)),r?("content"===n&&(a-=x.css(e,"padding"+Zt[o],!0,i)),"margin"!==n&&(a-=x.css(e,"border"+Zt[o]+"Width",!0,i))):(a+=x.css(e,"padding"+Zt[o],!0,i),"padding"!==n&&(a+=x.css(e,"border"+Zt[o]+"Width",!0,i)));return a}function sn(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=Rt(e),a=x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=Wt(e,t,o),(0>i||null==i)&&(i=e.style[t]),Yt.test(i))return i;r=a&&(x.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+an(e,t,n||(a?"border":"content"),r,o)+"px"}function ln(e){var t=a,n=Gt[e];return n||(n=un(e,t),"none"!==n&&n||(Pt=(Pt||x("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement),t=(Pt[0].contentWindow||Pt[0].contentDocument).document,t.write("<!doctype html><html><body>"),t.close(),n=un(e,t),Pt.detach()),Gt[e]=n),n}function un(e,t){var n=x(t.createElement(e)).appendTo(t.body),r=x.css(n[0],"display");return n.remove(),r}x.each(["height","width"],function(e,n){x.cssHooks[n]={get:function(e,r,i){return r?0===e.offsetWidth&&Xt.test(x.css(e,"display"))?x.swap(e,Qt,function(){return sn(e,n,i)}):sn(e,n,i):t},set:function(e,t,r){var i=r&&Rt(e);return on(e,t,r?an(e,n,r,x.support.boxSizing&&"border-box"===x.css(e,"boxSizing",!1,i),i):0)}}}),x.support.opacity||(x.cssHooks.opacity={get:function(e,t){return It.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=x.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=r&&r.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===x.trim(o.replace($t,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||r&&!r.filter)||(n.filter=$t.test(o)?o.replace($t,i):o+" "+i)}}),x(function(){x.support.reliableMarginRight||(x.cssHooks.marginRight={get:function(e,n){return n?x.swap(e,{display:"inline-block"},Wt,[e,"marginRight"]):t}}),!x.support.pixelPosition&&x.fn.position&&x.each(["top","left"],function(e,n){x.cssHooks[n]={get:function(e,r){return r?(r=Wt(e,n),Yt.test(r)?x(e).position()[n]+"px":r):t}}})}),x.expr&&x.expr.filters&&(x.expr.filters.hidden=function(e){return 0>=e.offsetWidth&&0>=e.offsetHeight||!x.support.reliableHiddenOffsets&&"none"===(e.style&&e.style.display||x.css(e,"display"))},x.expr.filters.visible=function(e){return!x.expr.filters.hidden(e)}),x.each({margin:"",padding:"",border:"Width"},function(e,t){x.cssHooks[e+t]={expand:function(n){var r=0,i={},o="string"==typeof n?n.split(" "):[n];for(;4>r;r++)i[e+Zt[r]+t]=o[r]||o[r-2]||o[0];return i}},Ut.test(e)||(x.cssHooks[e+t].set=on)});var cn=/%20/g,pn=/\[\]$/,fn=/\r?\n/g,dn=/^(?:submit|button|image|reset|file)$/i,hn=/^(?:input|select|textarea|keygen)/i;x.fn.extend({serialize:function(){return x.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=x.prop(this,"elements");return e?x.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!x(this).is(":disabled")&&hn.test(this.nodeName)&&!dn.test(e)&&(this.checked||!Ct.test(e))}).map(function(e,t){var n=x(this).val();return null==n?null:x.isArray(n)?x.map(n,function(e){return{name:t.name,value:e.replace(fn,"\r\n")}}):{name:t.name,value:n.replace(fn,"\r\n")}}).get()}}),x.param=function(e,n){var r,i=[],o=function(e,t){t=x.isFunction(t)?t():null==t?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(n===t&&(n=x.ajaxSettings&&x.ajaxSettings.traditional),x.isArray(e)||e.jquery&&!x.isPlainObject(e))x.each(e,function(){o(this.name,this.value)});else for(r in e)gn(r,e[r],n,o);return i.join("&").replace(cn,"+")};function gn(e,t,n,r){var i;if(x.isArray(t))x.each(t,function(t,i){n||pn.test(e)?r(e,i):gn(e+"["+("object"==typeof i?t:"")+"]",i,n,r)});else if(n||"object"!==x.type(t))r(e,t);else for(i in t)gn(e+"["+i+"]",t[i],n,r)}x.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){x.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),x.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}});var mn,yn,vn=x.now(),bn=/\?/,xn=/#.*$/,wn=/([?&])_=[^&]*/,Tn=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Cn=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Nn=/^(?:GET|HEAD)$/,kn=/^\/\//,En=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,Sn=x.fn.load,An={},jn={},Dn="*/".concat("*");try{yn=o.href}catch(Ln){yn=a.createElement("a"),yn.href="",yn=yn.href}mn=En.exec(yn.toLowerCase())||[];function Hn(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(T)||[];if(x.isFunction(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function qn(e,n,r,i){var o={},a=e===jn;function s(l){var u;return o[l]=!0,x.each(e[l]||[],function(e,l){var c=l(n,r,i);return"string"!=typeof c||a||o[c]?a?!(u=c):t:(n.dataTypes.unshift(c),s(c),!1)}),u}return s(n.dataTypes[0])||!o["*"]&&s("*")}function _n(e,n){var r,i,o=x.ajaxSettings.flatOptions||{};for(i in n)n[i]!==t&&((o[i]?e:r||(r={}))[i]=n[i]);return r&&x.extend(!0,e,r),e}x.fn.load=function(e,n,r){if("string"!=typeof e&&Sn)return Sn.apply(this,arguments);var i,o,a,s=this,l=e.indexOf(" ");return l>=0&&(i=e.slice(l,e.length),e=e.slice(0,l)),x.isFunction(n)?(r=n,n=t):n&&"object"==typeof n&&(a="POST"),s.length>0&&x.ajax({url:e,type:a,dataType:"html",data:n}).done(function(e){o=arguments,s.html(i?x("<div>").append(x.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){s.each(r,o||[e.responseText,t,e])}),this},x.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){x.fn[t]=function(e){return this.on(t,e)}}),x.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:yn,type:"GET",isLocal:Cn.test(mn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Dn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":x.parseJSON,"text xml":x.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?_n(_n(e,x.ajaxSettings),t):_n(x.ajaxSettings,e)},ajaxPrefilter:Hn(An),ajaxTransport:Hn(jn),ajax:function(e,n){"object"==typeof e&&(n=e,e=t),n=n||{};var r,i,o,a,s,l,u,c,p=x.ajaxSetup({},n),f=p.context||p,d=p.context&&(f.nodeType||f.jquery)?x(f):x.event,h=x.Deferred(),g=x.Callbacks("once memory"),m=p.statusCode||{},y={},v={},b=0,w="canceled",C={readyState:0,getResponseHeader:function(e){var t;if(2===b){if(!c){c={};while(t=Tn.exec(a))c[t[1].toLowerCase()]=t[2]}t=c[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===b?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return b||(e=v[n]=v[n]||e,y[e]=t),this},overrideMimeType:function(e){return b||(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>b)for(t in e)m[t]=[m[t],e[t]];else C.always(e[C.status]);return this},abort:function(e){var t=e||w;return u&&u.abort(t),k(0,t),this}};if(h.promise(C).complete=g.add,C.success=C.done,C.error=C.fail,p.url=((e||p.url||yn)+"").replace(xn,"").replace(kn,mn[1]+"//"),p.type=n.method||n.type||p.method||p.type,p.dataTypes=x.trim(p.dataType||"*").toLowerCase().match(T)||[""],null==p.crossDomain&&(r=En.exec(p.url.toLowerCase()),p.crossDomain=!(!r||r[1]===mn[1]&&r[2]===mn[2]&&(r[3]||("http:"===r[1]?"80":"443"))===(mn[3]||("http:"===mn[1]?"80":"443")))),p.data&&p.processData&&"string"!=typeof p.data&&(p.data=x.param(p.data,p.traditional)),qn(An,p,n,C),2===b)return C;l=p.global,l&&0===x.active++&&x.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Nn.test(p.type),o=p.url,p.hasContent||(p.data&&(o=p.url+=(bn.test(o)?"&":"?")+p.data,delete p.data),p.cache===!1&&(p.url=wn.test(o)?o.replace(wn,"$1_="+vn++):o+(bn.test(o)?"&":"?")+"_="+vn++)),p.ifModified&&(x.lastModified[o]&&C.setRequestHeader("If-Modified-Since",x.lastModified[o]),x.etag[o]&&C.setRequestHeader("If-None-Match",x.etag[o])),(p.data&&p.hasContent&&p.contentType!==!1||n.contentType)&&C.setRequestHeader("Content-Type",p.contentType),C.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+Dn+"; q=0.01":""):p.accepts["*"]);for(i in p.headers)C.setRequestHeader(i,p.headers[i]);if(p.beforeSend&&(p.beforeSend.call(f,C,p)===!1||2===b))return C.abort();w="abort";for(i in{success:1,error:1,complete:1})C[i](p[i]);if(u=qn(jn,p,n,C)){C.readyState=1,l&&d.trigger("ajaxSend",[C,p]),p.async&&p.timeout>0&&(s=setTimeout(function(){C.abort("timeout")},p.timeout));try{b=1,u.send(y,k)}catch(N){if(!(2>b))throw N;k(-1,N)}}else k(-1,"No Transport");function k(e,n,r,i){var c,y,v,w,T,N=n;2!==b&&(b=2,s&&clearTimeout(s),u=t,a=i||"",C.readyState=e>0?4:0,c=e>=200&&300>e||304===e,r&&(w=Mn(p,C,r)),w=On(p,w,C,c),c?(p.ifModified&&(T=C.getResponseHeader("Last-Modified"),T&&(x.lastModified[o]=T),T=C.getResponseHeader("etag"),T&&(x.etag[o]=T)),204===e||"HEAD"===p.type?N="nocontent":304===e?N="notmodified":(N=w.state,y=w.data,v=w.error,c=!v)):(v=N,(e||!N)&&(N="error",0>e&&(e=0))),C.status=e,C.statusText=(n||N)+"",c?h.resolveWith(f,[y,N,C]):h.rejectWith(f,[C,N,v]),C.statusCode(m),m=t,l&&d.trigger(c?"ajaxSuccess":"ajaxError",[C,p,c?y:v]),g.fireWith(f,[C,N]),l&&(d.trigger("ajaxComplete",[C,p]),--x.active||x.event.trigger("ajaxStop")))}return C},getJSON:function(e,t,n){return x.get(e,t,n,"json")},getScript:function(e,n){return x.get(e,t,n,"script")}}),x.each(["get","post"],function(e,n){x[n]=function(e,r,i,o){return x.isFunction(r)&&(o=o||i,i=r,r=t),x.ajax({url:e,type:n,dataType:o,data:r,success:i})}});function Mn(e,n,r){var i,o,a,s,l=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),o===t&&(o=e.mimeType||n.getResponseHeader("Content-Type"));if(o)for(s in l)if(l[s]&&l[s].test(o)){u.unshift(s);break}if(u[0]in r)a=u[0];else{for(s in r){if(!u[0]||e.converters[s+" "+u[0]]){a=s;break}i||(i=s)}a=a||i}return a?(a!==u[0]&&u.unshift(a),r[a]):t}function On(e,t,n,r){var i,o,a,s,l,u={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)u[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!l&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),l=o,o=c.shift())if("*"===o)o=l;else if("*"!==l&&l!==o){if(a=u[l+" "+o]||u["* "+o],!a)for(i in u)if(s=i.split(" "),s[1]===o&&(a=u[l+" "+s[0]]||u["* "+s[0]])){a===!0?a=u[i]:u[i]!==!0&&(o=s[0],c.unshift(s[1]));break}if(a!==!0)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(p){return{state:"parsererror",error:a?p:"No conversion from "+l+" to "+o}}}return{state:"success",data:t}}x.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return x.globalEval(e),e}}}),x.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),x.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=a.head||x("head")[0]||a.documentElement;return{send:function(t,i){n=a.createElement("script"),n.async=!0,e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,t){(t||!n.readyState||/loaded|complete/.test(n.readyState))&&(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),n=null,t||i(200,"success"))},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(t,!0)}}}});var Fn=[],Bn=/(=)\?(?=&|$)|\?\?/;x.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Fn.pop()||x.expando+"_"+vn++;return this[e]=!0,e}}),x.ajaxPrefilter("json jsonp",function(n,r,i){var o,a,s,l=n.jsonp!==!1&&(Bn.test(n.url)?"url":"string"==typeof n.data&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Bn.test(n.data)&&"data");return l||"jsonp"===n.dataTypes[0]?(o=n.jsonpCallback=x.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,l?n[l]=n[l].replace(Bn,"$1"+o):n.jsonp!==!1&&(n.url+=(bn.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return s||x.error(o+" was not called"),s[0]},n.dataTypes[0]="json",a=e[o],e[o]=function(){s=arguments},i.always(function(){e[o]=a,n[o]&&(n.jsonpCallback=r.jsonpCallback,Fn.push(o)),s&&x.isFunction(a)&&a(s[0]),s=a=t}),"script"):t});var Pn,Rn,Wn=0,$n=e.ActiveXObject&&function(){var e;for(e in Pn)Pn[e](t,!0)};function In(){try{return new e.XMLHttpRequest}catch(t){}}function zn(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}x.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&In()||zn()}:In,Rn=x.ajaxSettings.xhr(),x.support.cors=!!Rn&&"withCredentials"in Rn,Rn=x.support.ajax=!!Rn,Rn&&x.ajaxTransport(function(n){if(!n.crossDomain||x.support.cors){var r;return{send:function(i,o){var a,s,l=n.xhr();if(n.username?l.open(n.type,n.url,n.async,n.username,n.password):l.open(n.type,n.url,n.async),n.xhrFields)for(s in n.xhrFields)l[s]=n.xhrFields[s];n.mimeType&&l.overrideMimeType&&l.overrideMimeType(n.mimeType),n.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");try{for(s in i)l.setRequestHeader(s,i[s])}catch(u){}l.send(n.hasContent&&n.data||null),r=function(e,i){var s,u,c,p;try{if(r&&(i||4===l.readyState))if(r=t,a&&(l.onreadystatechange=x.noop,$n&&delete Pn[a]),i)4!==l.readyState&&l.abort();else{p={},s=l.status,u=l.getAllResponseHeaders(),"string"==typeof l.responseText&&(p.text=l.responseText);try{c=l.statusText}catch(f){c=""}s||!n.isLocal||n.crossDomain?1223===s&&(s=204):s=p.text?200:404}}catch(d){i||o(-1,d)}p&&o(s,c,p,u)},n.async?4===l.readyState?setTimeout(r):(a=++Wn,$n&&(Pn||(Pn={},x(e).unload($n)),Pn[a]=r),l.onreadystatechange=r):r()},abort:function(){r&&r(t,!0)}}}});var Xn,Un,Vn=/^(?:toggle|show|hide)$/,Yn=RegExp("^(?:([+-])=|)("+w+")([a-z%]*)$","i"),Jn=/queueHooks$/,Gn=[nr],Qn={"*":[function(e,t){var n=this.createTween(e,t),r=n.cur(),i=Yn.exec(t),o=i&&i[3]||(x.cssNumber[e]?"":"px"),a=(x.cssNumber[e]||"px"!==o&&+r)&&Yn.exec(x.css(n.elem,e)),s=1,l=20;if(a&&a[3]!==o){o=o||a[3],i=i||[],a=+r||1;do s=s||".5",a/=s,x.style(n.elem,e,a+o);while(s!==(s=n.cur()/r)&&1!==s&&--l)}return i&&(a=n.start=+a||+r||0,n.unit=o,n.end=i[1]?a+(i[1]+1)*i[2]:+i[2]),n}]};function Kn(){return setTimeout(function(){Xn=t}),Xn=x.now()}function Zn(e,t,n){var r,i=(Qn[t]||[]).concat(Qn["*"]),o=0,a=i.length;for(;a>o;o++)if(r=i[o].call(n,t,e))return r}function er(e,t,n){var r,i,o=0,a=Gn.length,s=x.Deferred().always(function(){delete l.elem}),l=function(){if(i)return!1;var t=Xn||Kn(),n=Math.max(0,u.startTime+u.duration-t),r=n/u.duration||0,o=1-r,a=0,l=u.tweens.length;for(;l>a;a++)u.tweens[a].run(o);return s.notifyWith(e,[u,o,n]),1>o&&l?n:(s.resolveWith(e,[u]),!1)},u=s.promise({elem:e,props:x.extend({},t),opts:x.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Xn||Kn(),duration:n.duration,tweens:[],createTween:function(t,n){var r=x.Tween(e,u.opts,t,n,u.opts.specialEasing[t]||u.opts.easing);return u.tweens.push(r),r},stop:function(t){var n=0,r=t?u.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)u.tweens[n].run(1);return t?s.resolveWith(e,[u,t]):s.rejectWith(e,[u,t]),this}}),c=u.props;for(tr(c,u.opts.specialEasing);a>o;o++)if(r=Gn[o].call(u,e,c,u.opts))return r;return x.map(c,Zn,u),x.isFunction(u.opts.start)&&u.opts.start.call(e,u),x.fx.timer(x.extend(l,{elem:e,anim:u,queue:u.opts.queue})),u.progress(u.opts.progress).done(u.opts.done,u.opts.complete).fail(u.opts.fail).always(u.opts.always)}function tr(e,t){var n,r,i,o,a;for(n in e)if(r=x.camelCase(n),i=t[r],o=e[n],x.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),a=x.cssHooks[r],a&&"expand"in a){o=a.expand(o),delete e[r];for(n in o)n in e||(e[n]=o[n],t[n]=i)}else t[r]=i}x.Animation=x.extend(er,{tweener:function(e,t){x.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;i>r;r++)n=e[r],Qn[n]=Qn[n]||[],Qn[n].unshift(t)},prefilter:function(e,t){t?Gn.unshift(e):Gn.push(e)}});function nr(e,t,n){var r,i,o,a,s,l,u=this,c={},p=e.style,f=e.nodeType&&nn(e),d=x._data(e,"fxshow");n.queue||(s=x._queueHooks(e,"fx"),null==s.unqueued&&(s.unqueued=0,l=s.empty.fire,s.empty.fire=function(){s.unqueued||l()}),s.unqueued++,u.always(function(){u.always(function(){s.unqueued--,x.queue(e,"fx").length||s.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],"inline"===x.css(e,"display")&&"none"===x.css(e,"float")&&(x.support.inlineBlockNeedsLayout&&"inline"!==ln(e.nodeName)?p.zoom=1:p.display="inline-block")),n.overflow&&(p.overflow="hidden",x.support.shrinkWrapBlocks||u.always(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in t)if(i=t[r],Vn.exec(i)){if(delete t[r],o=o||"toggle"===i,i===(f?"hide":"show"))continue;c[r]=d&&d[r]||x.style(e,r)}if(!x.isEmptyObject(c)){d?"hidden"in d&&(f=d.hidden):d=x._data(e,"fxshow",{}),o&&(d.hidden=!f),f?x(e).show():u.done(function(){x(e).hide()}),u.done(function(){var t;x._removeData(e,"fxshow");for(t in c)x.style(e,t,c[t])});for(r in c)a=Zn(f?d[r]:0,r,u),r in d||(d[r]=a.start,f&&(a.end=a.start,a.start="width"===r||"height"===r?1:0))}}function rr(e,t,n,r,i){return new rr.prototype.init(e,t,n,r,i)}x.Tween=rr,rr.prototype={constructor:rr,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(x.cssNumber[n]?"":"px")},cur:function(){var e=rr.propHooks[this.prop];return e&&e.get?e.get(this):rr.propHooks._default.get(this)},run:function(e){var t,n=rr.propHooks[this.prop];return this.pos=t=this.options.duration?x.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):rr.propHooks._default.set(this),this}},rr.prototype.init.prototype=rr.prototype,rr.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=x.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){x.fx.step[e.prop]?x.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[x.cssProps[e.prop]]||x.cssHooks[e.prop])?x.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},rr.propHooks.scrollTop=rr.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},x.each(["toggle","show","hide"],function(e,t){var n=x.fn[t];x.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ir(t,!0),e,r,i)}}),x.fn.extend({fadeTo:function(e,t,n,r){return this.filter(nn).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=x.isEmptyObject(e),o=x.speed(t,n,r),a=function(){var t=er(this,x.extend({},e),o);(i||x._data(this,"finish"))&&t.stop(!0)};return a.finish=a,i||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",o=x.timers,a=x._data(this);if(n)a[n]&&a[n].stop&&i(a[n]);else for(n in a)a[n]&&a[n].stop&&Jn.test(n)&&i(a[n]);for(n=o.length;n--;)o[n].elem!==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(r),t=!1,o.splice(n,1));(t||!r)&&x.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=x._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=x.timers,a=r?r.length:0;for(n.finish=!0,x.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;a>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}});function ir(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=Zt[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}x.each({slideDown:ir("show"),slideUp:ir("hide"),slideToggle:ir("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){x.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),x.speed=function(e,t,n){var r=e&&"object"==typeof e?x.extend({},e):{complete:n||!n&&t||x.isFunction(e)&&e,duration:e,easing:n&&t||t&&!x.isFunction(t)&&t};return r.duration=x.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in x.fx.speeds?x.fx.speeds[r.duration]:x.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){x.isFunction(r.old)&&r.old.call(this),r.queue&&x.dequeue(this,r.queue)},r},x.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},x.timers=[],x.fx=rr.prototype.init,x.fx.tick=function(){var e,n=x.timers,r=0;for(Xn=x.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||x.fx.stop(),Xn=t},x.fx.timer=function(e){e()&&x.timers.push(e)&&x.fx.start()},x.fx.interval=13,x.fx.start=function(){Un||(Un=setInterval(x.fx.tick,x.fx.interval))},x.fx.stop=function(){clearInterval(Un),Un=null},x.fx.speeds={slow:600,fast:200,_default:400},x.fx.step={},x.expr&&x.expr.filters&&(x.expr.filters.animated=function(e){return x.grep(x.timers,function(t){return e===t.elem}).length}),x.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){x.offset.setOffset(this,e,t)});var n,r,o={top:0,left:0},a=this[0],s=a&&a.ownerDocument;if(s)return n=s.documentElement,x.contains(n,a)?(typeof a.getBoundingClientRect!==i&&(o=a.getBoundingClientRect()),r=or(s),{top:o.top+(r.pageYOffset||n.scrollTop)-(n.clientTop||0),left:o.left+(r.pageXOffset||n.scrollLeft)-(n.clientLeft||0)}):o},x.offset={setOffset:function(e,t,n){var r=x.css(e,"position");"static"===r&&(e.style.position="relative");var i=x(e),o=i.offset(),a=x.css(e,"top"),s=x.css(e,"left"),l=("absolute"===r||"fixed"===r)&&x.inArray("auto",[a,s])>-1,u={},c={},p,f;l?(c=i.position(),p=c.top,f=c.left):(p=parseFloat(a)||0,f=parseFloat(s)||0),x.isFunction(t)&&(t=t.call(e,n,o)),null!=t.top&&(u.top=t.top-o.top+p),null!=t.left&&(u.left=t.left-o.left+f),"using"in t?t.using.call(e,u):i.css(u)}},x.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===x.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),x.nodeName(e[0],"html")||(n=e.offset()),n.top+=x.css(e[0],"borderTopWidth",!0),n.left+=x.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-x.css(r,"marginTop",!0),left:t.left-n.left-x.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||s;while(e&&!x.nodeName(e,"html")&&"static"===x.css(e,"position"))e=e.offsetParent;return e||s})}}),x.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);x.fn[e]=function(i){return x.access(this,function(e,i,o){var a=or(e);return o===t?a?n in a?a[n]:a.document.documentElement[i]:e[i]:(a?a.scrollTo(r?x(a).scrollLeft():o,r?o:x(a).scrollTop()):e[i]=o,t)},e,i,arguments.length,null)}});function or(e){return x.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}x.each({Height:"height",Width:"width"},function(e,n){x.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){x.fn[i]=function(i,o){var a=arguments.length&&(r||"boolean"!=typeof i),s=r||(i===!0||o===!0?"margin":"border");return x.access(this,function(n,r,i){var o;return x.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(o=n.documentElement,Math.max(n.body["scroll"+e],o["scroll"+e],n.body["offset"+e],o["offset"+e],o["client"+e])):i===t?x.css(n,r,s):x.style(n,r,i,s)},n,a?i:t,a,null)}})}),x.fn.size=function(){return this.length},x.fn.andSelf=x.fn.addBack,"object"==typeof module&&module&&"object"==typeof module.exports?module.exports=x:(e.jQuery=e.$=x,"function"==typeof define&&define.amd&&define("jquery",[],function(){return x}))})(window);
|
lib/hello-react.js
|
gnandretta/mochify-react-example
|
import React from 'react';
import Immutable from 'immutable';
export default class HelloReact extends React.Component {
constructor(props) {
super(props);
this.state = {sayHello: false};
}
render() {
let helloReact;
if (this.state.sayHello) {
helloReact = <div className="message">Hello {this.props.name}</div>;
}
return (
<div className="hello-react">
<button onClick={this._sayHello.bind(this)}>Say Hello</button>
{helloReact}
</div>
);
}
_sayHello() {
this.setState({
sayHello: true
});
}
}
HelloReact.propTypes = {
name: React.PropTypes.string.isRequired
};
|
src/components/Text/Text.js
|
wundery/wundery-ui-react
|
import React from 'react';
import classnames from 'classnames';
import { spacingStyles } from '../Spacing/utils';
function Text(props) {
const {
block,
bold,
center,
children,
margin,
muted,
padding,
small,
theme,
left,
right,
italic,
large
} = props;
const style = spacingStyles({ margin, padding });
const classNames = classnames('ui-text', `ui-text-theme-${theme}`, {
'ui-text-muted': muted,
'ui-text-bold': bold,
'ui-text-small': small,
'ui-align-center': center,
'ui-align-left': left,
'ui-align-right': right,
'ui-text-font-italic': italic,
'ui-text-large': large,
});
return block
? <div className={classNames} style={style}>{children}</div>
: <span className={classNames} style={style}>{children}</span>;
}
Text.propTypes = {
muted: React.PropTypes.bool,
block: React.PropTypes.bool,
children: React.PropTypes.node,
bold: React.PropTypes.bool,
margin: React.PropTypes.string,
padding: React.PropTypes.string,
small: React.PropTypes.bool,
center: React.PropTypes.bool,
theme: React.PropTypes.oneOf(['default', 'success', 'light']),
left: React.PropTypes.bool,
right: React.PropTypes.bool,
italic: React.PropTypes.bool,
large: React.PropTypes.bool,
};
Text.defaultProps = {
theme: 'default',
};
export default Text;
|
client_apps/canvas_quizzes/apps/statistics/js/views/questions/short_answer.js
|
venturehive/canvas-lms
|
/** @jsx React.DOM */
/*
* Copyright (C) 2014 - present Instructure, Inc.
*
* This file is part of Canvas.
*
* Canvas is free software: you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License as published by the Free
* Software Foundation, version 3 of the License.
*
* Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
define(function(require) {
var React = require('../../ext/react');
var Question = require('jsx!../question');
var CorrectAnswerDonut = require('jsx!../charts/correct_answer_donut');
var DiscriminationIndex = require('jsx!../charts/discrimination_index');
var AnswerTable = require('jsx!./answer_table');
var calculateResponseRatio = require('../../models/ratio_calculator');
var QuestionHeader = require('jsx!./header');
var ShortAnswer = React.createClass({
render: function() {
var props = this.props;
var crr = calculateResponseRatio(props.answers, props.participantCount, {
correctResponseCount: props.correct,
questionType: props.questionType
});
return(
<Question>
<div className="grid-row">
<div className="col-sm-8 question-top-left">
<QuestionHeader
responseCount={this.props.responses}
participantCount={this.props.participantCount}
questionText={this.props.questionText}
position={this.props.position} />
<div
className="question-text"
aria-hidden
dangerouslySetInnerHTML={{ __html: this.props.questionText }} />
</div>
<div className="col-sm-4 question-top-right"></div>
</div>
<div className="grid-row">
<div className="col-sm-8 question-bottom-left">
<AnswerTable answers={this.props.answers} />
</div>
<div className="col-sm-4 question-bottom-right">
<CorrectAnswerDonut correctResponseRatio={crr} />
</div>
</div>
</Question>
);
},
});
return ShortAnswer;
});
|
examples/server/routes.js
|
reactjs/react-router-redux
|
import React from 'react'
import { Route, IndexRoute, Link } from 'react-router'
const App = ({ children }) => (
<div>
<header>
Links:
{' '}
<Link to="/">Home</Link>
{' '}
<Link to="/foo">Foo</Link>
{' '}
<Link to="/bar">Bar</Link>
</header>
{children}
</div>
)
const Home = () => (<div>Home!</div>)
const Foo = () => (<div>Foo!</div>)
const Bar = () => (<div>Bar!</div>)
const routes = (
<Route path="/" component={App}>
<IndexRoute component={Home}/>
<Route path="foo" component={Foo}/>
<Route path="bar" component={Bar}/>
</Route>
)
export default routes
|
packages/material-ui-icons/src/BorderTopTwoTone.js
|
Kagami/material-ui
|
import React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<React.Fragment><path fill="none" d="M0 0h24v24H0V0z" /><g><path d="M19 19h2v2h-2zM3 19h2v2H3zM11 19h2v2h-2zM3 11h2v2H3zM3 15h2v2H3zM7 19h2v2H7zM11 7h2v2h-2zM11 11h2v2h-2zM3 7h2v2H3zM3 3h18v2H3zM11 15h2v2h-2zM15 19h2v2h-2zM7 11h2v2H7zM15 11h2v2h-2zM19 15h2v2h-2zM19 11h2v2h-2zM19 7h2v2h-2z" /></g></React.Fragment>
, 'BorderTopTwoTone');
|
node_modules/react-icons/fa/upload.js
|
bairrada97/festival
|
import React from 'react'
import Icon from 'react-icon-base'
const FaUpload = props => (
<Icon viewBox="0 0 40 40" {...props}>
<g><path d="m30.1 32.9q0-0.6-0.5-1t-1-0.5-1 0.5-0.4 1 0.4 1 1 0.4 1-0.4 0.5-1z m5.7 0q0-0.6-0.4-1t-1-0.5-1 0.5-0.5 1 0.5 1 1 0.4 1-0.4 0.4-1z m2.8-5v7.1q0 0.9-0.6 1.5t-1.5 0.6h-32.9q-0.8 0-1.5-0.6t-0.6-1.5v-7.1q0-0.9 0.6-1.6t1.5-0.6h9.6q0.4 1.3 1.5 2.1t2.5 0.8h5.7q1.4 0 2.5-0.8t1.6-2.1h9.5q0.9 0 1.5 0.6t0.6 1.6z m-7.2-14.5q-0.4 0.9-1.3 0.9h-5.7v10q0 0.6-0.5 1t-1 0.4h-5.7q-0.6 0-1-0.4t-0.4-1v-10h-5.7q-1 0-1.3-0.9-0.4-0.9 0.3-1.5l10-10q0.4-0.5 1-0.5t1 0.5l10 10q0.7 0.6 0.3 1.5z"/></g>
</Icon>
)
export default FaUpload
|
src/encoded/static/components/util/Schemas.js
|
4dn-dcic/fourfront
|
'use strict';
import _ from 'underscore';
import React from 'react';
import { linkFromItem } from '@hms-dbmi-bgm/shared-portal-components/es/components/util/object';
import { LocalizedTime, format as dateFormat } from '@hms-dbmi-bgm/shared-portal-components/es/components/ui/LocalizedTime';
import { patchedConsoleInstance as console } from '@hms-dbmi-bgm/shared-portal-components/es/components/util/patched-console';
import { getTitleForType, getSchemaProperty, schemasToItemTypeHierarchy } from '@hms-dbmi-bgm/shared-portal-components/es/components/util/schema-transforms';
import {
capitalize, capitalizeSentence, bytesToLargerUnit, roundLargeNumber, roundDecimal, hrefToFilename
} from '@hms-dbmi-bgm/shared-portal-components/es/components/util/value-transforms';
// import { downloadFileButtonClick } from './file';
let cachedSchemas = null;
/**
* Should be set by app.js to return app.state.schemas
*
* @type {function}
*/
export function get(){
return cachedSchemas;
}
export function set(schemas){
cachedSchemas = schemas;
return true;
}
export const Term = {
toName : function(field, term, allowJSXOutput = false, addDescriptionTipForLinkTos = true){
if (allowJSXOutput && typeof term !== 'string' && term && typeof term === 'object'){
// Object, probably an item.
return linkFromItem(term, addDescriptionTipForLinkTos);
}
let name = null;
switch (field) {
case 'experimentset_type':
name = capitalizeSentence(term);
break;
case 'type':
name = getTitleForType(term, get());
break;
case 'status':
name = capitalizeSentence(term);
break;
case 'date_created':
case 'public_release':
case 'project_release':
case 'date_approved':
if (allowJSXOutput) name = <LocalizedTime timestamp={term} />;
else name = dateFormat(term);
break;
default:
name = null;
break;
}
if (typeof name === 'string') return name;
// Remove 'experiments_in_set' and test as if an experiment field. So can work for both ?type=Experiment, ?type=ExperimentSet.
field = field.replace('experiments_in_set.', '');
switch (field) {
case 'biosource_type':
case 'organism.name':
case 'individual.organism.name':
case 'biosource.individual.organism.name':
case 'biosample.biosource.individual.organism.name':
case 'biosample.biosource.organism.name':
name = capitalize(term);
break;
case 'file_type':
case 'file_classification':
case 'file_type_detailed':
case 'files.file_type':
case 'files.file_classification':
case 'files.file_type_detailed':
name = capitalizeSentence(term);
break;
case 'file_size':
if (typeof term === 'number'){
name = term;
} else if (!isNaN(parseInt(term))) {
name = parseInt(term);
}
if (typeof name === 'number' && !isNaN(name)){
name = bytesToLargerUnit(name);
} else {
name = null;
}
break;
case '@id':
name = term;
break;
default:
name = null;
break;
}
// Custom stuff
// TODO: We really should disallow ppl from seeing download URL unless are on the Item page?
// if (field === "href" && typeof name === "string" && name.indexOf("/@@download/") > -1){
// // Analytics track
// return (
// <a href={term} target="_blank" rel="noopener noreferrer">
// { linkTitle }
// </a>
// );
// }
if (field.indexOf('quality_metric.') > -1){
if (field.slice(-11) === 'Total reads') return roundLargeNumber(term);
if (field.slice(-15) === 'Total Sequences') return roundLargeNumber(term);
if (field.slice(-14) === 'Sequence length') return roundLargeNumber(term);
if (field.slice(-15) === 'Cis/Trans ratio') return roundDecimal(term) + '%';
if (field.slice(-35) === '% Long-range intrachromosomal reads') return roundDecimal(term) + '%';
if (field.slice(-4) === '.url' && term.indexOf('http') > -1) {
var linkTitle = hrefToFilename(term); // Filename most likely for quality_metric.url case(s).
if (allowJSXOutput){
return <a href={term} target="_blank" rel="noopener noreferrer">{ linkTitle }</a>;
} else {
return linkTitle;
}
}
}
// Fallback
if (typeof name !== 'string') name = term;
return name;
}
};
export const Field = {
nameMap : {
'experiments_in_set.biosample.biosource.organism.name' : 'Organism',
'accession' : 'Experiment Set',
'experiments_in_set.digestion_enzyme.name' : 'Enzyme',
'experiments_in_set.biosample.biosource_summary' : 'Biosource',
'experiments_in_set.lab.display_title' : 'Lab',
'lab.display_title' : 'Lab',
'experiments_in_set.experiment_type' : 'Experiment Type',
'experiments_in_set.experiment_type.display_title' : 'Experiment Type',
'experimentset_type' : 'Set Type',
'@id' : "Link",
'display_title' : "Title"
},
toName : function(field, schemas, itemType = 'ExperimentSet', schemaOnly = false){
if (!schemaOnly && Field.nameMap[field]){
return Field.nameMap[field];
} else {
const schemaProperty = getSchemaProperty(field, schemas, itemType);
if (schemaProperty && schemaProperty.title){
Field.nameMap[field] = schemaProperty.title; // Cache in nameMap for faster lookups.
return schemaProperty.title;
} else if (!schemaOnly) {
return field;
} else {
return null;
}
}
},
getSchemaProperty : function(field, schemas = null, startAt = 'ExperimentSet'){
return getSchemaProperty(field, schemas, startAt);
}
};
|
Practicas/TicTac2/componentes/Square.js
|
tonkyfiero/React_Ejercicios
|
/*
*Importacion de Modulos
*/
import React from 'react';
export default class Square extends React.Component{
render(){
return(
<button className="square" onClick={()=>this.props.onMouse()} >
{this.props.valor}
</button>
)
}
}
|
nlyyAPP/component/药物管理/研究中心/MLYwhgl.js
|
a497500306/nlyy_APP
|
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
TouchableOpacity,
Navigator,
ListView,
Alert
} from 'react-native';
//时间操作
var moment = require('moment');
moment().format();
var MLNavigatorBar = require('../../MLNavigatorBar/MLNavigatorBar');
var MLActivityIndicatorView = require('../../MLActivityIndicatorView/MLActivityIndicatorView');
var MLTableCell = require('../../MLTableCell/MLTableCell');
var Users = require('../../../entity/Users');
var settings = require('../../../settings');
var Changku = require('../../../entity/Changku');
var Ywqd = require('../仓库/MLYwqd');
var FPQDData = require('../仓库/保存数据/FPQDData');
var YwhglNewYwqd = require('./MLYwhglNewYwqd');
var ZXNewYwqd = require('./MLZXNewYwqd');
var Ywhgl = React.createClass({
//初始化设置
getInitialState() {
return {
//ListView设置
dataSource: null,
animating: true,//是否显示菊花
}
},
//耗时操作,网络请求
componentDidMount(){
var UserSite = '';
for (var i = 0 ; i < Users.Users.length ; i++) {
if (Users.Users[i].UserFun == 'H4'){
if (Users.Users[i].UserSite != null) {
UserSite = Users.Users[i].UserSite
}
}
}
var UserSiteYN = '';
for (var i = 0 ; i < Users.Users.length ; i++) {
if (Users.Users[i].UserFun == 'H4') {
if (Users.Users[i].UserSiteYN != null) {
UserSiteYN = Users.Users[i].UserSiteYN
}
}
}
//网络请求
fetch(settings.fwqUrl + "/app/getZXAllYwqd", {
method: 'POST',
headers: {
'Accept': 'application/json; charset=utf-8',
'Content-Type': 'application/json',
},
body: JSON.stringify({
StudyID : Users.Users[0].StudyID,
UserSiteYN : UserSiteYN,
UserSite : UserSite
})
})
.then((response) => response.json())
.then((responseJson) => {
console.log(responseJson)
if (responseJson.isSucceed != 400){
//移除等待
this.setState({animating:false});
//错误
Alert.alert(
'提示:',
responseJson.msg,
[
{text: '确定'}
]
)
}else{
//ListView设置
var tableData = [];
for (var i = 0 ; i < responseJson.data.length ; i++){
var changku = responseJson.data[i];
tableData.push(changku)
}
var ds = new ListView.DataSource({rowHasChanged:(r1, r2) => r1 !== r2});
this.setState({dataSource: ds.cloneWithRows(tableData)});
//移除等待
this.setState({animating:false});
}
})
.catch((error) => {//错误
//移除等待,弹出错误
this.setState({animating:false});
//错误
Alert.alert(
'提示:',
'请检查您的网络',
[
{text: '确定'}
]
)
});
},
render() {
if (this.state.animating == true){
return (
<View style={styles.container}>
<MLNavigatorBar title={'药物号管理'} isBack={true} backFunc={() => {
this.props.navigator.pop()
}} leftTitle={'首页'} leftFunc={()=>{
this.props.navigator.popToRoute(this.props.navigator.getCurrentRoutes()[1])
}}/>
{/*设置完了加载的菊花*/}
<MLActivityIndicatorView />
</View>
);
}else{
return (
<View style={styles.container}>
<MLNavigatorBar title={'药物号管理'} isBack={true} backFunc={() => {
this.props.navigator.pop()
}} leftTitle={'首页'} leftFunc={()=>{
this.props.navigator.popToRoute(this.props.navigator.getCurrentRoutes()[1])
}}/>
<ListView
dataSource={this.state.dataSource}//数据源
renderRow={this.renderRow}
/>
</View>
);
}
},
//返回具体的cell
renderRow(rowData){
if (rowData.isSign == 1){
return(
<TouchableOpacity onPress={()=>{
console.log(rowData)
// 页面的切换
this.props.navigator.push({
name:'sdfljsdf',
component: ZXNewYwqd, // 具体路由的版块
//传递参数
passProps:{
DrugId : rowData.id,
UsedAddressId : rowData.Address.id,
SiteID : rowData.Address.SiteID
},
});
}}>
<MLTableCell title={moment(rowData.Date).format('YYYY-MM-DD HH:mm:ss')}/>
</TouchableOpacity>
)
}else {
return(
<TouchableOpacity onPress={()=>{
console.log(rowData)
// 页面的切换
this.props.navigator.push({
name:'sdfljsdf',
component: YwhglNewYwqd, // 具体路由的版块
//传递参数
passProps:{
data : rowData
},
});
}}>
<MLTableCell title={moment(rowData.Date).format('YYYY-MM-DD HH:mm:ss')}/>
</TouchableOpacity>
)
}
},
});
const styles = StyleSheet.create({
container: {
flex: 1,
// justifyContent: 'center',
// alignItems: 'center',
backgroundColor: 'rgba(233,234,239,1.0)',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
}
});
// 输出组件类
module.exports = Ywhgl;
|
app/components/PreSplash/PreSplash.js
|
heptaman/Voluncheering
|
import React, { Component } from 'react';
import PropTypes from 'prop-types'
import { View, Text, StyleSheet, TouchableOpacity, Animated } from 'react-native'
import { connect } from 'react-redux'
import { colors, fontSizes } from '~/styles'
import { logout } from '~/actions/auth'
class PreSplash extends Component {
state = {
rotation: new Animated.Value(0)
}
handleCancel = () => {
this.props.dispatch(logout())
}
componentDidMount() {
this.interval = setInterval(() => {
Animated.sequence([
Animated.timing(this.state.rotation, {toValue: -1, duration: 150}),
Animated.timing(this.state.rotation, {toValue: 1, duration: 150}),
Animated.timing(this.state.rotation, {toValue: 0, duration: 250})
]).start()
}, 1000)
}
componentWillUnmount() {
window.clearInterval(this.interval)
}
getTransform() {
return {
transform: [{
rotate: this.state.rotation.interpolate({
inputRange: [-1, 1],
outputRange: ['-20deg', '20deg']
})
}]
}
}
render() {
return (
<View style={styles.container}>
<Animated.Image
style={[styles.image, this.getTransform()]}
source={require('../../images/logo.gif')}
/>
<Text style={styles.message}>We are logging you in...</Text>
{/* <View style={styles.buttonContainer}>
<TouchableOpacity onPress={this.handleCancel} style={styles.cancelButton}>
<Text style={styles.cancelText}>Cancel</Text>
</TouchableOpacity>
</View> */}
</View>
)
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: colors.white,
alignItems: 'center',
justifyContent: 'center'
},
image: {
resizeMode: 'contain',
height: 300
},
message: {
marginTop: 32,
fontSize: fontSizes.secondary,
},
buttonContainer: {
marginTop: 48,
width: '100%',
alignItems: 'center'
},
cancelButton: {
height: 40,
width: 240,
backgroundColor: colors.red,
alignItems: 'center',
borderRadius: 8,
padding: 10,
},
cancelText: {
color: colors.background,
fontSize: fontSizes.secondary,
},
})
export default connect()(PreSplash)
|
js/components/singleBookmark/index.js
|
kondoSoft/que_hacer_movil
|
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { actions } from 'react-native-navigation-redux-helpers';
import { Image, Linking, Dimensions } from 'react-native'
import { Container, Header, Content, Fab, Text,Thumbnail, Button, Icon, Item, Input, Left, Right, Body, H3, View } from 'native-base';
import { set_item } from '../../actions/bookmarks';
import { openDrawer } from '../../actions/drawer';
import styles from './styles';
import { Grid, Row, Col } from 'react-native-easy-grid';
import Swiper from 'react-native-swiper';
import { Platform } from 'react-native';
import ActionButton from 'react-native-action-button';
const { width, height } = Dimensions.get('window');
import {add_bookmark, remove_bookmark} from '../../actions/bookmarks'
import { setLoading } from '../../actions/listZone'
import Spinner from 'react-native-loading-spinner-overlay';
const {
reset,
popRoute,
pushRoute,
} = actions;
class SingleBookmark extends Component {
constructor() {
super();
this.state = {
active: false,
heightSwiper: '',
};
this.handleClick = this.handleClick.bind(this)
this.handleClickInsta = this.handleClickInsta.bind(this)
this.handleClickFace = this.handleClickFace.bind(this)
}
static propTypes = {
// setEstablishment: React.PropTypes.func,
// listEstablishment: React.PropTypes.arrayOf(React.PropTypes.object),
openDrawer: React.PropTypes.func,
popRoute: React.PropTypes.func,
reset: React.PropTypes.func,
navigation: React.PropTypes.shape({
key: React.PropTypes.string,
}),
}
pushRoute(route, index) {
this.props.set_item(index)
this.props.setLoading()
this.props.pushRoute({ key: route, index: 1}, this.props.navigation.key);
}
popRoute() {
this.props.popRoute(this.props.navigation.key);
}
componentWillMount(){
if(Platform.OS === 'android'){
this.setState({
heightSwiper: 300,
widthSwiper: 370,
})
}else{
this.setState({
heightSwiper: 200,
widthSwiper: width,
})
}
}
componentDidMount(){
setTimeout(()=>{
this.props.setLoading()
}, 1000)
}
handleClick(index){
Linking.canOpenURL(this.props.bookmarks[index].web).then(supported => {
if (supported) {
Linking.openURL(this.props.bookmarks[index].web);
} else {
console.log('Don\'t know how to open URI: ' + this.props.url);
}
});
};
handleClickFace(index){
Linking.canOpenURL(this.props.bookmarks[index].facebook).then(supported => {
if (supported) {
Linking.openURL(this.props.bookmarks[index].facebook);
} else {
console.log('Don\'t know how to open URI: ' + this.props.url);
}
});
};
handleClickInsta(index){
Linking.canOpenURL(this.props.bookmarks[index].instagram).then(supported => {
if (supported) {
Linking.openURL(this.props.bookmarks[index].instagram);
} else {
console.log('Don\'t know how to open URI: ' + this.props.url);
}
});
};
goToURL(url){
Linking.canOpenURL(url).then(supported => {
if(supported){
Linking.openURL(url)
}else{
alert('Hay un error, por favor contactanos...')
}
});
}
render() {
const activeFab = this.state.active;
const { props: { name, index, list } } = this;
let iconFace = null;
if(this.props.bookmarks[index].facebook) {
iconFace = <Button style={styles.buttonSocial} transparent onPress={() => this.handleClickFace(index)}>
<Icon style={styles.iconFooter} name="logo-facebook"></Icon>
</Button>
}
let iconInsta = null
if(this.props.bookmarks[index].instagram){
iconInsta = <Button style={styles.buttonSocial} transparent onPress={() => this.handleClickInsta(index)}>
<Icon style={styles.iconFooter} name="logo-instagram"></Icon>
</Button>
}
let iconWeb = null
if(this.props.bookmarks[index].web){
iconWeb = <Button style={styles.buttonSocial} transparent onPress={() => this.handleClick(index)}>
<Icon style={styles.iconFooter} name="globe"></Icon>
</Button>
}
return (
<Container>
<Header searchBar style={{ backgroundColor: '#ffa726' }}>
<Left>
<Button transparent onPress={() => this.props.reset(this.props.navigation.key)}>
<Icon style={{ color: 'dimgray' }} name="md-close" />
</Button>
</Left>
<Right style={styles.headerRight}>
<Button style={{ marginRight: -8 }} transparent onPress={this.props.openDrawer}>
<Icon style={{ color: 'dimgray' }} name="md-more" />
</Button>
</Right>
</Header>
<Swiper
showsButtons
height={this.state.heightSwiper}
horizontal={true}
showsPagination={false}
scrollEnabled={true}
>
{this.props.bookmarks[index].image.map((item, i) =>
<View key={i} style={styles.slide1}>
<Image
key={index}
style={styles.image}
source={{uri: item.image}}
resizeMode='stretch'
>
</Image>
</View>
)}
</Swiper>
<Grid style={styles.gridCircle}>
<Row>
<Button style={styles.buttonMaps} transparent onPress={() => this.pushRoute('singlemapbookmark', index)}>
<Thumbnail source={{ uri: 'https://placeholdit.imgix.net/~text?txtsize=14&txt=145%C3%97125&w=145&h='}} style={styles.thumbnailMaps}>
<Icon style={{ fontSize: 22, color: 'dimgray', bottom: 4}} name="md-pin" />
<Text style={{ fontSize: 12, color: 'dimgray', bottom: 6 }}>Mapa</Text>
</Thumbnail>
</Button>
</Row>
</Grid>
<Content scrollEnabled={true}>
<Grid style={styles.gridDescription}>
<View style={{ flex: 1}}>
<Spinner visible={this.props.loading} textStyle={{color: '#FFF'}} />
</View>
<Row>
<H3>{this.props.bookmarks[index].name}</H3>
</Row>
<Row style={styles.rowDescription}>
<Text style={styles.fontText}>{this.props.bookmarks[index].description}</Text>
</Row>
<Row style={styles.rowMain}>
<Icon style={styles.iconGray} name="md-pin" />
<Text style={styles.textRow}>{this.props.bookmarks[index].address}</Text>
</Row>
<Row style={styles.rowDescriptionData}>
<Col style={styles.colDescription}>
<Icon style={styles.iconGray} name="md-call" />
<Text style={styles.textRow}>{this.props.bookmarks[index].phone}</Text>
</Col>
<Col style={styles.colDescription}>
<Icon style={styles.iconGray} name="clock"/>
<Text style={styles.textRow}>{this.props.bookmarks[index].horary}</Text>
</Col>
</Row>
<Row style={styles.rowDescriptionSocial}>
{iconFace}
{iconInsta}
{iconWeb}
</Row>
<Row>
<Right>
{ activeFab ? (
<Text style={styles.fontFooter}>Te encuentras en "{this.props.bookmarks[index].name}" a traves de Que Hacer? Merida</Text>
):(
<Text></Text>
)}
</Right>
</Row>
</Grid>
</Content>
{this.props.bookmarks[index].web ? (
<ActionButton
active={this.state.active}
onPress={() => this.setState({ active: !this.state.active })}
buttonColor='#5067FF'
icon={<Icon name="md-share"
style={{ color: 'white'}}/>} >
<ActionButton.Item
buttonColor='#3B5998'
// title='facebook'
onPress={()=> this.goToURL(`https://www.facebook.com/sharer/sharer.php?u=${this.props.bookmarks[index].web}`)} >
<Icon name="logo-facebook" style={styles.buttonF}/>
</ActionButton.Item>
<ActionButton.Item
buttonColor='#3B5998'
// title='facebook'
onPress={()=> this.goToURL(`https://twitter.com/intent/tweet?text=Estoy en ${this.props.bookmarks[index].name} ${this.props.bookmarks[index].web} a traves de QueHacerMerida`)} >
<Icon name="logo-twitter" style={styles.buttonF}/>
</ActionButton.Item>
</ActionButton>
):(
console.log("no hay web")
)}
</Container>
);
}
}
function bindAction(dispatch) {
return {
set_item: index => dispatch(set_item(index)),
openDrawer: () => dispatch(openDrawer()),
pushRoute: (route, key) => dispatch(pushRoute(route, key)),
popRoute: key => dispatch(popRoute(key)),
reset: key => dispatch(reset([{ key: 'bookmarks' }], key, 0)),
add_bookmark: id => dispatch(add_bookmark(id)),
remove_bookmark: id => dispatch(remove_bookmark(id)),
setLoading: () => dispatch(setLoading())
};
}
const mapStateToProps = state => ({
navigation: state.cardNavigation,
index: state.bookmarks.selectedItem,
listEstablishment: state.listEstablishment.results,
bookmarks: state.bookmarks.space,
loading: state.listZone.loading,
});
export default connect(mapStateToProps, bindAction)(SingleBookmark);
|
pet-projects/list-of-stuff/App_example.js
|
oka-haist/codeHere
|
import React from 'react';
import ReactDOM from 'react-native';
import Posts from './components/Posts.jsx';
import Footer from './components/Footer.jsx';
import { Button,Badge } from 'reactstrap';
import 'bootstrap/dist/css/bootstrap.css';
require('./public/stylesheets/bootstrap.css');
class App extends React.Component {
constructor(props) {
super(props);
// Class methods are not bound by default!!!
this.handleClick = this.handleClick.bind(this);
this.handleInput = this.handleInput.bind(this);
this.state = {
toggle: "OFF",
header: "Heading"
};
}
componentWillMount() {
console.log('will mount');
}
componentDidMount() {
console.log('did mount');
}
componentWillReceiveProps(nextProps) {
console.log('will receive props');
}
shouldComponentUpdate(nextProps, nextState) {
console.log('should update?');
}
componentWillUpdate(nextProps, nextState) {
console.log('will update');
}
componentDidUpdate(prevProps, prevState) {
console.log('did update');
}
componentWillUnmount() {
console.log('will unmount');
}
// This handler pass a new prop to Component (and it renders it)
handleClick() {
console.log('Clicked and '+this.state.toggle+'!');
if(this.state.toggle == "OFF"){
this.setState((prevState, props) => ({ toggle: "ON" }));
}else{
this.setState((prevState, props) => ({ toggle: "OFF" }));
}
}
// This handler is called by its child (Footer on onTextWritten)
handleInput(text) {
this.setState((prevState, props) => ({ header: text }));
}
render() {
// Keys help React to know where the changes came from
const phrase = this.props.phrase;
const listWords = phrase.map( (word,index) =>
<h1 key={index}>
{word}
</h1>
);
return (
<div>
<Posts />
<div>{listWords}</div>
<h1>{this.state.header} <Badge>New</Badge></h1>
<Button color="primary" onClick={this.handleClick} >primary</Button>{' '}
<Footer options={this.state.toggle} onClick={this.handleClick} onTextWritten={this.handleInput}/>
</div>
)
}
}
const phrase = ['...and ', 'theeeeere ', 'we go~!'];
ReactDOM.render(<App phrase={phrase} />, document.getElementById('root'));
|
src/svg-icons/image/filter-drama.js
|
tan-jerene/material-ui
|
import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ImageFilterDrama = (props) => (
<SvgIcon {...props}>
<path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.61 5.64 5.36 8.04 2.35 8.36 0 10.9 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM19 18H6c-2.21 0-4-1.79-4-4s1.79-4 4-4 4 1.79 4 4h2c0-2.76-1.86-5.08-4.4-5.78C8.61 6.88 10.2 6 12 6c3.03 0 5.5 2.47 5.5 5.5v.5H19c1.65 0 3 1.35 3 3s-1.35 3-3 3z"/>
</SvgIcon>
);
ImageFilterDrama = pure(ImageFilterDrama);
ImageFilterDrama.displayName = 'ImageFilterDrama';
ImageFilterDrama.muiName = 'SvgIcon';
export default ImageFilterDrama;
|
examples/slorber-scalable-frontend/src/randomGif/RandomGif.js
|
mpeyper/redux-subspace
|
import React from 'react'
import { connect } from 'react-redux'
import { getGif } from './actions'
const RandomGif = ({ loading, src, getGif }) => (
<div style={{ width: '100px' }}>
<button onClick={getGif} disabled={loading}>{ loading ? "Loading..." : "Get Gif" }</button>
{ src && <div><img alt="Gif" src={src} style={{ marginTop: '5px' }} /></div> }
</div>
)
const mapStateToProps = (state) => ({
loading: state.loading,
src: state.src
})
const actionCreators = { getGif }
export default connect(mapStateToProps, actionCreators)(RandomGif)
|
lib/cli/generators/REACT_NATIVE/template-csf/storybook/stories/Welcome/index.js
|
storybooks/react-storybook
|
import React from 'react';
import PropTypes from 'prop-types';
import { View, Text } from 'react-native';
export default class Welcome extends React.Component {
styles = {
wrapper: {
flex: 1,
padding: 24,
justifyContent: 'center',
},
header: {
fontSize: 18,
marginBottom: 18,
},
content: {
fontSize: 12,
marginBottom: 10,
lineHeight: 18,
},
};
showApp = event => {
const { showApp } = this.props;
event.preventDefault();
if (showApp) {
showApp();
}
};
render() {
return (
<View style={this.styles.wrapper}>
<Text style={this.styles.header}>Welcome to React Native Storybook</Text>
<Text style={this.styles.content}>
This is a UI Component development environment for your React Native app. Here you can
display and interact with your UI components as stories. A story is a single state of one
or more UI components. You can have as many stories as you want. In other words a story is
like a visual test case.
</Text>
<Text style={this.styles.content}>
We have added some stories inside the "storybook/stories" directory for examples. Try
editing the "storybook/stories/Welcome.js" file to edit this message.
</Text>
</View>
);
}
}
Welcome.defaultProps = {
showApp: null,
};
Welcome.propTypes = {
showApp: PropTypes.func,
};
|
files/domcom/0.1.2/domcom.min.js
|
perosb/jsdelivr
|
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):"object"==typeof exports?exports.dc=e():t.dc=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="/assets/",e(0)}([function(t,e,n){n(1),n(35),t.exports=dc},function(t,e,n){var r,o;window.dc=t.exports=r=n(5),r.extend=o=n(12),o(r,n(10),n(9),n(2),n(8),n(7),n(13))},function(t,e,n){var r,o,i,u=[].slice;o=(r=n(3)).react,t.exports=r,i=Array.prototype.slice,r.watchEachList=function(t,e){var n,r,o,a,s,c,l,d;return d=t.watchingComponents||(t.watchingComponents={}),d[e.dcid]=e,t.$dcWatching?void 0:(t.$dcWatching=!0,a=t.shift,n=t.pop,r=t.push,o=t.reverse,s=t.sort,c=t.splice,l=t.unshift,t.setItem=function(){var n,r,o,i,a,s,c;if(a=arguments[0],s=2<=arguments.length?u.call(arguments,1):[],a>>>=0,0>a)throw new Error("array index is negative");for(i=t.length,r=a,o=0,c=s.length;c>o;)t[r]=s[o],r++,o++;if(i>a)for(n in d)e=d[n],e.invalidateChildren(a,r);else for(n in d)e=d[n],e.invalidateChildren(i,r)},t.pop=function(){var r,o,i;if(o=t.length){i=n.call(this);for(r in d)e=d[r],e.invalidateChildren(o-1,o);return i}},t.push=function(){var n,o,i,u;i=t.length,u=r.apply(t,arguments),o=t.length;for(n in d)e=d[n],e.invalidateChildren(i,o);return u},t.shift=function(){var n,r,o;if(t.length){o=a.call(this),r=t.length;for(n in d)e=d[n],e.invalidateChildren(0,r);return o}},t.unshift=function(){var n,r,o;o=l.apply(t,arguments),r=t.length;for(n in d)e=d[n],e.invalidateChildren(0,r);return o},t.reverse=function(){var n,r;if(r=t.length,1>=r)return t;o.call(t);for(n in d)e=d[n],e.invalidateChildren(0,r);return t},t.sort=function(){var n,r;if(r=t.length,1>=r)return t;s.call(t);for(n in d)e=d[n],e.invalidateChildren(0,r);return t},t.splice=function(n,r){var o,u,a,s,l,f;a=arguments.length,l=t.length,n>>>=0,0>n&&(n=0),n>l&&(n=l),u=i.call(arguments,2),f=c.apply(this,[n,r].concat(u)),s=t.length;for(o in d)e=d[o],l===s?e.invalidateChildren(n,n+r):e.invalidateChildren(n,Math.max(l,s));return f},t.setLength=function(n){var r,o;if(o=t.length,n!==o){t.length=n;for(r in d)e=d[r],n>o?e.invalidateChildren(o,n):e._setLength(n)}})},r.watchEachObject=function(t,e){var n;return n=t.watchingComponents||(t.watchingComponents={}),n[e.dcid]=e,t.$dcWatching?void 0:(t.$dcWatching=!0,t.deleteItem=function(){var r,o,i,a,s,c,l,d,f,h,p,v,m,g,y,w;for(c=1<=arguments.length?u.call(arguments,0):[],i=e._items,d=i.length,w=[],h=0,v=c.length;v>h;h++)if(a=c[h],t.hasOwnProperty(a)){delete t[a];for(r in n)for(e=n[r],l=d,g=e.items,o=p=0,m=g.length;m>p;o=++p)if(y=g[o],s=y[0],f=y[1],s==a){i.splice(o,1),l>o&&(l=o),e.invalidateChildren(l,d);break}w.push(d--)}return w},t.setItem=function(r,o){var i,u,a,s,c,l,d,f;if(a=e._items,!t.hasOwnProperty(r)){c=_items.length,f=[];for(i in n)e=n[i],_items.push([r,o]),f.push(e.invalidateChildren(c,c+1));return f}if(t[r]!==o){d=[];for(i in n)e=n[i],d.push(function(){var t,n,o,i;for(i=[],u=t=0,n=a.length;n>t;u=++t){if(o=a[u],s=o[0],l=o[1],s==r){e.invalidateChildren(u,u+1);break}i.push(void 0)}return i}());return d}},t.extend=function(e){var n,r,o;o=[];for(n in e)r=e[n],o.push(t.setItem(n,r));return o})},r.pour=function(t){return t.pouring=!0,t}},function(t,e,n){var r,o,i,u,a,s,c,l,d=[].slice;l=n(4),u=l.newLine,i=l.funcString,a=function(t){return t.invalidate?t:(t.valid=!1,t.invalidateCallbacks=[],t.onInvalidate=function(e){var n;if("function"!=typeof e)throw new Error("call back should be a function");return n=t.invalidateCallbacks||(t.invalidateCallbacks=[]),n.push(e)},t.offInvalidate=function(e){var n,r;return r=t.invalidateCallbacks,!r||(n=r.indexOf(e),0>n)?void 0:(r.splice(n,1),r.length?void 0:t.invalidateCallbacks=null)},t.invalidate=function(){var e,n,r,o;if(t.valid&&t.invalidateCallbacks){for(o=t.invalidateCallbacks,n=0,r=o.length;r>n;n++)(e=o[n])();t.valid=!1}},t)},s=function(t){var e;return e=function(){var n;if(arguments.length)throw new Error("flow.renew is not allowed to accept arguments");return n=t(),e.valid=!0,e.invalidate(),n},e.toString=function(){return"renew: "+i(t)},a(e)},r=function(t){var e,n;return e=null,n=function(){if(arguments.length)throw new Error("flow.dependent is not allowed to accept arguments");return n.valid?e:(n.valid=!0,e=t())},n.toString=function(){return"dependent: "+i(t)},a(n)},t.exports=o=function(){var t,e,n,r,o,u,s,c,l,f;for(r=2<=arguments.length?d.call(arguments,0,u=arguments.length-1):(u=0,[]),e=arguments[u++],s=0,l=r.length;l>s;s++)if(n=r[s],"function"==typeof n&&!n.invalidate)return o=a(function(){return o.invalidate(),e()});for(t=null,o=a(function(n){return arguments.length?n===t?n:(t=n,e(n),o.invalidate(),t):o.valid?t:(o.valid=!0,t=e())}),c=0,f=r.length;f>c;c++)n=r[c],n&&n.onInvalidate&&n.onInvalidate(o.invalidate);return o.toString=function(){return"flow: ["+function(){var t,e,o;for(o=[],t=0,e=r.length;e>t;t++)n=r[t],o.push(n.toString());return o}().join(",")+"] --> "+i(e)},o},o.pipe=function(){var t,e,n,r,o,i,u,s,c;for(n=2<=arguments.length?d.call(arguments,0,o=arguments.length-1):(o=0,[]),t=arguments[o++],i=0,s=n.length;s>i;i++)if(e=n[i],"function"==typeof e&&!e.invalidate)return r=a(function(){var o,i,u;if(argumnets.length)throw new Error("flow.pipe is not allow to have arguments");for(r.invalidate(),o=[],i=0,u=n.length;u>i;i++)e=n[i],"function"==typeof e?o.push(e()):o.push(e);return t.apply(null,o)});for(r=a(function(){var r,o,i;for(r=[],o=0,i=n.length;i>o;o++)e=n[o],"function"==typeof e?r.push(e()):r.push(e);return t.apply(null,r)}),u=0,c=n.length;c>u;u++)e=n[u],e&&e.onInvalidate&&e.onInvalidate(r.invalidate);return r},o.react=a,o.renew=s,o.dependent=r,o.flow=o,o.see=c=function(t,e){var n,r;return n=t,r=function(t){return arguments.length?(t=e?e(t):t,t!==n&&(n=t,r.invalidate()),t):(r.valid=!0,n)},r.isDuplex=!0,r.toString=function(){return"see: "+t},a(r)},o.seeN=function(){var t,e,n,r,o;for(e=1<=arguments.length?d.call(arguments,0):[],o=[],n=0,r=e.length;r>n;n++)t=e[n],o.push(c(t));return o},Object.defineProperty?(o.bind=function(t,e,n){var r,o,i,u;return r=Object.getOwnPropertyDescriptor(t,e),r&&(o=r.get,i=r.set),o&&o.invalidate||(o=function(){if(arguments.length)throw new Error("should not set value on flow.bind");return o.valid=!0,o.cacheValue},o.cacheValue=t[e],u=function(n){return n!==t[e]?(i&&i(n),o.invalidate(),o.cacheValue=n):void 0},a(o),o.toString=function(){return""+(n||"m")+"["+e+"]"},Object.defineProperty(t,e,{get:o,set:u})),o},o.duplex=function(t,e,n){var r,o,i,u;return r=Object.getOwnPropertyDescriptor(t,e),r&&(o=r.get,u=r.set),u&&u.invalidate?u:(i=function(n){return arguments.length?n!==t[e]?(u&&u(n),o&&o.invalidate&&o.invalidate(),i.invalidate(),i.cacheValue=n):void 0:(i.valid=!0,i.cacheValue)},i.cacheValue=t[e],a(i),i.isDuplex=!0,i.toString=function(){return""+(n||"m")+"["+e+"]"},Object.defineProperty(t,e,{get:i,set:i}),i)}):(o.bind=function(t,e,n){var r,o;return o=t._dcBindMethodMap,o||(o=t._dcBindMethodMap={}),t.dcSet$||(t.dcSet$=function(e,n){var r;return n!==t[e]?(o&&o[e]&&o[e].invalidate(),(r=this._dcDuplexMethodMap)&&r[e]&&r[e].invalidate()):void 0}),r=o[e],r||(r=o[e]=function(){return r.valid=!0,t[e]},r.toString=function(){return""+(n||"m")+"["+e+"]"},a(r)),r},o.duplex=function(t,e,n){var r,o;return o=t._dcDuplexMethodMap,o||(o=t._dcDuplexMethodMap={}),t.dcSet$||(t.dcSet$=function(e,n){var r;return n!==t[e]&&((r=this._dcBindMethodMap)&&r[e]&&r[e].invalidate(),o&&o[e]&&o[e].invalidate()),n}),r=o[e],r||(r=o[e]=function(n){return arguments.length?t.dcSet$(e,n):(r.valid=!0,t[e])},r.isDuplex=!0,r.toString=function(){return""+(n||"m")+"["+e+"]"},a(r)),r}),o.unary=function(t,e){return"function"!=typeof t?e(t):t.invalidate?o(t,function(){return e(t())}):function(){return e(t())}},o.binary=function(t,e,n){return"function"==typeof t&&"function"==typeof e?t.invalidate&&e.invalidate?o(t,e,function(){return n(t(),e())}):function(){return n(t(),e())}:"function"==typeof t?t.invalidate?o(t,function(){return n(t(),e)}):function(){return n(t(),e)}:"function"==typeof e?e.invalidate?o(e,function(){return n(t,e())}):function(){return n(t,e())}:n(t,e)}},function(t,e,n){var r,o,i=[].slice;e.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)},e.cloneObject=function(t){var e,n;n={};for(e in t)n[e]=t[e];return n},e.pairListDict=function(){var t,e,n,r;for(e=1<=arguments.length?i.call(arguments,0):[],1===e.length&&(e=e[0]),n=e.length,t=0,r={};n>t;)r[e[t]]=e[t+1],t+=2;return r},r=function(t,e){var n,r;for(r="",n=0;n++<e;)r+=t;return r},e.newLine=function(t,e,n){return n?"\n"+r(" ",e)+t:t},e.funcString=function(t){var e,n;if("function"!=typeof t){if(null==t)return"null";if(t.getBaseComponent)return t.toString();try{return JSON.stringify(t)}catch(r){return e=r,t.toString()}}return n=t.toString(),t.invalidate?n:(n="function (){"===n.slice(0,12)?n.slice(12,n.length-1):"function () {"===n.slice(0,13)?n.slice(13,n.length-1):n.slice(9),n=n.trim(),"return "===n.slice(0,7)&&(n=n.slice(7)),";"===n[n.length-1]&&(n=n.slice(0,n.length-1)),"fn:"+n)},o=1,e.newDcid=function(){return o++},e.isEven=function(t){for(0>t&&(t=-t);t>0;)t-=2;return 0===t},e.matchCurvedString=function(t,e){var n,r;if("("===t[e])for(r=0;n=t[++e];)if("\\"===n){if(!(n=t[++e]))return}else if("("===n)r++;else if(")"===n){if(0===r)return++e;r--}},e.intersect=function(t){var e,n,r,o,i,u,a,s;i={},r=t[0];for(n in r){for(e=!0,s=t.slice(1),u=0,a=s.length;a>u;u++)if(o=s[u],!o[n]){e=!1;break}e&&(i[n]=r[n])}return i},e.substractSet=function(t,e){var n;for(n in e)delete t[n];return t},e.binarySearch=function(t,e){var n,r,o,i;if(o=e.length,!o)return 0;if(1===o)return e[0]>=t?0:1;for(i=0,n=o-1;;){if(r=i+Math.floor((n-i)/2),i===n)return e[r]>=t?r:r+1;if(t===e[r])return r;if(t===e[r+1])return r+1;if(t<e[r])n=r;else{if(!(t>e[r+1]))return r+1;i=r+1}}},e.binaryInsert=function(t,e){var n,r,o,i;if(o=e.length,!o)return e[0]=t,0;if(1===o)return e[0]===t?0:e[0]>t?(e[1]=e[0],e[0]=t,0):(e[1]=t,1);for(i=0,n=o-1;;){if(r=i+Math.floor((n-i)/2),i===n)return e[r]===t?r:e[r]>t?(e.splice(r,0,t),r):(e.splice(r+1,0,t),r+1);if(t===e[r])return r;if(t===e[r+1])return r+1;if(t<e[r])n=r;else{if(!(t>e[r+1]))return e.splice(r+1,0,t),r+1;i=r+1}}},e.numbers=function(t){var e,r,o;if(e=n(3),"function"==typeof t)return e(t,function(){var e,n,r;for(e=0,r=[],n=t();n>e;)r.push(e),e++;return r});for(r=0,o=[];t>r;)o.push(r),r++;return o}},function(t,e,n){var r,o,i,u,a,s,c,l,d,f,h,p,v,m,g,y,w,b,x,C,N,q;r=n(6),x=n(8),b=x.requestAnimationFrame,v=x.raf,d=x.isElement,C=n(7),h=C.newDcid,f=C.isEven,N=n(10),c=N.domNodeCache,m=N.readyFnList,s=N.directiveRegistry,y=N.renderCallbackList,l=n(11),t.exports=u=function(t,e){if(null==e&&(e={}),"string"==typeof t)return e.noCache?p(t,e.all):c[t]||(c[t]=p(t,e.all));if(t instanceof Node||t instanceof NodeList||t instanceof Array)return e.noCache?new r(t):t.dcid?c[t.dcid]:(t.dcid=h(),c[t.dcid]=new r(t));throw new Error("error type for dc")},p=function(t,e){return new r(e?document.querySelectorAll(t):document.querySelector(t))},window.dcid=h(),a=document.dcid=h(),window.$document=u.$document=c[a]=new r(document),a=document.body.dcid=h(),window.$body=u.$body=c[a]=new r(document.body),u.onReady=function(t){return m.push(t)},u.offReady=function(t){return m.indexOf(t)>=0&&m.splice(index,1)},u.ready=function(){var t,e,n;for(e=0,n=m.length;n>e;e++)(t=m[e])()},document.addEventListener("DOMContentLoaded",u.ready,!1),u.render=g=function(){var t,e,n,r;for(r=[],e=0,n=y.length;n>e;e++)t=y[e],r.push(t());return r},u.onRender=function(t){return y.push(t)},u.offRender=function(t){return y.indexOf(t)>=0&&y.splice(index,1)},u.renderLoop=w=function(){requestAnimFrame(w),g()},u.updateWhen=function(t,e,n,r){return u._renderWhenBy("update",t,e,n,r)},u.renderWhen=function(t,e,n,r){return u._renderWhenBy("render",t,e,n,r)},u._renderWhenBy=function(t,e,n,r,o){var u,a,s,c,d,f,h,p,v,m,y,w,b,x;if(e instanceof Array)if(r instanceof Array||(r=[r]),n instanceof Array)for(s=0,h=e.length;h>s;s++)for(u=e[s],c=0,p=n.length;p>c;c++)a=n[c],q(t,u,a,r);else for(d=0,v=e.length;v>d;d++)u=e[d],q(t,u,n,r);else if(e===setInterval)if(l(n))i(t,n,r);else if(n instanceof Array)for(f=0,m=n.length;m>f;f++)u=n[f],i(t,n,r);else"number"==typeof n&&(o=o||{},o.interval=n,i(t,r,o));else if(e===g){if(l(n))addRafUpdate(t,n,r);else if(n instanceof Array)for(b=0,y=n.length;y>b;b++)u=n[b],addRafUpdate(t,n,r)}else if(n instanceof Array)for(r instanceof Array||(r=[r]),x=0,w=n.length;w>x;x++)a=n[x],q(t,e,a,r);else r instanceof Array||(r=[r]),q(t,e,n,r)},q=function(t,e,n,r,o){var i,u,a,s,c;if("on"!==n.slice(0,2)&&(n="on"+n),o)o.method=t,e.eventUpdateConfig[n]=function(){var t,e,n;for(n=[],t=0,e=r.length;e>t;t++)i=r[t],n.push([i,o]);return n}();else{for(u=s=0,c=r.length;c>s;u=++s)a=r[u],r[u]=l(a)?[a,{method:t}]:a;e.eventUpdateConfig[n]=r}},i=function(t,e,n){var r,o,i,u,a;return i=null,a=n.test,u=n.interval,o=n.clear,r=function(){return(!a||a())&&e[t](),o&&o()?clearInterval(i):void 0},i=setInterval(r,u||16)},o=function(t,e,n){var r,o,i;return i=n.test,o=n.clear,r=function(){return(!i||i())&&e[t](),o&&o()?u.offRender(r):void 0},u.onRender(r)},u.directives=function(t,e){var n,r,o;if(1===arguments.length){o=[];for(r in t)n=t[r],"$"!==r[0]&&(r="$"+r),o.push(s[r]=n);return o}return"$"!==t[0]&&(t="$"+t),s[t]=e}},function(t,e,n){var r,o,i,u,a,s;i=n(7).newLine,s=n(8),o=s.addEventListener,a=s.removeEventListener,u=function(t,e,n,r){var o,i,u,a;if(null==n)return t;if(null==r){if("string"==typeof n)return t[n];for(a=[],r=i=0,u=n.length;u>i;r=++i)o=n[r],null==cacheProps[o]||r!==cacheProps[o]?a.push(cacheProps[o]=t[o]=r):a.push(void 0);return a}return null==cacheProps[n]||r!==cacheProps[n]?cacheProps[n]=this.node[n]=r:void 0},t.exports=r=function(){function t(t){var e;this.node=t,t instanceof Node?(this.cacheProps={},this.cacheStyle={}):(this.cacheProps=function(){var t,n,r,o;for(r=this.node,o=[],t=0,n=r.length;n>t;t++)e=r[t],o.push({});return o}.call(this),this.cacheStyle=function(){var t,n,r,o;for(r=this.node,o=[],t=0,n=r.length;n>t;t++)e=r[t],o.push({});return o}.call(this))}return t.prototype.prop=function(t,e){var n,r,o,i,a;if(o=this.node,o instanceof Node)u(o,this.cacheProps,t,e);else for(n=i=0,a=o.length;a>i;n=++i)r=o[n],u(r,this.cacheProps[n],t,e);return this},t.prototype.css=function(t,e){var n,r,o,i,a;if(o=this.node,o instanceof Node)u(o.style,this.cacheStyle,t,e);else for(n=i=0,a=o.length;a>i;n=++i)r=o[n],u(r.style,this.cacheStyle[n],t,e);return this},t.prototype.bind=function(t,e){var n,r,i,u,a,s,c,l;for(i=t.split(/\s+/),u=this.node,a=0,c=i.length;c>a;a++)if(r=i[a],"on"===r.slice(0,2)&&(r=r.slice(2)),u instanceof Node)o(u,r,e);else for(s=0,l=u.length;l>s;s++)n=u[s],o(n,r,e)},t.prototype.unbind=function(t,e){var n,r,o,i,u,s,c,l;for(o=t.split(/\s+/),i=this.node,u=0,c=o.length;c>u;u++)if(r=o[u],"on"===r.slice(0,2)&&(r=r.slice(2)),i instanceof Node)a(i,r,e);else for(s=0,l=i.length;l>s;s++)n=i[s],a(n,r,e)},t.prototype.toString=function(t,e){return null==t&&(t=0),i("",t,e)+"<DomNode>"+i(this.node.toString(),t+2,!0)+i("</DomNode>",t,!0)},t}()},function(t,e,n){var r,o,i=[].slice;e.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)},e.cloneObject=function(t){var e,n;n={};for(e in t)n[e]=t[e];return n},e.pairListDict=function(){var t,e,n,r;for(e=1<=arguments.length?i.call(arguments,0):[],1===e.length&&(e=e[0]),n=e.length,t=0,r={};n>t;)r[e[t]]=e[t+1],t+=2;return r},r=function(t,e){var n,r;for(r="",n=0;n++<e;)r+=t;return r},e.newLine=function(t,e,n){return n?"\n"+r(" ",e)+t:t},e.funcString=function(t){var e,n;if("function"!=typeof t){if(null==t)return"null";if(t.getBaseComponent)return t.toString();try{return JSON.stringify(t)}catch(r){return e=r,t.toString()}}return n=t.toString(),t.invalidate?n:(n="function (){"===n.slice(0,12)?n.slice(12,n.length-1):"function () {"===n.slice(0,13)?n.slice(13,n.length-1):n.slice(9),n=n.trim(),"return "===n.slice(0,7)&&(n=n.slice(7)),";"===n[n.length-1]&&(n=n.slice(0,n.length-1)),"fn:"+n)},o=1,e.newDcid=function(){return o++},e.isEven=function(t){for(0>t&&(t=-t);t>0;)t-=2;return 0===t},e.matchCurvedString=function(t,e){var n,r;if("("===t[e])for(r=0;n=t[++e];)if("\\"===n){if(!(n=t[++e]))return}else if("("===n)r++;else if(")"===n){if(0===r)return++e;r--}},e.intersect=function(t){var e,n,r,o,i,u,a,s;i={},r=t[0];for(n in r){for(e=!0,s=t.slice(1),u=0,a=s.length;a>u;u++)if(o=s[u],!o[n]){e=!1;break}e&&(i[n]=r[n])}return i},e.substractSet=function(t,e){var n;for(n in e)delete t[n];return t},e.binarySearch=function(t,e){var n,r,o,i;if(o=e.length,!o)return 0;if(1===o)return e[0]>=t?0:1;for(i=0,n=o-1;;){if(r=i+Math.floor((n-i)/2),i===n)return e[r]>=t?r:r+1;if(t===e[r])return r;if(t===e[r+1])return r+1;if(t<e[r])n=r;else{if(!(t>e[r+1]))return r+1;i=r+1}}},e.binaryInsert=function(t,e){var n,r,o,i;if(o=e.length,!o)return e[0]=t,0;if(1===o)return e[0]===t?0:e[0]>t?(e[1]=e[0],e[0]=t,0):(e[1]=t,1);for(i=0,n=o-1;;){if(r=i+Math.floor((n-i)/2),i===n)return e[r]===t?r:e[r]>t?(e.splice(r,0,t),r):(e.splice(r+1,0,t),r+1);if(t===e[r])return r;if(t===e[r+1])return r+1;if(t<e[r])n=r;else{if(!(t>e[r+1]))return e.splice(r+1,0,t),r+1;i=r+1}}},e.numbers=function(t){var e,r,o;if(e=n(3),"function"==typeof t)return e(t,function(){var e,n,r;for(e=0,r=[],n=t();n>e;)r.push(e),e++;return r});for(r=0,o=[];t>r;)o.push(r),r++;return o}},function(t,e,n){var r,o;o=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame,e.requestAnimationFrame=e.raf=o||function(t){window.setInterval(t,1e3/60)},e.normalizeDomElement=function(t){return"string"==typeof t&&(t=document.querySelector(t)),t},e.getBindProp=function(t){var e;if(e=t.tagName)return"textarea"===e||"select"===e?"value":"checkbox"===t.props.type?"checked":"value";throw new Error("trying to bind a Component which is not a Tag")},document.body.addEventListener?(e.addEventListener=function(t,e,n){t.addEventListener(e,n,!1)},e.removeEventListener=function(t,e,n){t.removeEventListener(e,n)}):(e.addEventListener=function(t,e,n){t.attachEvent(e,setCheckedValues)},e.removeEventListener=function(t,e,n){t.detachEvent(e,n)}),e.isElement=function(t){return"object"==typeof HTMLElement?t instanceof HTMLElement:t&&"object"==typeof t&&null!==t&&1===t.nodeType&&"string"==typeof t.nodeName},r=n(9).renew,e.domField=function(t){var e;return null==t?"":"function"!=typeof t?t.then&&t["catch"]?(e=react(function(){return e.promiseResult}),t.then(function(t){return e.promiseResult=t,e.invalidate()})["catch"](function(t){return e.promiseResult=t,e.invalidate()}),e):t:t.invalidate?t:r(t)},e.domValue=function(t){return null==t?"":"function"!=typeof t?t:(t=t(),null==t?"":t)},e.checkConflictOffspring=function(t,e){var n,r;n=e.dcid;for(r in e.family){if(t[r])throw new Error("do not allow to have the same component to be referenced in different location of one List");t[r]=!0}}},function(t,e,n){var r,o,i,u,a,s,c,l,d=[].slice;l=n(4),u=l.newLine,i=l.funcString,a=function(t){return t.invalidate?t:(t.valid=!1,t.invalidateCallbacks=[],t.onInvalidate=function(e){var n;if("function"!=typeof e)throw new Error("call back should be a function");return n=t.invalidateCallbacks||(t.invalidateCallbacks=[]),n.push(e)},t.offInvalidate=function(e){var n,r;return r=t.invalidateCallbacks,!r||(n=r.indexOf(e),0>n)?void 0:(r.splice(n,1),r.length?void 0:t.invalidateCallbacks=null)},t.invalidate=function(){var e,n,r,o;if(t.valid&&t.invalidateCallbacks){for(o=t.invalidateCallbacks,n=0,r=o.length;r>n;n++)(e=o[n])();t.valid=!1}},t)},s=function(t){var e;return e=function(){var n;if(arguments.length)throw new Error("flow.renew is not allowed to accept arguments");return n=t(),e.valid=!0,e.invalidate(),n},e.toString=function(){return"renew: "+i(t)},a(e)},r=function(t){var e,n;return e=null,n=function(){if(arguments.length)throw new Error("flow.dependent is not allowed to accept arguments");return n.valid?e:(n.valid=!0,e=t())},n.toString=function(){return"dependent: "+i(t)},a(n)},t.exports=o=function(){var t,e,n,r,o,u,s,c,l,f;for(r=2<=arguments.length?d.call(arguments,0,u=arguments.length-1):(u=0,[]),e=arguments[u++],s=0,l=r.length;l>s;s++)if(n=r[s],"function"==typeof n&&!n.invalidate)return o=a(function(){return o.invalidate(),e()});for(t=null,o=a(function(n){return arguments.length?n===t?n:(t=n,e(n),o.invalidate(),t):o.valid?t:(o.valid=!0,t=e())}),c=0,f=r.length;f>c;c++)n=r[c],n&&n.onInvalidate&&n.onInvalidate(o.invalidate);return o.toString=function(){return"flow: ["+function(){var t,e,o;for(o=[],t=0,e=r.length;e>t;t++)n=r[t],o.push(n.toString());return o}().join(",")+"] --> "+i(e)},o},o.pipe=function(){var t,e,n,r,o,i,u,s,c;for(n=2<=arguments.length?d.call(arguments,0,o=arguments.length-1):(o=0,[]),t=arguments[o++],i=0,s=n.length;s>i;i++)if(e=n[i],"function"==typeof e&&!e.invalidate)return r=a(function(){var o,i,u;if(argumnets.length)throw new Error("flow.pipe is not allow to have arguments");for(r.invalidate(),o=[],i=0,u=n.length;u>i;i++)e=n[i],"function"==typeof e?o.push(e()):o.push(e);return t.apply(null,o)});for(r=a(function(){var r,o,i;for(r=[],o=0,i=n.length;i>o;o++)e=n[o],"function"==typeof e?r.push(e()):r.push(e);return t.apply(null,r)}),u=0,c=n.length;c>u;u++)e=n[u],e&&e.onInvalidate&&e.onInvalidate(r.invalidate);return r},o.react=a,o.renew=s,o.dependent=r,o.flow=o,o.see=c=function(t,e){var n,r;return n=t,r=function(t){return arguments.length?(t=e?e(t):t,t!==n&&(n=t,r.invalidate()),t):(r.valid=!0,n)},r.isDuplex=!0,r.toString=function(){return"see: "+t},a(r)},o.seeN=function(){var t,e,n,r,o;for(e=1<=arguments.length?d.call(arguments,0):[],o=[],n=0,r=e.length;r>n;n++)t=e[n],o.push(c(t));return o},Object.defineProperty?(o.bind=function(t,e,n){var r,o,i,u;return r=Object.getOwnPropertyDescriptor(t,e),r&&(o=r.get,i=r.set),o&&o.invalidate||(o=function(){if(arguments.length)throw new Error("should not set value on flow.bind");return o.valid=!0,o.cacheValue},o.cacheValue=t[e],u=function(n){return n!==t[e]?(i&&i(n),o.invalidate(),o.cacheValue=n):void 0},a(o),o.toString=function(){return""+(n||"m")+"["+e+"]"},Object.defineProperty(t,e,{get:o,set:u})),o},o.duplex=function(t,e,n){var r,o,i,u;return r=Object.getOwnPropertyDescriptor(t,e),r&&(o=r.get,u=r.set),u&&u.invalidate?u:(i=function(n){return arguments.length?n!==t[e]?(u&&u(n),o&&o.invalidate&&o.invalidate(),i.invalidate(),i.cacheValue=n):void 0:(i.valid=!0,i.cacheValue)},i.cacheValue=t[e],a(i),i.isDuplex=!0,i.toString=function(){return""+(n||"m")+"["+e+"]"},Object.defineProperty(t,e,{get:i,set:i}),i)}):(o.bind=function(t,e,n){var r,o;return o=t._dcBindMethodMap,o||(o=t._dcBindMethodMap={}),t.dcSet$||(t.dcSet$=function(e,n){var r;return n!==t[e]?(o&&o[e]&&o[e].invalidate(),(r=this._dcDuplexMethodMap)&&r[e]&&r[e].invalidate()):void 0}),r=o[e],r||(r=o[e]=function(){return r.valid=!0,t[e]},r.toString=function(){return""+(n||"m")+"["+e+"]"},a(r)),r},o.duplex=function(t,e,n){var r,o;return o=t._dcDuplexMethodMap,o||(o=t._dcDuplexMethodMap={}),t.dcSet$||(t.dcSet$=function(e,n){var r;return n!==t[e]&&((r=this._dcBindMethodMap)&&r[e]&&r[e].invalidate(),o&&o[e]&&o[e].invalidate()),n}),r=o[e],r||(r=o[e]=function(n){return arguments.length?t.dcSet$(e,n):(r.valid=!0,t[e])},r.isDuplex=!0,r.toString=function(){return""+(n||"m")+"["+e+"]"},a(r)),r}),o.unary=function(t,e){return"function"!=typeof t?e(t):t.invalidate?o(t,function(){return e(t())}):function(){return e(t())}},o.binary=function(t,e,n){return"function"==typeof t&&"function"==typeof e?t.invalidate&&e.invalidate?o(t,e,function(){return n(t(),e())}):function(){return n(t(),e())}:"function"==typeof t?t.invalidate?o(t,function(){return n(t(),e)}):function(){return n(t(),e)}:"function"==typeof e?e.invalidate?o(e,function(){return n(t,e())}):function(){return n(t,e())}:n(t,e)}},function(t,e){t.exports={domNodeCache:{},readyFnList:[],useSystemUpdating:!1,directiveRegistry:{},renderCallbackList:[]}},function(t,e){t.exports=function(t){return t&&t.renderDom}},function(t,e){var n,r=Object.prototype.hasOwnProperty,o=Object.prototype.toString,i=function(t){return"function"==typeof Array.isArray?Array.isArray(t):"[object Array]"===o.call(t)},u=function(t){"use strict";if(!t||"[object Object]"!==o.call(t))return!1;var e=r.call(t,"constructor"),i=t.constructor&&t.constructor.prototype&&r.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!e&&!i)return!1;var u;for(u in t);return u===n||r.call(t,u)};t.exports=function a(){"use strict";var t,e,r,o,s,c,l=arguments[0],d=1,f=arguments.length,h=!1;for("boolean"==typeof l?(h=l,l=arguments[1]||{},d=2):("object"!=typeof l&&"function"!=typeof l||null==l)&&(l={});f>d;++d)if(t=arguments[d],null!=t)for(e in t)r=l[e],o=t[e],l!==o&&(h&&o&&(u(o)||(s=i(o)))?(s?(s=!1,c=r&&i(r)?r:[]):c=r&&u(r)?r:{},l[e]=a(h,c,o)):o!==n&&(l[e]=o));return l}},function(t,e,n){var e,r;r=n(12),t.exports=e=r({},n(14),n(32),n(34),n(25))},function(t,e,n){var r;r=n(15),t.exports={isComponent:n(11),toComponent:n(18),Component:n(17),BaseComponent:n(20),List:n(22),Tag:n(24),Text:n(21),Comment:n(26),Html:n(27),Nothing:n(19),TransformComponent:n(16),If:n(28),Case:n(29),Func:n(23),Each:n(30),Defer:n(31),Route:r.Route,route:r}},function(t,e,n){var r,o,i,u,a,s,c,l,d,f,h,p,v,m,g,y=[].slice,w={}.hasOwnProperty,b=function(t,e){function n(){this.constructor=t}for(var r in e)w.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};o=n(16),u=n(11),v=n(18),m=n(7),a=m.isEven,s=m.matchCurvedString,t.exports=p=function(){var t,e,n,r;return n=3<=arguments.length?y.call(arguments,0,r=arguments.length-2):(r=0,[]),e=arguments[r++],t=arguments[r++],g(n,e,t,0)},g=function(t,e,n,o){var i,s,c;if("function"==typeof n?(t.push(e),t.push(n),e=null,n=o):u(n)?(t.push(e),e=n,n=o):n&&!u(n)&&n.otherwise?(t.push(e),e=n.otherwise,n=o):(n>>>=0,e&&!u(e)&&e.otherwise&&(e=e.otherwise)),s=t.length,!a(s))throw new Error("route parameter error: missing matched handler");if(2>s||"function"!=typeof t[s-1])throw new Error("route parameter error:\n expect route(pattern, handler, pattern, handler, ..., otherwise, baseIndex)");for(c=[],i=0;s>i;)c.push([t[i],t[i+1]]),i+=2;return new r(c,e,n)},p._navigateTo=d=function(t,e,n){var r,o;if(null==n&&(n=0),e=""+e,"/"!==e[0]){for(o=0;e;)if("./"===e.slice(0,2))e=e.slice(2);else{if("../"!==e.slice(0,3))break;e=e.slice(3),o++}return n-=o,0>n&&(n=0),r=t.split("/").slice(0,n).join("/")+"/","/"===r&&(r=""),e=r+e}return e=e.slice(1)},l=function(t){return function(e){var n,r;return r=window.history&&window.history.pushState?decodeURI(location.pathname+location.search).replace(/\?(.*)$/,""):(n=location.href.match(/#(.*)$/))?n[1]:"",d(r,e,t),window.history&&window.history.pushState?history.pushState(null,null,e):location.href=location.href.replace(/#(.*)$/,"")+"#"+e,e}},p.to=l(0),p.Route=r=function(t){function e(t,e,n){var r,o,u;for(this.routeList=t,this.otherwise=e,this.baseIndex=n,o=0,u=t.length;u>o;o++)r=t[o],r[0]=i(r[0]);this.otherwise=v(e)}return b(e,t),e.prototype.getContentComponent=function(){var t,e,n,r,o,i;for(e=this.getPath(),i=this.routeList,r=0,o=i.length;o>r;r++)if(n=i[r],t=h(n,e,this.baseIndex))return t;return this.otherwise},e.prototype.getPath=function(){var t;return window.history&&window.history.pushState?decodeURI(location.pathname+location.search).replace(/\?(.*)$/,""):(t=location.href.match(/#(.*)$/))?t[1]:""},e}(o),p._processRouteItem=h=function(t,e,n){var r,o,i,u,a,s;return u=t[0],o=t[1],u instanceof Array&&(s=u,u=s[0],a=s[1]),i=c(u,e,n),!i||a&&!(i=a(i,e,n))?void 0:(r=function(){var t,e,n,r;return n=3<=arguments.length?y.call(arguments,0,r=arguments.length-2):(r=0,[]),e=arguments[r++],t=arguments[r++],g(n,e,t,i.base)},r.to=l(i.base),v(o(i,r)))},p._processPiecePatterns=f=function(t,e,n){var r,o,i,u,a,c;for(o=0,u=t.length,a=[];r=t[o];)if(c=o,":"===r){if(r=t[++o],!r.match(/[A-Za-z_$]/))throw new Error("route pattern error: expect a parameter identifier "+t);for(r=t[++o];r&&r.match(/[$\w]/);)r=t[++o];if(o===c+1)throw new Error("route pattern error: expect a parameter identifier "+t);if(i=t.slice(c+1,o),e[i])throw new Error("route pattern error: repeated parameter name");if(e[i]=!0,"("===r){if(c=o,!(o=s(t,o)))throw new Error("route pattern error: missing ) for regexp");if(c+1===o-1)throw new Error("route pattern error: empty regexp: ()");a.push({key:i,pattern:new RegExp(t.slice(c+1,o-1))}),r=t[o]}else a.push({key:i,pattern:new RegExp("\\w+")}),++o}else if("("===r){if(!(o=s(t,o)))throw new Error("route pattern error: missing ) for regexp");if(c+1===o-1)throw new Error("route pattern error: empty regexp: ()");a.push({key:n++,pattern:new RegExp(t.slice(c+1,o-1))})}else{for(++o;(r=t[o])&&":"!==r&&"("!==r;)o++;a.push({pattern:t.slice(c,o)})}return[a,n]},p._getRoutePattern=i=function(t){var e,n,r,o,i,u,a,s,c,l,d,h,p,v;for(t=""+t,t.match(/\\\//)&&new Error("should not include /\\// in pattern"),h=""===t?[]:t.split("/"),p=0,e=!1,n=!0,r=!1,u=!1,d=[],s={},i=h.length,o=0,a=0;i>o;){if(l=h[o++],"."===l){if(n)continue;throw new Error("route pattern error: do not use ./ pattern except the start")}if(".."===l){if(n){p++;continue}throw new Error("route pattern error: do not use ../ except the start")}if(""===l)if(n)e=!0;else{if(o!==i)throw new Error("route pattern error: do not use ../ except the start");r=!0}else if("*"===l)d.push("*");else if("**"===l){if(o!==i)throw new Error("route pattern error: do not use ** except the last segment");u=!0}else v=f(l,s,a),c=v[0],a=v[1],d.push(c);n=!1}return{segmentPatterns:d,absolute:e,upCount:p,endSlash:r,moreComing:u}},p._matchRoute=c=function(t,e,n){var r,o,i,u,a,s,c,l,d,f,h,p,v,m,g,y,w,b,x,C;if(!t.endSlash||"/"===e[e.length-1]){for(t.absolute?n=0:(n-=t.upCount,0>n&&(n=0)),"/"===e||""===e?f=[]:(f=e.split("/"),""===e[0]&&f.shift()),s=f.length,r=n,u={},g=[],C=t.segmentPatterns,i=y=0,b=C.length;b>y;i=++y){if(v=C[i],r>=s)return;if("*"!==v){for(l=0,m=d=f[r],w=0,x=v.length;x>w;w++)if(h=v[w],p=h.pattern,"string"==typeof p){if(0!==d.indexOf(p))break;d=d.slice(p.length),l+=p.length}else{if(!(c=d.match(p)))break;u[h.key]=c,l+=c[0].length}if(l!==m.length)return;g.push(m),r++}else g.push(f[r]),r++}if(r===s||t.moreComing)return o="/"+f.slice(0,n+1).join("/")+"/",a="/"+f.slice(r).join("/"),{items:u,basePath:o,segments:g,leftPath:a,base:r}}}},function(t,e,n){var r,o,i={}.hasOwnProperty,u=function(t,e){function n(){this.constructor=t}for(var r in e)i.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};r=n(17),t.exports=o=function(t){function e(){e.__super__.constructor.call(this),this.valid=!1,this.transformValid=!1,this.isTransformComponent=!0}return u(e,t),e.prototype.invalidate=function(){return this.valid?(this.valid=!1,this.holder&&this.holder.invalidateContent(this)):void 0},e.prototype.invalidateContent=function(t){return this.invalidate()},e.prototype.invalidateTransform=function(){return this.transformValid=!1,this.invalidate()},e.prototype.renderDom=function(){var t,e,n,r,o;return o=this.parentNode,n=this.node,o?this.valid?(o&&!n.parentNode&&(t=this.baseComponent,t.parentNode=o,t.nextNode=this.nextNode,t.attachNode()),this):(this.valid=!0,!this.node&&this.emit("beforeAttach"),r=this.content,this.transformValid?e=r:(this.transformValid=!0,e=this.getContentComponent(),r&&e!==r&&(this.emit("contentChanged",r,e),r.parentNode=null,r.node&&r.node.parentNode&&r.removeDom()),this.content=e),e.holder=this,e.parentNode=this.parentNode,e.nextNode=this.nextNode,e.renderDom(),this.node=e.node,this.firstNode=e.firstNode,this.baseComponent=e.baseComponent,this):(this.holder=null,n&&n.parentNode?this.removeDom():this)},e.prototype.removeDom=function(){var t;return t=this.content,t.holder=null,t.parentNode=null,t.removeDom(),this.emit("afterRemoveDom"),this},e}(r)},function(t,e,n){var r,o,i,u,a,s,c,l,d=[].slice;u=n(12),l=n(8).normalizeDomElement,c=n(7).newDcid,a=n(11),i=n(5),o=1,s=[],t.exports=r=function(){function t(){this.listeners={},this.baseComponent=null,this.parentNode=null,this.node=null,this.dcid=c()}return t.prototype.on=function(t,e){var n;return n=this.listeners[t]||(this.listeners[t]=[]),
n.push(e),this},t.prototype.off=function(t,e){var n;return n=this.listeners[t]||(this.listeners[t]=[]),n.indexOf(e)>=0&&n.splice(index,1),!n.length&&(this.listeners[t]=null),this},t.prototype.emit=function(){var t,e,n,r,o,i;if(r=arguments[0],t=2<=arguments.length?d.call(arguments,1):[],n=this.listeners[r]){for(o=0,i=n.length;i>o;o++)e=n[o],e.apply(this,t);return this}},t.prototype.mount=function(t,e){return this.emit("beforeMount"),this.parentNode=l(t)||this.parentNode||document.getElementsByTagName("body")[0],this.renderDom(),this.emit("afterMount"),this},t.prototype.create=function(){return this.renderDom()},t.prototype.render=function(){return this.renderDom()},t.prototype.update=function(){return this.emit("update"),this.renderDom(),this},t.prototype.unmount=function(){var t,e;if(this.emit("beforeUnmount"),!this.node||!this.node.parentNode)return this.emit("afterUnmount"),this;for(t=this,e=this.holder;e&&!e.isBaseComponent;)t=e,e=e.holder;return e&&(e.isList||e.isTag)&&e.removeChild(e.dcidIndexMap[t.dcid]),t.parentNode=null,e&&(e.isList||e.isTag)?e.renderDom():t.renderDom(),this.emit("afterUnmount"),t},t.prototype.remount=function(t){var e,n,r;for(this.emit("beforeMount"),e=this,n=this.holder;n&&!n.isBaseComponent;)e=n,n=n.holder;return(n.isList||n.isTag)&&(r=n.dcidIndexMap[e.dcid])&&(r=null!=r?r:n.children.length,n.insertChild(r,e)),e.parentNode=n?n.parentNode:t?t:document.body,e.invalidate(),n&&(n.isList||n.isTag)?n.renderDom():e.renderDom(),this.emit("afterMount"),e},t.prototype.updateWhen=function(){var t;return t=1<=arguments.length?d.call(arguments,0):[],this._renderWhenBy("update",t)},t.prototype.renderWhen=function(){var t;return t=1<=arguments.length?d.call(arguments,0):[],this._renderWhenBy("render",t)},t.prototype._renderWhenBy=function(t,e){return e[0]===setInterval?"number"===e[1]?i._renderWhenBy(t,setInterval,e[1],[this],e[2]):i._renderWhenBy(t,setInterval,[this],e[1]):e[1]===i.raf?i._renderWhenBy(t,i.raf,[this],e[1]):i._renderWhenBy(t,e[0],e[1],[this]),this},t.prototype.addController=function(t){return t.component=this},t.prototype.copyEventListeners=function(t){var e,n,r;n=this.listeners,r=t.listeners;for(e in r)r[e]&&(n[e]=r[e].splice());return this},t}()},function(t,e,n){var r,o,i,u,a,s;r=n(17),u=n(11),o=n(19),i=n(21),a=n(9).react,t.exports=s=function(t){var e,r,c,l;return u(t)?t:"function"==typeof t?new i(t):t instanceof Array?new(r=n(22))(function(){var e,n,r;for(r=[],e=0,n=t.length;n>e;e++)l=t[e],r.push(s(l));return r}()):null==t?new o:t.then&&t["catch"]?(e=n(23),c=new e(a(function(){return c.promiseResult})),t.then(function(t){return c.promiseResult=t,c.invalideTransform()})["catch"](function(t){return c.promiseResult=t,c.invalideTransform()}),c):new i(t)}},function(t,e,n){var r,o,i,u={}.hasOwnProperty,a=function(t,e){function n(){this.constructor=t}for(var r in e)u.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};r=n(20),i=n(7).newLine,t.exports=o=function(t){function e(){e.__super__.constructor.apply(this,arguments),this.firstNode=null,this.family={},this.baseComponent=this}return a(e,t),e.prototype.createDom=function(){return this.node=[]},e.prototype.updateDom=function(){return this.node},e.prototype.attachNode=function(){return this.node},e.prototype.clone=function(){return new e},e.prototype.toString=function(t,e){return null==t&&(t=2),i("<Nothing/>",t,e)},e}(r)},function(t,e,n){var r,o,i,u={}.hasOwnProperty,a=function(t,e){function n(){this.constructor=t}for(var r in e)u.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};o=n(17),i=n(7).cloneObject,t.exports=r=function(t){function e(){e.__super__.constructor.call(this),this.isBaseComponent=!0,this.baseComponent=this}return a(e,t),e.prototype.renderDom=function(){return this.parentNode?(this.node?this.valid||(this.valid=!0,this.updateDom()):(this.valid=!0,this.emit("beforeAttach"),this.createDom()),this.attachNode(this.parentNode,this.nextNode),this):this.node&&this.node.parentNode?(this.valid=!0,this.removeDom()):this},e.prototype.invalidate=function(){return this.valid?(this.valid=!1,this.holder&&this.holder.invalidateContent(this)):void 0},e.prototype.removeDom=function(){return this.removeNode(),this.emit("afterRemoveDom"),this},e.prototype.removeNode=function(){return this.node.parentNode&&this.node.parentNode.removeChild(this.node)},e.prototype.attachNode=function(){var t;return t=this.node,this.parentNode===t.parentNode?t:(this.parentNode.insertBefore(t,this.nextNode),t)},e}(o)},function(t,e,n){var r,o,i,u,a,s,e,c,l,d,f,h,p={}.hasOwnProperty,v=function(t,e){function n(){this.constructor=t}for(var r in e)p.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};r=n(20),f=n(7),c=f.funcString,l=f.newLine,d=f.value,s=f.dynamic,h=n(8),u=h.domField,a=h.domValue,e=t.exports=o=function(t){function e(t){e.__super__.constructor.call(this),i.call(this,t)}return v(e,t),e.prototype.createDom=function(){return this.textValid=!0,this.firstNode=this.node=document.createTextNode(a(this.text)),this.node},e.prototype.updateDom=function(){var t;return this.textValid?(this.textValid=!0,t=a(this.text),t!==this.cacheText&&(this.node.parentNode&&this.removeNode(),this.node=document.createTextNode(t),this.firstNode=this.node,this.cacheText=t),this.node):this.node},e.prototype.clone=function(){return new this.constructor(this.text).copyEventListeners(this)},e.prototype.toString=function(t,e){return null==t&&(t=2),l(c(this.text),t,e)},e}(r),e.constructTextLikeComponent=i=function(t){var e;return e=this,this.text=t=u(t),"function"==typeof t&&t.onInvalidate(function(){return e.invalidate()}),this.family={},this.family[this.dcid]=!0,this}},function(t,e,n){var r,o,i,u,a,s,c,e,l,d,f,h,p={}.hasOwnProperty,v=function(t,e){function n(){this.constructor=t}for(var r in e)p.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},m=[].slice;f=n(18),r=n(20),i=n(19),h=n(7),c=h.checkContainer,l=h.newLine,a=h.binarySearch,u=h.binaryInsert,d=h.substractSet,s=n(8).checkConflictOffspring,t.exports=e=o=function(t){function e(t){var n,r,o,i,u,a;for(this.children=t,e.__super__.constructor.call(this),this.family=o={},o[this.dcid]=!0,this.dcidIndexMap=r={},i=u=0,a=t.length;a>u;i=++u)n=t[i],t[i]=n=f(n),s(o,n),n.holder=this,r[n.dcid]=i;this.isList=!0}return v(e,t),e.prototype.invalidateContent=function(t){return this.valid=!1,this.contentValid=!1,this.node&&u(this.dcidIndexMap[t.dcid],this.invalidIndexes),this.holder&&this.holder.invalidateContent(this)},e.prototype.createDom=function(){var t,e,n,r,o,i,u,a;if(r=this.children.length)for(i=this.parentNode,e=this.children,e[r-1].nextNode=this.nextNode,n=u=0,a=e.length;a>u;n=++u)t=e[n],t.parentNode=i;return this.node=this.childNodes=o=[],o.parentNode=this.parentNode,this.createChildrenDom(),this.firstNode=this.childFristNode,this.childrenNextNode=this.nextNode,this.node},e.prototype.createChildrenDom=function(){var t,e,n,r,o;for(o=this.childNodes,this.invalidIndexes=[],this.removedChildren={},e=this.children,r=e.length-1,n=null;r>=0;)t=e[r],t.holder!==this&&(t.invalidate(),t.holder=this),t.renderDom(),o.unshift(t.node),n=t.firstNode||n,r&&(e[r-1].nextNode=n||t.nextNode),r--;return this.childFristNode=n,o},e.prototype.updateDom=function(){var t,e,n,r,o,i;for(t=this.children,r=this.parentNode,n=this.invalidIndexes,o=0,i=n.length;i>o;o++)e=n[o],t[e].parentNode=r;return this.childrenNextNode=this.nextNode,this.updateChildrenDom()},e.prototype.updateChildrenDom=function(){var t,e,n,r,o,i,u,a,s,c,l,d;if(o=this.invalidIndexes,!o.length){l=this.removedChildren;for(c in l)t=l[c],t.removeDom();return this.removedChildren={},e}for(n=this.children,this.invalidIndexes=[],s=this.parentNode,u=this.nextNode,e=this.childNodes,a=u,r=o.length-1,n[n.length-1].nextNode=this.childrenNextNode;r>=0;)i=o[r],t=n[i],t.holder!==this&&(t.invalidate(),t.holder=this),t.renderDom(),e[i]=t.node,i&&(n[i-1].nextNode=t.firstNode||u),r--;d=this.removedChildren;for(c in d)t=d[c],t.removeDom();return this.removedChildren={},e},e.prototype.removeNode=function(){var t,e,n,r;for(this.node.parentNode=null,r=this.children,e=0,n=r.length;n>e;e++)t=r[e],t.baseComponent.removeNode()},e.prototype.pushChild=function(t){return this.setChildren(this.children.length,t)},e.prototype.unshiftChild=function(t){return this.insertChild(0,t)},e.prototype.insertChild=function(t,e){var n,r,o,i;if(n=this.children,t>=n.length)return this.setChildren(t,e);if(this.invalidate(),e=f(e),n.splice(t,0,e),this.dcidIndexMap[e.dcid]=t,this.node)for(o=this.invalidIndexes,r=u(t,o),i=o.length,r++;i>r;)o[r]++,r++;return this},e.prototype.removeChild=function(t){var e,n,r,o;return n=this.children,t>n.length?this:(this.invalidate(),e=n[t],e.parentNode=null,d(this.family,e.family),n.splice(t,1),this.node&&(o=this.invalidIndexes,r=a(t,o),o[r]===t&&o.splice(o,1),n[t-1]&&(n[t-1].nextNode=e.nextNode),this.node.splice(t,1),this.removedChildren[e.dcid]=e),this)},e.prototype.invalidChildren=function(t,e){var n,r,o;if(null==e&&(e=t+1),!this.node)return this;for(this.invalidate(),o=this.invalidIndexes,n=a(t,this.invalidIndexes);e>t;)r=o[n],r!==t&&o.splice(n,0,t),n++,t++;return this},e.prototype.setChildren=function(){var t,e,n,r,o,u,c,l,h,p,v,g,y,w,b;if(w=arguments[0],h=2<=arguments.length?m.call(arguments,1):[],this.invalidate(),e=this.children,r=this.family,p=this.node,n=this.dcidIndexMap,w>(g=e.length)){for(o=g;w>o;)h.unshift(new i),o++;w=g}for(p&&(l=this.invalidIndexes,y=this.removedChildren,u=a(w,this.invalidIndexes)),b=w+h.length,o=0;b>w;)t=f(h[o]),v=e[w],null==v&&(e[w]=new i),v===t?p&&(c=l[u],c&&b>c&&u++):(v&&(d(r,v.family),p&&(this.removedChildren[v.dcid]=v)),s(r,t),e[w]=t,n[t.dcid]=w,p&&(c=l[u],c!==w&&l.splice(u,0,w),u++)),w++,o++;return this},e.prototype.setLength=function(t){var e,n,r;if(e=this.children,t>=e.length)return this;for(r=e.length-1,this.node&&(n=a(t,this.invalidIndexes),this.invalidIndexes=this.invalidIndexes.slice(0,n));r>=t;)this.removeChild(r),r--;return this},e.prototype.attachNode=function(){var t,e,n,r,o,i;if(n=this.children,(i=this.parentNode)!==this.node.parentNode&&(this.node.parentNode=i,n.length))for(o=this.nextNode,r=n.length-1,n[r].nextNode=o;r>=0;)e=n[r],e.parentNode=i,t=e.baseComponent,t.parentNode=i,t.nextNode=e.nextNode,t.attachNode(),r&&(n[r-1].nextNode=e.firstNode||e.nextNode),r--;return this.node},e.prototype.removeDom=function(){var t,e,n,r;for(this.node.parentNode=null,r=this.children,e=0,n=r.length;n>e;e++)t=r[e],t.parentNode=null,t.removeDom();return this.emit("afterRemoveDom"),this},e.prototype.clone=function(){var t;return new e(function(){var e,n,r,o;for(r=this.children,o=[],e=0,n=r.length;n>e;e++)t=r[e],o.push(t.clone());return o}.call(this)).copyEventListeners(this)},e.prototype.toString=function(t,e){var n,r,o,i,u;if(null==t&&(t=0),this.children.length){for(r=l("<List>",t,e),u=this.children,o=0,i=u.length;i>o;o++)n=u[o],r+=n.toString(t+2,!0);return r+=l("</List>",t,!0)}return l("<List/>",t,e)},e}(r)},function(t,e,n){var r,o,i,u,a,s,c,l={}.hasOwnProperty,d=function(t,e){function n(){this.constructor=t}for(var r in e)l.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};s=n(18),o=n(16),c=n(7),i=c.funcString,u=c.newLine,a=n(9).renew,t.exports=r=function(t){function e(t){return e.__super__.constructor.call(this),t.invalidate?this.func=t:this.func=a(t),this.func.onInvalidate(this.invalidateTransform.bind(this)),this}return d(e,t),e.prototype.getContentComponent=function(){return s(this.func())},e.prototype.clone=function(){return new e(function(){return s(func()).clone()}).copyEventListeners(this)},e.prototype.toString=function(t,e){return null==t&&(t=2),u("<Func "+i(this.func)+"/>",t,e)},e}(o)},function(t,e,n){var r,o,i,u,a,s,c,l,d,f,h,p,v,m,g,y,w,b,x,C,N={}.hasOwnProperty,q=function(t,e){function n(){this.constructor=t}for(var r in e)N.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},_=[].slice;p=n(12),l=n(5),x=n(25),s=x.classFn,y=x.styleFrom,h=x.eventHandlerFromArray,a=x.attrToPropName,b=x.updating,r=n(20),u=n(21),o=n(22),C=n(7),m=C.funcString,g=C.newLine,c=C.cloneObject,d=n(10).directiveRegistry,v=n(9).flow,f=n(8).domField,w=n(18),t.exports=i=function(t){function e(t,n,r){null==n&&(n={}),e.__super__.constructor.call(this,r),delete this.isList,this.isTag=!0,this.tagName=t=t.toLowerCase(),this.namespace=n.namespace,this.namespace||("svg"===t?this.namespace="http://www.w3.org/2000/svg":"math"===t&&(this.namespace="http://www.w3.org/1998/Math/MathML")),this.initAttrs(),this.extendAttrs(n)}return q(e,t),e.prototype.initAttrs=function(){var t,e,n,r,o;return n=this,this.hasActiveProperties=!1,this.cacheClassName="",this.className=t=s(),this.className.onInvalidate(function(){return t.valid?(n.hasActiveProperties=!0,n.invalidate()):void 0}),this.hasActiveProps=!1,this.cacheProps={},this.props=r={},this.invalidateProps={},this.hasActiveStyle=!1,this.cacheStyle={},this.style=o={},this.invalidateStyle={},this.hasActiveEvents=!1,this.events=e={},this.eventUpdateConfig={}},e.prototype.extendAttrs=function(t){var e,n,r,o,i,u,a,s,c,l,f,h,p,v,m;e=this.className,u=this.style,i=this.props;for(o in t)if(l=t[o],"style"===o){a=y(l);for(o in a)l=a[o],this.setProp(o,l,u,"Style")}else if("class"===o||"className"===o)e.extend(l);else if("on"===o.slice(0,2)){if(!l)continue;if("function"==typeof l)this.bindOne(o,l);else if(c=l[0],"before"===c||"after"===c)for(m=l.slice(1),f=0,p=m.length;p>f;f++)s=m[f],this.bindOne(o,s,"before"===c);else for(h=0,v=l.length;v>h;h++)s=l[h],this.bindOne(o,s)}else"$"===o[0]?(n=d[o],(r=l instanceof Array?n.apply(null,l):n.apply(null,[l]))(this)):this.setProp(o,l,i,"Props");return this},e.prototype.prop=function(){var t;return t=1<=arguments.length?_.call(arguments,0):[],this._prop(t,this.props,"Props")},e.prototype.css=function(){var t;return t=1<=arguments.length?_.call(arguments,0):[],this._prop(t,this.style,"Style")},e.prototype._prop=function(t,e,n){var r,o,i;if(0===t.length)return e;if(1===t.length){if(o=t[0],"string"==typeof o)return e[o];for(r in o)i=o[r],this.setProp(r,i,e,n)}else 2===t.length&&this.setProp(t[0],t[1],e,n);return this},e.prototype.setProp=function(t,e,n,r){var o,i,u;return t=a(t),e=f(e),u=n[t],null==u?"function"==typeof e?this.addActivity(n,t,r):e!==this["cache"+r][t]&&this.addActivity(n,t,r):"function"==typeof u&&u.offInvalidate(this["invalidate"+r][t]),"function"==typeof e&&(i=this,this["invalidate"+r][t]=o=function(){return i.addActivity(n,t,r,!0),n[t]=e},e.onInvalidate(o)),n[t]=e,this},e.prototype.addActivity=function(t,e,n){return this["hasActive"+n]=!0,this.hasActiveProperties=!0,this.node?this.invalidate():void 0},e.prototype.bind=function(t,e,n){var r,o,i;for(t=t.split("s+"),o=0,i=t.length;i>o;o++)r=t[o],this.bindOne(r,e,n);return this},e.prototype.bindOne=function(t,e,n){var r,o,i;if("on"!==t.slice(0,2)&&(t="on"+t),o=this.events,r=o[t]){if(i=r.indexOf(e),i>=0)return this;n?r.unshift.call(r,e):r.push.call(r,e)}else o[t]=[e],this.node?this.node[t]=h(o[t],t,this):(this.hasActiveEvents=!0,this.hasActiveProperties=!0);return this},e.prototype.unbind=function(t,e){var n,r,o,i,u,a;for(t=t.split("s+"),o=this.events,u=0,a=t.length;a>u;u++)r=t[u],"on"!==r.slice(0,2)&&(r="on"+r),n=o[r],n&&(i=n.indexOf(e),i>=0&&(n.splice(i,1),n.length||(o[r]=null,this.node&&(this.node[prop]=null))));return this},e.prototype.addClass=function(){var t;return t=1<=arguments.length?_.call(arguments,0):[],this.className.extend(t),this.node&&!this.className.valid&&(this.hasActiveProperties=!0,this.invalidate()),this},e.prototype.removeClass=function(){var t,e;return t=1<=arguments.length?_.call(arguments,0):[],(e=this.className).removeClass.apply(e,t),this.node&&!this.className.valid&&(this.hasActiveProperties=!0,this.invalidate()),this},e.prototype.show=function(t){return"function"==typeof t&&(t=t(),null==t&&(t="")),null==t?this.setProp("display","block",this.style,"Style"):"visible"===t?this.setProp("visibility","visible",this.style,"Style"):this.setProp("display",t,this.style,"Style"),this.update(),this},e.prototype.hide=function(t){return"function"==typeof t&&(t=t(),null==t&&(t="")),t?"hidden"===t?this.setProp("visibility","hidden",this.style,"Style"):this.setProp("display",t,this.style,"Style"):this.setProp("display","none",this.style,"Style"),this.update(),this},e.prototype.showHide=function(t,e,n){var r,o,i,u,a;return a=this.style,e=f(e),u=a.display,u?"function"==typeof u&&u.offInvalidate&&u.offInvalidate(this.invalidateStyle.display):this.addActivity(a,"display","Style",this.node),a.display=i=v(e,u,function(){var r;return("function"==typeof e?!!e():!!e)===t?n?"function"==typeof n?n():n:null!=u?(r="function"==typeof u?u():u,"none"!==r?r:"block"):u="block":"none"}),o=this,this.invalidateStyle.display=r=function(){return o.addActivity(a,"display","Style",!0),a.display=i},i.onInvalidate(r),this.style=a,this},e.prototype.showOn=function(t,e){return this.showHide(!0,t,e)},e.prototype.hideOn=function(t,e){return this.showHide(!1,t,e)},e.prototype.createDom=function(){var t,e,n,r,o,i;for(this.node=r=this.namespace?document.createElementNS(this.namespace,this.tagName):document.createElement(this.tagName),this.hasActiveProperties&&this.updateProperties(),e=this.children,o=0,i=e.length;i>o;o++)t=e[o],t.parentNode=r;return(n=e.length)&&(e[n-1].nextNode=null),this.childNodes=[],this.createChildrenDom(),this.firstNode=r,r},e.prototype.updateDom=function(){var t,e,n,r,o,i;for(this.hasActiveProperties&&this.updateProperties(),t=this.children,r=this.node,n=this.invalidIndexes,o=0,i=n.length;i>o;o++)e=n[o],t[e].parentNode=r;return this.updateChildrenDom(),this.firstNode=this.node},e.prototype.removeDom=function(){return this.removeNode(),this.emit("afterRemoveDom"),this},e.prototype.attachNode=function(){var t;return t=this.node,this.parentNode===t.parentNode?t:(this.parentNode.insertBefore(t,this.nextNode),t)},e.prototype.removeNode=function(){return this.node.parentNode.removeChild(this.node)},e.prototype.updateProperties=function(){var t,e,n,r,o,i,u,a,s,c,l,d,f;if(this.hasActiveProperties=!1,s=this.node,r=this.className,r.valid||(o=r(),o!==this.cacheClassName&&(this.cacheClassName=s.className=o)),this.hasActiveProps){l=this.props,t=this.cacheProps,this.hasActiveProps=!1;for(c in l)f=l[c],delete l[c],"function"==typeof f&&(f=f()),null==f&&(f=""),t[c]=s[c]=f}if(this.hasActiveStyle){d=this.style,e=this.cacheStyle,this.hasActiveStyle=!1,i=s.style;for(c in d)f=d[c],delete d[c],"function"==typeof f&&(f=f()),null==f&&(f=""),e[c]=i[c]=f}if(this.hasActiveEvents){a=this.events;for(u in a)n=a[u],s[u]=h(n,u,this)}this.hasActiveEvents=!1},e.prototype.clone=function(){var t,n,r,o,i;for(n=[],i=this.children,r=0,o=i.length;o>r;r++)t=i[r],n.push(t.clone());return new e(this.tagName,this.attrs,n).copyEventListeners(this)},e.prototype.toString=function(t,e){var n,r,o,i,u,a,s,c,l,d,f;null==t&&(t=0),i=g("<"+this.tagName,t,e),l=this.props;for(o in l)a=l[o],i+=" "+o+"="+m(a);if(this.hasActiveStyle){i+=" style={",d=this.style;for(o in d)if(a=d[o],"string"==typeof a)i+=a;else for(o in a)u=a[o],i+=" "+o+"="+m(u);i+="}"}if(i+=">",r=this.children,r.length>1){for(f=this.children,s=0,c=f.length;c>s;s++)n=f[s],i+=n.toString(t+2,!0);return i+=g("</"+this.tagName+">",t+2,!0)}return 1===r.length&&(i+=r[0].toString(t+2)),i+=g("</"+this.tagName+">",t+2)},e}(o)},function(t,e,n){var r,o,i,u,a,s,c,l,d,f,h,p,v,m=[].slice;v=n(7),l=v.isArray,i=v.cloneObject,a=n(8).domField,h=n(9).react,s=n(12),d=n(11).isComponent,e.extendEventValue=c=function(t,e,n,r){var o;return o=t[e],o?o instanceof Array||(o=[o]):o=[],n?n instanceof Array||(n=[n]):n=[],r?t[e]=n.concat(o):t[e]=o.concat(n)},e.extendAttrs=function(t,e,n){var r,i,u;if(null==n&&(n={}),!e)return t;if(!t)return e;i=o([e["class"],e.className]),n.replaceClass?t.className=i:(t.className=o([t["class"],t.className]),delete t["class"],t.className=o([t.className,i])),e.style&&s(p(t.style),e.style);for(r in e)u=e[r],"on"===r.slice(0,2)?n["replace_"+r]||n.replaceEvents?t[r]=u:c(t,r,u):t[r]=u;return t},e.overAttrs=f=function(t,e){var n,r;if(e){if(t){for(n in t)r=t[n],null==e[n]&&(e[n]=r),"style"===n&&(e[n]=f(t[n],e[n]));return e}return e}return t=s({},t),t.style&&(t.style=s({},p(t.style))),t},e.classFn=o=function(){var t,e,n,r,o;return n=1<=arguments.length?m.call(arguments,0):[],t={},r=function(){var n,o,i;if(!arguments.length){o=[],r.valid=!0;for(n in t)i=t[n],"function"==typeof i&&(i=i()),i&&o.push(n);return o.join(" ")}e(arguments.slice())},o=function(e,n){var o;return n=a(n),o=t[e],"function"==typeof o&&o.offInvalidate(r.invalidate),!n&&o?(r.invalidate(),delete t[e]):o!==n?(r.invalidate(),"function"==typeof n&&n.onInvalidate(r.invalidate),t[e]=n):void 0},e=function(t){var n,r,i,u,a,s,c,d,f;if(t)for(l(t)||(t=[t]),a=0,c=t.length;c>a;a++)if(n=t[a])if("string"==typeof n)for(i=n.trim().split(/\s+(?:,\s+)?/),s=0,d=i.length;d>s;s++)r=i[s],"!"===r[0]?o(r.slice(1),!1):o(r,!0);else if(n instanceof Array)e(n);else if(n&&n.classMap){f=n.classMap;for(r in f)u=f[r],"function"!=typeof u&&(u=!0),o(r,u)}else if("object"==typeof n)for(r in n)u=n[r],"function"!=typeof u&&(u=!0),o(r,u)},h(r),e(n),r.classMap=t,r.valid=!Object.keys(t).length,r.removeClass=function(){var t,e,n,r,i;for(e=1<=arguments.length?m.call(arguments,0):[],i=[],n=0,r=e.length;r>n;n++)t=e[n],i.push(o(t,!1));return i},r.extend=function(){var t;return t=1<=arguments.length?m.call(arguments,0):[],e(t)},r},e.styleFrom=p=function(t){var e,n,r,o,u,a,s,c,l,d;if("string"==typeof t){for(r={},t=t.trim().split(/\s*;\s*/),u=0,s=t.length;s>u;u++)e=t[u],e=e.trim(),e&&(l=e.split(/\s*:\s*/),n=l[0],o=l[1],r[n]=o);return r}if(t instanceof Array){for(r={},a=0,c=t.length;c>a;a++){if(e=t[a],"string"==typeof e){if(e=e.trim(),!e)continue;d=e.split(/\s*:\s*/),n=d[0],t=d[1]}else n=e[0],t=e[1];r[n]=t}return r}return t&&"object"!=typeof t?{}:i(t)},u=n(10),e.eventHandlerFromArray=function(t,e,n){return function(r){var o,i,a,s,c,l,d,f,h,p;for(a=n.node,l=0,f=t.length;f>l;l++)i=t[l],i&&i.call(a,r,n);if(c=n.eventUpdateConfig[e])for(d=0,h=c.length;h>d;d++)p=c[d],o=p[0],s=p[1],(s.alwaysUpdating||!u.useSystemUpdating)&&o[s.method]();r&&(!r.executeDefault&&r.preventDefault(),!r.continuePropagation&&r.stopPropagation())}},r={"for":"htmlFor"},e.attrToPropName=function(t){var e,n,o,i;if(o=r[t])return o;if(i=t.split("-"),1===i.length)return t;for(e=1,n=i.length;n>e;)i[e]=i[e][0].toUpperCase()+i[e].slice(1),e++;return i.join("")}},function(t,e,n){var r,o,i,u,a,s,c,l={}.hasOwnProperty,d=function(t,e){function n(){this.constructor=t}for(var r in e)l.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};r=n(20),i=n(21).constructTextLikeComponent,c=n(7),a=c.funcString,s=c.newLine,u=n(8).domValue,t.exports=o=function(t){function e(t){e.__super__.constructor.call(this),i.call(this,t)}return d(e,t),e.prototype.createDom=function(t,e){return this.node=document.createComment(u(this.text)),this.node},e.prototype.updateDom=function(t,e){return this.text&&(this.node.data=u(this.text)),this.node},e.prototype.toString=function(t,e){return null==t&&(t=2),s("<Comment "+a(this.text)+"/>",t,e)},e}(r)},function(t,e,n){var r,o,i,u,a,s,c,l={}.hasOwnProperty,d=function(t,e){function n(){this.constructor=t}for(var r in e)l.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};r=n(20),i=n(21).constructTextLikeComponent,c=n(7),a=c.funcString,s=c.newLine,u=n(8).domValue,t.exports=o=function(t){function e(t,n){this.transform=n,e.__super__.constructor.call(this),i.call(this,t)}return d(e,t),e.prototype.createDom=function(){var t;return this.textValid=!0,t=document.createElement("DIV"),t.innerHTML=this.cacheText=this.transform&&this.transform(u(this.text))||u(this.text),this.node=function(){var e,n,r,o;for(r=t.childNodes,o=[],e=0,n=r.length;n>e;e++)t=r[e],o.push(t);return o}(),this.firstNode=this.node[0],this},e.prototype.updateDom=function(){var t,e;return this.textValid?(this.textValid=!0,e=this.transform&&this.transform(u(this.text))||u(this.text),e!==this.cacheText&&(this.node.parentNode&&this.removeNode(),t=document.createElement("DIV"),t.innerHTML=e,this.node=t.childNodes,this.firstNode=this.node[0],this.cacheText=e),this):this},e.prototype.attachNode=function(){var t,e,n,r,o;if(e=this.node,n=this.parentNode,n===e.parentNode)return e;for(e.parentNode=n,r=0,o=e.length;o>r;r++)t=e[r],n.insertBefore(t,this.nextNode);return e},e.prototype.removeNode=function(){var t,e,n,r,o;for(e=this.node.parentNode,o=this.node,n=0,r=o.length;r>n;n++)t=o[n],e.removeChild(t);this.node.parentNode=null},e.prototype.toString=function(t,e){return null==t&&(t=2),s("<Html "+a(this.text)+"/>",t,e)},e}(r)},function(t,e,n){var r,o,i,u,a,s,c,l,d={}.hasOwnProperty,f=function(t,e){function n(){this.constructor=t}for(var r in e)d.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};c=n(18),o=n(16),l=n(7),i=l.funcString,a=l.newLine,u=l.intersect,s=n(9).renew,t.exports=r=function(t){function e(t,n,r){var o;return n===r?c(n):(n=c(n),r=c(r),"function"!=typeof t?t?n:r:(e.__super__.constructor.call(this),this.then_=n,this.else_=r,this.family=o=u([n.family,r.family]),o[this.dcid]=!0,t.invalidate?this.test=t:this.test=s(t),this.test.onInvalidate(this.invalidateTransform.bind(this)),this))}return f(e,t),e.prototype.getContentComponent=function(){return this.test()?this.then_:this.else_},e.prototype.clone=function(){return new e(this.test,this.then_.clone(),this.else_.clone()).copyEventListeners(this)},e.prototype.toString=function(t,e){return null==t&&(t=0),null==e&&(e=""),a("",t,e)+"<if "+i(this.test)+">"+this.then_.toString(t+2,!0)+this.else_.toString(t+2,!0)+a("</if>",t,!0)},e}(o)},function(t,e,n){var r,o,i,u,a,s,c,l,d={}.hasOwnProperty,f=function(t,e){function n(){this.constructor=t}for(var r in e)d.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};c=n(18),o=n(16),l=n(7),i=l.funcString,a=l.newLine,u=l.intersect,s=n(9).renew,t.exports=r=function(t){function e(t,n,r){var o,i,a,l,d;if(this.map=n,"function"!=typeof t)return c(n.hasOwnPoperty(t)?n[a]:r);e.__super__.constructor.call(this),t.invalidate?this.test=t:this.test=s(t),this.test.onInvalidate(this.invalidateTransform.bind(this));for(a in n)l=n[a],n[a]=c(l);this.else_=c(r),o=function(){var t,e;t=this.map,e=[];for(d in t)l=t[d],e.push(l.family);return e}.call(this),o.push(this.else_.family),this.family=i=u(o),i[this.dcid]=!0}return f(e,t),e.prototype.getContentComponent=function(){return this.map[this.test()]||this.else_},e.prototype.clone=function(){var t,n,r,o;t={},o=this.map;for(n in o)r=o[n],t[n]=r.clone();return new e(this.test,t,this["else"].clone()).copyEventListeners(this)},e.prototype.toString=function(t,e){var n,r,o,u;null==t&&(t=0),o=a("",t,e)+"<Case "+i(this.test)+">",u=this.map;for(r in u)n=u[r],o+=a(r+": "+n.toString(t+2,!1),t+2,!0);return o+=this.else_.toString(t+2,!0)+a("</Case>",t,!0)},e}(o)},function(t,e,n){var r,o,i,u,a,s,c,l,d,f,h,p,v,m,g,y,w,b={}.hasOwnProperty,x=function(t,e){function n(){this.constructor=t}for(var r in e)b.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};p=n(18),a=n(16),i=n(22),o=n(23),u=n(21),g=n(7),l=g.isArray,c=g.funcString,d=g.newLine,y=n(9),f=y.react,h=y.renew,s=y.flow,w=n(2),v=w.watchEachList,m=w.watchEachObject,t.exports=r=function(t){function e(t,n,r){var o,u;this.itemFn=n,null==r&&(r={}),e.__super__.constructor.call(this),this.family={},u=this,"function"==typeof t&&(this.isFunction=!0,!t.invalidate&&(t=h(t)),t.onInvalidate(this.invalidateTransform.bind(this))),this.items=t,r.sort&&(this.needSort=!0,"function"==typeof r.sort?this.sortFunction=r.sort:this.sortFunction=null),o=r.key,this.keyFunction="function"==typeof o?o:null!=o?function(t,e){return t[o]}:void 0,this.childReactives=[],this.memoComponents={},this.memoChildMap={},this.cacheChildren=[],this.listComponent=new i([]),this.listComponent.holder=this}return x(e,t),e.prototype.getItems=function(){},e.prototype.getContentComponent=function(){var t,e,n,r,o,i,u,a,s;if(o=this.listComponent,e=this.items,t=this.isFunction,i=this.needSort,!e)return this.emptyPlaceHolder||(this.emptyPlaceHolder=new Nothing);if(t){if(e=e(),!e)return this.emptyPlaceHolder||(this.emptyPlaceHolder=new Nothing);if("object"!=typeof e)throw new Error("Each Component need an array or object")}return(this.isArrayItems=e instanceof Array)||(e=function(){var t;t=[];for(n in e)u=e[n],t.push([n,u]);return t}()),i?e.sort(this.sortFunction):(s=this._items,s&&s.watchingComponents&&delete s.watchingComponents[this.dcid],a=e&&e.watchingComponents&&e.watchingComponents[this.dcid],this.notWatch||a||(this.isArrayItems?v(e,this):m(e,this))),this._items=e,r=e.length,r<o.children.length?(this._setLength(r),(t||i||!this.isArrayItems)&&this.invalidateChildren(0,r)):this.invalidateChildren(0,r),o},e.prototype.getChild=function(t){var e,n,r,i,u,a,s,c,l;if(c=this,a&&(l=this.isArrayItems?a(_items[t],t):a(_items[t][0],_items[t][1],t)),s=this.listComponent,e=this.cacheChildren,i=this.children,r=this.childReactives,a=this.keyFunction,u=this.itemFn,i=s.children,a){if(this.memoChildMap[l])throw new Error("duplicated memo key in Each Component");if(n=this.memoComponents[l])return n.valid=!1,n.transformValid=!1,i[t]=e[t]=n,this.memoChildMap[l]=n,n}return t<i.length?(n=i[t],n.valid=!1,n.transformValid=!1):t<e.length?(n=i[t]=e[t],n.valid=!1,n.transformValid=!1):(r[t]=f(function(){var e,r,o,i,a;return r=c._items,e=r[t],u.pouring&&n.invalidateTransform(),i=c.isArrayItems?u(e,t,r,c):(o=e[0],a=e[1],e,u(a,o,t,r,c))}),i[t]=e[t]=n=new o(r[t]),n.holder=s,s.dcidIndexMap[n.dcid]=t),n},e.prototype.invalidateChildren=function(t,e){var n,r,o,i;for(null==e&&(e=t+1),r=t,o=this.listComponent,n=o.children,i=n.length;e>r;)this.getChild(r),r++;return e>i&&(n[e-1].nextNode=this.nextNode),o.invalidChildren(t,e),this},e.prototype._setLength=function(t){var e,n,r;if(n=this.listComponent,r=n.children.length,t>=r)return this;if(this.keyFunction)for(e=t;r>e;)delete memoChildMap[children[e].memoKey],e++;return n.setLength(t),this},e.prototype.clone=function(t){return new e(this.items,this.itemFn,t||this.options).copyEventListeners(this)},e.prototype.toString=function(t,e){return null==t&&(t=0),d("<Each "+c(this.items)+" "+c(this.itemFn)+"/>",t,e)},e}(a)},function(t,e,n){var r,o,i,u,a,s,c,l,d,f,h,p,v={}.hasOwnProperty,m=function(t,e){function n(){this.constructor=t}for(var r in e)v.call(e,r)&&(t[r]=e[r]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t};h=n(18),a=n(16),s=n(12),p=n(7),c=p.funcString,d=p.newLine,l=p.intersect,f=n(9).renew,i=0,o=1,u=2,t.exports=r=function(t){function e(t,n,r,a){var s;return this.promise=t,e.__super__.constructor.apply(this,arguments),this.fulfill=n||function(t){return t},this.reject=r||function(t){return t},this.init=a&&a(t,this)||new Nothing,this.family=s=l([fullfill.family,r.family,a.family]),s[this.dcid]=!0,this.promiseState=i,t.then(function(t){return this.promiseResult=t,this.promiseState=o,this.invalidateTransform()})["catch"](function(t){return this.promiseResult=t,this.promiseState=u,this.invalidateTransform()}),this}return m(e,t),e.prototype.getContentComponent=function(){var t;return(t=this.promiseState)===i?init:h(t===o?this.fulfill(this.promiseResult,this.promise,this):this.reject(this.promiseResult,this.promise,this))},e.prototype.clone=function(){return new e(this.promise,this.fulfill,this.reject,this.init.clone).copyEventListeners(this)},e.prototype.toString=function(t,e){return null==t&&(t=0),null==e&&(e=""),d("",t,e)+"<Defer "+this.promise+">"+d("",t,e)+c(this.fulfill)+d("",t,e)+c(this.reject)+this.init.toString(t+2,!0)+d("</Defer>",t,!0)},e}(a),s(r,{INIT:i,FULFILL:o,REJECT:u})},function(t,e,n){var r,o,i,u,a,s,c,l,d,f,h,p,v,m,g,y,w,b,x,C,N,q,_,S=[].slice;q=n(14),i=q.Component,C=q.toComponent,g=q.isComponent,f=q.Tag,h=q.Text,o=q.Comment,c=q.Html,l=q.If,
r=q.Case,s=q.Func,d=q.List,a=q.Each,u=q.Defer,_=n(7),y=_.isEven,b=_.numbers,m=n(33).isAttrs,p=function(t){var e;return e=t[0],t.length?null==e?[{},t.slice(1)]:e instanceof Array?[{},t]:"function"==typeof e?[{},t]:"object"==typeof e?g(e)?[{},t]:[e,t.slice(1)]:[{},t]:[{},[]]},N=function(t){return t instanceof Array?t.length?1===t.length?N(t[0]):t:[]:[t]},x=e.tag=function(){var t,e,n,r,o;return r=arguments[0],t=2<=arguments.length?S.call(arguments,1):[],o=p(t),e=o[0],n=o[1],new f(r,e,N(n))},e.nstag=function(){var t,e,n,r,o,i;return o=arguments[0],r=arguments[1],t=3<=arguments.length?S.call(arguments,2):[],i=p(t),e=i[0],n=i[1],new f(o,e,N(n),r)},e.txt=function(t,e){return m(t)?new f("div",t,[new h(e)]):new h(t)},e.comment=function(t,e){return m(t)?new f("div",t,[new o(e)]):new o(t)},e.html=function(t,e,n){return m(t)?new f("div",t,[new c(e,n)]):new c(t,e)},e.if_=function(t,e,n,r){return m(t)?new f("div",t,[new l(e,n,r)]):new l(t,e,n,r)},e.case_=function(t,e,n,o){return m(t)?new f("div",t,[new r(e,n,o)]):new r(t,e,n,o)},e.cond=function(){var t,e,n,r;return t=arguments[0],e=3<=arguments.length?S.call(arguments,1,r=arguments.length-1):(r=1,[]),n=arguments[r++],m(t)?(y(e)||(e.push(n),n=null),new f("div",t,[new Cond(e,n)])):(e.unshift(t),y(e)||(e.push(n),n=null),new Cond(e,n))},e.func=function(t,e){return m(t)?new f("div",t,[new s(e)]):new s(t)},e.list=w=function(){var t,e;return t=arguments[0],e=2<=arguments.length?S.call(arguments,1):[],m(t)?new f("div",t,[new d(e)]):(e.unshift(t),1===e.length?C(e[0]):new d(e))},e.each=function(t,e,n){return m(t)?new f("div",t,[new a(e,n)]):new a(t,e)},e.every=v=function(t,e,n){var r,o,i,u,a,s,c;if(m(t)){if(!e)return new Nothing;for(r=[],o=u=0,s=e.length;s>u;o=++u)i=e[o],r.push(n(i,o,e));return new f("div",t,[new d(r)])}if(!t)return new Nothing;for(r=[],o=a=0,c=t.length;c>a;o=++a)i=t[o],r.push(e(i,o,t));return new d(r)},e.all=function(t,e,n){var r,o,i,u;if(m(t)){if(!e)return new Nothing;r=[],o=0;for(i in e){if(u=e[i],!e.hasOwnProperty(i))break;r.push(n(i,u,o,e)),o++}return new f("div",t,[new d(r)])}if(!t)return new Nothing;r=[],o=0;for(i in t){if(u=t[i],!t.hasOwnProperty(i))break;r.push(n(i,u,o,e)),o++}return new d(r)},e.nItems=function(t,e,n){return m?"function"==typeof e?new f("div",t,[new a(b(e),n)]):new f("div",v(b(e),n)):"function"==typeof atrrs?new a(b(atrrs),e):v(b(atrrs),e)},e.defer=function(t,e,n,r,o){return m(t)?new f("div",t,[new u(e,n,r,o)]):new u(t,e,n,r)},e.clone=function(t,e){return m(t)?new f("div",t,[C(e).clone()]):C(t).clone(e)}},function(t,e,n){var r,o,i,u,a,s,c,l;l=n(14),a=l.isComponent,c=l.toComponent,o=n(23),u=n(21),i=n(27),r=n(26),e.isAttrs=function(t){return!("object"!=typeof t||null===t||a(t)||t instanceof Array)},s=function(t,e,n){return dc.flow.if_(t,e,n)},e._maybeIf=function(t,e,n){var a,l,d,f;if(e=c(e),n=c(n),e===n)return e;if(e instanceof Nothing&&n instanceof Nothing)return e;if("function"==typeof t){if(e.isTag&&n.isTag&&e.tagName===n.tagName&&e.namespace===n.namespace){a={},f=e.attrs,l=n.attrs;for(d in bothKeys(f,l))a[d]=s(t,f[d],l[d]);return a.namespace=e.namespace,new Tag(e.tagName,a,children)}return e instanceof u&&n instanceof u?new u(s(t,e.text,n.text)):e instanceof r&&n instanceof r?new r(s(t,e.text,n.text)):e instanceof i&&n instanceof i?new i(s(t,e.text,n.text)):e instanceof o&&n instanceof o?new o(flow.if_(t,e.func,n.func)):new If(t,e,n)}return t?e:n}},function(t,e,n){var r,o,i,u,a,s,c,l,d,f,h,p,v,m,g,y=[].slice;for(r=n(12),a=n(32).tag,o=n(8).getBindProp,c="a abbr acronym address area b base bdo big blockquote body br button caption cite code col colgroup dd del dfn div dl dt em fieldset form h1 h2 h3 h4 h5 h6 head hr i img input ins kbd label legend li link map meta noscript object ol optgroup option p param pre q samp script select small span strong style sub sup table tbody td textarea tfoot th thead title tr tt ul var header footer section",c=c.split(" "),d=function(t){return e[t]=function(){return a.apply(null,[t].concat(y.call(arguments)))}},h=0,v=c.length;v>h;h++)s=c[h],d(s);for(e.tagHtml=a.apply(null,[s].concat(y.call(arguments))),u="text checkbox radio date email number".split(" "),i=e.input=function(t,e,n){var i;return"object"==typeof t&&(n=e,e=t,t="text"),e=r({type:t},e),i=a("input",e),null!=n&&(i.prop(o(i),n),n.isDuplex&&i.bind("onchange",function(t,e){return n(this.value)},"before")),i},g="text checkbox radio date email tel number".split(" "),f=function(t){return e[t]=function(e,n){var r;return"object"==typeof e&&(r=n,n=e,e=r),n=n||{},i(t,n,e)}},p=0,m=g.length;m>p;p++)l=g[p],f(l);e.textarea=function(t,e){var n;return isAttrs(t)?null!=e?(t=r({value:e},t),n=a("textarea",t),e.isDuplex&&n.bind("onchange",function(t,n){return e(this.value)},"before")):n=a("textarea",t):null!=t?(n=a("textarea",{value:t}),t.isDuplex&&n.bind("onchange",function(e,n){return t(this.value)},"before")):n=a("textarea"),n}},function(t,e,n){var r,o;r=dc.extend,dc.builtinDirectives=n(36),r(dc,dc.builtinDirectives,n(43)),o=dc.flow,r(o,n(49),n(2)),dc.bindings=o.bindings,t.exports=dc},function(t,e,n){var r,o,i;e.$model=n(38),e.$bind=n(39),i=n(40),o=i.$show,r=i.$hide,e.$show=o,e.$hide=r,e.$blink=n(37),e.$splitter=n(41),e.$options=n(42)},function(t,e){var n,r;r=dc.see,n=dc.flow,t.exports=function(t){return function(e){var o,i;return null==t&&(t=500),o=null,e.on("beforeMount",function(n){return function(){return o=setInterval(function(){return i(!i()),e.update()},t)}}),e.on("afterUnmount",function(t){return function(){return clearInterval(o)}}),i=r(!0),this.style.visibility=n(i,function(){return i()?"visible":"hidden"}),e}}},function(t,e){var n;n=dc.getBindProp,t.exports=function(t,e){return function(r){var o,i;return i=r.props,o=n(r),r.setProp(o,t,i,"Props"),r.bind(e||"onchange",function(){return t(this[o])},"before"),r}}},function(t,e){var n,r;r=dc.getBindProp,n=dc.domField,t.exports=function(t){return function(e){return e.setProp(r(e),t,props,"Props"),e}}},function(t,e){var n;n=function(t){return function(e,n){return function(r){return r.showHide(t,e,n),r}}},e.$show=n(!0),e.$hide=n(!1)},function(t,e){var n,r,o,i,u;i=dc.pairListDict,r=dc.classFn,n=dc.Component,o=dc.div,u=dc.span,t.exports=function(t){return function(e){var n,a,s,c,l,d,f,h,p,v,m,g,y,w,b,x,C,N,q,_,S,P,L,M,T,k,I,D;return dc.directives({$show:dc.$show}),S=e.props,t=t||"vertical","vertical"===t?(w="top",P="bottom",D="height",v="clientY",I="splitbarH",h="splitbuttonH",m="s-resize"):(w="left",P="right",D="width",v="clientX",I="splitbarV",h="splitbuttonV",m="e-resize"),_=200,q=.5,L=null,g=!1,y=function(){return L||600},p=e.children,C=p[0],N=p[1],b=S.minAWidth||0,x=S.minBWidth||0,T={"class":I,unselectable:"on",style:k={cursor:m,"user-select":"none","-webkit-user-select":"none","-khtml-user-select":"none","-moz-user-select":"none"}},k[w]=function(){return _+"px"},k[D]=f=6,c=!1,n={"class":r(h,{inactive:function(){return c}}),unselectable:"on",style:{cursor:"pointer"},onmouseover:function(){return c=!0,e.update()},onmouseleave:function(){return c=!1,e.update()},onclick:function(t){return _=b,e.update()},$show:function(){return _>b}},d=!1,a={"class":r(h+" invert",{inactive:function(){return d}}),unselectable:"on",style:{cursor:"pointer"},onmouseover:function(){return d=!0,e.update()},onmouseleave:function(){return d=!1,e.update()},onclick:function(t){return _=y()-x,e.update()},$show:function(){return y()-_>x}},s=o(n),l=o(a),M=o(T,u(),s,l),e.setChildren(1,M,N),M.bind("mousedown",function(t){return g=!0}),dc(document).bind("mouseup",function(){return g=!1}),e.bind("mousemove",function(t){var n,r,o;return t.continuePropagation=!0,t.executeDefault=!0,g?(t.continuePropagation=!1,t.executeDefault=!1,n=e.node.getBoundingClientRect(),L=o=n[P]-n[w],_=Math.max(t[v]-n[w],0),r=_/o,e.update()):void 0}),C.css(i("position","absolute",D,function(){return _+"px"})),N.css(i("position","absolute",w,function(){return _+f+"px"},D,function(){return y()-(_+f)+"px"})),e.css(i("position","absolute")),e.bind("resize",function(t){var n,r;return t.preventDefault(),t.stopPropagation(),n=e.node.getBoundingClientRect(),r=n[P]-n[w],_=q*r,b>_?_=b:x>r-_&&(_=r-x),e.update()}),e}}},function(t,e){var n,r,o,i;r=dc.every,i=dc.txt,o=dc.option,n=dc.Tag,t.exports=function(t,e){return function(u){if(!(u instanceof n)||"select"!==u.tagName)throw new Error("options should be only used in select tag");return u.setChildren(0,r(t,function(t){return o(e,[i(t)])})),u}}},function(t,e,n){var r;r=dc.extend,r(e,n(44)),e.triangle=n(45),e.dialog=n(46),r(e,n(47)),r(e,n(48))},function(t,e){var n,r,o,i,u,a,e,s,c,l,d,f;s=dc.extend,u=dc.div,l=dc.h4,r=dc.a,f=dc.span,d=dc.img,n=dc.Component,a=dc.each,c=dc.extendAttrs,t.exports=e=o=function(t,e,n){var r,o;return t=c({"class":"panel-group"},t||{}),r=n||{},o=u(t,a(e,function(t,n){var u,a,s,c;return a=t[0],c=t[1],u=t[2],s=t[3],s=s||{},s.toggleOpen=function(){var t,i,u,a;if(s.opened=!s.opened,r.closeOthers&&s.opened)for(i=u=0,a=e.length;a>u;i=++u)t=e[i],i!==n&&(t[3].opened=!1);return o.update()},i(a,c,u,s)}))},e.accordionGroup=i=function(t,e,n,r){return u({"class":"panel panel-default"},u({"class":"panel-heading",onclick:r.toggleOpen},l({"class":"panel-title"},u({"class":"accordion-toggle"},f({"class":{"text-muted":function(){return r.disabled}}},e)))),u({"class":{"panel-collapse":function(){return!r.opened}},style:{display:function(){return r.opened?"block":"none"}}},u({"class":"panel-body"},n)))},e.accordion=o},function(t,e){var n,r,o,i;r=dc.div,o=dc.extendAttrs,i={left:"right",right:"left",top:"bottom",bottom:"top"},n=function(t,e,n){var r,o;return r={width:0,height:0},o=e+"px solid transparent","left"===t||"right"===t?r["border-top"]=r["border-bottom"]=o:r["border-left"]=r["border-right"]=o,r["border-"+i[t]]=e+"px solid "+n,r},t.exports=function(t,e,i,u){return t=o(t,{style:n(e,i,u)}),r(t)}},function(t,e){var n,r,o,i,u,a;n=dc.Component,u=dc.list,i=dc.if_,r=dc.div,a=dc.see,o=0,t.exports=function(t,e){var n,s,c,l;return t.showClose&&(e=u(r({"class":"dcdialog-close",style:{position:"absolute","z-index":10001,top:0,right:"80px"},onclick:function(){return s.close()}}),e)),e=t.overlay?u(r({"class":"dcdialog-overlay",style:{"z-index":1e4}}),r({"class":"dcdialog-content",style:{position:"absolute","z-index":10001}},e)):r({"class":"dcdialog-content",style:{"z-index":10001}},e),l=a(!t.closed),s=i(l,r({id:"dcdialog"+ ++o,"class":"dcdialog",style:{position:"absolute",top:"0px",left:"0px","z-index":9999}},e)),c=t.openCallback,s.open=function(){return c&&c(),l(!0),s.update()},n=t.closeCallback,s.close=function(){return l(!1),s.update(),n&&n()},t.escClose&&(s.on("onMount",function(){var t;return t=function(t){var e;return e=27,t.which===e||t.keyCode===e?s.close():void 0},document.body.addEventListener("keydown",t)}),s.on("onUnmount",function(){return document.body.removeEventListener("keydown",escHandler)})),s}},function(t,e){var n,r,o,i,u,a,s;u=dc.list,i=dc.input,s=dc.span,r=dc.div,o=dc.extendAttrs,a=dc.see,e.combobox=n=function(t,e,n,u){var c,l,d,f,h;return h=a(!1),l="v"===u||"vertical"===u?"block":"inline-block",c=null,f=function(){var t,r,o;for(o=[],t=0,r=n.length;r>t;t++)d=n[t],o.push(function(t){return s({style:{display:l,border:"1px solid blue","min-width":"40px"},onclick:function(){return e(t),c.update()}},t)}(d));return o}(),t=o(t,{onmouseleave:function(){return h(!1),c.update()}}),c=r(t,i({$model:e,onmouseenter:function(){return h(!0),c.update()}}),r({style:{display:function(){return h()?"block":"none"}}},f))},e.vcombo=function(t,e,r){return n(t,e,r,"vertical")},e.hcombo=function(t,e,r){return n(t,e,r,"horizontal")}},function(t,e){var n,r,o,i,u,a,s;u=dc.see,i=dc.pipe,n=dc.div,s=dc.text,o=dc.extendAttrs,r=dc.extend,e.setAutoWidth=a=function(t,e){var r,o,a,s,c,l,d,f,h,p;return null==e&&(e={}),r=e.initialWidth||48,f=e.spaceWidth||40,d=u(r),c=e.inputEvents||"onkeydown",a=e.inputComponent||t.children[0],l=u(""),p={position:"absolute",top:"30px",width:"auto",height:"20px",whiteSpace:"nowrap",display:"inline-block",margin:"0",padding:"0",fontSize:function(){return t.css("fontSize")},fontFamily:function(){return t.css("fontFamily")},fontWeight:function(){return t.css("fontWeight")},letterSpacing:function(){return t.css("letterSpacing")},visibility:"hidden"},h=n({style:p},l),o={style:{"z-index":"10",width:i(d,function(t){return Math.max(Math.floor(t)+f,r)+"px"}),whiteSpace:"nowrap"}},s=function(e,n){return e.executeDefault=!0,l(this.value),d(h.node.getBoundingClientRect().width),t.update(),this.focus()},a.extendAttrs(o),a.bind(c,s),t.pushChild(h),t},e.autoWidthEdit=function(t,e,r){var o,i;return o=n(t,i=s()),a(o,r)}},function(t,e,n){var r,o,i,u,a,s;s=n(3),o=s.bind,i=s.duplex,u=s.flow,a=s.unary,r=s.binary,t.exports=u,u.bindings=function(t,e){var n,r;r={};for(n in t)r[n+"$"]=i(t,n,e),r[n+"_"]=o(t,n,e);return r},u.neg=function(t){return a(t,function(t){return-t})},u.no=function(t){return a(t,function(t){return!t})},u.bitnot=function(t){return a(t,function(t){return~t})},u.reciprocal=function(t){return a(t,function(t){return 1/t})},u.abs=function(t){return a(t,Math.abs)},u.floor=function(t){return a(t,Math.floor)},u.ceil=function(t){return a(t,Math.ceil)},u.round=function(t){return a(t,Math.round)},u.add=function(t,e){return r(t,e,function(t,e){return t+e})},u.sub=function(t,e){return r(t,e,function(t,e){return t-e})},u.mul=function(t,e){return r(t,e,function(t,e){return t*e})},u.div=function(t,e){return r(t,e,function(t,e){return t/e})},u.min=function(t,e){return r(t,e,function(t,e){return Math.min(t,e)})},u.funcAttr=function(t,e){return u(t,e,function(n){var r;return r=t(),null==r?r:arguments.length?r[e]=n:r[e]})},u.toggle=function(t){return t(!t())},u.if_=function(t,e,n){return"function"!=typeof t?t?e:n:t.invalidate?"function"==typeof e&&"function"==typeof n?e.invalidate&&n.invalidate?u(t,e,n,function(){return t()?e():n()}):function(){return t()?e():n()}:"function"==typeof e?e.invalidate?u(t,e,function(){return t()?e():n}):function(){return t()?e():n}:"function"==typeof n?n.invalidate?u(n,function(){return t()?e:n()}):function(){return t()?e:n()}:u(t,function(){return t()?e:n}):"function"==typeof e&&"function"==typeof n?function(){return t()?e():n()}:"function"===e?function(){return t()?e():n}:"function"===n?function(){return t()?e:n()}:t()?e:n}}])});
|
src/components/LoaderCentered.js
|
ademuk/features
|
import React from 'react';
import { Loader } from 'semantic-ui-react';
const LoaderCentered = () => {
return <Loader active inline='centered' />
};
export default LoaderCentered;
|
app/javascript/mastodon/components/modal_root.js
|
glitch-soc/mastodon
|
import React from 'react';
import PropTypes from 'prop-types';
import 'wicg-inert';
import { createBrowserHistory } from 'history';
import { multiply } from 'color-blend';
export default class ModalRoot extends React.PureComponent {
static contextTypes = {
router: PropTypes.object,
};
static propTypes = {
children: PropTypes.node,
onClose: PropTypes.func.isRequired,
backgroundColor: PropTypes.shape({
r: PropTypes.number,
g: PropTypes.number,
b: PropTypes.number,
}),
ignoreFocus: PropTypes.bool,
};
activeElement = this.props.children ? document.activeElement : null;
handleKeyUp = (e) => {
if ((e.key === 'Escape' || e.key === 'Esc' || e.keyCode === 27)
&& !!this.props.children) {
this.props.onClose();
}
}
handleKeyDown = (e) => {
if (e.key === 'Tab') {
const focusable = Array.from(this.node.querySelectorAll('button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')).filter((x) => window.getComputedStyle(x).display !== 'none');
const index = focusable.indexOf(e.target);
let element;
if (e.shiftKey) {
element = focusable[index - 1] || focusable[focusable.length - 1];
} else {
element = focusable[index + 1] || focusable[0];
}
if (element) {
element.focus();
e.stopPropagation();
e.preventDefault();
}
}
}
componentDidMount () {
window.addEventListener('keyup', this.handleKeyUp, false);
window.addEventListener('keydown', this.handleKeyDown, false);
this.history = this.context.router ? this.context.router.history : createBrowserHistory();
}
componentWillReceiveProps (nextProps) {
if (!!nextProps.children && !this.props.children) {
this.activeElement = document.activeElement;
this.getSiblings().forEach(sibling => sibling.setAttribute('inert', true));
}
}
componentDidUpdate (prevProps) {
if (!this.props.children && !!prevProps.children) {
this.getSiblings().forEach(sibling => sibling.removeAttribute('inert'));
// Because of the wicg-inert polyfill, the activeElement may not be
// immediately selectable, we have to wait for observers to run, as
// described in https://github.com/WICG/inert#performance-and-gotchas
Promise.resolve().then(() => {
if (!this.props.ignoreFocus) {
this.activeElement.focus({ preventScroll: true });
}
this.activeElement = null;
}).catch(console.error);
this._handleModalClose();
}
if (this.props.children && !prevProps.children) {
this._handleModalOpen();
}
if (this.props.children) {
this._ensureHistoryBuffer();
}
}
componentWillUnmount () {
window.removeEventListener('keyup', this.handleKeyUp);
window.removeEventListener('keydown', this.handleKeyDown);
}
_handleModalOpen () {
this._modalHistoryKey = Date.now();
this.unlistenHistory = this.history.listen((_, action) => {
if (action === 'POP') {
this.props.onClose();
}
});
}
_handleModalClose () {
if (this.unlistenHistory) {
this.unlistenHistory();
}
const { state } = this.history.location;
if (state && state.mastodonModalKey === this._modalHistoryKey) {
this.history.goBack();
}
}
_ensureHistoryBuffer () {
const { pathname, state } = this.history.location;
if (!state || state.mastodonModalKey !== this._modalHistoryKey) {
this.history.push(pathname, { ...state, mastodonModalKey: this._modalHistoryKey });
}
}
getSiblings = () => {
return Array(...this.node.parentElement.childNodes).filter(node => node !== this.node);
}
setRef = ref => {
this.node = ref;
}
render () {
const { children, onClose } = this.props;
const visible = !!children;
if (!visible) {
return (
<div className='modal-root' ref={this.setRef} style={{ opacity: 0 }} />
);
}
let backgroundColor = null;
if (this.props.backgroundColor) {
backgroundColor = multiply({ ...this.props.backgroundColor, a: 1 }, { r: 0, g: 0, b: 0, a: 0.7 });
}
return (
<div className='modal-root' ref={this.setRef}>
<div style={{ pointerEvents: visible ? 'auto' : 'none' }}>
<div role='presentation' className='modal-root__overlay' onClick={onClose} style={{ backgroundColor: backgroundColor ? `rgba(${backgroundColor.r}, ${backgroundColor.g}, ${backgroundColor.b}, 0.7)` : null }} />
<div role='dialog' className='modal-root__container'>{children}</div>
</div>
</div>
);
}
}
|
src/assets/js/react/components/Template/TemplateHeaderNavigation.js
|
blueliquiddesigns/gravity-forms-pdf-extended
|
import React from 'react'
import PropTypes from 'prop-types'
import { connect } from 'react-redux'
import { withRouter } from 'react-router-dom'
/**
* Renders the template navigation header that get displayed on the
* /template/:id pages.
*
* @package Gravity PDF
* @copyright Copyright (c) 2020, Blue Liquid Designs
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
* @since 4.1
*/
/**
* React Component
*
* @since 4.1
*/
export class TemplateHeaderNavigation extends React.Component {
/**
* @since 4.1
*/
static propTypes = {
templates: PropTypes.array.isRequired,
templateIndex: PropTypes.number.isRequired,
history: PropTypes.object,
isFirst: PropTypes.bool,
isLast: PropTypes.bool,
showPreviousTemplateText: PropTypes.string,
showNextTemplateText: PropTypes.string
}
/**
* Add window event listeners
*
* @since 4.1
*/
componentDidMount () {
window.addEventListener('keydown', this.handleKeyPress, false)
}
/**
* Cleanup window event listeners
*
* @since 4.1
*/
componentWillUnmount () {
window.removeEventListener('keydown', this.handleKeyPress, false)
}
/**
* Attempt to get the previous template in our list and update the URL
*
* @param {Object} e Event
*
* @since 4.1
*/
previousTemplate = (e) => {
e.preventDefault()
e.stopPropagation()
const prevId = this.props.templates[this.props.templateIndex - 1].id
if (prevId) {
this.props.history.push('/template/' + prevId)
}
}
/**
* Attempt to get the next template in our list and update the URL
*
* @param {Object} e Event
*
* @since 4.1
*/
nextTemplate = (e) => {
e.preventDefault()
e.stopPropagation()
const nextId = this.props.templates[this.props.templateIndex + 1].id
if (nextId) {
this.props.history.push('/template/' + nextId)
}
}
/**
* Checks if the Left or Right arrow keys are pressed and fires appropriate functions
*
* @param {Object} e Event
*
* @since 4.1
*/
handleKeyPress = (e) => {
/* Left Arrow */
if (!this.props.isFirst && e.keyCode === 37) {
this.previousTemplate(e)
}
/* Right Arrow */
if (!this.props.isLast && e.keyCode === 39) {
this.nextTemplate(e)
}
}
/**
* @since 4.1
*/
render () {
/*
* Work our the correct classes and attributes for our left and right arrows
* based on if we are currently showing the first or last templates
*/
const isFirst = this.props.isFirst
const isLast = this.props.isLast
let prevClass = (isFirst) ? 'dashicons dashicons-no left disabled' : 'dashicons dashicons-no left'
let nextClass = (isLast) ? 'dashicons dashicons-no right disabled' : 'dashicons dashicons-no right'
let leftDisabled = (isFirst) ? 'disabled' : ''
let rightDisabled = (isLast) ? 'disabled' : ''
return (
<span>
<button
onClick={this.previousTemplate}
onKeyDown={this.handleKeyPress}
className={prevClass}
tabIndex="141"
disabled={leftDisabled}>
<span
className="screen-reader-text">
{this.props.showPreviousTemplateText}
</span>
</button>
<button
onClick={this.nextTemplate}
onKeyDown={this.handleKeyPress}
className={nextClass}
tabIndex="141"
disabled={rightDisabled}>
<span
className="screen-reader-text">
{this.props.showNextTemplateText}
</span>
</button>
</span>
)
}
}
/**
* Map state to props
*
* @param {Object} state The current Redux State
* @param {Object} props The current React props
*
* @returns {{isFirst: boolean, isLast: boolean}}
*
* @since 4.1
*/
const MapStateToProps = (state, props) => {
/* Check if the current template is the first or last in our templates */
const templates = props.templates
const currentTemplateId = props.template.id
const lastTemplate = templates.length - 1
const first = templates[0].id
const last = templates[lastTemplate].id
return {
isFirst: first === currentTemplateId,
isLast: last === currentTemplateId
}
}
/**
* Maps our Redux store to our React component
*
* @since 4.1
*/
export default withRouter(connect(MapStateToProps)(TemplateHeaderNavigation))
|
third_party/font-awesome/License_files/jquery.min.js
|
google/dana
|
/*! jQuery v1.11.3 | (c) 2005, 2015 jQuery Foundation, Inc. | jquery.org/license */
!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l="1.11.3",m=function(a,b){return new m.fn.init(a,b)},n=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,o=/^-ms-/,p=/-([\da-z])/gi,q=function(a,b){return b.toUpperCase()};m.fn=m.prototype={jquery:l,constructor:m,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=m.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return m.each(this,a,b)},map:function(a){return this.pushStack(m.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},m.extend=m.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||m.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(m.isPlainObject(c)||(b=m.isArray(c)))?(b?(b=!1,f=a&&m.isArray(a)?a:[]):f=a&&m.isPlainObject(a)?a:{},g[d]=m.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},m.extend({expando:"jQuery"+(l+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===m.type(a)},isArray:Array.isArray||function(a){return"array"===m.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!m.isArray(a)&&a-parseFloat(a)+1>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==m.type(a)||a.nodeType||m.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(k.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&m.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(o,"ms-").replace(p,q)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=r(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(n,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(r(Object(a))?m.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=r(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),m.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||m.guid++,e):void 0},now:function(){return+new Date},support:k}),m.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function r(a){var b="length"in a&&a.length,c=m.type(a);return"function"===c||m.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var s=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N=M.replace("w","w#"),O="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+N+"))|)"+L+"*\\]",P=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+O+")*)|.*)\\)|)",Q=new RegExp(L+"+","g"),R=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),S=new RegExp("^"+L+"*,"+L+"*"),T=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),U=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),V=new RegExp(P),W=new RegExp("^"+N+"$"),X={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+O),PSEUDO:new RegExp("^"+P),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,aa=/[+~]/,ba=/'|\\/g,ca=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),da=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ea=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(fa){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],k=b.nodeType,"string"!=typeof a||!a||1!==k&&9!==k&&11!==k)return d;if(!e&&p){if(11!==k&&(f=_.exec(a)))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return H.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName)return H.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=1!==k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(ba,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+ra(o[l]);w=aa.test(a)&&pa(b.parentNode)||b,x=o.join(",")}if(x)try{return H.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function pa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=g.documentElement,e=g.defaultView,e&&e!==e.top&&(e.addEventListener?e.addEventListener("unload",ea,!1):e.attachEvent&&e.attachEvent("onunload",ea)),p=!f(g),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(g.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(g.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!g.getElementsByName||!g.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(g.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="<a id='"+u+"'></a><select id='"+u+"-\f]' msallowcapture=''><option selected=''></option></select>",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){var b=g.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",P)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===g||a.ownerDocument===v&&t(v,a)?-1:b===g||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,h=[a],i=[b];if(!e||!f)return a===g?-1:b===g?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?la(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},g):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ca,da),a[3]=(a[3]||a[4]||a[5]||"").replace(ca,da),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ca,da).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(Q," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(ca,da),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return W.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(ca,da).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:oa(function(){return[0]}),last:oa(function(a,b){return[b-1]}),eq:oa(function(a,b,c){return[0>c?c+b:c]}),even:oa(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:oa(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:oa(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:oa(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=ma(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=na(b);function qa(){}qa.prototype=d.filters=d.pseudos,d.setFilters=new qa,g=ga.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=S.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=T.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(R," ")}),h=h.slice(c.length));for(g in d.filter)!(e=X[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?ga.error(a):z(a,i).slice(0)};function ra(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function sa(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function ta(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ua(a,b,c){for(var d=0,e=b.length;e>d;d++)ga(a,b[d],c);return c}function va(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function wa(a,b,c,d,e,f){return d&&!d[u]&&(d=wa(d)),e&&!e[u]&&(e=wa(e,f)),ia(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ua(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:va(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=va(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=va(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function xa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=sa(function(a){return a===b},h,!0),l=sa(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[sa(ta(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return wa(i>1&&ta(m),i>1&&ra(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&xa(a.slice(i,e)),f>e&&xa(a=a.slice(e)),f>e&&ra(a))}m.push(c)}return ta(m)}function ya(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=F.call(i));s=va(s)}H.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&ga.uniqueSort(i)}return k&&(w=v,j=t),r};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=xa(b[c]),f[u]?d.push(f):e.push(f);f=A(a,ya(e,d)),f.selector=a}return f},i=ga.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(ca,da),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(ca,da),aa.test(j[0].type)&&pa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&ra(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,aa.test(a)&&pa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ja(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);m.find=s,m.expr=s.selectors,m.expr[":"]=m.expr.pseudos,m.unique=s.uniqueSort,m.text=s.getText,m.isXMLDoc=s.isXML,m.contains=s.contains;var t=m.expr.match.needsContext,u=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,v=/^.[^:#\[\.,]*$/;function w(a,b,c){if(m.isFunction(b))return m.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return m.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(v.test(b))return m.filter(b,a,c);b=m.filter(b,a)}return m.grep(a,function(a){return m.inArray(a,b)>=0!==c})}m.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?m.find.matchesSelector(d,a)?[d]:[]:m.find.matches(a,m.grep(b,function(a){return 1===a.nodeType}))},m.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(m(a).filter(function(){for(b=0;e>b;b++)if(m.contains(d[b],this))return!0}));for(b=0;e>b;b++)m.find(a,d[b],c);return c=this.pushStack(e>1?m.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(w(this,a||[],!1))},not:function(a){return this.pushStack(w(this,a||[],!0))},is:function(a){return!!w(this,"string"==typeof a&&t.test(a)?m(a):a||[],!1).length}});var x,y=a.document,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=m.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||x).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof m?b[0]:b,m.merge(this,m.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:y,!0)),u.test(c[1])&&m.isPlainObject(b))for(c in b)m.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=y.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return x.find(a);this.length=1,this[0]=d}return this.context=y,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):m.isFunction(a)?"undefined"!=typeof x.ready?x.ready(a):a(m):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),m.makeArray(a,this))};A.prototype=m.fn,x=m(y);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};m.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!m(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),m.fn.extend({has:function(a){var b,c=m(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(m.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=t.test(a)||"string"!=typeof a?m(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&m.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?m.unique(f):f)},index:function(a){return a?"string"==typeof a?m.inArray(this[0],m(a)):m.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(m.unique(m.merge(this.get(),m(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}m.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return m.dir(a,"parentNode")},parentsUntil:function(a,b,c){return m.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return m.dir(a,"nextSibling")},prevAll:function(a){return m.dir(a,"previousSibling")},nextUntil:function(a,b,c){return m.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return m.dir(a,"previousSibling",c)},siblings:function(a){return m.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return m.sibling(a.firstChild)},contents:function(a){return m.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:m.merge([],a.childNodes)}},function(a,b){m.fn[a]=function(c,d){var e=m.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=m.filter(d,e)),this.length>1&&(C[a]||(e=m.unique(e)),B.test(a)&&(e=e.reverse())),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return m.each(a.match(E)||[],function(a,c){b[c]=!0}),b}m.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):m.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){m.each(b,function(b,c){var d=m.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&m.each(arguments,function(a,c){var d;while((d=m.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?m.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},m.extend({Deferred:function(a){var b=[["resolve","done",m.Callbacks("once memory"),"resolved"],["reject","fail",m.Callbacks("once memory"),"rejected"],["notify","progress",m.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return m.Deferred(function(c){m.each(b,function(b,f){var g=m.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&m.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?m.extend(a,d):d}},e={};return d.pipe=d.then,m.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&m.isFunction(a.promise)?e:0,g=1===f?a:m.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&m.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;m.fn.ready=function(a){return m.ready.promise().done(a),this},m.extend({isReady:!1,readyWait:1,holdReady:function(a){a?m.readyWait++:m.ready(!0)},ready:function(a){if(a===!0?!--m.readyWait:!m.isReady){if(!y.body)return setTimeout(m.ready);m.isReady=!0,a!==!0&&--m.readyWait>0||(H.resolveWith(y,[m]),m.fn.triggerHandler&&(m(y).triggerHandler("ready"),m(y).off("ready")))}}});function I(){y.addEventListener?(y.removeEventListener("DOMContentLoaded",J,!1),a.removeEventListener("load",J,!1)):(y.detachEvent("onreadystatechange",J),a.detachEvent("onload",J))}function J(){(y.addEventListener||"load"===event.type||"complete"===y.readyState)&&(I(),m.ready())}m.ready.promise=function(b){if(!H)if(H=m.Deferred(),"complete"===y.readyState)setTimeout(m.ready);else if(y.addEventListener)y.addEventListener("DOMContentLoaded",J,!1),a.addEventListener("load",J,!1);else{y.attachEvent("onreadystatechange",J),a.attachEvent("onload",J);var c=!1;try{c=null==a.frameElement&&y.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!m.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}I(),m.ready()}}()}return H.promise(b)};var K="undefined",L;for(L in m(k))break;k.ownLast="0"!==L,k.inlineBlockNeedsLayout=!1,m(function(){var a,b,c,d;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",k.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(d))}),function(){var a=y.createElement("div");if(null==k.deleteExpando){k.deleteExpando=!0;try{delete a.test}catch(b){k.deleteExpando=!1}}a=null}(),m.acceptData=function(a){var b=m.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var M=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,N=/([A-Z])/g;function O(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(N,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:M.test(c)?m.parseJSON(c):c}catch(e){}m.data(a,b,c)}else c=void 0}return c}function P(a){var b;for(b in a)if(("data"!==b||!m.isEmptyObject(a[b]))&&"toJSON"!==b)return!1;
return!0}function Q(a,b,d,e){if(m.acceptData(a)){var f,g,h=m.expando,i=a.nodeType,j=i?m.cache:a,k=i?a[h]:a[h]&&h;if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||m.guid++:h),j[k]||(j[k]=i?{}:{toJSON:m.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=m.extend(j[k],b):j[k].data=m.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[m.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[m.camelCase(b)])):f=g,f}}function R(a,b,c){if(m.acceptData(a)){var d,e,f=a.nodeType,g=f?m.cache:a,h=f?a[m.expando]:m.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){m.isArray(b)?b=b.concat(m.map(b,m.camelCase)):b in d?b=[b]:(b=m.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!P(d):!m.isEmptyObject(d))return}(c||(delete g[h].data,P(g[h])))&&(f?m.cleanData([a],!0):k.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}m.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?m.cache[a[m.expando]]:a[m.expando],!!a&&!P(a)},data:function(a,b,c){return Q(a,b,c)},removeData:function(a,b){return R(a,b)},_data:function(a,b,c){return Q(a,b,c,!0)},_removeData:function(a,b){return R(a,b,!0)}}),m.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=m.data(f),1===f.nodeType&&!m._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=m.camelCase(d.slice(5)),O(f,d,e[d])));m._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){m.data(this,a)}):arguments.length>1?this.each(function(){m.data(this,a,b)}):f?O(f,a,m.data(f,a)):void 0},removeData:function(a){return this.each(function(){m.removeData(this,a)})}}),m.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=m._data(a,b),c&&(!d||m.isArray(c)?d=m._data(a,b,m.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=m.queue(a,b),d=c.length,e=c.shift(),f=m._queueHooks(a,b),g=function(){m.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return m._data(a,c)||m._data(a,c,{empty:m.Callbacks("once memory").add(function(){m._removeData(a,b+"queue"),m._removeData(a,c)})})}}),m.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?m.queue(this[0],a):void 0===b?this:this.each(function(){var c=m.queue(this,a,b);m._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&m.dequeue(this,a)})},dequeue:function(a){return this.each(function(){m.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=m.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=m._data(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var S=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=["Top","Right","Bottom","Left"],U=function(a,b){return a=b||a,"none"===m.css(a,"display")||!m.contains(a.ownerDocument,a)},V=m.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===m.type(c)){e=!0;for(h in c)m.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,m.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(m(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},W=/^(?:checkbox|radio)$/i;!function(){var a=y.createElement("input"),b=y.createElement("div"),c=y.createDocumentFragment();if(b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",k.leadingWhitespace=3===b.firstChild.nodeType,k.tbody=!b.getElementsByTagName("tbody").length,k.htmlSerialize=!!b.getElementsByTagName("link").length,k.html5Clone="<:nav></:nav>"!==y.createElement("nav").cloneNode(!0).outerHTML,a.type="checkbox",a.checked=!0,c.appendChild(a),k.appendChecked=a.checked,b.innerHTML="<textarea>x</textarea>",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,c.appendChild(b),b.innerHTML="<input type='radio' checked='checked' name='t'/>",k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,k.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){k.noCloneEvent=!1}),b.cloneNode(!0).click()),null==k.deleteExpando){k.deleteExpando=!0;try{delete b.test}catch(d){k.deleteExpando=!1}}}(),function(){var b,c,d=y.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(k[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),k[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var X=/^(?:input|select|textarea)$/i,Y=/^key/,Z=/^(?:mouse|pointer|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=/^([^.]*)(?:\.(.+)|)$/;function aa(){return!0}function ba(){return!1}function ca(){try{return y.activeElement}catch(a){}}m.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=m.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof m===K||a&&m.event.triggered===a.type?void 0:m.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(E)||[""],h=b.length;while(h--)f=_.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=m.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=m.event.special[o]||{},l=m.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&m.expr.match.needsContext.test(e),namespace:p.join(".")},i),(n=g[o])||(n=g[o]=[],n.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?n.splice(n.delegateCount++,0,l):n.push(l),m.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m.hasData(a)&&m._data(a);if(r&&(k=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=_.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=m.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,n=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=n.length;while(f--)g=n[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(n.splice(f,1),g.selector&&n.delegateCount--,l.remove&&l.remove.call(a,g));i&&!n.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||m.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)m.event.remove(a,o+b[j],c,d,!0);m.isEmptyObject(k)&&(delete r.handle,m._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,n,o=[d||y],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||y,3!==d.nodeType&&8!==d.nodeType&&!$.test(p+m.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[m.expando]?b:new m.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:m.makeArray(c,[b]),k=m.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!m.isWindow(d)){for(i=k.delegateType||p,$.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||y)&&o.push(l.defaultView||l.parentWindow||a)}n=0;while((h=o[n++])&&!b.isPropagationStopped())b.type=n>1?i:k.bindType||p,f=(m._data(h,"events")||{})[b.type]&&m._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&m.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&m.acceptData(d)&&g&&d[p]&&!m.isWindow(d)){l=d[g],l&&(d[g]=null),m.event.triggered=p;try{d[p]()}catch(r){}m.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=m.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(m._data(this,"events")||{})[a.type]||[],k=m.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=m.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((m.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?m(c,this).index(i)>=0:m.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},fix:function(a){if(a[m.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=Z.test(e)?this.mouseHooks:Y.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new m.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=f.srcElement||y),3===a.target.nodeType&&(a.target=a.target.parentNode),a.metaKey=!!a.metaKey,g.filter?g.filter(a,f):a},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button,g=b.fromElement;return null==a.pageX&&null!=b.clientX&&(d=a.target.ownerDocument||y,e=d.documentElement,c=d.body,a.pageX=b.clientX+(e&&e.scrollLeft||c&&c.scrollLeft||0)-(e&&e.clientLeft||c&&c.clientLeft||0),a.pageY=b.clientY+(e&&e.scrollTop||c&&c.scrollTop||0)-(e&&e.clientTop||c&&c.clientTop||0)),!a.relatedTarget&&g&&(a.relatedTarget=g===a.target?b.toElement:g),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==ca()&&this.focus)try{return this.focus(),!1}catch(a){}},delegateType:"focusin"},blur:{trigger:function(){return this===ca()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return m.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):void 0},_default:function(a){return m.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=m.extend(new m.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?m.event.trigger(e,null,b):m.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},m.removeEvent=y.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){var d="on"+b;a.detachEvent&&(typeof a[d]===K&&(a[d]=null),a.detachEvent(d,c))},m.Event=function(a,b){return this instanceof m.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?aa:ba):this.type=a,b&&m.extend(this,b),this.timeStamp=a&&a.timeStamp||m.now(),void(this[m.expando]=!0)):new m.Event(a,b)},m.Event.prototype={isDefaultPrevented:ba,isPropagationStopped:ba,isImmediatePropagationStopped:ba,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=aa,a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=aa,a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=aa,a&&a.stopImmediatePropagation&&a.stopImmediatePropagation(),this.stopPropagation()}},m.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){m.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!m.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),k.submitBubbles||(m.event.special.submit={setup:function(){return m.nodeName(this,"form")?!1:void m.event.add(this,"click._submit keypress._submit",function(a){var b=a.target,c=m.nodeName(b,"input")||m.nodeName(b,"button")?b.form:void 0;c&&!m._data(c,"submitBubbles")&&(m.event.add(c,"submit._submit",function(a){a._submit_bubble=!0}),m._data(c,"submitBubbles",!0))})},postDispatch:function(a){a._submit_bubble&&(delete a._submit_bubble,this.parentNode&&!a.isTrigger&&m.event.simulate("submit",this.parentNode,a,!0))},teardown:function(){return m.nodeName(this,"form")?!1:void m.event.remove(this,"._submit")}}),k.changeBubbles||(m.event.special.change={setup:function(){return X.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(m.event.add(this,"propertychange._change",function(a){"checked"===a.originalEvent.propertyName&&(this._just_changed=!0)}),m.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1),m.event.simulate("change",this,a,!0)})),!1):void m.event.add(this,"beforeactivate._change",function(a){var b=a.target;X.test(b.nodeName)&&!m._data(b,"changeBubbles")&&(m.event.add(b,"change._change",function(a){!this.parentNode||a.isSimulated||a.isTrigger||m.event.simulate("change",this.parentNode,a,!0)}),m._data(b,"changeBubbles",!0))})},handle:function(a){var b=a.target;return this!==b||a.isSimulated||a.isTrigger||"radio"!==b.type&&"checkbox"!==b.type?a.handleObj.handler.apply(this,arguments):void 0},teardown:function(){return m.event.remove(this,"._change"),!X.test(this.nodeName)}}),k.focusinBubbles||m.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){m.event.simulate(b,a.target,m.event.fix(a),!0)};m.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=m._data(d,b);e||d.addEventListener(a,c,!0),m._data(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=m._data(d,b)-1;e?m._data(d,b,e):(d.removeEventListener(a,c,!0),m._removeData(d,b))}}}),m.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(f in a)this.on(f,b,c,a[f],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=ba;else if(!d)return this;return 1===e&&(g=d,d=function(a){return m().off(a),g.apply(this,arguments)},d.guid=g.guid||(g.guid=m.guid++)),this.each(function(){m.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,m(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=ba),this.each(function(){m.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){m.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?m.event.trigger(a,b,c,!0):void 0}});function da(a){var b=ea.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}var ea="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",fa=/ jQuery\d+="(?:null|\d+)"/g,ga=new RegExp("<(?:"+ea+")[\\s/>]","i"),ha=/^\s+/,ia=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,ja=/<([\w:]+)/,ka=/<tbody/i,la=/<|&#?\w+;/,ma=/<(?:script|style|link)/i,na=/checked\s*(?:[^=]|=\s*.checked.)/i,oa=/^$|\/(?:java|ecma)script/i,pa=/^true\/(.*)/,qa=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,ra={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:k.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},sa=da(y),ta=sa.appendChild(y.createElement("div"));ra.optgroup=ra.option,ra.tbody=ra.tfoot=ra.colgroup=ra.caption=ra.thead,ra.th=ra.td;function ua(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==K?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==K?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||m.nodeName(d,b)?f.push(d):m.merge(f,ua(d,b));return void 0===b||b&&m.nodeName(a,b)?m.merge([a],f):f}function va(a){W.test(a.type)&&(a.defaultChecked=a.checked)}function wa(a,b){return m.nodeName(a,"table")&&m.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function xa(a){return a.type=(null!==m.find.attr(a,"type"))+"/"+a.type,a}function ya(a){var b=pa.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function za(a,b){for(var c,d=0;null!=(c=a[d]);d++)m._data(c,"globalEval",!b||m._data(b[d],"globalEval"))}function Aa(a,b){if(1===b.nodeType&&m.hasData(a)){var c,d,e,f=m._data(a),g=m._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)m.event.add(b,c,h[c][d])}g.data&&(g.data=m.extend({},g.data))}}function Ba(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!k.noCloneEvent&&b[m.expando]){e=m._data(b);for(d in e.events)m.removeEvent(b,d,e.handle);b.removeAttribute(m.expando)}"script"===c&&b.text!==a.text?(xa(b).text=a.text,ya(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),k.html5Clone&&a.innerHTML&&!m.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&W.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}m.extend({clone:function(a,b,c){var d,e,f,g,h,i=m.contains(a.ownerDocument,a);if(k.html5Clone||m.isXMLDoc(a)||!ga.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(ta.innerHTML=a.outerHTML,ta.removeChild(f=ta.firstChild)),!(k.noCloneEvent&&k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||m.isXMLDoc(a)))for(d=ua(f),h=ua(a),g=0;null!=(e=h[g]);++g)d[g]&&Ba(e,d[g]);if(b)if(c)for(h=h||ua(a),d=d||ua(f),g=0;null!=(e=h[g]);g++)Aa(e,d[g]);else Aa(a,f);return d=ua(f,"script"),d.length>0&&za(d,!i&&ua(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,l,n=a.length,o=da(b),p=[],q=0;n>q;q++)if(f=a[q],f||0===f)if("object"===m.type(f))m.merge(p,f.nodeType?[f]:f);else if(la.test(f)){h=h||o.appendChild(b.createElement("div")),i=(ja.exec(f)||["",""])[1].toLowerCase(),l=ra[i]||ra._default,h.innerHTML=l[1]+f.replace(ia,"<$1></$2>")+l[2],e=l[0];while(e--)h=h.lastChild;if(!k.leadingWhitespace&&ha.test(f)&&p.push(b.createTextNode(ha.exec(f)[0])),!k.tbody){f="table"!==i||ka.test(f)?"<table>"!==l[1]||ka.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)m.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}m.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),k.appendChecked||m.grep(ua(p,"input"),va),q=0;while(f=p[q++])if((!d||-1===m.inArray(f,d))&&(g=m.contains(f.ownerDocument,f),h=ua(o.appendChild(f),"script"),g&&za(h),c)){e=0;while(f=h[e++])oa.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=m.expando,j=m.cache,l=k.deleteExpando,n=m.event.special;null!=(d=a[h]);h++)if((b||m.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)n[e]?m.event.remove(d,e):m.removeEvent(d,e,g.handle);j[f]&&(delete j[f],l?delete d[i]:typeof d.removeAttribute!==K?d.removeAttribute(i):d[i]=null,c.push(f))}}}),m.fn.extend({text:function(a){return V(this,function(a){return void 0===a?m.text(this):this.empty().append((this[0]&&this[0].ownerDocument||y).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wa(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wa(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?m.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||m.cleanData(ua(c)),c.parentNode&&(b&&m.contains(c.ownerDocument,c)&&za(ua(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&m.cleanData(ua(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&m.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return m.clone(this,a,b)})},html:function(a){return V(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(fa,""):void 0;if(!("string"!=typeof a||ma.test(a)||!k.htmlSerialize&&ga.test(a)||!k.leadingWhitespace&&ha.test(a)||ra[(ja.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(ia,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(m.cleanData(ua(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,m.cleanData(ua(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,n=this,o=l-1,p=a[0],q=m.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&na.test(p))return this.each(function(c){var d=n.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(i=m.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=m.map(ua(i,"script"),xa),f=g.length;l>j;j++)d=i,j!==o&&(d=m.clone(d,!0,!0),f&&m.merge(g,ua(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,m.map(g,ya),j=0;f>j;j++)d=g[j],oa.test(d.type||"")&&!m._data(d,"globalEval")&&m.contains(h,d)&&(d.src?m._evalUrl&&m._evalUrl(d.src):m.globalEval((d.text||d.textContent||d.innerHTML||"").replace(qa,"")));i=c=null}return this}}),m.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){m.fn[a]=function(a){for(var c,d=0,e=[],g=m(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),m(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Ca,Da={};function Ea(b,c){var d,e=m(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:m.css(e[0],"display");return e.detach(),f}function Fa(a){var b=y,c=Da[a];return c||(c=Ea(a,b),"none"!==c&&c||(Ca=(Ca||m("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=(Ca[0].contentWindow||Ca[0].contentDocument).document,b.write(),b.close(),c=Ea(a,b),Ca.detach()),Da[a]=c),c}!function(){var a;k.shrinkWrapBlocks=function(){if(null!=a)return a;a=!1;var b,c,d;return c=y.getElementsByTagName("body")[0],c&&c.style?(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:1px;width:1px;zoom:1",b.appendChild(y.createElement("div")).style.width="5px",a=3!==b.offsetWidth),c.removeChild(d),a):void 0}}();var Ga=/^margin/,Ha=new RegExp("^("+S+")(?!px)[a-z%]+$","i"),Ia,Ja,Ka=/^(top|right|bottom|left)$/;a.getComputedStyle?(Ia=function(b){return b.ownerDocument.defaultView.opener?b.ownerDocument.defaultView.getComputedStyle(b,null):a.getComputedStyle(b,null)},Ja=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ia(a),g=c?c.getPropertyValue(b)||c[b]:void 0,c&&(""!==g||m.contains(a.ownerDocument,a)||(g=m.style(a,b)),Ha.test(g)&&Ga.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0===g?g:g+""}):y.documentElement.currentStyle&&(Ia=function(a){return a.currentStyle},Ja=function(a,b,c){var d,e,f,g,h=a.style;return c=c||Ia(a),g=c?c[b]:void 0,null==g&&h&&h[b]&&(g=h[b]),Ha.test(g)&&!Ka.test(b)&&(d=h.left,e=a.runtimeStyle,f=e&&e.left,f&&(e.left=a.currentStyle.left),h.left="fontSize"===b?"1em":g,g=h.pixelLeft+"px",h.left=d,f&&(e.left=f)),void 0===g?g:g+""||"auto"});function La(a,b){return{get:function(){var c=a();if(null!=c)return c?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d,e,f,g,h;if(b=y.createElement("div"),b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",d=b.getElementsByTagName("a")[0],c=d&&d.style){c.cssText="float:left;opacity:.5",k.opacity="0.5"===c.opacity,k.cssFloat=!!c.cssFloat,b.style.backgroundClip="content-box",b.cloneNode(!0).style.backgroundClip="",k.clearCloneStyle="content-box"===b.style.backgroundClip,k.boxSizing=""===c.boxSizing||""===c.MozBoxSizing||""===c.WebkitBoxSizing,m.extend(k,{reliableHiddenOffsets:function(){return null==g&&i(),g},boxSizingReliable:function(){return null==f&&i(),f},pixelPosition:function(){return null==e&&i(),e},reliableMarginRight:function(){return null==h&&i(),h}});function i(){var b,c,d,i;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),b.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",e=f=!1,h=!0,a.getComputedStyle&&(e="1%"!==(a.getComputedStyle(b,null)||{}).top,f="4px"===(a.getComputedStyle(b,null)||{width:"4px"}).width,i=b.appendChild(y.createElement("div")),i.style.cssText=b.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",i.style.marginRight=i.style.width="0",b.style.width="1px",h=!parseFloat((a.getComputedStyle(i,null)||{}).marginRight),b.removeChild(i)),b.innerHTML="<table><tr><td></td><td>t</td></tr></table>",i=b.getElementsByTagName("td"),i[0].style.cssText="margin:0;border:0;padding:0;display:none",g=0===i[0].offsetHeight,g&&(i[0].style.display="",i[1].style.display="none",g=0===i[0].offsetHeight),c.removeChild(d))}}}(),m.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var Ma=/alpha\([^)]*\)/i,Na=/opacity\s*=\s*([^)]*)/,Oa=/^(none|table(?!-c[ea]).+)/,Pa=new RegExp("^("+S+")(.*)$","i"),Qa=new RegExp("^([+-])=("+S+")","i"),Ra={position:"absolute",visibility:"hidden",display:"block"},Sa={letterSpacing:"0",fontWeight:"400"},Ta=["Webkit","O","Moz","ms"];function Ua(a,b){if(b in a)return b;var c=b.charAt(0).toUpperCase()+b.slice(1),d=b,e=Ta.length;while(e--)if(b=Ta[e]+c,b in a)return b;return d}function Va(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=m._data(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&U(d)&&(f[g]=m._data(d,"olddisplay",Fa(d.nodeName)))):(e=U(d),(c&&"none"!==c||!e)&&m._data(d,"olddisplay",e?c:m.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}function Wa(a,b,c){var d=Pa.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Xa(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=m.css(a,c+T[f],!0,e)),d?("content"===c&&(g-=m.css(a,"padding"+T[f],!0,e)),"margin"!==c&&(g-=m.css(a,"border"+T[f]+"Width",!0,e))):(g+=m.css(a,"padding"+T[f],!0,e),"padding"!==c&&(g+=m.css(a,"border"+T[f]+"Width",!0,e)));return g}function Ya(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=Ia(a),g=k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=Ja(a,b,f),(0>e||null==e)&&(e=a.style[b]),Ha.test(e))return e;d=g&&(k.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Xa(a,b,c||(g?"border":"content"),d,f)+"px"}m.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=Ja(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":k.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=m.camelCase(b),i=a.style;if(b=m.cssProps[h]||(m.cssProps[h]=Ua(i,h)),g=m.cssHooks[b]||m.cssHooks[h],void 0===c)return g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b];if(f=typeof c,"string"===f&&(e=Qa.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(m.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||m.cssNumber[h]||(c+="px"),k.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),!(g&&"set"in g&&void 0===(c=g.set(a,c,d)))))try{i[b]=c}catch(j){}}},css:function(a,b,c,d){var e,f,g,h=m.camelCase(b);return b=m.cssProps[h]||(m.cssProps[h]=Ua(a.style,h)),g=m.cssHooks[b]||m.cssHooks[h],g&&"get"in g&&(f=g.get(a,!0,c)),void 0===f&&(f=Ja(a,b,d)),"normal"===f&&b in Sa&&(f=Sa[b]),""===c||c?(e=parseFloat(f),c===!0||m.isNumeric(e)?e||0:f):f}}),m.each(["height","width"],function(a,b){m.cssHooks[b]={get:function(a,c,d){return c?Oa.test(m.css(a,"display"))&&0===a.offsetWidth?m.swap(a,Ra,function(){return Ya(a,b,d)}):Ya(a,b,d):void 0},set:function(a,c,d){var e=d&&Ia(a);return Wa(a,c,d?Xa(a,b,d,k.boxSizing&&"border-box"===m.css(a,"boxSizing",!1,e),e):0)}}}),k.opacity||(m.cssHooks.opacity={get:function(a,b){return Na.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=m.isNumeric(b)?"alpha(opacity="+100*b+")":"",f=d&&d.filter||c.filter||"";c.zoom=1,(b>=1||""===b)&&""===m.trim(f.replace(Ma,""))&&c.removeAttribute&&(c.removeAttribute("filter"),""===b||d&&!d.filter)||(c.filter=Ma.test(f)?f.replace(Ma,e):f+" "+e)}}),m.cssHooks.marginRight=La(k.reliableMarginRight,function(a,b){return b?m.swap(a,{display:"inline-block"},Ja,[a,"marginRight"]):void 0}),m.each({margin:"",padding:"",border:"Width"},function(a,b){m.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+T[d]+b]=f[d]||f[d-2]||f[0];return e}},Ga.test(a)||(m.cssHooks[a+b].set=Wa)}),m.fn.extend({css:function(a,b){return V(this,function(a,b,c){var d,e,f={},g=0;if(m.isArray(b)){for(d=Ia(a),e=b.length;e>g;g++)f[b[g]]=m.css(a,b[g],!1,d);return f}return void 0!==c?m.style(a,b,c):m.css(a,b)},a,b,arguments.length>1)},show:function(){return Va(this,!0)},hide:function(){return Va(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){U(this)?m(this).show():m(this).hide()})}});function Za(a,b,c,d,e){
return new Za.prototype.init(a,b,c,d,e)}m.Tween=Za,Za.prototype={constructor:Za,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(m.cssNumber[c]?"":"px")},cur:function(){var a=Za.propHooks[this.prop];return a&&a.get?a.get(this):Za.propHooks._default.get(this)},run:function(a){var b,c=Za.propHooks[this.prop];return this.options.duration?this.pos=b=m.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):this.pos=b=a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Za.propHooks._default.set(this),this}},Za.prototype.init.prototype=Za.prototype,Za.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=m.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){m.fx.step[a.prop]?m.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[m.cssProps[a.prop]]||m.cssHooks[a.prop])?m.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},Za.propHooks.scrollTop=Za.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},m.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},m.fx=Za.prototype.init,m.fx.step={};var $a,_a,ab=/^(?:toggle|show|hide)$/,bb=new RegExp("^(?:([+-])=|)("+S+")([a-z%]*)$","i"),cb=/queueHooks$/,db=[ib],eb={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=bb.exec(b),f=e&&e[3]||(m.cssNumber[a]?"":"px"),g=(m.cssNumber[a]||"px"!==f&&+d)&&bb.exec(m.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,m.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function fb(){return setTimeout(function(){$a=void 0}),$a=m.now()}function gb(a,b){var c,d={height:a},e=0;for(b=b?1:0;4>e;e+=2-b)c=T[e],d["margin"+c]=d["padding"+c]=a;return b&&(d.opacity=d.width=a),d}function hb(a,b,c){for(var d,e=(eb[b]||[]).concat(eb["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function ib(a,b,c){var d,e,f,g,h,i,j,l,n=this,o={},p=a.style,q=a.nodeType&&U(a),r=m._data(a,"fxshow");c.queue||(h=m._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,n.always(function(){n.always(function(){h.unqueued--,m.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[p.overflow,p.overflowX,p.overflowY],j=m.css(a,"display"),l="none"===j?m._data(a,"olddisplay")||Fa(a.nodeName):j,"inline"===l&&"none"===m.css(a,"float")&&(k.inlineBlockNeedsLayout&&"inline"!==Fa(a.nodeName)?p.zoom=1:p.display="inline-block")),c.overflow&&(p.overflow="hidden",k.shrinkWrapBlocks()||n.always(function(){p.overflow=c.overflow[0],p.overflowX=c.overflow[1],p.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],ab.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(q?"hide":"show")){if("show"!==e||!r||void 0===r[d])continue;q=!0}o[d]=r&&r[d]||m.style(a,d)}else j=void 0;if(m.isEmptyObject(o))"inline"===("none"===j?Fa(a.nodeName):j)&&(p.display=j);else{r?"hidden"in r&&(q=r.hidden):r=m._data(a,"fxshow",{}),f&&(r.hidden=!q),q?m(a).show():n.done(function(){m(a).hide()}),n.done(function(){var b;m._removeData(a,"fxshow");for(b in o)m.style(a,b,o[b])});for(d in o)g=hb(q?r[d]:0,d,n),d in r||(r[d]=g.start,q&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function jb(a,b){var c,d,e,f,g;for(c in a)if(d=m.camelCase(c),e=b[d],f=a[c],m.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=m.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function kb(a,b,c){var d,e,f=0,g=db.length,h=m.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=$a||fb(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:m.extend({},b),opts:m.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:$a||fb(),duration:c.duration,tweens:[],createTween:function(b,c){var d=m.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(jb(k,j.opts.specialEasing);g>f;f++)if(d=db[f].call(j,a,k,j.opts))return d;return m.map(k,hb,j),m.isFunction(j.opts.start)&&j.opts.start.call(a,j),m.fx.timer(m.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}m.Animation=m.extend(kb,{tweener:function(a,b){m.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],eb[c]=eb[c]||[],eb[c].unshift(b)},prefilter:function(a,b){b?db.unshift(a):db.push(a)}}),m.speed=function(a,b,c){var d=a&&"object"==typeof a?m.extend({},a):{complete:c||!c&&b||m.isFunction(a)&&a,duration:a,easing:c&&b||b&&!m.isFunction(b)&&b};return d.duration=m.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in m.fx.speeds?m.fx.speeds[d.duration]:m.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){m.isFunction(d.old)&&d.old.call(this),d.queue&&m.dequeue(this,d.queue)},d},m.fn.extend({fadeTo:function(a,b,c,d){return this.filter(U).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=m.isEmptyObject(a),f=m.speed(b,c,d),g=function(){var b=kb(this,m.extend({},a),f);(e||m._data(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=m.timers,g=m._data(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&cb.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&m.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=m._data(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=m.timers,g=d?d.length:0;for(c.finish=!0,m.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),m.each(["toggle","show","hide"],function(a,b){var c=m.fn[b];m.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(gb(b,!0),a,d,e)}}),m.each({slideDown:gb("show"),slideUp:gb("hide"),slideToggle:gb("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){m.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),m.timers=[],m.fx.tick=function(){var a,b=m.timers,c=0;for($a=m.now();c<b.length;c++)a=b[c],a()||b[c]!==a||b.splice(c--,1);b.length||m.fx.stop(),$a=void 0},m.fx.timer=function(a){m.timers.push(a),a()?m.fx.start():m.timers.pop()},m.fx.interval=13,m.fx.start=function(){_a||(_a=setInterval(m.fx.tick,m.fx.interval))},m.fx.stop=function(){clearInterval(_a),_a=null},m.fx.speeds={slow:600,fast:200,_default:400},m.fn.delay=function(a,b){return a=m.fx?m.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a,b,c,d,e;b=y.createElement("div"),b.setAttribute("className","t"),b.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",d=b.getElementsByTagName("a")[0],c=y.createElement("select"),e=c.appendChild(y.createElement("option")),a=b.getElementsByTagName("input")[0],d.style.cssText="top:1px",k.getSetAttribute="t"!==b.className,k.style=/top/.test(d.getAttribute("style")),k.hrefNormalized="/a"===d.getAttribute("href"),k.checkOn=!!a.value,k.optSelected=e.selected,k.enctype=!!y.createElement("form").enctype,c.disabled=!0,k.optDisabled=!e.disabled,a=y.createElement("input"),a.setAttribute("value",""),k.input=""===a.getAttribute("value"),a.value="t",a.setAttribute("type","radio"),k.radioValue="t"===a.value}();var lb=/\r/g;m.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=m.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,m(this).val()):a,null==e?e="":"number"==typeof e?e+="":m.isArray(e)&&(e=m.map(e,function(a){return null==a?"":a+""})),b=m.valHooks[this.type]||m.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=m.valHooks[e.type]||m.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(lb,""):null==c?"":c)}}}),m.extend({valHooks:{option:{get:function(a){var b=m.find.attr(a,"value");return null!=b?b:m.trim(m.text(a))}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(k.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&m.nodeName(c.parentNode,"optgroup"))){if(b=m(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=m.makeArray(b),g=e.length;while(g--)if(d=e[g],m.inArray(m.valHooks.option.get(d),f)>=0)try{d.selected=c=!0}catch(h){d.scrollHeight}else d.selected=!1;return c||(a.selectedIndex=-1),e}}}}),m.each(["radio","checkbox"],function(){m.valHooks[this]={set:function(a,b){return m.isArray(b)?a.checked=m.inArray(m(a).val(),b)>=0:void 0}},k.checkOn||(m.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var mb,nb,ob=m.expr.attrHandle,pb=/^(?:checked|selected)$/i,qb=k.getSetAttribute,rb=k.input;m.fn.extend({attr:function(a,b){return V(this,m.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){m.removeAttr(this,a)})}}),m.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===K?m.prop(a,b,c):(1===f&&m.isXMLDoc(a)||(b=b.toLowerCase(),d=m.attrHooks[b]||(m.expr.match.bool.test(b)?nb:mb)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=m.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void m.removeAttr(a,b))},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(E);if(f&&1===a.nodeType)while(c=f[e++])d=m.propFix[c]||c,m.expr.match.bool.test(c)?rb&&qb||!pb.test(c)?a[d]=!1:a[m.camelCase("default-"+c)]=a[d]=!1:m.attr(a,c,""),a.removeAttribute(qb?c:d)},attrHooks:{type:{set:function(a,b){if(!k.radioValue&&"radio"===b&&m.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),nb={set:function(a,b,c){return b===!1?m.removeAttr(a,c):rb&&qb||!pb.test(c)?a.setAttribute(!qb&&m.propFix[c]||c,c):a[m.camelCase("default-"+c)]=a[c]=!0,c}},m.each(m.expr.match.bool.source.match(/\w+/g),function(a,b){var c=ob[b]||m.find.attr;ob[b]=rb&&qb||!pb.test(b)?function(a,b,d){var e,f;return d||(f=ob[b],ob[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,ob[b]=f),e}:function(a,b,c){return c?void 0:a[m.camelCase("default-"+b)]?b.toLowerCase():null}}),rb&&qb||(m.attrHooks.value={set:function(a,b,c){return m.nodeName(a,"input")?void(a.defaultValue=b):mb&&mb.set(a,b,c)}}),qb||(mb={set:function(a,b,c){var d=a.getAttributeNode(c);return d||a.setAttributeNode(d=a.ownerDocument.createAttribute(c)),d.value=b+="","value"===c||b===a.getAttribute(c)?b:void 0}},ob.id=ob.name=ob.coords=function(a,b,c){var d;return c?void 0:(d=a.getAttributeNode(b))&&""!==d.value?d.value:null},m.valHooks.button={get:function(a,b){var c=a.getAttributeNode(b);return c&&c.specified?c.value:void 0},set:mb.set},m.attrHooks.contenteditable={set:function(a,b,c){mb.set(a,""===b?!1:b,c)}},m.each(["width","height"],function(a,b){m.attrHooks[b]={set:function(a,c){return""===c?(a.setAttribute(b,"auto"),c):void 0}}})),k.style||(m.attrHooks.style={get:function(a){return a.style.cssText||void 0},set:function(a,b){return a.style.cssText=b+""}});var sb=/^(?:input|select|textarea|button|object)$/i,tb=/^(?:a|area)$/i;m.fn.extend({prop:function(a,b){return V(this,m.prop,a,b,arguments.length>1)},removeProp:function(a){return a=m.propFix[a]||a,this.each(function(){try{this[a]=void 0,delete this[a]}catch(b){}})}}),m.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!m.isXMLDoc(a),f&&(b=m.propFix[b]||b,e=m.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=m.find.attr(a,"tabindex");return b?parseInt(b,10):sb.test(a.nodeName)||tb.test(a.nodeName)&&a.href?0:-1}}}}),k.hrefNormalized||m.each(["href","src"],function(a,b){m.propHooks[b]={get:function(a){return a.getAttribute(b,4)}}}),k.optSelected||(m.propHooks.selected={get:function(a){var b=a.parentNode;return b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex),null}}),m.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){m.propFix[this.toLowerCase()]=this}),k.enctype||(m.propFix.enctype="encoding");var ub=/[\t\r\n\f]/g;m.fn.extend({addClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j="string"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).addClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ub," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=m.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0,i=this.length,j=0===arguments.length||"string"==typeof a&&a;if(m.isFunction(a))return this.each(function(b){m(this).removeClass(a.call(this,b,this.className))});if(j)for(b=(a||"").match(E)||[];i>h;h++)if(c=this[h],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ub," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?m.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(m.isFunction(a)?function(c){m(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=m(this),f=a.match(E)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===K||"boolean"===c)&&(this.className&&m._data(this,"__className__",this.className),this.className=this.className||a===!1?"":m._data(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(ub," ").indexOf(b)>=0)return!0;return!1}}),m.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){m.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),m.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var vb=m.now(),wb=/\?/,xb=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;m.parseJSON=function(b){if(a.JSON&&a.JSON.parse)return a.JSON.parse(b+"");var c,d=null,e=m.trim(b+"");return e&&!m.trim(e.replace(xb,function(a,b,e,f){return c&&b&&(d=0),0===d?a:(c=e||b,d+=!f-!e,"")}))?Function("return "+e)():m.error("Invalid JSON: "+b)},m.parseXML=function(b){var c,d;if(!b||"string"!=typeof b)return null;try{a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b))}catch(e){c=void 0}return c&&c.documentElement&&!c.getElementsByTagName("parsererror").length||m.error("Invalid XML: "+b),c};var yb,zb,Ab=/#.*$/,Bb=/([?&])_=[^&]*/,Cb=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Db=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Eb=/^(?:GET|HEAD)$/,Fb=/^\/\//,Gb=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,Hb={},Ib={},Jb="*/".concat("*");try{zb=location.href}catch(Kb){zb=y.createElement("a"),zb.href="",zb=zb.href}yb=Gb.exec(zb.toLowerCase())||[];function Lb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(E)||[];if(m.isFunction(c))while(d=f[e++])"+"===d.charAt(0)?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function Mb(a,b,c,d){var e={},f=a===Ib;function g(h){var i;return e[h]=!0,m.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function Nb(a,b){var c,d,e=m.ajaxSettings.flatOptions||{};for(d in b)void 0!==b[d]&&((e[d]?a:c||(c={}))[d]=b[d]);return c&&m.extend(!0,a,c),a}function Ob(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===e&&(e=a.mimeType||b.getResponseHeader("Content-Type"));if(e)for(g in h)if(h[g]&&h[g].test(e)){i.unshift(g);break}if(i[0]in c)f=i[0];else{for(g in c){if(!i[0]||a.converters[g+" "+i[0]]){f=g;break}d||(d=g)}f=f||d}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function Pb(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}m.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:zb,type:"GET",isLocal:Db.test(yb[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Jb,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":m.parseJSON,"text xml":m.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?Nb(Nb(a,m.ajaxSettings),b):Nb(m.ajaxSettings,a)},ajaxPrefilter:Lb(Hb),ajaxTransport:Lb(Ib),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=m.ajaxSetup({},b),l=k.context||k,n=k.context&&(l.nodeType||l.jquery)?m(l):m.event,o=m.Deferred(),p=m.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!j){j={};while(b=Cb.exec(f))j[b[1].toLowerCase()]=b[2]}b=j[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?f:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return i&&i.abort(b),x(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||zb)+"").replace(Ab,"").replace(Fb,yb[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=m.trim(k.dataType||"*").toLowerCase().match(E)||[""],null==k.crossDomain&&(c=Gb.exec(k.url.toLowerCase()),k.crossDomain=!(!c||c[1]===yb[1]&&c[2]===yb[2]&&(c[3]||("http:"===c[1]?"80":"443"))===(yb[3]||("http:"===yb[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=m.param(k.data,k.traditional)),Mb(Hb,k,b,v),2===t)return v;h=m.event&&k.global,h&&0===m.active++&&m.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!Eb.test(k.type),e=k.url,k.hasContent||(k.data&&(e=k.url+=(wb.test(e)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=Bb.test(e)?e.replace(Bb,"$1_="+vb++):e+(wb.test(e)?"&":"?")+"_="+vb++)),k.ifModified&&(m.lastModified[e]&&v.setRequestHeader("If-Modified-Since",m.lastModified[e]),m.etag[e]&&v.setRequestHeader("If-None-Match",m.etag[e])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+Jb+"; q=0.01":""):k.accepts["*"]);for(d in k.headers)v.setRequestHeader(d,k.headers[d]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(d in{success:1,error:1,complete:1})v[d](k[d]);if(i=Mb(Ib,k,b,v)){v.readyState=1,h&&n.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,i.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,c,d){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),i=void 0,f=d||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,c&&(u=Ob(k,v,c)),u=Pb(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(m.lastModified[e]=w),w=v.getResponseHeader("etag"),w&&(m.etag[e]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?o.resolveWith(l,[r,x,v]):o.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,h&&n.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),h&&(n.trigger("ajaxComplete",[v,k]),--m.active||m.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return m.get(a,b,c,"json")},getScript:function(a,b){return m.get(a,void 0,b,"script")}}),m.each(["get","post"],function(a,b){m[b]=function(a,c,d,e){return m.isFunction(c)&&(e=e||d,d=c,c=void 0),m.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),m._evalUrl=function(a){return m.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},m.fn.extend({wrapAll:function(a){if(m.isFunction(a))return this.each(function(b){m(this).wrapAll(a.call(this,b))});if(this[0]){var b=m(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&1===a.firstChild.nodeType)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return this.each(m.isFunction(a)?function(b){m(this).wrapInner(a.call(this,b))}:function(){var b=m(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=m.isFunction(a);return this.each(function(c){m(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){m.nodeName(this,"body")||m(this).replaceWith(this.childNodes)}).end()}}),m.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0||!k.reliableHiddenOffsets()&&"none"===(a.style&&a.style.display||m.css(a,"display"))},m.expr.filters.visible=function(a){return!m.expr.filters.hidden(a)};var Qb=/%20/g,Rb=/\[\]$/,Sb=/\r?\n/g,Tb=/^(?:submit|button|image|reset|file)$/i,Ub=/^(?:input|select|textarea|keygen)/i;function Vb(a,b,c,d){var e;if(m.isArray(b))m.each(b,function(b,e){c||Rb.test(a)?d(a,e):Vb(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==m.type(b))d(a,b);else for(e in b)Vb(a+"["+e+"]",b[e],c,d)}m.param=function(a,b){var c,d=[],e=function(a,b){b=m.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=m.ajaxSettings&&m.ajaxSettings.traditional),m.isArray(a)||a.jquery&&!m.isPlainObject(a))m.each(a,function(){e(this.name,this.value)});else for(c in a)Vb(c,a[c],b,e);return d.join("&").replace(Qb,"+")},m.fn.extend({serialize:function(){return m.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=m.prop(this,"elements");return a?m.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!m(this).is(":disabled")&&Ub.test(this.nodeName)&&!Tb.test(a)&&(this.checked||!W.test(a))}).map(function(a,b){var c=m(this).val();return null==c?null:m.isArray(c)?m.map(c,function(a){return{name:b.name,value:a.replace(Sb,"\r\n")}}):{name:b.name,value:c.replace(Sb,"\r\n")}}).get()}}),m.ajaxSettings.xhr=void 0!==a.ActiveXObject?function(){return!this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&Zb()||$b()}:Zb;var Wb=0,Xb={},Yb=m.ajaxSettings.xhr();a.attachEvent&&a.attachEvent("onunload",function(){for(var a in Xb)Xb[a](void 0,!0)}),k.cors=!!Yb&&"withCredentials"in Yb,Yb=k.ajax=!!Yb,Yb&&m.ajaxTransport(function(a){if(!a.crossDomain||k.cors){var b;return{send:function(c,d){var e,f=a.xhr(),g=++Wb;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)void 0!==c[e]&&f.setRequestHeader(e,c[e]+"");f.send(a.hasContent&&a.data||null),b=function(c,e){var h,i,j;if(b&&(e||4===f.readyState))if(delete Xb[g],b=void 0,f.onreadystatechange=m.noop,e)4!==f.readyState&&f.abort();else{j={},h=f.status,"string"==typeof f.responseText&&(j.text=f.responseText);try{i=f.statusText}catch(k){i=""}h||!a.isLocal||a.crossDomain?1223===h&&(h=204):h=j.text?200:404}j&&d(h,i,j,f.getAllResponseHeaders())},a.async?4===f.readyState?setTimeout(b):f.onreadystatechange=Xb[g]=b:b()},abort:function(){b&&b(void 0,!0)}}}});function Zb(){try{return new a.XMLHttpRequest}catch(b){}}function $b(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}m.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return m.globalEval(a),a}}}),m.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),m.ajaxTransport("script",function(a){if(a.crossDomain){var b,c=y.head||m("head")[0]||y.documentElement;return{send:function(d,e){b=y.createElement("script"),b.async=!0,a.scriptCharset&&(b.charset=a.scriptCharset),b.src=a.url,b.onload=b.onreadystatechange=function(a,c){(c||!b.readyState||/loaded|complete/.test(b.readyState))&&(b.onload=b.onreadystatechange=null,b.parentNode&&b.parentNode.removeChild(b),b=null,c||e(200,"success"))},c.insertBefore(b,c.firstChild)},abort:function(){b&&b.onload(void 0,!0)}}}});var _b=[],ac=/(=)\?(?=&|$)|\?\?/;m.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=_b.pop()||m.expando+"_"+vb++;return this[a]=!0,a}}),m.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(ac.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&ac.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=m.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(ac,"$1"+e):b.jsonp!==!1&&(b.url+=(wb.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||m.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,_b.push(e)),g&&m.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),m.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||y;var d=u.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=m.buildFragment([a],b,e),e&&e.length&&m(e).remove(),m.merge([],d.childNodes))};var bc=m.fn.load;m.fn.load=function(a,b,c){if("string"!=typeof a&&bc)return bc.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=m.trim(a.slice(h,a.length)),a=a.slice(0,h)),m.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(f="POST"),g.length>0&&m.ajax({url:a,type:f,dataType:"html",data:b}).done(function(a){e=arguments,g.html(d?m("<div>").append(m.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,e||[a.responseText,b,a])}),this},m.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){m.fn[b]=function(a){return this.on(b,a)}}),m.expr.filters.animated=function(a){return m.grep(m.timers,function(b){return a===b.elem}).length};var cc=a.document.documentElement;function dc(a){return m.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}m.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=m.css(a,"position"),l=m(a),n={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=m.css(a,"top"),i=m.css(a,"left"),j=("absolute"===k||"fixed"===k)&&m.inArray("auto",[f,i])>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),m.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(n.top=b.top-h.top+g),null!=b.left&&(n.left=b.left-h.left+e),"using"in b?b.using.call(a,n):l.css(n)}},m.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){m.offset.setOffset(this,a,b)});var b,c,d={top:0,left:0},e=this[0],f=e&&e.ownerDocument;if(f)return b=f.documentElement,m.contains(b,e)?(typeof e.getBoundingClientRect!==K&&(d=e.getBoundingClientRect()),c=dc(f),{top:d.top+(c.pageYOffset||b.scrollTop)-(b.clientTop||0),left:d.left+(c.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}):d},position:function(){if(this[0]){var a,b,c={top:0,left:0},d=this[0];return"fixed"===m.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),m.nodeName(a[0],"html")||(c=a.offset()),c.top+=m.css(a[0],"borderTopWidth",!0),c.left+=m.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-m.css(d,"marginTop",!0),left:b.left-c.left-m.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||cc;while(a&&!m.nodeName(a,"html")&&"static"===m.css(a,"position"))a=a.offsetParent;return a||cc})}}),m.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c=/Y/.test(b);m.fn[a]=function(d){return V(this,function(a,d,e){var f=dc(a);return void 0===e?f?b in f?f[b]:f.document.documentElement[d]:a[d]:void(f?f.scrollTo(c?m(f).scrollLeft():e,c?e:m(f).scrollTop()):a[d]=e)},a,d,arguments.length,null)}}),m.each(["top","left"],function(a,b){m.cssHooks[b]=La(k.pixelPosition,function(a,c){return c?(c=Ja(a,b),Ha.test(c)?m(a).position()[b]+"px":c):void 0})}),m.each({Height:"height",Width:"width"},function(a,b){m.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){m.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return V(this,function(b,c,d){var e;return m.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?m.css(b,c,g):m.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),m.fn.size=function(){return this.length},m.fn.andSelf=m.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return m});var ec=a.jQuery,fc=a.$;return m.noConflict=function(b){return a.$===m&&(a.$=fc),b&&a.jQuery===m&&(a.jQuery=ec),m},typeof b===K&&(a.jQuery=a.$=m),m});
//# sourceMappingURL=jquery.min.map
|
src/parser/priest/holy/modules/spells/Renew.js
|
ronaldpereira/WoWAnalyzer
|
import React from 'react';
import SPELLS from 'common/SPELLS';
import Analyzer from 'parser/core/Analyzer';
import DistanceMoved from 'parser/shared/modules/others/DistanceMoved';
import SpellUsable from 'parser/shared/modules/SpellUsable';
import SpellLink from 'common/SpellLink';
import { ABILITIES_THAT_TRIGGER_ENDURING_RENEWAL } from '../../constants';
const MS_BUFFER = 100;
class Renew extends Analyzer {
static dependencies = {
distanceMoved: DistanceMoved,
spellUsable: SpellUsable,
};
totalRenewHealing = 0;
totalRenewOverhealing = 0;
totalRenewAbsorbs = 0;
totalRenewTicks = 0;
renewsCast = 0;
goodRenews = 0;
// A list of the reasons that a renew is listed as "bad". I may expand upon this later in a card.
badRenewReason = {};
totalRenewApplications = 0;
salvationActive = false;
lastSalvationCast = 0;
renewsFromSalvation = 0;
enduringRenewalActive = false;
lastEnduringRenewalSpellCast = 0;
renewsFromEnduringRenewal = 0;
benedictionActive = false;
renewsFromBenedictionAndRenew = 0;
lastGCD = null;
lastCast = null;
constructor(...args) {
super(...args);
if (this.selectedCombatant.hasTalent(SPELLS.HOLY_WORD_SALVATION_TALENT.id)) {
this.salvationActive = true;
}
if (this.selectedCombatant.hasTalent(SPELLS.ENDURING_RENEWAL_TALENT.id)) {
this.enduringRenewalEnabled = true;
}
if (this.selectedCombatant.hasTalent(SPELLS.BENEDICTION_TALENT.id)) {
this.benedictionActive = true;
}
}
get renewsFromBenediction() {
return this.renewsFromBenedictionAndRenew - this.renewsCast;
}
get badRenews() {
return this.renewsCast - this.goodRenews;
}
get badRenewThreshold() {
return {
actual: this.badRenews,
isGreaterThan: {
minor: 2 * this.owner.fightDuration / 1000 / 60,
average: 3 * this.owner.fightDuration / 1000 / 60,
major: 4 * this.owner.fightDuration / 1000 / 60,
},
style: 'number',
};
}
healingFromRenew(applicationCount) {
const averageHealingPerRenewApplication = this.totalRenewHealing / this.totalRenewApplications;
return averageHealingPerRenewApplication * applicationCount;
}
overhealingFromRenew(applicationCount) {
const averageOverHealingPerRenewApplication = this.totalRenewOverhealing / this.totalRenewApplications;
return averageOverHealingPerRenewApplication * applicationCount;
}
absorptionFromRenew(applicationCount) {
const averageAbsorptionPerRenewApplication = this.totalRenewOverhealing / this.totalRenewApplications;
return averageAbsorptionPerRenewApplication * applicationCount;
}
on_byPlayer_heal(event) {
const spellId = event.ability.guid;
if (spellId === SPELLS.RENEW.id) {
this.totalRenewHealing += event.amount || 0;
this.totalRenewOverhealing += event.overheal || 0;
this.totalRenewAbsorbs += event.absorbed || 0;
this.totalRenewTicks += 1;
}
}
on_byPlayer_cast(event) {
const spellId = event.ability.guid;
if (this.lastCast) {
// If our last cast was a renew cast, validate that it was used well.
this.validateRenew(event);
}
if (spellId === SPELLS.RENEW.id) {
this.renewsCast += 1;
this.lastCast = event;
} else if (spellId === SPELLS.HOLY_WORD_SALVATION_TALENT.id) {
this.lastSalvationCast = event.timestamp;
} else if (ABILITIES_THAT_TRIGGER_ENDURING_RENEWAL.includes(spellId)) {
this.lastEnduringRenewalSpellCast = event.timestamp;
}
}
on_byPlayer_applybuff(event) {
this.handleRenewApplication(event);
}
on_byPlayer_refreshbuff(event) {
this.handleRenewApplication(event);
}
handleRenewApplication(event) {
const spellId = event.ability.guid;
if (spellId !== SPELLS.RENEW.id) {
return;
}
this.totalRenewApplications += 1;
if (this.salvationActive && event.timestamp - this.lastSalvationCast < MS_BUFFER) {
this.renewsFromSalvation += 1;
} else if (this.enduringRenewalActive && event.timestamp - this.lastEnduringRenewalSpellCast < MS_BUFFER) {
this.renewsFromEnduringRenewal += 1;
} else {
this.renewsFromBenedictionAndRenew += 1;
}
}
on_byPlayer_globalcooldown(event) {
const spellId = event.ability.guid;
if (spellId !== SPELLS.RENEW.id) {
return;
}
this.lastGCD = event;
}
// This function validates if a renew should have been cast at all.
validateRenew(event) {
this.lastRenewCast = event.timestamp;
if (this.lastGCD && this.movedSinceCast(event)) {
// We are moving, but do we have any other instant cast spells?
const sanctifyOnCooldown = this.spellUsable.isOnCooldown(SPELLS.HOLY_WORD_SANCTIFY.id);
const serenityOnCooldown = this.spellUsable.isOnCooldown(SPELLS.HOLY_WORD_SERENITY.id);
let cohOnCooldown = true;
if (this.selectedCombatant.hasTalent(SPELLS.CIRCLE_OF_HEALING_TALENT.id)) {
cohOnCooldown = this.spellUsable.isOnCooldown(SPELLS.CIRCLE_OF_HEALING_TALENT.id);
}
if (sanctifyOnCooldown && serenityOnCooldown && cohOnCooldown) {
this.goodRenews += 1;
} else {
this.badRenewReason.betterspell = (this.badRenewReason.betterspell || 0) + 1;
}
}
this.badRenewReason.stationary = (this.badRenewReason.stationary || 0) + 1;
// Reset the cast history
this.lastGCD = null;
this.lastCast = null;
}
movedSinceCast(event) {
const timeSinceCast = event.timestamp - this.lastGCD.timestamp;
const timeSinceLastMovement = this.distanceMoved.timeSinceLastMovement();
if (timeSinceLastMovement < timeSinceCast) {
return true;
}
return false;
}
suggestions(when) {
when(this.badRenewThreshold)
.addSuggestion((suggest, actual, recommended) => {
return suggest(<>You should cast <SpellLink id={SPELLS.RENEW.id} /> less.</>)
.icon(SPELLS.RENEW.icon)
.actual(<>
You used Renew {this.badRenews} times when another spell would have been more productive.
Renew is one of the least efficient spells Holy Priests have, and should only be cast when moving with no other instants available.</>)
.recommended(`Two or less per minute is recommended, except for movement heavy fights.`);
},
);
}
}
export default Renew;
|
ajax/libs/react-redux-form/1.11.0/ReactReduxForm.min.js
|
sufuf3/cdnjs
|
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("react-redux"),require("redux"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-redux","redux","react-dom"],t):"object"==typeof exports?exports.ReactReduxForm=t(require("react"),require("react-redux"),require("redux"),require("react-dom")):e.ReactReduxForm=t(e.React,e.ReactRedux,e.Redux,e.ReactDOM)}(this,function(e,t,r,n){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){r(42),e.exports=r(42)},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t,r){var n=t;if("number"==typeof t){var o=e[t];return void 0===o?r:o}return t.length?((0,l.default)(n,".")?n=n.slice(0,-1):(0,l.default)(n,"[]")&&(n=n.slice(0,-2)),(0,a.default)(e,n,r)):e}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var u=r(86),a=n(u),i=r(32),l=n(i)},function(e,t){"use strict";function r(e){return null!=e&&"object"===("undefined"==typeof e?"undefined":u(e))&&Array.isArray(e)===!1}function n(e){return r(e)===!0&&"[object Object]"===Object.prototype.toString.call(e)}function o(e){if(n(e)===!1)return!1;var t=e.constructor;if("function"!=typeof t)return!1;var r=t.prototype;return n(r)!==!1&&r.hasOwnProperty("isPrototypeOf")!==!1}Object.defineProperty(t,"__esModule",{value:!0});var u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.default=o},function(e,t){"use strict";function r(e,t){var r={};return Object.keys(e||{}).forEach(function(n){r[n]=t(e[n],n,e)}),r}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={BLUR:"rrf/blur",CHANGE:"rrf/change",FOCUS:"rrf/focus",RESET:"rrf/reset",VALIDATE:"rrf/validate",SET_DIRTY:"rrf/setDirty",SET_ERRORS:"rrf/setErrors",SET_INITIAL:"rrf/setInitial",SET_PENDING:"rrf/setPending",SET_PRISTINE:"rrf/setPristine",SET_SUBMITTED:"rrf/setSubmitted",SET_SUBMIT_FAILED:"rrf/setSubmitFailed",SET_TOUCHED:"rrf/setTouched",SET_UNTOUCHED:"rrf/setUntouched",SET_VALIDITY:"rrf/setValidity",SET_VALIDATING:"rrf/setValidating",SET_FIELDS_VALIDITY:"rrf/setFieldsValidity",SET_VIEW_VALUE:"rrf/setViewValue",RESET_VALIDITY:"rrf/resetValidity",BATCH:"rrf/batch",NULL:null,ADD_INTENT:"rrf/addIntent",CLEAR_INTENTS:"rrf/clearIntents"};t.default=r},function(t,r){t.exports=e},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={focus:!1,pending:!1,pristine:!0,submitted:!1,submitFailed:!1,retouched:!1,touched:!1,valid:!0,validating:!1,validated:!1,validity:{},errors:{},intents:[]};t.default=r},function(e,t,r){"use strict";var n=function(e,t,r,n,o,u,a,i){if(!e){var l;if(void 0===t)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var f=[r,n,o,u,a,i],c=0;l=new Error(t.replace(/%s/g,function(){return f[c++]})),l.name="Invariant Violation"}throw l.framesToPop=1,l}};e.exports=n},function(e,t){"use strict";function r(e,t){return e===t?0!==e||1/e===1/t:e!==e&&t!==t}function n(e,t){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(r(e,t))return!0;if("object"!==("undefined"==typeof e?"undefined":u(e))||null===e||"object"!==("undefined"==typeof t?"undefined":u(t))||null===t)return!1;if(e instanceof Date&&t instanceof Date)return e===t;var i=Object.keys(e),l=Object.keys(t);if(i.length!==l.length)return!1;for(var f=o.omitKeys,c=o.deepKeys,d=0;d<i.length;d++)if(!(f&&f.length&&~f.indexOf(i[d])))if(c&&c.length&&~c.indexOf(i[d])){var s=n(e[i[d]],t[i[d]]);if(!s)return!1}else if(!a.call(t,i[d])||!r(e[i[d]],t[i[d]]))return!1;return!0}Object.defineProperty(t,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u="function"==typeof Symbol&&"symbol"===o(Symbol.iterator)?function(e){return"undefined"==typeof e?"undefined":o(e)}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":"undefined"==typeof e?"undefined":o(e)},a=Object.prototype.hasOwnProperty;t.default=n},function(e,t,r){"use strict";function n(e){return null!==e&&(Array.isArray(e)||o(e))}function o(e){return"object"==typeof e&&e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function u(e){for(var t=0,r=e.length,n=Array(r);t<r;t+=1)n[t]=e[t];return n}function a(e){for(var t,r=0,n=Object.keys(e),o=n.length,u={};r<o;r+=1)t=n[r],u[t]=e[t];return u}function i(e){return Array.isArray(e)?u(e):a(e)}function l(e){return n(e)&&(!Object.isFrozen(e),!1)?c(e,[]):e}function f(e){return e}function c(e,t){if(t.some(function(t){return t===e}))throw new Error("object has a reference cycle");return Object.freeze(e),t.push(e),Object.keys(e).forEach(function(r){var o=e[r];n(o)&&c(o,t)}),t.pop(),e}function d(e,t){return(t||[]).reduce(function(e,t){if(e)return e[t]},e)}function s(e,t){return Object.keys(t).reduce(function(e,r){return m.assoc(e,r,t[r])},e)}function p(e,t,r){return null==e||null==t?e:Object.keys(t).reduce(function(e,o){var u=t[o],a=e[o],i=r?r(a,u,o):u;return n(u)&&n(a)?(Object.isFrozen(i)&&Object.isFrozen(a),i===a?e:Array.isArray(u)?m.assoc(e,o,i):v(e,o,p(a,i,r))):v(e,o,i)},e)}function v(e,t,r){return e[t]===r?e:m.assoc(e,t,r)}function y(e,t){var r=t||0,n=e.length;n-=r,n=n<0?0:n;for(var o=new Array(n),u=0;u<n;u+=1)o[u]=e[u+r];return o}function h(e){return y(e,1)}var m=t;t.freeze=function(e){return e},t.thaw=function e(t){if(n(t)&&Object.isFrozen(t)){var r=i(t);return Object.keys(r).forEach(function(t){r[t]=e(r[t])}),r}return t},t.assoc=function(e,t,r){if(e[t]===r)return f(e);var n=i(e);return n[t]=l(r),f(n)},t.set=t.assoc,t.dissoc=function(e,t){var r=i(e);return delete r[t],f(r)},t.unset=t.dissoc,t.assocIn=function e(t,r,n){var o=r[0];return 1===r.length?m.assoc(t,o,n):m.assoc(t,o,e(t[o]||{},r.slice(1),n))},t.setIn=t.assocIn,t.getIn=d,t.updateIn=function(e,t,r){var n=d(e,t);return m.assocIn(e,t,r(n))},["push","unshift","pop","shift","reverse","sort"].forEach(function(e){t[e]=function(t,r){var n=u(t);return n[e](l(r)),f(n)},t[e].displayName="icepick."+e}),t.splice=function(e){var t=u(e),r=h(arguments).map(l);return t.splice.apply(t,r),f(t)},t.slice=function(e,t,r){var n=e.slice(t,r);return f(n)},["map","filter"].forEach(function(e){t[e]=function(t,r){var n=r[e](t);return f(n)},t[e].displayName="icepick."+e}),t.extend=t.assign=function(){var e=h(arguments).reduce(s,arguments[0]);return f(e)},t.merge=p;var b={value:function(){return this.val},thru:function(e){return this.val=l(e(this.val)),this}};Object.keys(t).forEach(function(e){b[e]=function(){var r=y(arguments);return r.unshift(this.val),this.val=t[e].apply(null,r),this}}),t.chain=function(e){var t=Object.create(b);return t.val=e,t},t._weCareAbout=n,t._slice=y},function(e,t,r){function n(e){return"object"==typeof e&&null!==e&&e.$$typeof===u}var o=r(88),u="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103;e.exports=o(n)},function(e,t){"use strict";function r(e){return e}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r},function(e,t){"use strict";function r(e,t){if(null==e)return{};var r=n({},e);return"string"==typeof t?delete r[t]:t.forEach(function(e){delete r[e]}),r}Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};t.default=r},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},u=r(38),a=n(u),i=r(57),l=n(i),f=r(28),c=n(f),d=o({},a.default,l.default,{batch:c.default});t.default=d},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){for(var t=Object.keys(e),r=t.length,n={},o=0,u=void 0;o<r;o+=1)u=t[o],n[u]=e[u];return n}function u(e,t,r){var n=o(e);return n[t]=r,n}function a(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:l.default;if(!t.length)return r;var o=t[0];return n(1===t.length?u(e,o,r):u(e,o,a(e[o]||{},t.slice(1),r,n)))}Object.defineProperty(t,"__esModule",{value:!0}),t.assoc=u,t.default=a;var i=r(11),l=n(i)},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:y,n=e&&"$form"in e?e:r.getForm(e,t);if(!n||!n.$form)return null;if(!t.length)return n;(0,v.default)(n,'Could not find form for "%s" in the store.',t);var o=(0,l.default)(n.$form.model),u=(0,l.default)(t).slice(o.length),i=(0,a.default)(n,u);return i?(0,s.default)(i)&&"$form"in i?i.$form:i:null}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var u=r(1),a=n(u),i=r(26),l=n(i),f=r(22),c=n(f),d=r(2),s=n(d),p=r(7),v=n(p),y={getForm:c.default}},function(e,t){"use strict";function r(e,t){return"function"==typeof e&&t?e(t):e}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r},function(e,r){e.exports=t},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={type:null};t.default=r},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{async:!0};if(!e)return!0;if(!e.$form){var r=e.errors;return Array.isArray(r)||(0,i.default)(r)?Object.keys(e.errors).every(function(r){if(!t.async&&e.asyncKeys&&~e.asyncKeys.indexOf(r))return!0;var n=!e.errors[r];return n}):!t.async&&e.asyncKeys||!r}return Object.keys(e).every(function(r){return o(e[r],t)})}function u(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{async:!0};return Object.keys(e).every(function(r){return"$form"===r||o(e[r],t)})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o,t.fieldsValid=u;var a=r(2),i=n(a)},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function u(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return Array.isArray(t)||(0,s.default)(t)?(0,j.createFormState)(e,t,r,n):(0,P.default)(e,t,r,n)}function a(e,t,r){return function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r,o=arguments[1];if(!o.model)return n;var u=(0,v.default)(o.model);if(t.length&&!(0,c.default)(u.slice(0,t.length),t))return n;var a=u.slice(t.length);return e(n,o,a)}}function i(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=r.plugins,i=void 0===n?[]:n,l=r.initialFieldState,f=r.transformAction,c=void 0===f?null:f,d=(0,v.default)(e),s=u(e,t,l,r),p=[(0,O.createFormActionsReducer)({initialFieldState:l}),_.default],y=i.concat(p).map(function(e){return a(e,d,s)});return(0,b.default)(h.default.apply(void 0,o(y)),void 0,{transformAction:c})}Object.defineProperty(t,"__esModule",{value:!0}),t.createInitialState=u,t.default=i;var l=r(1),f=(n(l),r(44)),c=n(f),d=r(2),s=n(d),p=r(26),v=n(p),y=r(70),h=n(y),m=r(30),b=n(m),g=r(69),_=n(g),O=r(68),j=r(21),P=n(j)},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t,r){var n=Array.isArray(e)?e.join("."):e;return Array.isArray(t)||(0,v.default)(t)?f(n,t,r):l(n,t,r)}function u(e,t){return e&&e.$form?e.$form[t]:e[t]}function a(e,t){return e?e+"."+t:t}function i(e,t){var r=c({},e,t);return r}function l(e,t,r){return c({},s.default,r,{model:e,value:t,initialValue:t})}function f(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},u={$form:l(e,t,r,n)};return n.lazy?u:(Object.assign(u,(0,h.default)(t,function(t,n){var u=a(e,n);return o(u,t,r)})),u)}Object.defineProperty(t,"__esModule",{value:!0});var c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};t.fieldOrForm=o,t.getMeta=u,t.updateFieldState=i,t.default=l,t.createFormState=f;var d=r(6),s=n(d),p=r(2),v=n(p),y=r(3),h=n(y)},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.filter(function(e){return!!e&&e.length}).join(".")}function u(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:v,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",a=[],l=null;return r.keys(e).some(function(u){var f=r.get(e,u);if(f&&r.get(f,"$form")){var c=r.get(f,"$form.model");if((0,p.default)(t,c)||""===c){var d=function(){var e=(0,s.pathDifference)(t,c),a=[n,u],i=f;return e.every(function(e){return!(!r.get(i,e)||!r.get(i,e+".$form")||(i=r.get(i,e),a.push(e),0))}),l=o.apply(void 0,a),{v:!0}}();if("object"===("undefined"==typeof d?"undefined":i(d)))return d.v}return!1}return r.isObject(f)&&a.push(u),!1}),l?l:(a.some(function(a){return l=u(r.get(e,a),t,r,o(n,a)),!!l}),l?l:null)}function a(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:v,n=h(e,t,r);if(!n)return null;var o=r.get(e,n);return o}Object.defineProperty(t,"__esModule",{value:!0}),t.clearGetFormCache=void 0;var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.getFormStateKey=u;var l=r(1),f=n(l),c=r(2),d=n(c),s=r(79),p=n(s),v={get:f.default,keys:function(e){return Object.keys(e)},isObject:function(e){return(0,d.default)(e)}},y={},h=(t.clearGetFormCache=function(){return y={}},function(){return function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:v;if(y[t])return y[t];var n=u(e,t,r);return y[t]=n,n}}());t.default=a},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function u(e){return!!(e&&e.stopPropagation&&e.preventDefault)}function a(e){var t=e.target;if(!t){if(!e.nativeEvent)return;return e.nativeEvent.text}return"file"===t.type?[].concat(o(t.files))||t.dataTransfer&&[].concat(o(t.dataTransfer.files)):t.multiple?[].concat(o(t.selectedOptions)).map(function(e){return e.value}):t.value}function i(e){return u(e)?a(e):e}function l(e,t){var r=t.controlProps;return(0,c.default)(t.model)?r.value:!t.modelValue}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i,t.getCheckboxValue=l;var f=r(24),c=n(f)},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){return(0,a.default)(e,"[]")}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var u=r(32),a=n(u)},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function i(e,t){if(t){if("."===e[0]||"["===e[0])return""+t+e;if("function"==typeof e)return function(r){return e(r,t)}}return e}function l(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],n=function(n){function l(e,n){o(this,l);var a=u(this,(l.__proto__||Object.getPrototypeOf(l)).call(this,e,n));return a.model=n.model,a.store=n.localStore,a.deepKeys=t,a.omitKeys=r,a}return a(l,n),c(l,[{key:"shouldComponentUpdate",value:function(e){return!(0,h.default)(this.props,e,{deepKeys:this.deepKeys,omitKeys:this.omitKeys})}},{key:"render",value:function(){var t=i(this.props.model,this.model);return s.default.createElement(e,f({},this.props,{model:t,store:this.store||void 0}))}}]),l}(m);return n.displayName="Modeled("+e.displayName+")",n.propTypes={model:v.default.any},n.contextTypes={model:v.default.any,localStore:v.default.shape({subscribe:v.default.func,dispatch:v.default.func,getState:v.default.func})},n}Object.defineProperty(t,"__esModule",{value:!0});var f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},c=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}();t.default=l;var d=r(5),s=n(d),p=r(10),v=n(p),y=r(8),h=n(y),m=d.PureComponent||d.Component},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e;return(0,l.default)(t,".")?t=t.slice(0,-1):(0,l.default)(t,"[]")&&(t=t.slice(0,-2)),(0,a.default)(t)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var u=r(55),a=n(u),i=r(32),l=n(i)},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){return Array.isArray(e)?e:Array.from(e)}function u(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y;return function(t){for(var r=arguments.length,n=Array(r>1?r-1:0),u=1;u<r;u++)n[u-1]=arguments[u];var a="."===t[0];return function(r,u){var i=a?t.slice(1):t,f=a?e.get(r,u):r,c=i.split(/\[\]\.?/),d=o(c),p=d[0],y=d.slice(1),h=p,m=e.get(f,h);return n.forEach(function(t,r){var n=y[r],o=(0,s.default)(t),u=n?(0,l.default)(m,o)+"."+n:""+(0,l.default)(m,o);m=e.get(m,u),h+="."+u}),(0,v.default)(i)&&n.length<y.length&&(h+="[]"),a?u+"."+h:h}}}function a(e){return function(t){for(var r=arguments.length,n=Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return"function"==typeof t?function(r,o){var u=t(o());r(e.apply(void 0,[u].concat(n)))}:e.apply(void 0,[t].concat(n))}}Object.defineProperty(t,"__esModule",{value:!0}),t.trackable=t.createTrack=void 0;var i=r(72),l=n(i),f=r(1),c=n(f),d=r(36),s=n(d),p=r(24),v=n(p),y={get:c.default},h=u();t.default=h,t.createTrack=u,t.trackable=a},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t,r){if(t.length){var n=t.filter(function(e){return!!e});if(n.length)return r(y(e,n))}}Object.defineProperty(t,"__esModule",{value:!0}),t.dispatchBatchIfNeeded=void 0;var u=function(){function e(e,t){var r=[],n=!0,o=!1,u=void 0;try{for(var a,i=e[Symbol.iterator]();!(n=(a=i.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){o=!0,u=e}finally{try{!n&&i.return&&i.return()}finally{if(o)throw u}}return r}return function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),a=r(4),i=n(a),l=r(78),f=n(l),c=r(2),d=n(c),s=r(27),p=r(18),v=n(p),y=(0,s.trackable)(function(e,t){var r=t.filter(function(e){return!!e});if(!r.length)return v.default;if(r.length&&r.every(d.default))return 1===r.length?r[0]:{type:i.default.BATCH,model:e,actions:r};var n=(0,f.default)(r,function(e){return"function"!=typeof e}),o=u(n,2),a=o[0],l=o[1];if(!l.length){if(a.length>1)return{type:i.default.BATCH,model:e,actions:a};if(1===a.length)return a[0]}return function(t){a.length>1?t({type:i.default.BATCH,model:e,actions:a}):1===a.length&&t(a[0]),l.forEach(t)}});t.default=y,t.dispatchBatchIfNeeded=o},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){return"string"==typeof e?""+e:e}function u(e){return(0,l.default)(e.model)?!!e.modelValue&&e.modelValue.some(function(t){return t===e.value}):!!e.modelValue}Object.defineProperty(t,"__esModule",{value:!0});var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},i=r(24),l=n(i),f=r(36),c=r(13),d=n(c),s={name:function(e){return e.name||e.model},disabled:function(e){var t=e.fieldValue,r=e.disabled;return(0,f.iterateeValue)(t,r)},onChange:function(e){var t=e.onChange;return t},onBlur:function(e){var t=e.onBlur;return t},onFocus:function(e){var t=e.onFocus;return t},onKeyPress:function(e){var t=e.onKeyPress;return t}},p=a({},s,{value:function e(t){if(t.hasOwnProperty("value"))return t.value;var e=o(t.viewValue);return void 0===e?"":e}}),v=function(e){var t=e.modelValue;return t},y={default:a({},s,{value:function(e){return e.hasOwnProperty("value")?e.value:e.viewValue}}),checkbox:a({},s,{checked:function(e){return e.defaultChecked?e.checked:u(e)}}),radio:a({},s,{checked:function(e){return e.defaultChecked?e.checked:e.modelValue===e.value},value:function(e){return e.value}}),select:a({},s,{value:v}),text:p,textarea:p,file:s,button:a({},s,{value:v}),reset:a({},s,{onClick:function(e){return function(t){t.preventDefault(),e.dispatch(d.default.reset(e.model))}}})};t.default=y},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=r.transformAction;return function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t,o=arguments[1],u=n?n(o):o;return u.type===a.default.BATCH?u.actions.reduce(e,r):e(r,u)}}Object.defineProperty(t,"__esModule",{value:!0});var u=r(4),a=n(u);t.default=o},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t,r){return f.default.setIn(e,t,r)}function u(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:b,t=e.get,r=e.set,n=e.object;return function(e){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=(0,p.default)(e),i=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:o,n=arguments[1];if(!n.model)return e;var u=(0,p.default)(n.model);if(!(0,d.default)(u.slice(0,a.length),a))return e;var i=u.slice(a.length);switch(n.type){case y.default.CHANGE:case y.default.LOAD:return i.length?t(e,i)===n.value?e:r(e,i,n.value):n.value;case y.default.RESET:return i.length?t(e,i)===t(o,i)?e:r(e,i,t(o,i)):o;default:return e}};return(0,m.default)(i,o,u)}}Object.defineProperty(t,"__esModule",{value:!0}),t.createModeler=void 0;var a=r(1),i=n(a),l=r(9),f=n(l),c=r(44),d=n(c),s=r(26),p=n(s),v=r(4),y=n(v),h=r(30),m=n(h),b={get:i.default,set:o,object:{}},g=u();t.createModeler=u,t.default=g},function(e,t){"use strict";function r(e,t){if("string"!=typeof e)return!1;var r=e.lastIndexOf(t);return r!==-1&&r+t.length===e.length}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var r=(0,a.default)(t);return"function"==typeof e?e(r):(0,l.default)(e,function(e){return o(e,r)})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var u=r(23),a=n(u),i=r(3),l=n(i)},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){return(0,a.default)(e)?(0,l.default)(e,o):!e}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var u=r(2),a=n(u),i=r(3),l=n(i)},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){return Array.isArray(e)?e.some(o):(0,a.default)(e)?Object.keys(e).some(function(t){return o(e[t])}):!!e}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var u=r(2),a=n(u)},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){return function(t){return t===e||Object.keys(e).every(function(r){return e[r]===t[r]})}}function u(e){return function(t){return t&&!!t[e]}}function a(e){return"function"==typeof e?e:null===e?c.default:"object"===("undefined"==typeof e?"undefined":l(e))?o(e):u(e)}function i(e,t){return"function"==typeof t?t(e):Array.isArray(t)||"object"===("undefined"==typeof t?"undefined":l(t))||"string"==typeof t?a(t)(e):!!t}Object.defineProperty(t,"__esModule",{value:!0});var l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.default=a,t.iterateeValue=i;var f=r(11),c=n(f)},function(e,t){e.exports=r},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:F,t=function(e,t){return{type:s.default.ADD_INTENT,model:e,intent:t}},r=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return{type:s.default.CLEAR_INTENTS,model:e,intents:t,options:r}},n=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return a({type:s.default.FOCUS,model:e,value:t},r)},u=function(e,t){return n(e,t,{silent:!0})},i=function(e){return{type:s.default.BLUR,model:e}},l=function(e){return{type:s.default.SET_PRISTINE,model:e}},f=function(e){return{type:s.default.SET_DIRTY,model:e}},d=function(e){return{type:s.default.SET_INITIAL,model:e}},p=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments[2];return a({type:s.default.SET_PENDING,model:e,pending:t},r)},y=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return{type:s.default.SET_VALIDATING,model:e,validating:t}},m=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return a({type:r.errors?s.default.SET_ERRORS:s.default.SET_VALIDITY,model:e},r,o({},r.errors?"errors":"validity",t))},g=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{type:s.default.RESET_VALIDITY,model:e,omitKeys:t}},O=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return{type:s.default.SET_FIELDS_VALIDITY,model:e,fieldsValidity:t,options:r}},S=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return m(e,t,a({},r,{errors:!0}))},E=function(e,t,r){return O(e,t,a({},r,{errors:!0}))},V=g,T=function(e){return{type:s.default.SET_TOUCHED,model:e}},w=function(e){return{type:s.default.SET_UNTOUCHED,model:e}},M=function(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function(o,u){var i=e.get(u(),t);o(y(t,!0));var l=function(e){o(m(t,e,a({async:!0},n)))},f=r(i,l);"undefined"!=typeof f&&l(f)}},C=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return M(e,t,a({errors:!0},r))},I=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return{type:s.default.SET_SUBMITTED,model:e,submitted:t}},R=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments[2];return a({type:s.default.SET_SUBMIT_FAILED,model:e,submitFailed:t},r)},x=function(r,n){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return"undefined"==typeof n?t(r,{type:"submit"}):function(t,u){if(o.validate){var a=e.getForm(u(),r);if((0,A.default)(a,'Unable to submit form with validation. Could not find form for "%s" in the store.',r),!a.$form.valid)return t(k.default);t(p(r,!0))}else if(o.validators||o.errors){var i=o.validators||o.errors,l=o.errors,f=e.get(u(),r),c=(0,h.default)(i,f),d=o.errors?!(0,_.default)(c):(0,b.default)(c);if(!d)return t(l?S(r,c):m(r,c));t((0,v.default)(r,[m(r,l?(0,j.default)(c):c),p(r,!0)]))}else t(p(r,!0));var s=o.fields?E:S;return n.then(function(e){t((0,v.default)(r,[I(r,!0),m(r,e)]))}).catch(function(e){t((0,v.default)(r,[R(r),s(r,e,{async:!0})]))}),n}},$=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return x(e,t,a({},r,{fields:!0}))},D=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return x(e,t,a({},r,{validate:!0}))},N=function(t,r){return function(n,o){var u=e.get(o(),t),a=(0,h.default)(r,u);n(m(t,a))}},U=function(t,r){return function(n,o){var u=e.get(o(),t),a=(0,h.default)(r,u);n(m(t,a,{errors:!0}))}},L=function(t,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return function(o,u){var a=e.get(u(),t),i=(0,c.default)(r,function(t,r){var n=r?e.get(a,r):a,o=(0,h.default)(t,n);return o}),l=n.errors?E:O;o(l(t,i))}},K=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return L(e,t,a({},r,{errors:!0}))};return(0,c.default)({blur:i,focus:n,silentFocus:u,submit:x,submitFields:$,validSubmit:D,setDirty:f,setErrors:S,setInitial:d,setPending:p,setValidating:y,setPristine:l,setSubmitted:I,setSubmitFailed:R,setTouched:T,setUntouched:w,setValidity:m,setFieldsValidity:O,setFieldsErrors:E,resetValidity:g,resetErrors:V,validate:N,validateErrors:U,validateFields:L,validateFieldsErrors:K,asyncSetValidity:M,asyncSetErrors:C,addIntent:t,clearIntents:r},P.trackable)}Object.defineProperty(t,"__esModule",{value:!0}),t.createFieldActions=void 0;var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},i=r(1),l=n(i),f=r(3),c=n(f),d=r(4),s=n(d),p=r(28),v=n(p),y=r(33),h=n(y),m=r(48),b=n(m),g=r(35),_=n(g),O=r(34),j=n(O),P=r(27),S=r(22),E=n(S),V=r(15),T=n(V),w=r(18),k=n(w),M=r(7),A=n(M),F={get:l.default,getForm:E.default,getFieldFromState:T.default};t.createFieldActions=u,t.default=u()},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function l(e,t,r){return Q.default.setErrors(e,t,d({merge:(0,k.default)(t)},r))}function f(){function e(e,r){var n=r.model,o=r.controlProps,u=d({},o,(0,C.default)(r,Object.keys(pe))),a=(0,Y.default)(n,e),i=t.getFieldFromState(e,a)||le.default;return{model:a,modelValue:t.get(e,a),fieldValue:i,controlProps:u}}var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ve,r={},n={},f=function(e){function t(e){u(this,t);var r=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.getChangeAction=r.getChangeAction.bind(r),r.getValidateAction=r.getValidateAction.bind(r),r.handleKeyPress=r.handleKeyPress.bind(r),r.createEventHandler=r.createEventHandler.bind(r),r.handleFocus=r.createEventHandler("focus").bind(r),r.handleBlur=r.createEventHandler("blur").bind(r),r.handleUpdate=r.createEventHandler("change").bind(r),r.handleChange=r.handleChange.bind(r),r.handleLoad=r.handleLoad.bind(r),r.getMappedProps=r.getMappedProps.bind(r),r.attachNode=r.attachNode.bind(r),e.debounce&&(r.handleUpdate=(0,$.default)(r.handleUpdate,e.debounce)),r.willValidate=!1,r.state={viewValue:e.modelValue
},r}return i(t,e),c(t,[{key:"componentDidMount",value:function(){this.attachNode(),this.handleLoad()}},{key:"componentWillReceiveProps",value:function(e){var t=e.modelValue;t!==this.props.modelValue&&this.setViewValue(t)}},{key:"shouldComponentUpdate",value:function(e,t){return!(0,O.default)(this.props,e,{deepKeys:["controlProps"],omitKeys:["mapProps"]})||!(0,O.default)(this.state.viewValue,t.viewValue)}},{key:"componentDidUpdate",value:function(){this.handleIntents()}},{key:"componentWillUnmount",value:function(){var e=this.props,t=e.model,r=e.fieldValue,n=e.dispatch,o=e.validators,u=void 0===o?{}:o,a=e.errors,i=void 0===a?{}:a,l=e.persist;if(!l&&r&&!r.valid){var f=Object.keys(u).concat(Object.keys(i),this.willValidate?te.default:[]);n(Q.default.resetValidity(t,f))}}},{key:"getMappedProps",value:function(){var e=this.props,t=e.mapProps,r=this.state.viewValue,o=d({},e,e.controlProps,{onFocus:this.handleFocus,onBlur:this.handleBlur,onChange:this.handleChange,onKeyPress:this.handleKeyPress,viewValue:r});return(0,k.default)(t)?(0,T.default)(t,function(e,t){return"function"==typeof e&&"component"!==t?e(o):e}):"function"==typeof t?t(o):n}},{key:"getChangeAction",value:function(e){return this.props.changeAction(this.props.model,this.getValue(e),{currentValue:this.props.modelValue,external:!1})}},{key:"getValidateAction",value:function(e,t){var r=this.props,n=r.validators,o=r.errors,u=r.model,a=r.modelValue,i=r.updateOn,f=r.fieldValue;if(!n&&!o&&!this.willValidate)return!1;var c=this.getNodeErrors(),d=(0,ce.default)(i,t)?e:a;if(n||o){var s=(0,L.default)(n,d),p=(0,E.default)((0,L.default)(o,d),c),v=n?(0,E.default)((0,B.default)(s),p):p;if(!f||!(0,O.default)(v,f.errors))return l(u,v)}else if(c&&Object.keys(c).length)return l(u,c);return!1}},{key:"getAsyncValidateAction",value:function(e,t){var r=this.props,n=r.asyncValidators,u=r.fieldValue,a=r.model,i=r.modelValue,l=r.updateOn,f=r.dispatch,c=r.getValue;if(!n)return!1;var d=(0,ce.default)(l,t)?e:i,s=Object.keys(n),p=Object.keys(u.validity).every(function(e){return!!~s.indexOf(e)||u.validity[e]});return!!p&&(f(Q.default.setValidating(a,!0)),(0,T.default)(n,function(e,t){var r=function(e){var r=A.default.merge(u.validity,o({},t,e));f(Q.default.setValidity(a,r))};e(c(d),r)}),d)}},{key:"getNodeErrors",value:function(){var e=this.node,t=this.props.fieldValue;if(!e||e&&!e.willValidate)return this.willValidate=!1,null;this.willValidate=!0;var r={};return te.default.forEach(function(n){var o=e.validity[n];(o||t&&t.errors[n])&&(r[n]=o)}),r}},{key:"setViewValue",value:function(e){this.props.isToggle||this.setState({viewValue:this.parse(e)})}},{key:"getValue",value:function(e){return this.props.getValue(e,this.props)}},{key:"handleIntents",value:function(){var e=this,t=this.props,r=t.model,n=t.modelValue,o=t.fieldValue,u=t.fieldValue.intents,a=t.controlProps,i=t.dispatch,l=t.updateOn,f=t.validateOn,c=void 0===f?l:f;u.length&&u.forEach(function(t){switch(t.type){case R.default.FOCUS:if(ae.default)return;var u=o.focus;return void(!u||!e.node.focus||e.props.isToggle&&"undefined"!=typeof t.value&&t.value!==a.value||(e.node.focus(),i(Q.default.clearIntents(r,t))));case"validate":return void((0,ce.default)(c,"change")&&e.validate({clearIntents:t}));case"load":return void((0,O.default)(n,o.value)||i(Q.default.load(r,o.value,{clearIntents:t})));default:return}})}},{key:"parse",value:function(e){return this.props.parser?this.props.parser(e):e}},{key:"handleChange",value:function(e){e&&e.persist&&e.persist(),this.setViewValue(this.getValue(e)),this.handleUpdate(e)}},{key:"handleKeyPress",value:function(e){var t=this.props,r=t.controlProps.onKeyPress,n=t.dispatch,o=t.getValue,u=this.parse(o(e));"Enter"===e.key&&n(this.getChangeAction(u)),r&&r(e)}},{key:"handleLoad",value:function(){var e=this.props,t=e.model,r=e.modelValue,n=e.fieldValue,o=e.controlProps,u=e.onLoad,a=e.dispatch,i=e.changeAction,l=e.parser,f=void 0;o.hasOwnProperty("defaultValue")?f=o.defaultValue:o.hasOwnProperty("defaultChecked")?f=o.defaultChecked:this.props.hasOwnProperty("defaultValue")&&(f=this.props.defaultValue);var c=[this.getValidateAction(f)];if("undefined"!=typeof f)c.push(i(t,f));else if(l){var d=l(r);d!==r&&c.push(i(t,d))}(0,re.dispatchBatchIfNeeded)(t,c,a),u&&u(r,n,this.node)}},{key:"createEventHandler",value:function(e){var t=this,r=this.props,n=r.dispatch,o=r.model,u=r.updateOn,a=r.validateOn,i=void 0===a?u:a,l=r.asyncValidateOn,f=r.controlProps,c=r.parser,d=r.ignore,s=r.withField,p=r.fieldValue,v={focus:Q.default.silentFocus,blur:Q.default.blur}[e],y={focus:f.onFocus,blur:f.onBlur,change:f.onChange}[e],h=function(r){var a=[v&&v(o),(0,ce.default)(i,e)&&t.getValidateAction(r,e),(0,ce.default)(u,e)&&t.getChangeAction(r)];return(0,re.dispatchBatchIfNeeded)(o,a,n),r};return function(r){return(0,ce.default)(d,e)?y?y(r):r:t.props.isToggle?(0,m.compose)(h,(0,z.default)(y||g.default))(r):(0,m.compose)(function(r){return(0,ce.default)(l,e)&&t.getAsyncValidateAction(r,e),r},h,c,function(e){return t.getValue(e)},(0,z.default)(y||g.default))(r,s?p:void 0)}}},{key:"attachNode",value:function(){var e=de&&de(this);e&&(this.node=e,this.willValidate=e.willValidate)}},{key:"validate",value:function(e){var t=this.props,r=t.model,n=t.modelValue,o=t.fieldValue,u=t.validators,a=t.errors,i=t.dispatch;if(!u&&!a)return n;if(!o)return n;var f=(0,L.default)(u,n),c=(0,L.default)(a,n),d=u?(0,E.default)((0,B.default)(f),c):c;return(0,O.default)(d,o.errors)?e.clearIntents&&i(Q.default.clearIntents(r,e.clearIntents)):i(l(r,d,e)),n}},{key:"render",value:function(){var e=this.props,t=e.controlProps,r=e.component,n=e.control,o=e.getRef,u=(0,C.default)(this.getMappedProps(),se);return o&&(u.ref=o),n?(0,s.cloneElement)(n,u,t.children):(0,s.createElement)(r,d({},t,u))}}]),t}(s.Component);f.displayName="Control",f.defaultProps={changeAction:t.actions.change,updateOn:"change",asyncValidateOn:"blur",parser:g.default,controlProps:r,ignore:[],dynamic:!1,component:"input",withField:!0,persist:!1,getValue:N.default,isToggle:!1};var v=(0,oe.default)((0,h.connect)(e,null,null,{areOwnPropsEqual:function(e,t){return(0,O.default)(e,t,{omitKeys:["mapProps"]})},areStatePropsEqual:function(e,t){return(0,O.default)(e,t,{deepKeys:["controlProps"]})}})(f),["controlProps"],["mapProps"]),y=function(e){function t(){return u(this,t),a(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),c(t,[{key:"shouldComponentUpdate",value:function(e){return!(0,O.default)(this.props,e,{deepKeys:["controlProps"],omitKeys:["mapProps"]})}},{key:"render",value:function(){return p.default.createElement(v,d({},this.props,{mapProps:d({},Z.default.default,this.props.mapProps)}))}}]),t}(p.default.Component);y.custom=v;var b=function(e){function t(){return u(this,t),a(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),c(t,[{key:"render",value:function(){return p.default.createElement(v,d({component:"input"},this.props,{mapProps:d({},Z.default.default,this.props.mapProps)}))}}]),t}(y);y.input=b;var _=function(e){function t(){return u(this,t),a(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),c(t,[{key:"render",value:function(){return p.default.createElement(v,d({component:"input"},this.props,{mapProps:d({},Z.default.text,{type:"text"},this.props.mapProps)}))}}]),t}(y);y.text=_;var j=function(e){function t(){return u(this,t),a(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),c(t,[{key:"render",value:function(){return p.default.createElement(v,d({component:"textarea"},this.props,{mapProps:d({},Z.default.textarea,this.props.mapProps)}))}}]),t}(y);y.textarea=j;var P=function(e){function t(){return u(this,t),a(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),c(t,[{key:"render",value:function(){return p.default.createElement(v,d({component:"input",type:"radio",isToggle:!0},this.props,{mapProps:d({},Z.default.radio,this.props.mapProps)}))}}]),t}(y);y.radio=P;var S=function(e){function r(){return u(this,r),a(this,(r.__proto__||Object.getPrototypeOf(r)).apply(this,arguments))}return i(r,e),c(r,[{key:"render",value:function(){return p.default.createElement(v,d({component:"input",type:"checkbox",isToggle:!0},this.props,{mapProps:d({},Z.default.checkbox,this.props.mapProps),getValue:D.getCheckboxValue,changeAction:this.props.changeAction||t.actions.checkWithValue}))}}]),r}(y);y.checkbox=S;var V=function(e){function t(){return u(this,t),a(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),c(t,[{key:"render",value:function(){return p.default.createElement(v,d({component:"input",type:"file"},this.props,{mapProps:d({},Z.default.file,this.props.mapProps)}))}}]),t}(y);y.file=V;var w=function(e){function t(){return u(this,t),a(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),c(t,[{key:"render",value:function(){return p.default.createElement(v,d({component:"select"},this.props,{mapProps:d({},Z.default.select,this.props.mapProps)}))}}]),t}(y);y.select=w;var M=function(e){function t(){return u(this,t),a(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),c(t,[{key:"render",value:function(){return p.default.createElement(v,d({component:"button"},this.props,{mapProps:d({},Z.default.button,this.props.mapProps)}))}}]),t}(y);y.button=M;var F=function(e){function t(){return u(this,t),a(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),c(t,[{key:"render",value:function(){return p.default.createElement(v,d({component:"button",type:"reset"},this.props,{mapProps:d({},Z.default.reset,this.props.mapProps)}))}}]),t}(y);return y.reset=F,y}Object.defineProperty(t,"__esModule",{value:!0}),t.createControlClass=void 0;var c=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),d=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},s=r(5),p=n(s),v=r(10),y=n(v),h=r(17),m=r(37),b=r(11),g=n(b),_=r(8),O=n(_),j=r(1),P=n(j),S=r(51),E=n(S),V=r(3),T=n(V),w=r(2),k=n(w),M=r(9),A=n(M),F=r(12),C=n(F),I=r(4),R=n(I),x=r(71),$=n(x),D=r(23),N=n(D),U=r(33),L=n(U),K=r(34),B=n(K),H=r(15),q=n(H),G=r(16),Y=n(G),W=r(80),z=n(W),J=r(13),Q=n(J),X=r(29),Z=n(X),ee=r(62),te=n(ee),re=r(28),ne=r(25),oe=n(ne),ue=r(77),ae=n(ue),ie=r(6),le=n(ie),fe=r(45),ce=n(fe),de=ae.default?null:r(90).findDOMNode,se=["changeAction","getFieldFromState","store"],pe={model:y.default.oneOfType([y.default.func,y.default.string]).isRequired,modelValue:y.default.any,viewValue:y.default.any,defaultValue:y.default.any,control:y.default.any,onLoad:y.default.func,onSubmit:y.default.func,fieldValue:y.default.object,mapProps:y.default.oneOfType([y.default.func,y.default.object]),changeAction:y.default.func,updateOn:y.default.oneOfType([y.default.arrayOf(y.default.string),y.default.string]),validateOn:y.default.oneOfType([y.default.arrayOf(y.default.string),y.default.string]),validators:y.default.oneOfType([y.default.func,y.default.object]),asyncValidateOn:y.default.oneOfType([y.default.arrayOf(y.default.string),y.default.string]),asyncValidators:y.default.oneOfType([y.default.func,y.default.object]),errors:y.default.oneOfType([y.default.func,y.default.object]),controlProps:y.default.object,component:y.default.any,dispatch:y.default.func,parser:y.default.func,ignore:y.default.oneOfType([y.default.arrayOf(y.default.string),y.default.string]),dynamic:y.default.bool,store:y.default.shape({subscribe:y.default.func,dispatch:y.default.func,getState:y.default.func}),getRef:y.default.func,withField:y.default.bool,debounce:y.default.number,persist:y.default.bool,getValue:y.default.func,isToggle:y.default.bool},ve={get:P.default,getFieldFromState:q.default,actions:Q.default};t.createControlClass=f,t.default=f()},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function i(){function e(e,r){var n=r.model,o=(0,x.default)(n,e),u=t.getForm(e,o);return(0,G.default)(u,'Unable to create Form component. Could not find form for "%s" in the store.',o),{model:o,modelValue:t.get(e,o),formValue:u}}var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:W,r=function(e){function r(e){o(this,r);var t=u(this,(r.__proto__||Object.getPrototypeOf(r)).call(this,e));return t.handleSubmit=t.handleSubmit.bind(t),t.handleReset=t.handleReset.bind(t),t.handleValidSubmit=t.handleValidSubmit.bind(t),t.handleInvalidSubmit=t.handleInvalidSubmit.bind(t),t.attachNode=t.attachNode.bind(t),t.state={lastSubmitEvent:null},t}return a(r,e),d(r,[{key:"getChildContext",value:function(){return{model:this.props.model,localStore:this.props.store}}},{key:"componentDidMount",value:function(){this.handleUpdate(),this.handleChange(),(0,K.default)(this.props.validateOn,"change")&&this.validate(this.props,!0),this.props.getDispatch&&this.props.getDispatch(this.props.dispatch)}},{key:"componentWillReceiveProps",value:function(e){(0,K.default)(e.validateOn,"change")&&this.validate(e)}},{key:"shouldComponentUpdate",value:function(e){return(0,U.default)(this,e)}},{key:"componentDidUpdate",value:function(e){this.handleIntents(),(0,b.default)(e.formValue,this.props.formValue)||this.handleUpdate(),(0,b.default)(e.modelValue,this.props.modelValue)||this.handleChange()}},{key:"handleUpdate",value:function(){this.props.onUpdate&&this.props.onUpdate(this.props.formValue)}},{key:"handleChange",value:function(){this.props.onChange&&this.props.onChange(this.props.modelValue)}},{key:"attachNode",value:function(e){e&&(this._node=e,this._node.submit=this.handleSubmit,this.props.getRef&&this.props.getRef(e))}},{key:"validate",value:function(e){var r=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=arguments.length>2&&void 0!==arguments[2]&&arguments[2],u=this.props,a=u.model,i=u.dispatch,l=u.formValue,d=u.modelValue,s=e.validators,p=e.errors;if(l&&(s||p||d===e.modelValue)){var v=s!==this.props.validators||p!==this.props.errors,y=(s?Object.keys(s):[]).concat(p?Object.keys(p):[]),h={},m=!1,g=[];y.forEach(function(u){if(!~g.indexOf(u)){var a=""===u?d!==e.modelValue:t.get(d,u)!==t.get(e.modelValue,u);(o||n||a||s&&r.props.validators[u]!==s[u]||p&&r.props.errors[u]!==p[u]||~u.indexOf("[]"))&&g.push(u)}});var _=function r(n,o){if(~n.indexOf("[]"))!function(){var u=n.split("[]"),a=c(u,2),i=a[0],l=a[1],f=i?t.get(e.modelValue,i):e.modelValue;f.forEach(function(e,t){r(i+"["+t+"]"+l,o)})}();else{var u=n?t.get(e.modelValue,n):e.modelValue,a=(0,D.default)(l,n).errors,i=(0,V.default)(o,u);m||(0,b.default)(i,a)||(m=!0),h[n]=(0,H.default)(h[n],i)}};if(g.forEach(function(e){s&&s[e]&&_(e,(0,w.default)(s[e])),p&&p[e]&&_(e,p[e])}),"function"==typeof s){var O=function(){var t=e.modelValue,r=d;if(!o&&!n&&!v&&t===r)return{v:void 0};var u=(0,V.default)(s,t);u&&Object.keys(u).forEach(function(e){var t=u[e],r=(0,D.default)(l,e).errors;Object.keys(t).forEach(function(e){t[e]=!t[e]}),m||(0,b.default)(t,r)||(m=!0),h[e]=(0,H.default)(h[e],t)})}();if("object"===("undefined"==typeof O?"undefined":f(O)))return O.v}h.hasOwnProperty("")||~y.indexOf("")||(h[""]=!1,m=m||(0,M.default)(l.$form.errors)),m&&i(t.actions.setFieldsErrors(a,h,{merge:!0})),o&&i(t.actions.addIntent(a,{type:"submit"}))}}},{key:"handleValidSubmit",value:function(e){var r=this.props,n=r.dispatch,o=r.model,u=r.modelValue,a=r.onSubmit;n(t.actions.setPending(o,!0,e)),a&&a(u,this.state.lastSubmitEvent)}},{key:"handleInvalidSubmit",value:function(e){var r=this.props,n=r.onSubmitFailed,o=r.formValue,u=r.dispatch;n&&n(o),u(t.actions.setSubmitFailed(this.props.model,!0,e))}},{key:"handleReset",value:function(e){e&&e.preventDefault(),this.props.dispatch(t.actions.reset(this.props.model))}},{key:"handleIntents",value:function(){var e=this,t=this.props.formValue;t.$form.intents.forEach(function(r){switch(r.type){case"submit":return void((0,F.default)(t,{async:!1})?e.handleValidSubmit({clearIntents:r}):e.handleInvalidSubmit({clearIntents:r}));default:return}})}},{key:"handleSubmit",value:function(e){e&&!this.props.action&&e.preventDefault(),e&&e.persist&&e.persist();var t=this.props,r=t.modelValue,n=t.formValue,o=t.onSubmit,u=t.validators,a=t.onBeforeSubmit;a&&a(e);var i=!n||n.$form.valid;return!u&&o&&i?(o(r,e),r):(this.setState({lastSubmitEvent:e}),this.validate(this.props,!1,!0),r)}},{key:"render",value:function(){var e=this.props,t=e.component,r=e.children,n=e.formValue,o=(0,j.default)(this.props,Object.keys(Y)),u="function"==typeof r?r(n):r;return p.default.createElement(t,l({},o,{onSubmit:this.handleSubmit,onReset:this.handleReset,ref:this.attachNode}),u)}}]),r}(s.Component);return r.defaultProps={validateOn:"change",component:"form"},r.childContextTypes={model:y.default.any,localStore:y.default.shape({subscribe:y.default.func,dispatch:y.default.func,getState:y.default.func})},(0,h.connect)(e)(r)}Object.defineProperty(t,"__esModule",{value:!0}),t.createFormClass=void 0;var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c=function(){function e(e,t){var r=[],n=!0,o=!1,u=void 0;try{for(var a,i=e[Symbol.iterator]();!(n=(a=i.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){o=!0,u=e}finally{try{!n&&i.return&&i.return()}finally{if(o)throw u}}return r}return function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),d=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),s=r(5),p=n(s),v=r(10),y=n(v),h=r(17),m=r(8),b=n(m),g=r(1),_=n(g),O=r(12),j=n(O),P=r(13),S=n(P),E=r(33),V=n(E),T=r(76),w=n(T),k=r(35),M=n(k),A=r(19),F=n(A),C=r(22),I=n(C),R=r(16),x=n(R),$=r(74),D=n($),N=r(46),U=n(N),L=r(45),K=n(L),B=r(50),H=n(B),q=r(7),G=n(q),Y={component:y.default.any,validators:y.default.oneOfType([y.default.object,y.default.func]),errors:y.default.object,validateOn:y.default.oneOf(["change","submit"]),model:y.default.string.isRequired,modelValue:y.default.any,formValue:y.default.object,onSubmit:y.default.func,onSubmitFailed:y.default.func,dispatch:y.default.func,children:y.default.oneOfType([y.default.func,y.default.node]),store:y.default.shape({subscribe:y.default.func,dispatch:y.default.func,getState:y.default.func}),storeSubscription:y.default.any,onUpdate:y.default.func,onChange:y.default.func,getRef:y.default.func,getDispatch:y.default.func,onBeforeSubmit:y.default.func,action:y.default.string},W={get:_.default,getForm:I.default,actions:S.default};t.createFormClass=i,t.default=i()},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a.default,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(r,n){var o=void 0;try{o=r(void 0,l.default)}catch(e){o=null}var u=e(n,o,t);return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:o,t=arguments[1],n=u(e,t);return r(n,t)}}}Object.defineProperty(t,"__esModule",{value:!0}),t.createModelReducerEnhancer=void 0;var u=r(31),a=n(u),i=r(18),l=n(i),f=o(a.default);t.createModelReducerEnhancer=o,t.default=f},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.track=t.getModel=t.getField=t.form=t.batched=t.modeled=t.createFieldClass=t.Fieldset=t.Errors=t.LocalForm=t.Form=t.Control=t.Field=t.controls=t.actionTypes=t.actions=t.initialFieldState=t.createForms=t.combineForms=t.modelReducer=t.formReducer=void 0;var o=r(13),u=n(o),a=r(4),i=n(a),l=r(59),f=n(l),c=r(60),d=n(c),s=r(39),p=n(s),v=r(40),y=n(v),h=r(61),m=n(h),b=r(58),g=n(b),_=r(29),O=n(_),j=r(41),P=n(j),S=r(30),E=n(S),V=r(20),T=n(V),w=r(6),k=n(w),M=r(43),A=n(M),F=r(31),C=n(F),I=r(27),R=n(I),x=r(15),$=n(x),D=r(1),N=n(D),U=r(63),L=n(U);t.formReducer=T.default,t.modelReducer=C.default,t.combineForms=A.default,t.createForms=M.createForms,t.initialFieldState=k.default,t.actions=u.default,t.actionTypes=i.default,t.controls=O.default,t.Field=f.default,t.Control=p.default,t.Form=y.default,t.LocalForm=m.default,t.Errors=g.default,t.Fieldset=d.default,t.createFieldClass=l.createFieldClass,t.modeled=P.default,t.batched=E.default,t.form=L.default,t.getField=$.default,t.getModel=N.default,t.track=R.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u(e,t){var r={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r}function a(e,t){return e?e+"."+t:t}function i(e){var t=Date.now();return S[t]=e,t}function l(e,t,r){return function(n,o){var u=e(n,o);return S[r][t]=u,u}}function f(){function e(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},f=Object.keys(e),d={},s={},p=c({},j,n),v=p.key,y=p.plugins,h=u(p,["key","plugins"]),m=i({});return f.forEach(function(n){var o=e[n],u=a(t,n);if("function"==typeof o){var i=void 0;try{i=o(void 0,O.default)}catch(e){i=null}d[n]=l(r.modeled(o,u),u,m),s[n]=i}else d[n]=l(r.modelReducer(u,o),u,m),s[n]=r.toJS(o)}),c({},d,o({},v,function(e,n){return r.formReducer(t,s,c({plugins:y},h))(e,c({},n,{state:Object.assign({},S[m])}))}))}function t(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=e(t,r,n);return(0,m.combineReducers)(o)}var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:P;return{createForms:e,combineForms:t}}Object.defineProperty(t,"__esModule",{value:!0}),t.createForms=t.createFormCombiner=void 0;var c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},d=r(41),s=n(d),p=r(31),v=n(p),y=r(20),h=n(y),m=r(37),b=r(11),g=n(b),_=r(18),O=n(_),j={key:"forms",plugins:[]},P={modelReducer:v.default,formReducer:h.default,modeled:s.default,toJS:g.default},S={},E=f(),V=E.combineForms,T=E.createForms;t.default=V,t.createFormCombiner=f,t.createForms=T},function(e,t){"use strict";function r(e,t){return e&&t&&e.length===t.length&&e.every(function(e,r){return e===t[r]})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r},function(e,t){"use strict";function r(e,t){return"string"==typeof e?e===t:!!~e.indexOf(t)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var r=e.children,n=t.children;if(i.default.Children.count(r)!==i.default.Children.count(n)||!i.default.Children.count(r)||!i.default.Children.count(n))return!0;var o=i.default.Children.toArray(r),a=i.default.Children.toArray(n);return o.length===a.length&&[].concat(o).some(function(e,t){var r=a[t];return e.props&&r.props?u(e,r.props,r.state):!(0,d.default)(e,r)})}function u(e,t,r){return e.props.children?(0,f.default)(e,t,r)||o(e.props,t):(0,f.default)(e,t,r)}Object.defineProperty(t,"__esModule",{value:!0}),t.compareChildren=o,t.default=u;var a=r(5),i=n(a),l=r(89),f=n(l),c=r(8),d=n(c)},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){if(e&&!e.$form)return"undefined"!=typeof e.loadedValue?e.loadedValue:e.initialValue;var t=(0,a.default)(e,function(e,t){if("$form"!==t)return o(e)});return delete t.$form,t}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var u=r(3),a=n(u)},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){return(0,a.default)(e)?Object.keys(e).every(function(t){return o(e[t])}):!!e}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var u=r(2),a=n(u)},function(e,t){"use strict";function r(e,t){if(Array.isArray(e))return e.map(t);var r=Object.keys(e).map(function(r){return t(e[r],r,e)});return r}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){return(0,i.default)(e)&&(0,i.default)(t)?(0,f.default)(u({},e),t):t}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};t.default=o;var a=r(2),i=n(a),l=r(51),f=n(l)},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){return a.default.merge(e,t)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var u=r(9),a=n(u)},function(e,t){"use strict";function r(e){return function(){return e}}var n=function(){};n.thatReturns=r,n.thatReturnsFalse=r(!1),n.thatReturnsTrue=r(!0),n.thatReturnsNull=r(null),n.thatReturnsThis=function(){return this},n.thatReturnsArgument=function(e){return e},e.exports=n},function(e,t,r){"use strict";function n(e,t,r,n,u,a,i,l){if(o(t),!e){var f;if(void 0===t)f=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[r,n,u,a,i,l],d=0;f=new Error(t.replace(/%s/g,function(){return c[d++]})),f.name="Invariant Violation"}throw f.framesToPop=1,f}}var o=function(e){};e.exports=n},function(e,t,r){"use strict";var n=r(52),o=n;e.exports=o},function(e,t){(function(t){function r(e,t){for(var r=-1,n=e?e.length:0,o=Array(n);++r<n;)o[r]=t(e[r],r,e);return o}function n(e,t){return null==e?void 0:e[t]}function o(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function u(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function a(){this.__data__=pe?pe(null):{}}function i(e){return this.has(e)&&delete this.__data__[e]}function l(e){var t=this.__data__;if(pe){var r=t[e];return r===K?void 0:r}return ie.call(t,e)?t[e]:void 0}function f(e){var t=this.__data__;return pe?void 0!==t[e]:ie.call(t,e)}function c(e,t){var r=this.__data__;return r[e]=pe&&void 0===t?K:t,this}function d(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function s(){this.__data__=[]}function p(e){var t=this.__data__,r=P(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():de.call(t,r,1),!0}function v(e){var t=this.__data__,r=P(t,e);return r<0?void 0:t[r][1]}function y(e){return P(this.__data__,e)>-1}function h(e,t){var r=this.__data__,n=P(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}function m(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function b(){this.__data__={hash:new u,map:new(se||d),string:new u}}function g(e){return T(this,e).delete(e)}function _(e){return T(this,e).get(e)}function O(e){return T(this,e).has(e)}function j(e,t){return T(this,e).set(e,t),this}function P(e,t){for(var r=e.length;r--;)if(I(e[r][0],t))return r;return-1}function S(e){if(!x(e)||M(e))return!1;var t=R(e)||o(e)?fe:Q;return t.test(F(e))}function E(e){if("string"==typeof e)return e;if(D(e))return ye?ye.call(e):"";var t=e+"";return"0"==t&&1/e==-B?"-0":t}function V(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}function T(e,t){var r=e.__data__;return k(t)?r["string"==typeof t?"string":"hash"]:r.map}function w(e,t){var r=n(e,t);return S(r)?r:void 0}function k(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}function M(e){return!!ue&&ue in e}function A(e){if("string"==typeof e||D(e))return e;var t=e+"";return"0"==t&&1/e==-B?"-0":t}function F(e){if(null!=e){try{return ae.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function C(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new TypeError(L);var r=function(){var n=arguments,o=t?t.apply(this,n):n[0],u=r.cache;if(u.has(o))return u.get(o);var a=e.apply(this,n);return r.cache=u.set(o,a),a};return r.cache=new(C.Cache||m),r}function I(e,t){return e===t||e!==e&&t!==t}function R(e){var t=x(e)?le.call(e):"";return t==H||t==q}function x(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function $(e){return!!e&&"object"==typeof e}function D(e){return"symbol"==typeof e||$(e)&&le.call(e)==G}function N(e){return null==e?"":E(e)}function U(e){return me(e)?r(e,A):D(e)?[e]:V(he(e))}var L="Expected a function",K="__lodash_hash_undefined__",B=1/0,H="[object Function]",q="[object GeneratorFunction]",G="[object Symbol]",Y=/^\./,W=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,z=/[\\^$.*+?()[\]{}|]/g,J=/\\(\\)?/g,Q=/^\[object .+?Constructor\]$/,X="object"==typeof t&&t&&t.Object===Object&&t,Z="object"==typeof self&&self&&self.Object===Object&&self,ee=X||Z||Function("return this")(),te=Array.prototype,re=Function.prototype,ne=Object.prototype,oe=ee["__core-js_shared__"],ue=function(){var e=/[^.]+$/.exec(oe&&oe.keys&&oe.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),ae=re.toString,ie=ne.hasOwnProperty,le=ne.toString,fe=RegExp("^"+ae.call(ie).replace(z,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ce=ee.Symbol,de=te.splice,se=w(ee,"Map"),pe=w(Object,"create"),ve=ce?ce.prototype:void 0,ye=ve?ve.toString:void 0;u.prototype.clear=a,u.prototype.delete=i,u.prototype.get=l,u.prototype.has=f,u.prototype.set=c,d.prototype.clear=s,d.prototype.delete=p,d.prototype.get=v,d.prototype.has=y,d.prototype.set=h,m.prototype.clear=b,m.prototype.delete=g,m.prototype.get=_,m.prototype.has=O,m.prototype.set=j;var he=C(function(e){e=N(e);var t=[];return Y.test(e)&&t.push(""),e.replace(W,function(e,r,n,o){t.push(n?o.replace(J,"$1"):r||e)}),t});C.Cache=m;var me=Array.isArray;e.exports=U}).call(t,function(){return this}())},function(e,t){"use strict";var r="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";e.exports=r},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function u(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if("undefined"!=typeof t)return i({},r,e[t])}function a(){function e(e,n,o,a){var i=function(i){for(var l=arguments.length,f=Array(l>1?l-1:0),c=1;c<l;c++)f[c-1]=arguments[c];return function(l,c){var d=t.get(c(),i,n),s=e.apply(void 0,[d].concat(f)),p=a?a.apply(void 0,[s].concat(f)):void 0;l(r(i,s,u(f,o-1,p)))}};return i}var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:P,r=function e(r,n){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},u=i({silent:!1,multi:(0,m.default)(r),external:!0},o);return"function"==typeof n?function(u,a){var i=t.get(a(),r);return u(e(r,n(i),o))}:i({type:g.default.CHANGE,model:r,value:t.getValue(n)},u)},n=e(function(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(e){
return e===r},u=e.filter(function(e){return!n(e)});return t.length(e)===t.length(u)?[].concat(o(e),[r]):u},t.array,3),a=e(function(e,r){return t.push(e||t.array,r)},t.array,2),l=e(function(e){return!e},void 0,1),f=function(e,n){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},u=o.currentValue;if((0,m.default)(e)){var a=u||t.array,i=(a||t.array).filter(function(e){return e!==n}),l=t.length(i)===t.length(a)?t.push(a,n):i;return r(e,l)}return r(e,!u)},c=function(e,r){return function(n,o){var u=t.get(o(),e),a=f(e,r,{currentValue:u});n(a)}},s=e(function(e,t){return e.filter(t)},t.array,2),p=function(e){return{type:g.default.RESET,model:e}},v=e(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d.default;return e.map(t)},t.array,2),y=e(function(e,r){return t.splice(e,r,1)},t.array,2,function(e,t){return{removeKeys:[t]}}),h=e(function(e,r,n){if(r>=t.length(e)||n>=t.length(e))throw new Error("Error moving array item: invalid bounds "+r+", "+n);var o=t.get(e,r),u=t.splice(e,r,1),a=t.splice(u,n,0,o);return a},t.array,3),b=e(t.merge,{},2),_=e(function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n="string"==typeof r?[r]:r,o=n.reduce(function(e,r){return t.remove(e,r)},e);return o},{},2,function(e,t){return{removeKeys:t}}),S=function(e,t,n){return r(e,t,i({silent:!0,load:!0},n))};return(0,O.default)({change:r,xor:n,push:a,toggle:l,check:c,checkWithValue:f,filter:s,reset:p,map:v,remove:y,move:h,merge:b,omit:_,load:S},j.trackable)}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};t.createModelActions=a;var l=r(1),f=n(l),c=r(11),d=n(c),s=r(9),p=n(s),v=r(23),y=n(v),h=r(24),m=n(h),b=r(4),g=n(b),_=r(3),O=n(_),j=r(27),P={get:f.default,getValue:y.default,splice:p.default.splice,merge:p.default.merge,remove:p.default.dissoc,push:p.default.push,length:function(e){return e.length},object:{},array:[]};t.default=a()},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function i(e,t){var r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return"function"==typeof r?r(e,t):Array.isArray(r)||"object"===("undefined"==typeof r?"undefined":c(r))||"string"==typeof r?(0,O.default)(r)(e):!!r}function l(){function e(e,r){var n=r.model,o=(0,A.default)(n,e),u=t.getForm(e,o);(0,L.default)(u,'Unable to retrieve errors. Could not find form for "%s" in the store.',o);var a=u.$form,i=t.getFieldFromState(e,o)||$.default;return{model:o,modelValue:t.get(e,o),formValue:a,fieldValue:i}}var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:K,r=function(e){function t(){return o(this,t),u(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,e),f(t,[{key:"shouldComponentUpdate",value:function(e){var t=e.fieldValue,r=e.formValue,n=this.props.dynamic;return n?!(0,N.default)(this.props,e):t!==this.props.fieldValue||r!==this.props.formValue}},{key:"mapErrorMessages",value:function(e){var t=this,r=this.props.messages;return"string"==typeof e?this.renderError(e,"error"):e?(0,g.default)(e,function(e,n){var o=r[n];if(e){if(o||"string"==typeof e)return t.renderError(o||e,n);if((0,P.default)(e))return t.mapErrorMessages(e)}return!1}).reduce(function(e,t){return t?e.concat(t):e},[]):null}},{key:"renderError",value:function(e,t){var r=this.props,n=r.component,o=r.model,u=r.modelValue,a=r.fieldValue,i=r.fieldValue.errors,l={key:t,model:o,modelValue:u,fieldValue:a},f="function"==typeof e?e(u,i[t]):e;if(!f)return null;var c="function"==typeof n?l:{key:t};return s.default.createElement(n,c,f)}},{key:"render",value:function(){var e=this.props,t=e.fieldValue,r=e.formValue,n=e.show,o=e.wrapper,u="function"==typeof o?this.props:(0,E.default)(this.props,Object.keys(B));if(!i(t,r,n))return null;var a=(0,C.default)(t)?null:this.mapErrorMessages(t.errors);return a?s.default.createElement(o,u,a):null}}]),t}(d.Component);return r.defaultProps={wrapper:"div",component:"span",messages:{},show:!0,dynamic:!0},(0,R.default)((0,y.connect)(e)(r))}Object.defineProperty(t,"__esModule",{value:!0}),t.createErrorsClass=void 0;var f=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},d=r(5),s=n(d),p=r(10),v=n(p),y=r(17),h=r(1),m=n(h),b=r(49),g=n(b),_=r(36),O=n(_),j=r(2),P=n(j),S=r(12),E=n(S),V=r(22),T=n(V),w=r(15),k=n(w),M=r(16),A=n(M),F=r(19),C=n(F),I=r(25),R=n(I),x=r(6),$=n(x),D=r(8),N=n(D),U=r(7),L=n(U),K={get:m.default,getForm:T.default,getFieldFromState:k.default},B={modelValue:v.default.any,formValue:v.default.object,fieldValue:v.default.object,model:v.default.string.isRequired,messages:v.default.objectOf(v.default.oneOfType([v.default.string,v.default.func,v.default.bool])),show:v.default.any,wrapper:v.default.oneOfType([v.default.string,v.default.func,v.default.element]),component:v.default.oneOfType([v.default.string,v.default.func,v.default.element]),dispatch:v.default.func,dynamic:v.default.oneOfType([v.default.bool,v.default.arrayOf(v.default.string)]),store:v.default.shape({subscribe:v.default.func,dispatch:v.default.func,getState:v.default.func}),storeSubscription:v.default.any};t.createErrorsClass=l,t.default=l()},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function i(e,t,r){var n=r.controlPropsMap,o=Object.keys(n).filter(function(t){var r=n[t];return!(!(0,O.default)(r)||!r.component)&&e.type===r.component});if(o.length)return o[0];try{var u=e.constructor.displayName||e.type.displayName||e.type.name||e.type;return"input"===u&&(u=n[e.props.type]?e.props.type:"text"),n[u]?u:null}catch(e){return}}function l(){function e(e,t){var n=t.model,o=(0,D.default)(n,e),u=r.getFieldFromState(e,o)||q.default;return{model:o,fieldValue:u}}var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Y,n=r.controlPropTypes||G,l={controlPropsMap:c({},F.default,t)},p={checkbox:{changeAction:r.actions.checkWithValue,getValue:B.getCheckboxValue,isToggle:!0},radio:{isToggle:!0}},v=function(e){function t(){return o(this,t),u(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,e),f(t,[{key:"shouldComponentUpdate",value:function(e){var t=this.props.dynamic;return t?(0,I.default)(this,e):(0,x.default)(this,e)}},{key:"createControlComponent",value:function(e){var t=this.props;if(!e||!e.props||e instanceof M.default)return e;var o=i(e,t,l),u=t.mapProps,a=void 0===u?l.controlPropsMap[o]:u,f=(0,P.default)(t,Object.keys(n));return a?s.default.createElement(r.Control,c({},f,{control:e,controlProps:e.props,component:e.type,mapProps:a},p[o]||{})):s.default.cloneElement(e,null,this.mapChildrenToControl(e.props.children))}},{key:"mapChildrenToControl",value:function(e){var t=this;return s.default.Children.count(e)>1?s.default.Children.map(e,function(e){return t.createControlComponent(e)}):this.createControlComponent(e)}},{key:"render",value:function(){var e=this.props,t=e.component,r=e.children,o=e.fieldValue,u=(0,g.default)(this.props,Object.keys(n)),a="function"==typeof r?r(o):r;return t?s.default.createElement(t,u,this.mapChildrenToControl(a)):((0,V.default)(1===s.default.Children.count(a),"Empty wrapper components for <Field> are only possiblewhen there is a single child. Please check the children"+('passed into <Field model="'+this.props.model+'">.')),this.createControlComponent(a))}}]),t}(d.Component);return v.defaultProps={updateOn:"change",asyncValidateOn:"blur",parser:m.default,changeAction:w.default.change,dynamic:!0,component:"div"},(0,K.default)((0,S.connect)(e)(v))}Object.defineProperty(t,"__esModule",{value:!0}),t.createFieldClass=t.controlPropsMap=void 0;var f=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},d=r(5),s=n(d),p=r(10),v=n(p),y=r(1),h=(n(y),r(11)),m=n(h),b=r(12),g=n(b),_=r(2),O=n(_),j=r(81),P=n(j),S=r(17),E=r(7),V=n(E),T=r(13),w=n(T),k=r(39),M=n(k),A=r(29),F=n(A),C=r(46),I=n(C),R=r(82),x=n(R),$=r(16),D=n($),N=r(15),U=n(N),L=r(25),K=n(L),B=r(23),H=r(6),q=n(H),G={model:v.default.oneOfType([v.default.func,v.default.string]).isRequired,component:v.default.oneOfType([v.default.func,v.default.string]),parser:v.default.func,updateOn:v.default.oneOfType([v.default.arrayOf(v.default.string),v.default.string]),changeAction:v.default.func,validators:v.default.oneOfType([v.default.func,v.default.object]),asyncValidators:v.default.object,validateOn:v.default.oneOfType([v.default.arrayOf(v.default.string),v.default.string]),asyncValidateOn:v.default.oneOfType([v.default.arrayOf(v.default.string),v.default.string]),errors:v.default.oneOfType([v.default.func,v.default.object]),mapProps:v.default.oneOfType([v.default.func,v.default.object]),componentMap:v.default.object,dynamic:v.default.bool,dispatch:v.default.func,getRef:v.default.func,fieldValue:v.default.object,store:v.default.shape({subscribe:v.default.func,dispatch:v.default.func,getState:v.default.func})},Y={Control:M.default,controlPropTypes:G,getFieldFromState:U.default,actions:w.default};t.controlPropsMap=F.default,t.createFieldClass=l,t.default=l(F.default)},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function i(e,t){var r=t.model,n=(0,y.default)(r,e);return{model:n}}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),f=r(5),c=n(f),d=r(10),s=n(d),p=r(17),v=r(16),y=n(v),h=r(12),m=n(h),b=r(25),g=n(b),_={model:s.default.string.isRequired,component:s.default.any,dispatch:s.default.func,store:s.default.shape({subscribe:s.default.func,dispatch:s.default.func,getState:s.default.func}),storeSubscription:s.default.any},O=function(e){function t(){return o(this,t),u(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,e),l(t,[{key:"getChildContext",value:function(){return{model:this.props.model}}},{key:"render",value:function(){var e=this.props.component,t=(0,m.default)(this.props,Object.keys(_));return c.default.createElement(e,t)}}]),t}(f.Component);O.displayName="Fieldset",O.childContextTypes={model:s.default.any},O.defaultProps={component:"div"},t.default=(0,g.default)((0,p.connect)(i)(O))},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},f=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),c=r(5),d=n(c),s=r(10),p=(n(s),r(40)),v=n(p),y=r(43),h=n(y),m=r(37),b=r(12),g=n(b),_=function(e){function t(e){u(this,t);var r=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.store=e.store||(0,m.createStore)((0,h.default)(o({},e.model,e.initialState))),r.dispatch=function(e){return"function"==typeof e?e(r.store.dispatch,r.store.getState):r.store.dispatch(e)},r}return i(t,e),f(t,[{key:"componentDidMount",value:function(){this.props.getDispatch&&this.props.getDispatch(this.dispatch)}},{key:"render",value:function(){var e=(0,g.default)(this.props,["store","initialState"]);return d.default.createElement(v.default,l({store:this.store},e))}}]),t}(d.default.Component);_.displayName="LocalForm",_.defaultProps={initialState:{},model:"local"},t.default=_},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=["badInput","customError","patternMismatch","rangeOverflow","rangeUnderflow","stepMismatch","tooLong","tooShort","typeMismatch","valueMissing"];t.default=r},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){return u({},e,{get valid(){return(0,i.default)(e)},get pending(){return(0,f.default)(e)},get touched(){return(0,d.default)(e)},get retouched(){return(0,p.default)(e)}})}Object.defineProperty(t,"__esModule",{value:!0}),t.isRetouched=t.isTouched=t.isPending=t.isValid=void 0;var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};t.default=o;var a=r(19),i=n(a),l=r(64),f=n(l),c=r(67),d=n(c),s=r(66),p=n(s);t.isValid=i.default,t.isPending=f.default,t.isTouched=d.default,t.isRetouched=p.default},function(e,t){"use strict";function r(e){return!!e&&(e.$form?Object.keys(e).some(function(t){return r(e[t])}):e.pending)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r},function(e,t){"use strict";function r(e){return!!e&&(e.$form?Object.keys(e).every(function(t){return"$form"===t||r(e[t])}):e.pristine)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r},function(e,t){"use strict";function r(e){return!!e&&(e.$form?Object.keys(e).some(function(t){return r(e[t])}):e.retouched)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r},function(e,t){"use strict";function r(e){return!!e&&(e.$form?Object.keys(e).some(function(t){return r(e[t])}):e.touched)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function u(e){var t=e?i({},Q,e,{initialFieldState:i({},Q.initialFieldState,e.initialFieldState)}):Q,r=t.initialFieldState;return function e(t,n,u){var l=(0,c.getFieldAndForm)(t,u),s=a(l,1),v=s[0],h=v&&v.$form?v.$form:v,b=h.intents,_={},j={},S=void 0;switch(n.type){case f.default.FOCUS:_={focus:!0,intents:n.silent?b:z(b,n)};break;case f.default.BLUR:case f.default.SET_TOUCHED:var V=(0,m.default)(t,u).$form;_={focus:n.type!==f.default.BLUR&&v.focus,touched:!0,retouched:!(!V||!V.submitted&&!V.submitFailed)},S={touched:!0,retouched:_.retouched};break;case f.default.SET_UNTOUCHED:_={focus:!1,touched:!1};break;case f.default.SET_PRISTINE:case f.default.SET_DIRTY:var w=n.type===f.default.SET_PRISTINE;_={pristine:w},j={pristine:w},S=function(e){return{pristine:(0,g.default)(e)}};break;case f.default.SET_VALIDATING:_={validating:n.validating,validated:!n.validating};break;case f.default.SET_VALIDITY:case f.default.SET_ERRORS:var F,I=n.type===f.default.SET_ERRORS,x=void 0;x=I?n.merge?(0,k.default)(h.errors,n.errors):n.errors:n.merge?(0,k.default)(h.validity,n.validity):n.validity;var D=(0,P.default)(x)?(0,E.default)(x,T.default):!x,U=!v||!v.$form||(0,M.fieldsValid)(v,{async:!1});if(F={},o(F,I?"errors":"validity",x),o(F,I?"validity":"errors",D),o(F,"validating",!1),o(F,"validated",!0),o(F,"valid",U&&(I?!(0,R.default)(x):(0,C.default)(x))),_=F,n.async){var L=I?n.errors:n.validity;_.asyncKeys=!(0,P.default)(L)&&!Array.isArray(L)||Object.keys(L)}S=function(e){return{valid:(0,A.default)(e)}};break;case f.default.SET_FIELDS_VALIDITY:return(0,O.default)(n.fieldsValidity,function(e,t){return $.default.setValidity(t,e,n.options)}).reduce(function(t,r){return e(t,r,u.concat((0,N.default)(r.model)))},t);case f.default.RESET_VALIDITY:var K=function(){var e=i({},h.validity),t=i({},h.errors),o=void 0;return n.omitKeys?(n.omitKeys.forEach(function(r){delete e[r],delete t[r]}),o=(0,C.default)(e)):(e=r.validity,t=r.errors,o=r.valid),_={valid:o,validity:e,errors:t},j={valid:r.valid,validity:r.validity,errors:r.errors},"break"}();if("break"===K)break;case f.default.SET_PENDING:_={pending:n.pending,submitted:!1,submitFailed:!1,retouched:!1},S={pending:n.pending};break;case f.default.SET_SUBMITTED:var B=!!n.submitted;_={pending:!1,submitted:B,submitFailed:!B&&h&&h.submitFailed,touched:!0,retouched:!1},j={submitted:B,submitFailed:!B&&_.submitFailed,retouched:!1};break;case f.default.SET_SUBMIT_FAILED:_={pending:!1,submitted:h.submitted&&!n.submitFailed,submitFailed:!!n.submitFailed,touched:!0,retouched:!1},j={pending:!1,submitted:!n.submitFailed,submitFailed:!!n.submitFailed,touched:!0,retouched:!1};break;case f.default.RESET:return u.length?(0,H.default)(t,u,Y(v,r)):Y(v,r);case f.default.SET_INITIAL:var q=W(r);return(0,d.default)(t,u,q,q);case f.default.ADD_INTENT:_={intents:z(b,n.intent)};break;case f.default.CLEAR_INTENTS:_={intents:J(b,n.intent)};break;case f.default.CHANGE:return(0,p.default)(t,u,function(e){var t=(0,G.default)(e);return e.$form?Object.keys(e.$form.validity).length&&e.$form.validity||e.$form.valid||!(0,A.default)(e,{async:!1})?{value:t}:{value:t,validity:!0,errors:!1,valid:!0}:i({},r,{value:t,initialValue:t})});default:return t}n.clearIntents&&(_.intents=J(b,n.clearIntents));var Q=(0,d.default)(t,u,_),X=Object.keys(j).length?(0,y.default)(Q,u,j):Q,Z=S?(0,p.default)(X,u,S):X;return Z}}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){var r=[],n=!0,o=!1,u=void 0;try{for(var a,i=e[Symbol.iterator]();!(n=(a=i.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){o=!0,u=e}finally{try{!n&&i.return&&i.return()}finally{if(o)throw u}}return r}return function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};t.createFormActionsReducer=u;var l=r(4),f=n(l),c=r(83),d=n(c),s=r(84),p=n(s),v=r(85),y=n(v),h=r(73),m=n(h),b=r(65),g=n(b),_=r(49),O=n(_),j=r(2),P=n(j),S=r(3),E=n(S),V=r(75),T=n(V),w=r(50),k=n(w),M=r(19),A=n(M),F=r(48),C=n(F),I=r(35),R=n(I),x=r(38),$=n(x),D=r(26),N=n(D),U=r(6),L=n(U),K=r(21),B=r(14),H=n(B),q=r(47),G=n(q),Y=function(e,t){if(!(0,P.default)(e))return e;var r=[{type:"validate"}],n=(0,K.getMeta)(e,"initialValue"),o=(0,K.getMeta)(e,"loadedValue");return o&&n!==o&&(r.push({type:"load"}),n=o),(0,K.fieldOrForm)((0,K.getMeta)(e,"model"),n,i({},t,{intents:r}))},W=function(e){return function(t,r){return(0,P.default)(t)?"$form"===r?(0,K.updateFieldState)(e,{value:t.value,model:t.model}):t.$form?(0,E.default)(t,Y):(0,K.updateFieldState)(e,{value:t.value,model:t.model}):t}},z=function(e,t){return e?e.some(function(e){return e.type===t.type})?e:e.concat(t):[t]},J=function(e,t){return e&&"undefined"!=typeof t?e.filter(function(e){return e.type!==t.type}):[]},Q={initialFieldState:L.default};t.default=u()},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,n=t.value,u=t.removeKeys,l=t.silent,f=t.load,c=t.model,s=t.external,p=e&&e.$form?e.$form:e,v={validated:!1,retouched:!!p.submitted||p.retouched,intents:s?[{type:"validate"}]:[],pristine:!!l&&p.pristine,value:n,loadedValue:f?n:p.loadedValue};if((0,y.default)(e.value,n))return d.default.merge(e,v);if(u){var h=function(){(0,w.default)(e&&e.$form,'Unable to remove keys. Field for "%s" in store is not an array/object.',c);var t=Array.isArray(e.$form.value),r=Array.isArray(u)?u:[u],n=void 0;if(t){n=[],Object.keys(e).forEach(function(t){~r.indexOf(+t)||"$form"===t||(n[t]=i({},e[t]))});var o=n.filter(function(e){return e}).map(function(e,t){return i({},e,{model:c+"."+t})});return o.$form=e.$form,{v:o}}return n=i({},e),Object.keys(e).forEach(function(e){~r.indexOf(e)&&delete n[""+e]}),{v:n}}();if("object"===("undefined"==typeof h?"undefined":a(h)))return h.v}if(!Array.isArray(n)&&!(0,m.default)(n))return d.default.merge(e,d.default.set(v,"value",n));var b=(0,g.default)(n,function(t,n){var u=e[n]||(0,_.createInitialState)(""+(r?r+".":"")+c+"."+n,t);return Object.hasOwnProperty.call(u,"$form")?o(u,{model:n,value:t,load:f},r?r+"."+c:c):(0,y.default)(t,u.value)?u:d.default.merge(u,d.default.assign(v,{value:t,loadedValue:f?t:u.loadedValue}))}),O=d.default.merge(e.$form||j.default,d.default.set(v,"retouched",e.submitted||e.$form&&e.$form.retouched));return d.default.set(b,"$form",O)}function u(e,t,r){if(t.type!==f.default.CHANGE)return e;var n=(0,p.default)(e,r,(0,_.createInitialState)(t.model,t.value)),u=o(n,t);if(!r.length)return u;var a=(0,S.default)(e,r,u,function(e){if(!e.$form)return e;var r=t.state?(0,p.default)(t.state,e.$form.model):(0,V.default)(e),n=i({},e.$form,{value:r});return t.silent?n.loadedValue=r:n.pristine=!1,i({},e,{$form:n})});return a}Object.defineProperty(t,"__esModule",{value:!0});var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e};t.default=u;var l=r(4),f=n(l),c=r(9),d=n(c),s=r(1),p=n(s),v=r(8),y=n(v),h=r(2),m=n(h),b=r(3),g=n(b),_=r(20),O=r(6),j=n(O),P=r(14),S=n(P),E=r(47),V=n(E),T=r(7),w=n(T)},function(e,t){"use strict";function r(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return function(e,r){return t.reduceRight(function(e,t){return t(e,r)},e)}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r},function(e,t){"use strict";function r(e,t){var r=void 0;return function(){for(var n=arguments.length,o=Array(n),u=0;u<n;u++)o[u]=arguments[u];var a=function(){r=null,e.apply(null,o)};clearTimeout(r),r=setTimeout(a,t)}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r},function(e,t){"use strict";function r(e,t){var r=void 0;return Object.keys(e).some(function(n){var o=t(e[n],n,e);return!!o&&(r=n,!0)}),r}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var r=t.slice(0,-1);if(!r.length)return e;var n=(0,a.default)(e,r);return(0,l.default)(n,'Could not find form for "%s" in the store.',r.join(".")),n}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var u=r(1),a=n(u),i=r(7),l=n(i)},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var r=(0,i.default)(e,t,f.default);return"$form"in r?r.$form:r}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var u=r(2),a=(n(u),r(1)),i=n(a),l=r(6),f=n(l)},function(e,t){"use strict";function r(e){return!e}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){return"function"==typeof e?function(t){return(0,l.default)(e(t))}:(0,a.default)(e,o)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var u=r(3),a=n(u),i=r(34),l=n(i)},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r="undefined"!=typeof window&&window.navigator&&window.navigator.product&&"ReactNative"===window.navigator.product;t.default=r},function(e,t){"use strict";function r(e,t){var r=[[],[]];return e.forEach(function(n,o){t(n,o,e)?r[0].push(n):r[1].push(n)}),r}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(e===t)return!0;var r=(0,i.default)(e),n=(0,i.default)(t),o=n.every(function(e,t){return r[t]===e});return o}function u(e,t){if(e===t)return[];var r=(0,i.default)(e),n=(0,i.default)(t),o=r.reduce(function(e,t,r){return t===n[r]?e:(e.push(t),e)},[]);return o}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o,t.pathDifference=u;var a=r(55),i=n(a)},function(e,t){"use strict";function r(e){return function(t){for(var r=arguments.length,n=Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return t&&t.persist&&t.persist(),e.apply(void 0,[t].concat(n)),t}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r},function(e,t){"use strict";function r(e,t){for(var r={},n=0;n<t.length;n++){var o=t[n];r[o]=e[o]}return r}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){return!(0,i.default)(e.props,t,{omitKeys:["children"]})||u.Children.count(e.props.children)!==u.Children.count(t.children)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var u=r(5),a=r(8),i=n(a)},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function u(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return 1===e.length?u({},e[0],t):u({},e[0],a(e.slice(1),t))}function i(e,t){var r=(0,p.default)(e,t),n=e;if((0,O.default)(n,'Could not find form for "%s" in the store.',t),!r){var o=(0,p.default)(e.$form.initialValue,t);n=d.default.merge((0,h.createInitialState)(e.$form.model,a(t,o)),e),r=(0,p.default)(n,t)}return[r,n]}function l(e,t,r,n,u){var a=i(e,t),l=f(a,2),c=l[0],d=l[1];if(!c)return e;var s=c.hasOwnProperty("$form"),p=s?[].concat(o(t),["$form"]):t,v=s?c.$form:c,h="function"==typeof r?r(v):r;if(s&&n){var b=(0,y.default)(c,function(e,t){if("$form"===t)return(0,m.updateFieldState)(v,h);var r="function"==typeof n?n(e,h):n;return(0,m.updateFieldState)(e,r)});return t.length?(0,g.default)(d,t,b,u):b}return(0,g.default)(d,p,(0,m.updateFieldState)(v,h),u)}Object.defineProperty(t,"__esModule",{value:!0});var f=function(){function e(e,t){var r=[],n=!0,o=!1,u=void 0;try{for(var a,i=e[Symbol.iterator]();!(n=(a=i.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){o=!0,u=e}finally{try{!n&&i.return&&i.return()}finally{if(o)throw u}}return r}return function(t,r){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();t.getFieldAndForm=i,t.default=l;var c=r(9),d=n(c),s=r(1),p=n(s),v=r(3),y=n(v),h=r(20),m=r(21),b=r(14),g=n(b),_=r(7),O=n(_)},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function u(e,t,r){var n=t.slice(0,-1),a=n.length?(0,f.default)(e,n):e;if(!a)return e;var l=a.$form,c="function"==typeof r?r(a):r,s=(0,d.default)(e,[].concat(o(n),["$form"]),i.default.merge(l,c));return n.length?u(s,n,r):s}Object.defineProperty(t,"__esModule",{value:!0}),t.default=u;var a=r(9),i=n(a),l=r(1),f=n(l),c=r(14),d=n(c)},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(e&&e.$form){var r=function(){var r={};return Object.keys(e).forEach(function(n){"$form"===n?r.$form=(0,d.updateFieldState)(e.$form,t):r[n]=o(e[n],t)}),{v:r}}();if("object"===("undefined"==typeof r?"undefined":a(r)))return r.v}return(0,d.updateFieldState)(e,t)}function u(e,t,r){var n=(0,l.default)(e,t);if(!n||!n.$form)return e;var u={};return Object.keys(n).forEach(function(e){"$form"===e?u.$form=n.$form:u[e]=o(n[e],r)}),t.length?(0,c.default)(e,t,u):u}Object.defineProperty(t,"__esModule",{value:!0});var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.default=u;var i=r(1),l=n(i),f=r(14),c=n(f),d=r(21)},function(e,t){(function(t){function r(e,t){return null==e?void 0:e[t]}function n(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}function o(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function u(){this.__data__=he?he(null):{}}function a(e){return this.has(e)&&delete this.__data__[e]}function i(e){var t=this.__data__;if(he){var r=t[e];return r===B?void 0:r}return ce.call(t,e)?t[e]:void 0}function l(e){var t=this.__data__;return he?void 0!==t[e]:ce.call(t,e)}function f(e,t){var r=this.__data__;return r[e]=he&&void 0===t?B:t,this}function c(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function d(){this.__data__=[]}function s(e){var t=this.__data__,r=j(t,e);if(r<0)return!1;var n=t.length-1;return r==n?t.pop():ve.call(t,r,1),!0}function p(e){var t=this.__data__,r=j(t,e);return r<0?void 0:t[r][1]}function v(e){return j(this.__data__,e)>-1}function y(e,t){var r=this.__data__,n=j(r,e);return n<0?r.push([e,t]):r[n][1]=t,this}function h(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var n=e[t];this.set(n[0],n[1])}}function m(){this.__data__={hash:new o,map:new(ye||c),string:new o}}function b(e){return T(this,e).delete(e)}function g(e){return T(this,e).get(e)}function _(e){
return T(this,e).has(e)}function O(e,t){return T(this,e).set(e,t),this}function j(e,t){for(var r=e.length;r--;)if(R(e[r][0],t))return r;return-1}function P(e,t){t=k(t,e)?[t]:V(t);for(var r=0,n=t.length;null!=e&&r<n;)e=e[F(t[r++])];return r&&r==n?e:void 0}function S(e){if(!$(e)||A(e))return!1;var t=x(e)||n(e)?se:ee;return t.test(C(e))}function E(e){if("string"==typeof e)return e;if(N(e))return be?be.call(e):"";var t=e+"";return"0"==t&&1/e==-H?"-0":t}function V(e){return _e(e)?e:ge(e)}function T(e,t){var r=e.__data__;return M(t)?r["string"==typeof t?"string":"hash"]:r.map}function w(e,t){var n=r(e,t);return S(n)?n:void 0}function k(e,t){if(_e(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!N(e))||z.test(e)||!W.test(e)||null!=t&&e in Object(t)}function M(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}function A(e){return!!le&&le in e}function F(e){if("string"==typeof e||N(e))return e;var t=e+"";return"0"==t&&1/e==-H?"-0":t}function C(e){if(null!=e){try{return fe.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function I(e,t){if("function"!=typeof e||t&&"function"!=typeof t)throw new TypeError(K);var r=function(){var n=arguments,o=t?t.apply(this,n):n[0],u=r.cache;if(u.has(o))return u.get(o);var a=e.apply(this,n);return r.cache=u.set(o,a),a};return r.cache=new(I.Cache||h),r}function R(e,t){return e===t||e!==e&&t!==t}function x(e){var t=$(e)?de.call(e):"";return t==q||t==G}function $(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function D(e){return!!e&&"object"==typeof e}function N(e){return"symbol"==typeof e||D(e)&&de.call(e)==Y}function U(e){return null==e?"":E(e)}function L(e,t,r){var n=null==e?void 0:P(e,t);return void 0===n?r:n}var K="Expected a function",B="__lodash_hash_undefined__",H=1/0,q="[object Function]",G="[object GeneratorFunction]",Y="[object Symbol]",W=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,z=/^\w*$/,J=/^\./,Q=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,X=/[\\^$.*+?()[\]{}|]/g,Z=/\\(\\)?/g,ee=/^\[object .+?Constructor\]$/,te="object"==typeof t&&t&&t.Object===Object&&t,re="object"==typeof self&&self&&self.Object===Object&&self,ne=te||re||Function("return this")(),oe=Array.prototype,ue=Function.prototype,ae=Object.prototype,ie=ne["__core-js_shared__"],le=function(){var e=/[^.]+$/.exec(ie&&ie.keys&&ie.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),fe=ue.toString,ce=ae.hasOwnProperty,de=ae.toString,se=RegExp("^"+fe.call(ce).replace(X,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),pe=ne.Symbol,ve=oe.splice,ye=w(ne,"Map"),he=w(Object,"create"),me=pe?pe.prototype:void 0,be=me?me.toString:void 0;o.prototype.clear=u,o.prototype.delete=a,o.prototype.get=i,o.prototype.has=l,o.prototype.set=f,c.prototype.clear=d,c.prototype.delete=s,c.prototype.get=p,c.prototype.has=v,c.prototype.set=y,h.prototype.clear=m,h.prototype.delete=b,h.prototype.get=g,h.prototype.has=_,h.prototype.set=O;var ge=I(function(e){e=U(e);var t=[];return J.test(e)&&t.push(""),e.replace(Q,function(e,r,n,o){t.push(n?o.replace(Z,"$1"):r||e)}),t});I.Cache=h;var _e=Array.isArray;e.exports=L}).call(t,function(){return this}())},function(e,t,r){"use strict";function n(e,t,r,n,o){}r(53),r(54),r(56),e.exports=n},function(e,t,r){"use strict";var n=(r(52),r(53)),o=(r(54),r(56),r(87));e.exports=function(e){function t(e){this.message=e,this.stack=""}var r,u=("function"==typeof Symbol&&Symbol.iterator,function(){n(!1,"React.PropTypes type checking code is stripped in production.")});u.isRequired=u;var a=function(){return u};return r={array:u,bool:u,func:u,number:u,object:u,string:u,symbol:u,any:u,arrayOf:a,element:u,instanceOf:a,node:u,objectOf:a,oneOf:a,oneOfType:a,shape:a},t.prototype=Error.prototype,r.checkPropTypes=o,r.PropTypes=r,r}},function(e,t,r){!function(t,r){e.exports=r()}(this,function(){"use strict";function e(e,t){for(var r in e)if(!(r in t))return!0;for(var n in t)if(e[n]!==t[n])return!0;return!1}var t=function(t,r,n){return e(t.props,r)||e(t.state,n)};return t})},function(e,t){e.exports=n}])});
|
docs-ui/components/barChart.stories.js
|
beeftornado/sentry
|
import React from 'react';
import {withInfo} from '@storybook/addon-info';
import BarChart from 'app/components/charts/barChart';
export default {
title: 'DataVisualization/Charts/BarChart',
};
export const _BarChart = withInfo('Stacked & Unstacked Bar Charts')(() => {
return (
<div>
<BarChart
style={{height: 250}}
stacked
series={[
{
seriesName: 'Unhandled Errors',
data: [
{
value: 923,
name: 'Chrome',
},
{
value: 107,
name: 'Safari',
},
{
value: 50,
name: 'Firefox',
},
],
},
{
seriesName: 'Handled Errors',
data: [
{
value: 100,
name: 'Chrome',
},
{
value: 99,
name: 'Safari',
},
{
value: 66,
name: 'Opera',
},
],
},
]}
/>
<BarChart
style={{height: 400}}
stacked
series={[
{
seriesName: 'Chrome',
data: [
{
value: 923,
name: 'Jan 1',
},
{
value: 107,
name: 'Jan 2',
},
{
value: 50,
name: 'Jan 3',
},
],
},
{
seriesName: 'Safari',
data: [
{
value: 100,
name: 'Jan 1',
},
{
value: 99,
name: 'Jan 2',
},
{
value: 66,
name: 'Jan 3',
},
{
value: 66,
name: 'Jan 4',
},
],
},
]}
/>
<h2 style={{paddingLeft: '60px'}}>Regular Bar Chart (Not Stacked):</h2>
<BarChart
style={{height: 400}}
series={[
{
seriesName: 'Chrome',
data: [
{
value: 923,
name: 'Jan 1',
},
{
value: 107,
name: 'Jan 2',
},
{
value: 50,
name: 'Jan 3',
},
],
},
{
seriesName: 'Safari',
data: [
{
value: 100,
name: 'Jan 1',
},
{
value: 99,
name: 'Jan 2',
},
{
value: 66,
name: 'Jan 3',
},
{
value: 66,
name: 'Jan 4',
},
],
},
]}
/>
</div>
);
});
_BarChart.story = {
name: 'BarChart',
};
|
src/svg-icons/content/block.js
|
ruifortes/material-ui
|
import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ContentBlock = (props) => (
<SvgIcon {...props}>
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zM4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12zm8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8z"/>
</SvgIcon>
);
ContentBlock = pure(ContentBlock);
ContentBlock.displayName = 'ContentBlock';
ContentBlock.muiName = 'SvgIcon';
export default ContentBlock;
|
packages/lore-generate-new/templates/es6/src/components/RemoveLoadingScreen.js
|
lore/lore
|
/**
* This component removes the loading screen. It does so by adding a class to hide it,
* and then removes it from the DOM by setting the display property to 'none'.
*/
import React from 'react';
import PropTypes from 'prop-types';
export default class RemoveLoadingScreen extends React.Component {
/*
* This component will remove the loading screen once it's mounted.
*/
componentDidMount() {
const element = document.getElementById("loading-screen");
// As a precaution, check if the loading screen exists or if it
// has already been hidden and stop here if either is true
if (
!element ||
element.className === "loading-screen-hide"
) {
return;
}
// Set up an event listener that will be invoked after the css transition
// finishes; in this case, once the opacity drops all the way down to 0 (it
// starts at 1)
element.addEventListener("transitionend", function(event) {
// Once the transition is done, apply a class that will set the "display"
// property of the loading screen to "none". If you don't do this, the
// user won't be able to interact with the main application. Alternatively,
// you could also remove the element from the DOM via element.remove()
element.className = "loading-screen-hide";
}, {
// Make sure this event listener is only invoked once
once: true
});
// Apply a class to the loading screen that will start the process of causing
// it to fade away, revealing the main application behind it.
//
// Note about why we're using setTimeout:
//
// In order for CSS transitions to work, the element needs to be rendered to
// the DOM *before* the property we want to transition away from changes. In
// this example, we need to have the loading-screen rendered to the DOM with an
// opacity of 1 *before* we apply a class that changes it's opacity to 0.
//
// But during development, when working on an unauthenticated application (such as a
// newly generated Lore project) where the loading screen is removed during the FIRST
// render cycle, it appears that it's actually possible for the componentDidMount()
// method of this component to run BEFORE the loading screen is visible in the DOM, which
// will prevent the transition from being picked up, and which will in turn mean that
// the application will be rendered with an invisible mask that will prevent you from
// interacting with it.
//
// In order to avoid the issue, we're wrapping the code that applies the "loading-screen-fade"
// class with setTimeout(), so that we can force a delay and make sure the loading-screen
// is visible in the DOM before we try to remove it.
//
// On a similar note, as of React v16, it appears that it's possible for componentDidMount()
// to execute BEFORE that component is visible in the DOM, which can prevent CSS transitions
// from working that are intended to be part of that component's entry behavior (such as
// a "fade in" effect).
//
// The work around being used appears to be the same; wrap the transition in a setTimeout()
// call. For more information, see this issue on GitHub:
//
// https://github.com/reactjs/react-transition-group/issues/216
setTimeout(function() {
element.className = "loading-screen-fade";
}, 0);
}
/*
* This component doesn't render anything; it strictly exists for behavioral
* control of the loading screen.
*/
render() {
return null;
}
};
|
client/src/index.js
|
Tapiiri/ChatBest
|
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import './index.css';
ReactDOM.render(
<App />,
document.getElementById('root')
);
|
app/assets/javascripts/nabu_editor/dashboard.js
|
Sense-Studios/nabu_editor
|
/* globals
initControls
initDescribe
sections/showCreateMovie
sections/showDescribeMovie
sections/showPublishMovie
sections/showSettingsMovie
sections/showQuestionsMovie
checkUserAgent
setDataFromProgram
getPlayer
resetMarqers
setMarqers
animateVideoUp
animateVideoDown
doControl
filter_table
mount_point
*/
// neccesary variables
// TODO, make these NOT neccessary
var agent;
//var debug = true;
//var remoting = false;
var pop = null;
var program = null;
var log = function(a, b, c) {};
var fullscreen = false;
var is_embedded = false;
var controlsAreVisible = false;
var describe_initialized = false;
var controls_initialized = false;
var aspect_ratio;
var aspect_height = 9;
var aspect_width = 16;
var smallvideo = false;
var visible_container;
var wasReallyPlaying = false
var in_editor = true
// REACT reference
window.filter_table = "not set yet";
// ### Overrides
// override function nabu/assets/javasctipt/marduq/player.js
var popOnLoadStart = function() {
//console.log("POP ON LOAD START")
$('#video_frame').fadeIn('slow');
// failsafe
setTimeout( function() { $('#video_frame').css('opacity', 1)}, 800 )
if (!describe_initialized ) initDescribe();
describe_initialized = true;
};
// override function nabu/assets/javasctipt/marduq/player.js
var popCanPlay = function () {
//console.log("POP CAN PLAY")
$('#nabu_controls').fadeIn('slow');
initControls();
controlsAreVisible = true;
controls_initialized = true;
$('.playhead').css('width','0');
margin_select_video();
};
var doSelectMovie = function(id) {
setProgram( id );
if ( $('.video_uploader_container').is(':visible') ) showCreateMovie();
$(".contentwrapper").animate({ scrollTop: 0 }, "slow");
setTimeout( function() { if ( $('.leprograms').is(":visible") ) $('.leprograms').shapeshift( shapeshiftOptions() ) }, 100 );
};
var doShowMovie = function(id) {
setProgram( id );
if ( $('.video_uploader_container').is(':visible') ) showCreateMovie();
if ( $('.video_describe_container').is(':visible') ) showDescribeMovie();
//if ( $('.describe_movie_advanced').is(':visible') ) showDescribeMovie();
if ( $('.editor_container').is(':visible') ) showQuestionsMovie();
if ( $('.video_publish_container').is(':visible') ) showPublishMovie();
$(".contentwrapper").animate({ scrollTop: 0 }, "slow");
setTimeout( function() { if ( $('.leprograms').is(":visible") ) $('.leprograms').shapeshift( shapeshiftOptions() ) }, 100 );
};
var doDescribeMovie = function(id) {
setProgram( id );
if ( $('.video_uploader_container').is(':visible') ) showCreateMovie();
if ( !$('.video_describe_container').is(':visible') ) showDescribeMovie();
//if ( $('.describe_movie_advanced').is(':visible') ) showDescribeMovie();
if ( $('.editor_container').is(':visible') ) showSettingsMovie();
if ( $('.video_publish_container').is(':visible') ) showPublishMovie();
$(".contentwrapper").animate({ scrollTop: 0 }, "slow");
//showDescribeMovie();
setTimeout( function() { if ( $('.leprograms').is(":visible") ) $('.leprograms').shapeshift( shapeshiftOptions() ) }, 100 );
};
var doTimeLineEditMovie = function(id) {
setProgram( id );
if ( $('.video_uploader_container').is(':visible') ) showCreateMovie();
if ( $('.video_describe_container').is(':visible') ) showDescribeMovie();
//if ( $('.describe_movie_advanced').is(':visible') ) showDescribeMovie();
if ( !$('.editor_container').is(':visible') ) showSettingsMovie();
if ( $('.video_publish_container').is(':visible') ) showPublishMovie();
$(".contentwrapper").animate({ scrollTop: 0 }, "slow");
//showSettingsMovie();
setTimeout( function() { if ( $('.leprograms').is(":visible") ) $('.leprograms').shapeshift( shapeshiftOptions() ) }, 100 );
};
var doQuestionsMovie = function(id) {
setProgram( id );
if ( $('.video_uploader_container').is(':visible') ) showCreateMovie();
if ( $('.video_describe_container').is(':visible') ) showDescribeMovie();
//if ( $('.describe_movie_advanced').is(':visible') ) showDescribeMovie();
if ( $('.editor_container').is(':visible') ) showSettingsMovie();
if ( !$('.questions_container').is(':visible') ) showQuestionsMovie();
if ( $('.video_publish_container').is(':visible') ) showPublishMovie();
$(".contentwrapper").animate({ scrollTop: 0 }, "slow");
//showQuestionsMovie();
setTimeout( function() { if ( $('.leprograms').is(":visible") ) $('.leprograms').shapeshift( shapeshiftOptions() ) }, 100 );
}
var doPublishMovie = function(id) {
setProgram( id );
if ( $('.video_uploader_container').is(':visible') ) showCreateMovie();
if ( $('.video_describe_container').is(':visible') ) showDescribeMovie();
//if ( $('.describe_movie_advanced').is(':visible') ) showDescribeMovie();
if ( $('.editor_container').is(':visible') ) showSettingsMovie();
if ( !$('.video_publish_container').is(':visible') ) showPublishMovie();
$(".contentwrapper").animate({ scrollTop: 0 }, "slow");
//showPublishMovie();
setTimeout( function() { if ( $('.leprograms').is(":visible") ) $('.leprograms').shapeshift( shapeshiftOptions() ) }, 100 );
};
var doCopyMovie = function(id) {
console.log("do copy movie: ", id )
$.ajax({
url: '/marduq_api/programs/copy/',
type: 'POST',
data: {'program': id },
success: function() { setPrograms() },
done: function() {}
});
}
var doDeleteMovie = function(id) {
if ( confirm( t.user_interface.confirm_delete_program ) ) {
setProgram(-1);
$.ajax({
url: '/marduq_api/programs/' + id,
type: 'DELETE',
success: function() { setPrograms() },
done: function() {}
});
}
};
var doStatsMovie = function(id) {
console.log("now do thestats", id)
$('#statistics_dialog').modal()
$('#statistics_iframe').attr('src', '/admin/statistics/traffic?program_id=' + id)
}
//Slide down videos if NABU_CONTROLS
//are visible
var margin_select_video = function() {
if($('#nabu_controls').is(':visible')) {
$('.select_videos').css("margin-top", "40px");
$('#publish_menu_container').css("margin-top", "40px");
$('.zoominContainer').css("top", "40px");
} else {
$('.select_videos').css("margin-top", "0px");
$('#publish_menu_container').css("margin-top", "0px");
$('.zoominContainer').css("top", "0px");
}
};
//resize aspect ratio on selectlist change
var resize_aspect_ration_change = function() {
aspect_ratio = $('.dropdown_select_ratio').val();
var arr = aspect_ratio.split(':');
aspect_width = arr[0];
aspect_height = arr[1];
resize_aspect_ratio();
}
setTimeout( margin_select_video(), 800 );
// ### Helpers
// update current program
var setProgram = function( id ) {
console.log("set program: ", id )
if ( program !== null && program.id === id ) return;
$('#video_frame').fadeOut('fast');
$('#nabu_controls').fadeOut('slow');
$('.big-play').addClass('hidden');
$('#video_frame').animate({'opacity':'1'});
setTimeout(margin_select_video(), 500);
if ( id == -1 || id == "-1") {
$('.video_uploader_container').fadeOut('slow');
$('.playhead').css('width','0');
return;
}
// add id to url
window.location.hash = "i" + id;
// retreive the program from the server
// #######################################################
// ### THIS NEEDS TO BE FUCKING SCOPED with CLIENT ID !!!!
// #######################################################
$.get('/marduq_api/programs/'+id, function(p) {
program = p;
getPlayer( program, "#video_frame", agent.technology, agent.videotype, null );
controlsAreVisible = false;
setMarqerAfterPopInits();
setDataFromProgram();
setDisabledStatesLeftMenu();
setSocial();
if(!smallvideo) {
setTimeout( resize_aspect_ratio, 200);
}
});
};
function setDisabledStatesLeftMenu() {
if( pop === null ) {
$("#describe_butt").addClass("disabled");
$("#settings_butt").addClass("disabled");
$("#questions_butt").addClass("disabled");
}else {
$("#describe_butt").removeClass("disabled");
$("#settings_butt").removeClass("disabled");
$("#questions_butt").removeClass("disabled");
}
}
function setDisabledStatePublish() {
console.log("aantal movies = " + $('.program_container').length);
if($('.program_container').length == 0 ) {
$("#publish_butt").addClass("disabled");
} else {
$("#publish_butt").removeClass("disabled");
}
}
// wait for pop and set marqers
function setMarqerAfterPopInits() {
if ( pop === null || isNaN( pop.duration() ) ) {
setTimeout( function( mrqs ) { setMarqerAfterPopInits(); setDisabledStatesLeftMenu(); }, 300 );
}else{
resetMarqers();
setMarqers( program.marqers, pop.duration() );
convertMarqersIntoTrackevents()
}
}
// update all programs
function setPrograms() {
console.log( "Update Programs: /editor3/get_programs/" );
$.get( '/'+mount_point+'/get_programs/', function( resp ) {
// update react
console.log( "Update programs Succes" );
console.log( resp );
filter_table.state.programs = resp
filter_table.forceUpdate()
updatePrograms( resp ) // for edit_menu.js, or the publish menu list
// reset the selected program, if it was updating
setTimeout( function() {
$('.leprograms').find('.selected').animate({'opacity':1}, 200);
setDisabledStatePublish();
}, 500 );
});
}
// update shapeshift
var shapeshiftOptions = function() {
var a_w = $('.video_search_wrapper').width();
var c_w = $('.program_container').width();
var numColums = Math.floor( a_w / c_w );
var roomLeft = a_w - ( c_w * numColums );
var gutterX = Math.floor( roomLeft / ( numColums - 1 ) );
return { enableDrag: false, gutterX: gutterX, gutterY: (gutterX/2), paddingX: 20 };
};
// keep video aspect ratio
function resize_aspect_ratio() {
console.log("resize aspect ", $('#video_frame').hasClass('fullscreen'))
// we're in full screen
if ( $('#video_frame').hasClass('fullscreen') ) {
$(".videowrapper").css({"height": "100%"});
$(".videowrapper").css({"width": "100%"});
$(".videowrapper").css({"margin": "0"});
$(".video_holder").css({"height": "100%"});
$(".ui-resizable-se").hide()
return;
}
// resets
$(".video_holder").css({"height": "initial"});
$(".videowrapper").css({"margin": "2% auto"});
$(".ui-resizable-se").fadeIn()
setTimeout( function() {
var width = $(".videowrapper").width();
var height = width * ( aspect_height / aspect_width );
var fixedheight = height //.toFixed(0);
$(".videowrapper").animate({"height": (fixedheight)+ 'px'}, 300);
if ( $('.contentwrapper').width() < width ) $(".videowrapper").css({"width": ""}); // reset
//updateMarqerBottomControls(fixedheight);
}, 600 );
// failsafe for laggy servers (looking at you kaltura)
setTimeout( function() {
if ( $('#video_frame').css('display') == 'none' ) {
$('#video_frame').fadeIn('slow');
}
}, 500 );
}
// find url tokens (ie. a selected marqer)
function checkURLForPresets() {
if ( window.location.hash.substring(0,2) == '#i' ) {
setProgram( window.location.hash.substring(2) );
showCreateMovie( false );
}
// if #m open marqer editor ?
// if ( window.location.hash.substring(0,2) == '#m' ) {
}
// ### Main
var original_width = $(document).width();
$(document).ready(function() {
//set var aspect_ratio
console.log('ready aspect ratio' + aspect_ratio);
$('.logopreview img').change(function(){
setLogoHeight();
});
setDisabledStatesLeftMenu();
setDisabledStatePublish();
// check out the user
agent = checkUserAgent();
setTimeout( function() { margin_select_video(); }, 1000); // fail safe
setTimeout( function() { $('#video_frame').css('opacity', 1)}, 1500 ) // fail safer
// Keep aspect ratio
$(window).resize(function() {
// always move editor
//updateMarqerBottomControls()
// Quickfix
if ( original_width == $(document).width() ) return;
original_width = $(document).width();
resize_aspect_ratio();
var document_width = $(document).width();
var nav_width = $("nav").width();
var right_menu_width = $(".right_menu").width();
var content_wrapper_width = document_width - nav_width - right_menu_width;
$(".contentwrapper").css("width", content_wrapper_width.toFixed(0) - 2);
// Keep shapeshifter
setTimeout( function() { if ( $('.leprograms').is(":visible") ) try { $('.leprograms').shapeshift(shapeshiftOptions())} catch(e){}} , 800 );
}).resize();
// Initialize Programs
setTimeout( function() { try { $('.leprograms').shapeshift(shapeshiftOptions()); $('.leprograms').fadeIn('slow'); } catch(e){} } , 800 );
// Initialize big-play
$('#nabu_controls').hide();
$('.big-play').click( function() {
$('.big-play').addClass('hidden');
doControl('play');
setTimeout( function() { margin_select_video() }, 800);
});
// TODO: also on swipe up and down
// rewrite this with a class (?)
var videoIsDown = true
//$('#butt-up').click( animateVideoUp );
//$('#butt-down').click( animateVideoDown );
$('#butt-toggle').click( function() {
if ( videoIsDown ) {
animateVideoUp();
videoIsDown = false;
}else{
animateVideoDown();
videoIsDown = true;
}
})
//$('.video_holder').on('swipedown',function(){alert("swipedown..");} );
//$('.video_holder').on('swipeup',function(){alert("swipedown..");} );
// Material design dropdowns hides the selectlist and shows a UL with listitems
// The selectlist wont change
// This will make it to work for all of them.
$('.dropdownjs ul li').click(function(){
var selectedvalue = $(this).attr('value');
var selected = $(this).parent().parent().prev('.dropdown_select');
setTimeout(function() {
$(selected[0]).find('option').removeAttr('selected')
$(selected[0]).val($(selected[0]).find('option[value="' + selectedvalue + '"]').val()).trigger('change');
$(selected[0]).find('option[value="' + selectedvalue + '"]').attr('selected', 'selected');
}, 100);
});
$(document).on('change','.dropdown_select_ratio',function(){
if(!smallvideo) {
resize_aspect_ration_change()
}
});
$(document).on('change','.dropdown_select_quality',function(){
var time = pop.currentTime()
changeSrc( $(this).val() )
pop.currentTime(time)
});
// Hide the sections
$('.video_describe_container').hide();
$('.video_publish_container').hide();
$('.describe_movie_advanced').hide();
$('.questions_container').hide();
$('.zoomContainer').hide();
$('.channels_container').hide();
// Hide the helpers
$('.describe_helper').hide();
$('.publish_helper').hide();
/////////////////////////////////////////////////
// HIDE TESTERS FOR MARQERS FOR TEST PURPOSE ONLY!
/////////////////////////////////////////////////
$('.marqers_container').hide();
//Hide the helpers when clicked
$('.readed').click(function() {
$(this).parent().fadeOut('fast',function(){
$(this).addClass('hidden');
});
});
// listen for fullscreen, and discard the max height from aspect ratio
document.addEventListener("fullscreenchange", delayedScreenChange, false);
document.addEventListener("webkitfullscreenchange", delayedScreenChange, false);
document.addEventListener("mozfullscreenchange", delayedScreenChange, false);
resize_aspect_ratio()
// set the bottom part of the editor
//updateMarqerBottomControls
// check for hash &c
checkURLForPresets()
// set resizable
$('.videowrapper').resizable({
aspectRatio: true,
handles: 'se',
maxWidth: $('.contentwrapper').width() - 40
});
});
var delayedScreenChange = function() {
setTimeout( function() { resize_aspect_ratio() }, 200 );
}
|
src/routes/Film/components/FilmView.js
|
jhash/jhash
|
import './FilmView.scss'
import React from 'react'
export class FilmView extends React.Component {
static propTypes = {}
render () {
return (
<div className='view--film row' />
)
}
}
export default FilmView
|
src/index.js
|
cowback/charcode-client
|
import React from 'react'
import ReactDOM from 'react-dom'
import { connect } from 'react-redux'
import logger from 'redux-logger'
import thunk from 'redux-thunk'
import multi from 'redux-multi'
import { createStore, combineReducers, applyMiddleware } from 'redux'
import { Provider } from 'react-redux'
import { ConnectedRouter, routerReducer, routerMiddleware } from 'react-router-redux'
import createHistory from 'history/createBrowserHistory'
import { Route, Switch } from 'react-router'
import App from 'scenes/App'
import Home from 'scenes/Home'
import LandingPage from 'scenes/LandingPage'
import Sandbox from 'scenes/Sandbox'
import reducers from 'store/reducers'
import api from './api'
import registerServiceWorker from './registerServiceWorker'
import './index.css'
const history = createHistory()
const store = createStore(
combineReducers({
router: routerReducer,
...reducers
}),
applyMiddleware(
logger,
routerMiddleware(history),
thunk.withExtraArgument(api),
multi
)
)
const ConnectedSwitch = connect(state => ({ location: state.location }))(Switch)
ReactDOM.render(
<Provider store={store}>
<ConnectedRouter history={history}>
<Switch>
<App>
<Route exact path="/" component={Home} />
<Route path="/landing" component={LandingPage} />
<Route path="/sandbox" component={Sandbox} />
</App>
</Switch>
</ConnectedRouter>
</Provider>,
document.getElementById('root')
)
registerServiceWorker()
|
app/creation/index.js
|
soryylinl/Gougoushuo
|
import React from 'react';
import { StyleSheet, Text, View, ListView, TouchableHighlight, Image,
Dimensions, ActivityIndicator, RefreshControl, AlertIOS } from 'react-native';
import Icon from 'react-native-vector-icons/Ionicons';
import request from './../common/request';
import config from './../common/config';
import Detail from './detail';
const width=Dimensions.get('window').width;
const initData=[
{
"id": "64000019930503144X",
"thumb": require('./../image/1.jpg'),
"title": "我的面包故事",
"video": "http://www.w3school.com.cn/i/movie.ogg"
},
{
"id": "710000198302267821",
"thumb": require('./../image/2.jpg'),
"title": "我的面包故事",
"video": "http://www.w3school.com.cn/i/movie.ogg"
},
{
"id": "340000200312248406",
"thumb": require('./../image/3.jpg'),
"title": "我的面包故事",
"video": "http://www.w3school.com.cn/i/movie.ogg"
},
{
"id": "420000197210318608",
"thumb": require('./../image/4.jpg'),
"title": "我的面包故事",
"video": "http://www.w3school.com.cn/i/movie.ogg"
},
{
"id": "650000199702087297",
"thumb": require('./../image/5.jpg'),
"title": "我的面包故事",
"video": "http://www.w3school.com.cn/i/movie.ogg"
},
{
"id": "150000197111146729",
"thumb": require('./../image/6.jpg'),
"title": "我的面包故事",
"video": "http://www.w3school.com.cn/i/movie.ogg"
},
{
"id": "460000200804133856",
"thumb": require('./../image/7.jpg'),
"title": "我的面包故事",
"video": "http://www.w3school.com.cn/i/movie.ogg"
},
{
"id": "330000199607270320",
"thumb": require('./../image/8.jpg'),
"title": "我的面包故事",
"video": "http://www.w3school.com.cn/i/movie.ogg"
},
{
"id": "540000198607215377",
"thumb": require('./../image/9.jpg'),
"title": "我的面包故事",
"video": "http://www.w3school.com.cn/i/movie.ogg"
},
{
"id": "630000198812012327",
"thumb": require('./../image/10.jpg'),
"title": "我的面包故事",
"video": "http://www.w3school.com.cn/i/movie.ogg"
}
]
const loadingData=[
{thumb:require('./../image/11.jpg'),title:'2017从心启程,挪威的森林'},{thumb:require('./../image/12.jpg'),title:'我们终究会牵手旅行'},{thumb:require('./../image/13.jpg'),title:'豳风,七月流火'}
,{thumb:require('./../image/14.jpg'),title:'醉美南疆行'},{thumb:require('./../image/15.jpg'),title:'一起到世界的尽头,一般古朴一般清新'},{thumb:require('./../image/16.jpg'),title:'拥抱天空之城,天空之镜'}
,{thumb:require('./../image/17.jpg'),title:'埃塞俄比亚之旅人文篇'},{thumb:require('./../image/18.jpg'),title:'秋天一定要住在北平'},{thumb:require('./../image/19.jpg'),title:'青春与步伐都不停歇,北国风光'}
,{thumb:require('./../image/20.jpg'),title:'冬日暖阳初访霓虹国'}
]
const refreshData=[
{thumb:require('./../image/1.jpg'),title:'青春与步伐都不停歇,北国风光'},{thumb:require('./../image/2.jpg'),title:'醉美南疆行'},{thumb:require('./../image/3.jpg'),title:'秋天一定要住在北平'}
,{thumb:require('./../image/4.jpg'),title:'2017从心启程,挪威的森林'},{thumb:require('./../image/5.jpg'),title:'一起到世界的尽头,一般古朴一般清新'},{thumb:require('./../image/6.jpg'),title:'拥抱天空之城,天空之镜'}
,{thumb:require('./../image/7.jpg'),title:'埃塞俄比亚之旅人文篇'},{thumb:require('./../image/8.jpg'),title:'我们终究会牵手旅行'},{thumb:require('./../image/9.jpg'),title:'豳风,七月流火'}
,{thumb:require('./../image/10.jpg'),title:'冬日暖阳初访霓虹国'}
]
let cachedResults={
nextPage:1,
items:[],
total:0
}
//将list组件化
class Item extends React.Component{
constructor(props){
super(props);
let rowData=this.props.rowData;
this.state={
rowData:rowData,
up:rowData.voted,
}
this.up=this.up.bind(this);
}
up() {
let rowData = this.state.rowData;
let up = !this.state.up; //传入的状态
let params = {
id: rowData.id,
accessToken: 'ss',
up: up ? '1' : '0'
}
let url = config.api.base + config.api.up;
request.post(url, params)
.then((data) => {
if (data && data.success) {
this.setState({
up: up
})
}
else {
AlertIOS.alert('点赞失败,稍后重试......');
}
})
.catch((err)=>{
console.log(err);
AlertIOS.alert('点赞失败,稍后重试......');
})
}
render(){
return (
<TouchableHighlight onPress={this.props.onSelect}>
<View style={styles.item}>
<Text style={styles.title}>{this.state.rowData.title}</Text>
<Image source={this.state.rowData.thumb} style={styles.thumb}>
<Icon name="ios-play" size={28} style={styles.play}/>
</Image>
<View style={styles.itemFooter}>
<View style={styles.handleBox}>
<Icon name={this.state.up?"ios-heart":"ios-heart-outline"}
size={28}
style={[styles.up,this.state.up?null:styles.down]}
onPress={this.up}
/>
<Text style={styles.handleText} onPress={this.up}>喜欢</Text>
</View>
<View style={styles.handleBox}>
<Icon name="ios-alarm-outline" size={28} style={styles.commentIcon}/>
<Text style={styles.handleText}>评论</Text>
</View>
</View>
</View>
</TouchableHighlight>
)
}
}
export default class List extends React.Component {
constructor(props){
super(props);
let ds = new ListView.DataSource({rowHasChanged : (r1,r2)=>r1!==r2});
this.state={
dataSource:ds.cloneWithRows(initData),
isLoadingTail:false,
isRefreshing:false
}
this.renderRow=this.renderRow.bind(this);
this.fetchData=this.fetchData.bind(this);
this.hasMore=this.hasMore.bind(this);
this.fetchMoreData=this.fetchMoreData.bind(this);
this.renderFooter=this.renderFooter.bind(this);
this.onRefresh=this.onRefresh.bind(this);
this.loadPage=this.loadPage.bind(this);
}
renderRow(rowData){
return (
<Item key={rowData.id} onSelect={()=>this.loadPage(rowData)} rowData={rowData}/>
)
}
componentDidMount(){
this.fetchData(1);
}
fetchData(page){
if(page!==0){
this.setState({
isLoadingTail:true
})
}
else{
this.setState({
isRefreshing:true
})
}
request.get(config.api.base + config.api.creations, {
accessToken: 'ss',
page:page
}
).then((response)=>{
if(response.success){
let result=response.data;
let newDate;
if(page!==0){
newDate=loadingData;
}
else{
newDate=refreshData;
}
result.forEach((item,index)=>{
let remainder=(index+1)%10;
item.thumb=newDate[remainder].thumb;
item.title=newDate[remainder].title;
})
let items=cachedResults.items.slice(); //初始化items
if(page!==0){
cachedResults.items=items.concat(result); //暂存数据
cachedResults.nextPage+=1;
}
else{
cachedResults.items=result.concat(items);
}
cachedResults.total=response.total; //数据的长度标志
if(page!==0){
//设置延时(模拟效果)
this.timer=setTimeout(()=>{
this.setState({
// 请求结束
isLoadingTail:false,
dataSource:this.state.dataSource.cloneWithRows(cachedResults.items)
})
},2000)
}
else{
this.setState({
// 请求结束
isRefreshing:false,
dataSource:this.state.dataSource.cloneWithRows(cachedResults.items)
})
}
}
else return false;
})
.catch((error) => {
if(page!==0){
this.setState({
isLoadingTail:false
})
}
else{
this.setState({
isRefreshing:false
})
}
console.error(error);
});
}
fetchMoreData(){
//如果有更多的数据或者已经在加载状态
if(!this.hasMore()||this.state.isLoadingTail){
return
}
let page=cachedResults.nextPage;
this.fetchData(page);
}
hasMore(){
return cachedResults.items.length!== cachedResults.total
}
//提示加载信息
renderFooter(){
if(!this.hasMore()&&cachedResults.total!==0){
return (
<View style={styles.loadingMore}>
<Text style={styles.loadingText}>没有更多了</Text>
</View>
)
}
//在请求发起,但是数据尚未返回的过程中isLoadingTail已经为false,此时任然可以继续下拉记载,避免此情况:在这段时间展示一个空的结点
if(!this.state.isLoadingTail){
return (
<View style={styles.loadingMore}></View>
)
}
return (
<ActivityIndicator style={styles.loadingMore}/>
)
}
onRefresh(){
if(!this.hasMore()||this.state.isRefreshing){
return
}
this.fetchData(0);
}
loadPage(rowData){
this.props.navigator.push({
name:'detail',
component:Detail,
params:{
data:rowData
}
})
}
render() {
return (
<View style={styles.container}>
<View style={styles.header}>
<Text style={styles.headerTitle}>
列表页面
</Text>
</View>
<ListView
dataSource={this.state.dataSource}
renderRow={this.renderRow}
enableEmptySections={true}
automaticallyAdjustContentInsets={false}
showsVerticalScrollIndicator={false}
onEndReached={this.fetchMoreData}
onEndReachedThreshold={20}
renderFooter={this.renderFooter}
refreshControl={
<RefreshControl
refreshing={this.state.isRefreshing}
onRefresh={this.onRefresh}
title='拼命加载中...'
titleColor="#ff6600"
/>
}
/>
</View>
)
}
}
;
const styles = {
container: {
flex: 1,
backgroundColor: '#F5FCFF',
},
header:{
paddingTop:25,
paddingBottom:12,
backgroundColor:'#ee735c'
},
headerTitle:{
color:'#fff',
fontSize:16,
textAlign:'center',
fontWeight:'600'
},
item:{
width:width,
marginBottom:10,
backgroundColor:'#fff'
},
thumb:{
width:width,
height:width*0.56,
resizeMode:'cover',
},
title:{
padding:10,
fontSize:18,
color:'#333'
},
itemFooter:{
flexDirection:'row',
justifyContent:'space-between',
backgroundColor:'#eee'
},
handleBox:{
padding:10,
flexDirection:'row',
width:width/2-0.5,
justifyContent:'center',
backgroundColor:'#fff'
},
play:{
position:'absolute',
bottom:14,
right:14,
width:46,
height:46,
paddingTop:9,
paddingLeft:18,
backgroundColor:'transparent',
borderColor:'#fff',
borderWidth:1,
borderRadius:23,
color:'#ed7b66'
},
handleText:{
paddingLeft:12,
fontSize:18,
color:'#333'
},
up:{
fontSize:22,
color:'#ed7b66'
},
down:{
fontSize:22,
color:'#333'
},
commentIcon:{
fontSize:22,
color:'#333'
},
loadingMore:{
marginVertical:20
},
loadingText:{
color:'#777',
textAlign:'center'
}
}
|
stories/Welcome.js
|
k2data/k2-react-components
|
import React from 'react'
import PropTypes from 'prop-types'
const styles = {
main: {
margin: 15,
maxWidth: 600,
lineHeight: 1.4,
fontFamily: '"Helvetica Neue", Helvetica, "Segoe UI", Arial, freesans, sans-serif',
},
logo: {
width: 200,
},
link: {
color: '#1474f3',
textDecoration: 'none',
borderBottom: '1px solid #1474f3',
paddingBottom: 2,
},
code: {
fontSize: 15,
fontWeight: 600,
padding: '2px 5px',
border: '1px solid #eae9e9',
borderRadius: 4,
backgroundColor: '#f3f2f2',
color: '#3a3a3a',
},
}
export default class Welcome extends React.Component {
constructor (props) {
super(props)
this.showApp = this.showApp.bind(this)
}
showApp (e) {
e.preventDefault()
if (this.props.showApp) this.props.showApp()
}
render () {
return (
<div style={styles.main}>
<h1>Welcome to STORYBOOK</h1>
<p>
This is a UI component dev environment for your app.
</p>
<p>
{`We've added some basic stories inside the`}
{' '}
<code style={styles.code}>src/stories</code>
{' '}
directory.
<br />
A story is a single state of one or more UI components. You can have as many stories as you want.
<br />
(Basically a story is like a visual test case.)
</p>
<p>
See these sample
{' '}
<a style={styles.link} href='#' onClick={this.showApp}>stories</a>
{' '}
for a component called
{' '}
<code style={styles.code}>Button</code>
.
</p>
<p>
Just like that, you can add your own components as stories.
<br />
You can also edit those components and see changes right away.
<br />
(Try editing the <code style={styles.code}>Button</code> component
located at <code style={styles.code}>stories/Button.js</code>.)
</p>
<p>
This is just one thing you can do with Storybook.
<br />
Have a look at the
{' '}
<a style={styles.link} href='https://github.com/storybooks/storybook' target='_blank'>
Storybook
</a>
{' '}
repo for more information.
</p>
</div>
)
}
}
Welcome.propTypes = {
showApp: PropTypes.func,
}
|
src/entypo/Mouse.js
|
cox-auto-kc/react-entypo
|
import React from 'react';
import EntypoIcon from '../EntypoIcon';
const iconClass = 'entypo-svgicon entypo--Mouse';
let EntypoMouse = (props) => (
<EntypoIcon propClass={iconClass} {...props}>
<path d="M15.402,14.402l-2.627-7.535c-0.722-2.073-2.966-3.22-5.092-2.653L5.707,0.379C5.528,0.033,5.109-0.1,4.769,0.083C4.43,0.266,4.3,0.697,4.48,1.044l1.929,3.742C4.872,5.806,4.073,7.74,4.58,9.56l2.139,7.696c0.602,2.162,3.08,3.264,5.571,2.502C14.749,18.895,16.14,16.521,15.402,14.402z M8.899,8.923c-0.73,0.24-1.511-0.172-1.745-0.921C6.919,7.254,7.322,6.454,8.051,6.214c0.73-0.24,1.512,0.172,1.746,0.92S9.629,8.683,8.899,8.923z"/>
</EntypoIcon>
);
export default EntypoMouse;
|
ajax/libs/react-redux/3.0.1/react-redux.min.js
|
seogi1004/cdnjs
|
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("redux")):"function"==typeof define&&define.amd?define(["react","redux"],e):"object"==typeof exports?exports.ReactRedux=e(require("react"),require("redux")):t.ReactRedux=e(t.React,t.Redux)}(this,function(t,e){return function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var o=r(9),u=n(o),s=r(2),i=n(s),a=i.default(u.default),c=a.Provider,p=a.connect;e.Provider=c,e.connect=p},function(t,e){"use strict";function r(t){return t.shape({subscribe:t.func.isRequired,dispatch:t.func.isRequired,getState:t.func.isRequired})}e.__esModule=!0,e.default=r,t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t){var e=s.default(t),r=a.default(t);return{Provider:e,connect:r}}e.__esModule=!0,e.default=o;var u=r(4),s=n(u),i=r(3),a=n(i);t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function s(t){return t.displayName||t.name||"Component"}function i(t){var e=t.Component,r=t.PropTypes,n=f.default(r);return function(r,i,p){function f(t,e){var r=t.getState(),n=R?w(r,e):w(r);return g.default(y.default(n),"`mapStateToProps` must return an object. Instead received %s.",n),n}function l(t,e){var r=t.dispatch,n=C?j(r,e):j(r);return g.default(y.default(n),"`mapDispatchToProps` must return an object. Instead received %s.",n),n}function h(t,e,r){var n=O(t,e,r);return g.default(y.default(n),"`mergeProps` must return an object. Instead received %s.",n),n}var b=arguments.length<=3||void 0===arguments[3]?{}:arguments[3],m=Boolean(r),w=r||x,j=y.default(i)?v.default(i):i||P,O=p||_,R=w.length>1,C=j.length>1,M=b.pure,T=void 0===M?!0:M,k=S++;return function(r){var i=function(e){function i(t,r){o(this,i),e.call(this,t,r),this.version=k,this.store=t.store||r.store,g.default(this.store,'Could not find "store" in either the context or '+('props of "'+this.constructor.displayName+'". ')+"Either wrap the root component in a <Provider>, "+('or explicitly pass "store" as a prop to "'+this.constructor.displayName+'".')),this.stateProps=f(this.store,t),this.dispatchProps=l(this.store,t),this.state={storeState:null},this.updateState()}return u(i,e),i.prototype.shouldComponentUpdate=function(t,e){if(!T)return this.updateStateProps(t),this.updateDispatchProps(t),this.updateState(t),!0;var r=e.storeState!==this.state.storeState,n=!d.default(t,this.props),o=!1,u=!1;return(r||n&&R)&&(o=this.updateStateProps(t)),n&&C&&(u=this.updateDispatchProps(t)),n||o||u?(this.updateState(t),!0):!1},a(i,null,[{key:"displayName",value:"Connect("+s(r)+")",enumerable:!0},{key:"WrappedComponent",value:r,enumerable:!0},{key:"contextTypes",value:{store:n},enumerable:!0},{key:"propTypes",value:{store:n},enumerable:!0}]),i.prototype.computeNextState=function(){var t=arguments.length<=0||void 0===arguments[0]?this.props:arguments[0];return h(this.stateProps,this.dispatchProps,t)},i.prototype.updateStateProps=function(){var t=arguments.length<=0||void 0===arguments[0]?this.props:arguments[0],e=f(this.store,t);return d.default(e,this.stateProps)?!1:(this.stateProps=e,!0)},i.prototype.updateDispatchProps=function(){var t=arguments.length<=0||void 0===arguments[0]?this.props:arguments[0],e=l(this.store,t);return d.default(e,this.dispatchProps)?!1:(this.dispatchProps=e,!0)},i.prototype.updateState=function(){var t=arguments.length<=0||void 0===arguments[0]?this.props:arguments[0];this.nextState=this.computeNextState(t)},i.prototype.isSubscribed=function(){return"function"==typeof this.unsubscribe},i.prototype.trySubscribe=function(){m&&!this.unsubscribe&&(this.unsubscribe=this.store.subscribe(this.handleChange.bind(this)),this.handleChange())},i.prototype.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null)},i.prototype.componentDidMount=function(){this.trySubscribe()},i.prototype.componentWillUnmount=function(){this.tryUnsubscribe()},i.prototype.handleChange=function(){this.unsubscribe&&this.setState({storeState:this.store.getState()})},i.prototype.getWrappedInstance=function(){return this.refs.wrappedInstance},i.prototype.render=function(){return t.createElement(r,c({ref:"wrappedInstance"},this.nextState))},i}(e);return i}}}e.__esModule=!0;var a=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),c=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t};e.default=i;var p=r(1),f=n(p),l=r(6),d=n(l),h=r(5),y=n(h),b=r(7),v=n(b),m=r(8),g=n(m),x=function(){return{}},P=function(t){return{dispatch:t}},_=function(t,e,r){return c({},r,t,e)},S=0;t.exports=e.default},function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function s(t){var e=t.version;if("string"!=typeof e)return!0;var r=e.split("."),n=parseInt(r[0],10),o=parseInt(r[1],10);return 0===n&&13===o}function i(t){function e(){h||d||(h=!0,console.error("With React 0.14 and later versions, you no longer need to wrap <Provider> child into a function."))}function r(){!h&&d&&(h=!0,console.error("With React 0.13, you need to wrap <Provider> child into a function. This restriction will be removed with React 0.14."))}function n(){y||(y=!0,console.error("<Provider> does not support changing `store` on the fly. It is most likely that you see this error because you updated to Redux 2.x and React Redux 2.x which no longer hot reload reducers automatically. See https://github.com/rackt/react-redux/releases/tag/v2.0.0 for the migration instructions."))}var i=t.Component,c=t.PropTypes,f=t.Children,l=p.default(c),d=s(t),h=!1,y=!1;return function(t){function s(e,r){o(this,s),t.call(this,e,r),this.store=e.store}return u(s,t),s.prototype.getChildContext=function(){return{store:this.store}},a(s,null,[{key:"childContextTypes",value:{store:l.isRequired},enumerable:!0},{key:"propTypes",value:{store:l.isRequired,children:(d?c.func:c.element).isRequired},enumerable:!0}]),s.prototype.componentWillReceiveProps=function(t){var e=this.store,r=t.store;e!==r&&n()},s.prototype.render=function(){var t=this.props.children;return"function"==typeof t?(e(),t=t()):r(),f.only(t)},s}(i)}e.__esModule=!0;var a=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}();e.default=i;var c=r(1),p=n(c);t.exports=e.default},function(t,e){"use strict";function r(t){if(!t||"object"!=typeof t)return!1;var e="function"==typeof t.constructor?Object.getPrototypeOf(t):Object.prototype;if(null===e)return!0;var r=e.constructor;return"function"==typeof r&&r instanceof r&&n(r)===n(Object)}e.__esModule=!0,e.default=r;var n=function(t){return Function.prototype.toString.call(t)};t.exports=e.default},function(t,e){"use strict";function r(t,e){if(t===e)return!0;var r=Object.keys(t),n=Object.keys(e);if(r.length!==n.length)return!1;for(var o=Object.prototype.hasOwnProperty,u=0;u<r.length;u++)if(!o.call(e,r[u])||t[r[u]]!==e[r[u]])return!1;return!0}e.__esModule=!0,e.default=r,t.exports=e.default},function(t,e,r){"use strict";function n(t){return function(e){return o.bindActionCreators(t,e)}}e.__esModule=!0,e.default=n;var o=r(10);t.exports=e.default},function(t,e,r){"use strict";var n=function(t,e,r,n,o,u,s,i){if(!t){var a;if(void 0===e)a=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[r,n,o,u,s,i],p=0;a=new Error("Invariant Violation: "+e.replace(/%s/g,function(){return c[p++]}))}throw a.framesToPop=1,a}};t.exports=n},function(e,r){e.exports=t},function(t,r){t.exports=e}])});
|
pages/api/dialog-content.js
|
allanalexandre/material-ui
|
import 'docs/src/modules/components/bootstrap';
// --- Post bootstrap -----
import React from 'react';
import MarkdownDocs from 'docs/src/modules/components/MarkdownDocs';
import markdown from './dialog-content.md';
function Page() {
return <MarkdownDocs markdown={markdown} />;
}
export default Page;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.